docker-compose.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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: packages/hoppscotch-backend/Dockerfile
  11. context: .
  12. target: prod
  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=3000
  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:3000"
  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: packages/hoppscotch-selfhost-web/Dockerfile
  36. context: .
  37. env_file:
  38. - ./.env
  39. depends_on:
  40. - hoppscotch-backend
  41. ports:
  42. - "3000:8080"
  43. # The Self Host dashboard for managing the app. This will be hosted at port 3100
  44. # NOTE: To do TLS or play around with how the app is hosted, you can look into the Caddyfile for
  45. # the SH admin dashboard server at packages/hoppscotch-sh-admin/Caddyfile
  46. hoppscotch-sh-admin:
  47. container_name: hoppscotch-sh-admin
  48. build:
  49. dockerfile: packages/hoppscotch-sh-admin/Dockerfile
  50. context: .
  51. env_file:
  52. - ./.env
  53. depends_on:
  54. - hoppscotch-backend
  55. ports:
  56. - "3100:8080"
  57. # The preset DB service, you can delete/comment the below lines if
  58. # you are using an external postgres instance
  59. # This will be exposed at port 5432
  60. hoppscotch-db:
  61. image: postgres:15
  62. ports:
  63. - "5432:5432"
  64. user: postgres
  65. environment:
  66. # The default user defined by the docker image
  67. POSTGRES_USER: postgres
  68. # NOTE: Please UPDATE THIS PASSWORD!
  69. POSTGRES_PASSWORD: testpass
  70. POSTGRES_DB: hoppscotch
  71. healthcheck:
  72. test: ["CMD-SHELL", "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'"]
  73. interval: 5s
  74. timeout: 5s
  75. retries: 10