Add healthcheck endpoints and scripts

This commit is contained in:
sid palas
2023-02-05 10:16:47 -05:00
parent af4bca05d0
commit 1ea6754c7f
14 changed files with 241 additions and 20 deletions

View File

@ -7,8 +7,14 @@ services:
ports:
- 80:80
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/ping"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
api-node:
image: sidpalas/devops-directive-docker-course-api-node:7
image: sidpalas/devops-directive-docker-course-api-node:8
networks:
- frontend
- backend
@ -18,8 +24,14 @@ services:
environment:
- DATABASE_URL=postgres://postgres:foobarbaz@db:5432/postgres
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "src/healthcheck.js"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
api-golang:
image: sidpalas/devops-directive-docker-course-api-golang:6
image: sidpalas/devops-directive-docker-course-api-golang:7
networks:
- frontend
- backend
@ -29,6 +41,12 @@ services:
environment:
- DATABASE_URL=postgres://postgres:foobarbaz@db:5432/postgres
restart: unless-stopped
healthcheck:
test: ["CMD", "/healthcheck"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
db:
image: postgres:15.1-alpine
networks:
@ -37,6 +55,11 @@ services:
- pgdata:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=foobarbaz
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
volumes:
pgdata: