docker-compose.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. build:
  66. dockerfile: prod.Dockerfile
  67. context: .
  68. target: aio
  69. env_file:
  70. - ./.env
  71. depends_on:
  72. hoppscotch-db:
  73. condition: service_healthy
  74. ports:
  75. - "3000:3000"
  76. - "3100:3100"
  77. - "3170:8080"
  78. - "3080:80"
  79. # The preset DB service, you can delete/comment the below lines if
  80. # you are using an external postgres instance
  81. # This will be exposed at port 5432
  82. hoppscotch-db:
  83. image: postgres:15
  84. ports:
  85. - "5432:5432"
  86. user: postgres
  87. environment:
  88. # The default user defined by the docker image
  89. POSTGRES_USER: postgres
  90. # NOTE: Please UPDATE THIS PASSWORD!
  91. POSTGRES_PASSWORD: testpass
  92. POSTGRES_DB: hoppscotch
  93. healthcheck:
  94. test:
  95. [
  96. "CMD-SHELL",
  97. "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'"
  98. ]
  99. interval: 5s
  100. timeout: 5s
  101. retries: 10
  102. # All the services listed below are deprececated
  103. hoppscotch-old-backend:
  104. container_name: hoppscotch-old-backend
  105. build:
  106. dockerfile: packages/hoppscotch-backend/Dockerfile
  107. context: .
  108. target: prod
  109. env_file:
  110. - ./.env
  111. restart: always
  112. environment:
  113. # Edit the below line to match your PostgresDB URL if you have an outside DB (make sure to update the .env file as well)
  114. - DATABASE_URL=postgresql://postgres:testpass@hoppscotch-db:5432/hoppscotch?connect_timeout=300
  115. - PORT=3000
  116. volumes:
  117. # Uncomment the line below when modifying code. Only applicable when using the "dev" target.
  118. # - ./packages/hoppscotch-backend/:/usr/src/app
  119. - /usr/src/app/node_modules/
  120. depends_on:
  121. hoppscotch-db:
  122. condition: service_healthy
  123. ports:
  124. - "3170:3000"
  125. hoppscotch-old-app:
  126. container_name: hoppscotch-old-app
  127. build:
  128. dockerfile: packages/hoppscotch-selfhost-web/Dockerfile
  129. context: .
  130. env_file:
  131. - ./.env
  132. depends_on:
  133. - hoppscotch-old-backend
  134. ports:
  135. - "3000:8080"
  136. hoppscotch-old-sh-admin:
  137. container_name: hoppscotch-old-sh-admin
  138. build:
  139. dockerfile: packages/hoppscotch-sh-admin/Dockerfile
  140. context: .
  141. env_file:
  142. - ./.env
  143. depends_on:
  144. - hoppscotch-old-backend
  145. ports:
  146. - "3100:8080"