Skip to content

Commit

Permalink
fix: use healthchecks and stuff to order startups
Browse files Browse the repository at this point in the history
  • Loading branch information
mvarendorff committed Jan 6, 2024
1 parent 18d5170 commit d9ba8a5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
25 changes: 19 additions & 6 deletions docker-compose.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ services:
POSTGRES_USER: ytfe2e
POSTGRES_PASSWORD: ytfe2e
POSTGRES_DB: ytfe2e
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ytfe2e"]
start_period: 2s
interval: 1s

server:
image: ghcr.io/yes-theory-fam/yestheory-family-server:COMMIT_HASH
image: ghcr.io/yes-theory-fam/yestheory-family-server:pr-266
hostname: server
ports:
- "5000:5000"
Expand All @@ -28,11 +32,13 @@ services:

CMS_ENDPOINT: "http://cms:3001/api/graphql"
depends_on:
- cms
- postgres
cms:
condition: 'service_healthy'
postgres:
condition: 'service_healthy'

web:
image: ghcr.io/yes-theory-fam/yestheory-family-web:COMMIT_HASH
image: ghcr.io/yes-theory-fam/yestheory-family-web:pr-266
environment:
SERVER_BACKEND_GRAPHQL_URL: http://server:5000/graphql
FRONTEND_URL: http://web:3000
Expand All @@ -42,7 +48,7 @@ services:
- server

cms:
image: ghcr.io/yes-theory-fam/yestheory-family-cms:COMMIT_HASH
image: ghcr.io/yes-theory-fam/yestheory-family-cms:pr-266
environment:
DATABASE_URI: "postgresql://ytfe2e:ytfe2e@postgres:5432/payload?schema=public"
ENABLE_DATASEEDER: "true"
Expand All @@ -53,10 +59,17 @@ services:
TYPESENSE_API_URL: http://typesense:8108
SERVER_URL: http://localhost:3001
FRONTEND_URL: http://web:3000
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:3001/admin"]
start_period: 2s
interval: 1s
ports:
- "3001:3001"
depends_on:
- typesense
postgres:
condition: 'service_healthy'
typesense:
condition: 'service_started'

typesense:
image: typesense/typesense:0.25.1
Expand Down
2 changes: 2 additions & 0 deletions packages/cms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ RUN yarn workspaces focus && \

FROM base as runtime

RUN apk add curl --no-cache

ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=packages/cms/dist/payload.config.js

Expand Down

0 comments on commit d9ba8a5

Please sign in to comment.