Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add healthchecks for services in Docker Compose #167

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docker-compose-quick-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ services:
target: /etc/nginx/conf.d/my_proxy.conf
ports:
- "80:80"
healthcheck:
test: "curl -s -I http://localhost | head -n 1 | grep -q 503"
interval: 5s
timeout: 5s
retries: 3
start_period: 10s

postgres:
image: postgres:14
networks:
Expand All @@ -111,6 +118,13 @@ services:
target: /docker-entrypoint-initdb.d/02-setup-context-db.sh
volumes:
- db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s

broker:
image: "iegomez/mosquitto-go-auth"
networks:
Expand All @@ -125,6 +139,7 @@ services:
configs:
- source: flowfuse_broker
target: /etc/mosquitto/mosquitto.conf

forge:
image: "flowfuse/forge-docker"
networks:
Expand All @@ -143,6 +158,12 @@ services:
- "postgres"
- "nginx"
- "broker"
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s

file-server:
image: "flowfuse/file-server"
Expand All @@ -156,6 +177,12 @@ services:
- fileStorage:/usr/src/flowforge-file-server/var/root
depends_on:
- "forge"
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:3001/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s

networks:
flowforge:
Expand Down
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ services:
- "443:443"
environment:
- "HTTPS_METHOD=redirect"
healthcheck:
test: "curl -s -I http://localhost | head -n 1 | grep -q 503"
interval: 5s
timeout: 5s
retries: 3
start_period: 10s

postgres:
image: postgres:14
Expand All @@ -136,6 +142,13 @@ services:
target: /docker-entrypoint-initdb.d/02-setup-context-db.sh
volumes:
- db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s

broker:
image: "iegomez/mosquitto-go-auth:latest-mosquitto_2.0.15"
networks:
Expand All @@ -150,6 +163,7 @@ services:
configs:
- source: flowfuse_broker
target: /etc/mosquitto/mosquitto.conf

forge:
image: "flowfuse/forge-docker:2.10.0"
networks:
Expand All @@ -168,6 +182,12 @@ services:
- "postgres"
- "nginx"
- "broker"
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s

file-server:
image: "flowfuse/file-server:2.10.0"
Expand All @@ -181,6 +201,12 @@ services:
- fileStorage:/usr/src/flowforge-file-server/var/root
depends_on:
- "forge"
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:3001/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s

acme:
image: nginxproxy/acme-companion:2.4.0
Expand Down