oracle / adb-free

Universal Permissive License v1.0
35 stars 4 forks source link

HealthChecks #8

Closed edoardodavini closed 5 months ago

edoardodavini commented 5 months ago

Hi, I wasn't able to find any reference to any healthcheck to verify if the container DB is ready to receive connections

We are trying to migrating our local developer environment from gvenzl/oci-oracle-xe to have a local environment as close as possible to our staging and production ATP

This is what we had

  database-localhost:
    image: gvenzl/oracle-xe:21.3.0
    environment:
      ORACLE_PASSWORD: ${ORACLE_DB_PASSWORD_SYS}
      APP_USER: ${ORACLE_DB_USER}
      APP_USER_PASSWORD: ${ORACLE_DB_PASSWORD}
    ports:
      - 1521:1521
    healthcheck:
      test: [CMD, /bin/bash, ./healthcheck.sh]
      interval: 15s
      timeout: 5s
      retries: 20
      start_period: 30s

Easily set up this new one


  database-localhost:
    container_name: retraced.oracledb-adb
    image: ghcr.io/oracle/adb-free:latest
    environment:
      - WORKLOAD_TYPE=ATP # use WORKLOAD_TYPE=ADW if ADW is needed
      - ADMIN_PASSWORD=R3rt4C3dL0ve5Or4cle
      - WALLET_PASSWORD=R3rt4C3dL0ve5Or4cle
    ports:
      - 1521:1521 # TLS
      - 1522:1522 # mTLS
      - 8443:8443 # HTTPS for ORDS/APEX
      - 27017:27017 # Mongo API
    hostname: localhost
    cap_add: 
      - SYS_ADMIN

But I want to add also the healthcheck. That was extremely useful. Any suggestion?

Thank you

aosingh commented 5 months ago

@edoardodavini

HEALTHCHECK instruction is already defined for the image. The Container runtime will automatically use it.

if you want to define in the docker compose file, you can use the following:

 healthcheck:
      test: [CMD, /bin/bash, /u01/scripts/healthcheck.sh]
      interval: 1m
      timeout: 30s
      start_period: 3m