🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
feat(postgres,server): added healthcheck (#261)
Khiet Tam Nguyenf21de33532be
diff --git a/docker-compose.yml b/docker-compose.ymlindex 3d90a740d..8f7f7561c 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -57,6 +57,12 @@ services:- POSTGRES_DB=${POSTGRES_DB:-analytics}volumes:- postgres-data:/var/lib/postgresql/data+ healthcheck:+ test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]+ interval: 3s+ timeout: 5s+ retries: 5+ start_period: 10srestart: unless-stoppedbackend:@@ -85,6 +91,12 @@ services:condition: service_healthypostgres:condition: service_started+ healthcheck:+ test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3001/health"]+ interval: 3s+ timeout: 5s+ retries: 5+ start_period: 10srestart: unless-stoppedclient:diff --git a/docs/src/content/self-hosting-advanced.mdx b/docs/src/content/self-hosting-advanced.mdxindex 109504606..c27951ca0 100644--- a/docs/src/content/self-hosting-advanced.mdx+++ b/docs/src/content/self-hosting-advanced.mdx@@ -90,8 +90,8 @@ _this setup assumes you have NPM docker up and running and are capable of creati```services:rybbit_clickhouse:- container_name: rybbit_clickhouseimage: clickhouse/clickhouse-server:25.4.2+ container_name: rybbit_clickhousevolumes:- ./clickhouse-data:/var/lib/clickhouse- ./clickhouse_config:/etc/clickhouse-server/config.d@@ -118,6 +118,12 @@ services:- POSTGRES_DB=${POSTGRES_DB:-analytics}volumes:- ./postgres-data:/var/lib/postgresql/data+ healthcheck:+ test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]+ interval: 3s+ timeout: 5s+ retries: 5+ start_period: 10srestart: unless-stoppednetworks:- internal@@ -143,6 +149,12 @@ services:condition: service_healthyrybbit_postgres:condition: service_started+ healthcheck:+ test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3001/health"]+ interval: 3s+ timeout: 5s+ retries: 5+ start_period: 10srestart: unless-stoppednetworks:- internaldiff --git a/server/src/index.ts b/server/src/index.tsindex d3701880e..b3e4eb395 100644--- a/server/src/index.ts+++ b/server/src/index.ts@@ -264,6 +264,7 @@ if (IS_CLOUD) {}server.post("/track", trackEvent);+server.get("/health", (_, reply) => reply.send("OK"));const start = async () => {try {