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. services:
  5. # This service runs the backend app in the port 3170
  6. hoppscotch-backend:
  7. container_name: hoppscotch-backend
  8. build:
  9. dockerfile: prod.Dockerfile
  10. context: .
  11. target: backend
  12. env_file:
  13. - ./.env
  14. restart: always
  15. environment:
  16. # Edit the below line to match your PostgresDB URL if you have an outside DB (make sure to update the .env file as well)
  17. - DATABASE_URL=postgresql://postgres:testpass@hoppscotch-db:5432/hoppscotch?connect_timeout=300
  18. - PORT=8080
  19. volumes:
  20. # Uncomment the line below when modifying code. Only applicable when using the "dev" target.
  21. # - ./packages/hoppscotch-backend/:/usr/src/app
  22. - /usr/src/app/node_modules/
  23. depends_on:
  24. hoppscotch-db:
  25. condition: service_healthy
  26. ports:
  27. - "3180:80"
  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. - "3080:80"
  44. - "3000:3000"
  45. # The Self Host dashboard for managing the app. This will be hosted at port 3100
  46. # NOTE: To do TLS or play around with how the app is hosted, you can look into the Caddyfile for
  47. # the SH admin dashboard server at packages/hoppscotch-sh-admin/Caddyfile
  48. hoppscotch-sh-admin:
  49. container_name: hoppscotch-sh-admin
  50. build:
  51. dockerfile: prod.Dockerfile
  52. context: .
  53. target: sh_admin
  54. env_file:
  55. - ./.env
  56. depends_on:
  57. - hoppscotch-backend
  58. ports:
  59. - "3280:80"
  60. - "3100:3100"
  61. # The service that spins up all 3 services at once in one container
  62. hoppscotch-aio:
  63. container_name: hoppscotch-aio
  64. restart: unless-stopped
  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:3170"
  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"