Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
chore: improve healthchecks (#75)
Browse files Browse the repository at this point in the history
* chore: improve healthchecks

This is initiated by looking at Unleash/unleash#1934

With this patch docker-compose correctly reports the stauts of our three
containers. Can be observed by running `watch -n0.1 docker-compose ps`
while starting the containers using `docker-compose up`.


Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>
  • Loading branch information
gardleopard and sighphyre authored Aug 22, 2022
1 parent 077ebfd commit 705ae35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ unleash locally without setting up a database or node.
$ docker-compose build
$ docker-compose up
```
On some computers the database won't start in time for Unleash the first time you run this. If Unleash fails to reach the database, `docker-compose restart web` usually resolves the issue.

### Requirements
We are using docker-compose version 3.9 and it requires:
Expand Down
10 changes: 9 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ services:
UNLEASH_API_TOKEN: "default:development.unleash-insecure-api-token"
depends_on:
- web
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:3000/proxy/health || exit 1
interval: 1s
timeout: 1m
retries: 5


# The Unleash server contains the Unleash configuration and
# communicates with server-side SDKs and the Unleash Proxy
Expand All @@ -61,11 +67,13 @@ services:
# key from `proxy.environment.UNLEASH_PROXY_CLIENT_KEYS`
# instead.
INIT_CLIENT_API_TOKENS: "default:development.unleash-insecure-api-token"
# Changing log levels:
# LOG_LEVEL: "debug"
depends_on:
- db
command: node index.js
healthcheck:
test: ["CMD", "nc", "-z", "db", "5432"]
test: wget --no-verbose --tries=1 --spider http://localhost:4242/health || exit 1
interval: 1s
timeout: 1m
retries: 5
Expand Down

0 comments on commit 705ae35

Please sign in to comment.