docker-compose.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. # To make it easier to self-host, we have a preset docker compose config that also
  2. # has a container with a Postgres instance running.
  3. # You can tweak around this file to match your instances
  4. version: "3.7"
  5. services:
  6. # This service runs the backend app in the port 3170
  7. hoppscotch-backend:
  8. container_name: hoppscotch-backend
  9. build:
  10. dockerfile: prod.Dockerfile
  11. context: .
  12. target: backend
  13. env_file:
  14. - ./.env
  15. restart: always
  16. environment:
  17. # Edit the below line to match your PostgresDB URL if you have an outside DB (make sure to update the .env file as well)
  18. - DATABASE_URL=postgresql://postgres:testpass@hoppscotch-db:5432/hoppscotch?connect_timeout=300
  19. - PORT=3170
  20. volumes:
  21. # Uncomment the line below when modifying code. Only applicable when using the "dev" target.
  22. # - ./packages/hoppscotch-backend/:/usr/src/app
  23. - /usr/src/app/node_modules/
  24. depends_on:
  25. hoppscotch-db:
  26. condition: service_healthy
  27. ports:
  28. - "3170:3170"
  29. # The main hoppscotch app. This will be hosted at port 3000
  30. # NOTE: To do TLS or play around with how the app is hosted, you can look into the Caddyfile for
  31. # the SH admin dashboard server at packages/hoppscotch-selfhost-web/Caddyfile
  32. hoppscotch-app:
  33. container_name: hoppscotch-app
  34. build:
  35. dockerfile: prod.Dockerfile
  36. context: .
  37. target: app
  38. env_file:
  39. - ./.env
  40. depends_on:
  41. - hoppscotch-backend
  42. ports:
  43. - "3000:8080"
  44. # The Self Host dashboard for managing the app. This will be hosted at port 3100
  45. # NOTE: To do TLS or play around with how the app is hosted, you can look into the Caddyfile for
  46. # the SH admin dashboard server at packages/hoppscotch-sh-admin/Caddyfile
  47. hoppscotch-sh-admin:
  48. container_name: hoppscotch-sh-admin
  49. build:
  50. dockerfile: prod.Dockerfile
  51. context: .
  52. target: sh_admin
  53. env_file:
  54. - ./.env
  55. depends_on:
  56. - hoppscotch-backend
  57. ports:
  58. - "3100:8080"
  59. # The service that spins up all 3 services at once in one container
  60. hoppscotch-aio:
  61. container_name: hoppscotch-aio
  62. build:
  63. dockerfile: prod.Dockerfile
  64. context: .
  65. target: aio
  66. env_file:
  67. - ./.env
  68. depends_on:
  69. hoppscotch-db:
  70. condition: service_healthy
  71. ports:
  72. - "3000:3000"
  73. - "3100:3100"
  74. - "3170:3170"
  75. # The preset DB service, you can delete/comment the below lines if
  76. # you are using an external postgres instance
  77. # This will be exposed at port 5432
  78. hoppscotch-db:
  79. image: postgres:15
  80. ports:
  81. - "5432:5432"
  82. user: postgres
  83. environment:
  84. # The default user defined by the docker image
  85. POSTGRES_USER: postgres
  86. # NOTE: Please UPDATE THIS PASSWORD!
  87. POSTGRES_PASSWORD: testpass
  88. POSTGRES_DB: hoppscotch
  89. healthcheck:
  90. test:
  91. [
  92. "CMD-SHELL",
  93. "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'"
  94. ]
  95. interval: 5s
  96. timeout: 5s
  97. retries: 10
  98. # All the services listed below are deprececated
  99. hoppscotch-old-backend:
  100. container_name: hoppscotch-old-backend
  101. build:
  102. dockerfile: packages/hoppscotch-backend/Dockerfile
  103. context: .
  104. target: prod
  105. env_file:
  106. - ./.env
  107. restart: always
  108. environment:
  109. # Edit the below line to match your PostgresDB URL if you have an outside DB (make sure to update the .env file as well)
  110. - DATABASE_URL=postgresql://postgres:testpass@hoppscotch-db:5432/hoppscotch?connect_timeout=300
  111. - PORT=3000
  112. volumes:
  113. # Uncomment the line below when modifying code. Only applicable when using the "dev" target.
  114. # - ./packages/hoppscotch-backend/:/usr/src/app
  115. - /usr/src/app/node_modules/
  116. depends_on:
  117. hoppscotch-db:
  118. condition: service_healthy
  119. ports:
  120. - "3170:3000"
  121. hoppscotch-old-app:
  122. container_name: hoppscotch-old-app
  123. build:
  124. dockerfile: packages/hoppscotch-selfhost-web/Dockerfile
  125. context: .
  126. env_file:
  127. - ./.env
  128. depends_on:
  129. - hoppscotch-old-backend
  130. ports:
  131. - "3000:8080"
  132. hoppscotch-old-sh-admin:
  133. container_name: hoppscotch-old-sh-admin
  134. build:
  135. dockerfile: packages/hoppscotch-sh-admin/Dockerfile
  136. context: .
  137. env_file:
  138. - ./.env
  139. depends_on:
  140. - hoppscotch-old-backend
  141. ports:
  142. - "3100:8080"