From 772c84a6b6ea3181bb3bc6bd8e1e52ee5d1cf858 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Mon, 4 Dec 2023 11:43:09 +0200 Subject: [PATCH 1/3] Add script for livenessProbe --- images/web/Dockerfile | 1 + ohm/requirements.yaml | 2 +- values.staging.template.yaml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/images/web/Dockerfile b/images/web/Dockerfile index ac58c25b..f087b593 100644 --- a/images/web/Dockerfile +++ b/images/web/Dockerfile @@ -110,5 +110,6 @@ RUN chown -R www-data: $workdir ADD config/settings.yml $workdir/config/ COPY start.sh $workdir/ +COPY liveness.sh $workdir/ CMD $workdir/start.sh diff --git a/ohm/requirements.yaml b/ohm/requirements.yaml index 3f0aa4f2..895d000e 100644 --- a/ohm/requirements.yaml +++ b/ohm/requirements.yaml @@ -1,4 +1,4 @@ dependencies: - name: osm-seed - version: '0.1.0-n815.hccedaed' + version: '0.1.0-n816.ha1443d4' repository: https://devseed.com/osm-seed-chart/ diff --git a/values.staging.template.yaml b/values.staging.template.yaml index adae9888..4c2d56db 100644 --- a/values.staging.template.yaml +++ b/values.staging.template.yaml @@ -90,6 +90,7 @@ osm-seed: memory: "10Gi" cpu: "5" sharedMemorySize: 256Mi + livenessProbeExec: true # ==================================================================================================== # Variables for osm-seed website # ==================================================================================================== From f831d68bfa824fd1d9c06e3fc3176e533d133a8e Mon Sep 17 00:00:00 2001 From: Rub21 Date: Mon, 4 Dec 2023 11:48:13 +0200 Subject: [PATCH 2/3] Add script for livenessProbe - fixed --- images/web/liveness.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 images/web/liveness.sh diff --git a/images/web/liveness.sh b/images/web/liveness.sh new file mode 100755 index 00000000..92fcae0b --- /dev/null +++ b/images/web/liveness.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# This is a script for the complex evaluation of whether Apache or other processes are running in the container. +check_process() { + if ps aux | grep "$1" | grep -v grep > /dev/null; then + return 0 + else + return 1 + fi +} + +# Check for openstreetmap-cgimap process +check_process "/usr/local/bin/openstreetmap-cgimap" +cgimap_status=$? + +# Check for apache2 process +check_process "apache2" +apache_status=$? + +# Evaluate results +if [ $cgimap_status -eq 0 ] && [ $apache_status -eq 0 ]; then + echo "Both openstreetmap-cgimap and apache2 are running." + exit 0 +else + echo "One or both processes are not running!" 1>&2 + exit 1 +fi From 12fc2e1221e4984ea2e63d52c851ceb2e6e77e6d Mon Sep 17 00:00:00 2001 From: Rub21 Date: Mon, 4 Dec 2023 12:50:04 +0200 Subject: [PATCH 3/3] Enable script for livenessProbe - production --- values.production.template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/values.production.template.yaml b/values.production.template.yaml index 3a49af46..b4d42da4 100644 --- a/values.production.template.yaml +++ b/values.production.template.yaml @@ -122,7 +122,7 @@ osm-seed: maxReplicas: 10 cpuUtilization: 80 sharedMemorySize: 512Mi - + livenessProbeExec: true # ==================================================================================================== # Variables for memcached. Memcached is used to store session cookies # ====================================================================================================