Skip to content

Commit

Permalink
Add liveness probe - imposm
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Feb 16, 2024
1 parent b5123fd commit 19f2d34
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 29 deletions.
57 changes: 31 additions & 26 deletions compose/tiler.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3'
version: '3.8'
services:
# ######################################################
# ### Tiler DB
Expand All @@ -9,11 +9,12 @@ services:
context: ../images/tiler-db
dockerfile: Dockerfile
ports:
- "5433:5432"
- "5433:5432"
volumes:
- ../data/tiler-db-data:/var/lib/postgresql/data
- ../data/tiler-db-data:/var/lib/postgresql/data
env_file:
- ../envs/.env.tiler-db
- ../envs/.env.tiler-db
restart: always
# ######################################################
# ### Tiler imposm for importing data
# ######################################################
Expand All @@ -23,18 +24,23 @@ services:
context: ../images/tiler-imposm
dockerfile: Dockerfile
volumes:
- ../data/tiler-imposm-data:/mnt/data
- ../data/tiler-imposm-data:/mnt/data
# - ../images/tiler-imposm:/osm
depends_on:
- tiler-db
command: >
/bin/bash -c "
echo starting imposm!;
sleep 1m;
./start.sh;
"
- tiler-db
command:
- sh
- -c
- "sleep 60 && ./start.sh"
env_file:
- ../envs/.env.tiler-db
- ../envs/.env.tiler-imposm
- ../envs/.env.tiler-db
- ../envs/.env.tiler-imposm
healthcheck:
test: ["CMD", "./liveness.sh"]
interval: 30s
timeout: 10s
retries: 3
restart: always
# ######################################################
# ### Tiler imposm for importing data
# ######################################################
Expand All @@ -44,18 +50,17 @@ services:
context: ../images/tiler-server
dockerfile: Dockerfile
volumes:
- ../data/tiler-server-data:/mnt/data
- ../data/tiler-server-data:/mnt/data
depends_on:
- tiler-db
- tiler-imposm
- tiler-db
- tiler-imposm
ports:
- "9090:9090"
command: >
/bin/bash -c "
echo Starting tiles server!;
sleep 2m;
./start.sh;
"
- "9090:9090"
command:
- sh
- -c
- "sleep 60 && ./start.sh"
env_file:
- ../envs/.env.tiler-db
- ../envs/.env.tiler-server
- ../envs/.env.tiler-db
- ../envs/.env.tiler-server
restart: always
4 changes: 1 addition & 3 deletions images/tiler-imposm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,5 @@ WORKDIR $IMPOSMDATA
VOLUME $IMPOSMDATA

WORKDIR /osm
COPY config config
COPY scripts scripts
COPY start.sh start.sh
COPY . .
CMD ./start.sh
8 changes: 8 additions & 0 deletions images/tiler-imposm/liveness.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
if ps aux | grep -v grep | grep "imposm" >/dev/null; then
echo "imposm process is running."
exit 0
else
echo "imposm process is not running." 1>&2
exit 1
fi
10 changes: 10 additions & 0 deletions osm-seed/templates/tiler-imposm/tiler-imposm-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ spec:
- name: {{ .Release.Name }}-tiler-imposm-statefulset
image: {{ .Values.tilerImposm.image.name }}:{{ .Values.tilerImposm.image.tag }}
command: ['./start.sh']
livenessProbe:
exec:
command:
- /bin/bash
- -c
- ./liveness.sh
initialDelaySeconds: 120
timeoutSeconds: 5
periodSeconds: 10
failureThreshold: 3
{{- if .Values.tilerImposm.resources.enabled }}
resources:
requests:
Expand Down

0 comments on commit 19f2d34

Please sign in to comment.