Optimize healthcheck parameters for dbpostgres 83/141183/6
authorhalil.cakal <halil.cakal@est.tech>
Tue, 10 Jun 2025 12:27:40 +0000 (13:27 +0100)
committerhalil.cakal <halil.cakal@est.tech>
Thu, 12 Jun 2025 08:39:18 +0000 (09:39 +0100)
- provide db name and user to pg_isready in order to remove logs: FATAL:
  role "root" does not exist
- optimize the healthcheck parameters

Issue-ID: CPS-2694

Change-Id: I1aa6330909e3e4a1a0c0b486b2cd3603b743472c
Signed-off-by: halil.cakal <halil.cakal@est.tech>
docker-compose/cps-base.yml

index 2a7e9c8..78d77b5 100644 (file)
@@ -46,12 +46,10 @@ services:
           cpus: '6'
           memory: 3G
     healthcheck:
-      test: pg_isready || exit 1 # This command runs inside the container, returning 0 for success, non-zero for failure.
-      timeout: 1s               # Time-out of the above test command.
-      interval: 2s              # How often the health is run.
-      retries: 100              # If 3 health checks fail, the container is unhealthy.
-      start_period: 210s        # Ignore failed health checks for first 30 seconds, to give system time to start
-      ### Full start-up time allowed = 30 seconds start period + 3 tries * 10 seconds interval = 60 seconds
+      test: pg_isready -U ${DB_USERNAME:-cps} -d cpsdb || exit 1 # This command runs inside the container, returning 0 for success, non-zero for failure.
+      timeout: 110s               # Time-out of the above test command.
+      interval: 10s               # How often the health is run.
+      retries: 10                 # If 10 health checks fail, the container is unhealthy.
 
   cps-and-ncmp-template:
     image: ${DOCKER_REPO:-nexus3.onap.org:10003}/onap/cps-and-ncmp:${CPS_VERSION:-latest}