docker-compose.yml 4.4 KB

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