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(docker compose): healthcheck for speckle-server #1651

Merged
merged 3 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions docker-compose-speckle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ services:
dockerfile: packages/server/Dockerfile
image: speckle/speckle-server:local
restart: always
healthcheck:
test:
- CMD
- node
- -e
- "require('node:http').request({headers: {'Content-Type': 'application/json'}, port:3000, hostname:'127.0.0.1', path:'/graphql?query={serverInfo{version}}', method: 'GET' }, (res) => { body = ''; res.on('data', (chunk) => {body += chunk;}); res.on('end', () => {process.exit(res.statusCode != 200 || body.toLowerCase().includes('error'));}); }).end();"
interval: 10s
timeout: 10s
retries: 3
start_period: 5s
environment:
# TODO: Change this to the URL of the speckle server, as accessed from the network
CANONICAL_URL: 'http://localhost'
Expand Down
14 changes: 10 additions & 4 deletions utils/1click_image_scripts/template-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,18 @@ services:
speckle-server:
image: speckle/speckle-server:2
restart: always
healthcheck:
test:
- CMD
- node
- -e
- "require('node:http').request({headers: {'Content-Type': 'application/json'}, port:3000, hostname:'127.0.0.1', path:'/graphql?query={serverInfo{version}}', method: 'GET' }, (res) => { body = ''; res.on('data', (chunk) => {body += chunk;}); res.on('end', () => {process.exit(res.statusCode != 200 || body.toLowerCase().includes('error'));}); }).end();"
interval: 10s
timeout: 10s
retries: 3
start_period: 5s
ports:
- '127.0.0.1:3000:3000'
command: ['bash', '-c', '/wait && node bin/www']
environment:
CANONICAL_URL: 'TODO: change'
SESSION_SECRET: 'TODO: change'
Expand Down Expand Up @@ -88,7 +97,6 @@ services:
restart: always
mem_limit: '1000m'
memswap_limit: '1000m'
command: ['bash', '-c', '/wait && node bin/www']

environment:
LOG_LEVEL: 'info'
Expand All @@ -98,7 +106,6 @@ services:
speckle-webhook-service:
image: speckle/speckle-webhook-service:2
restart: always
command: ['bash', '-c', '/wait && node main.js']
environment:
LOG_LEVEL: 'info'
PG_CONNECTION_STRING: 'postgres://speckle:speckle@postgres/speckle'
Expand All @@ -107,7 +114,6 @@ services:
fileimport-service:
image: speckle/speckle-fileimport-service:2
restart: always
command: ['bash', '-c', '/wait && node src/daemon.js']
environment:
LOG_LEVEL: 'info'
PG_CONNECTION_STRING: 'postgres://speckle:speckle@postgres/speckle'
Expand Down