netdisco-docker icon indicating copy to clipboard operation
netdisco-docker copied to clipboard

Better Dependencies in docker-compose.yml

Open rc9000 opened this issue 1 year ago • 0 comments

Using service_healthy could prevent a lot of error messages during the schema upgrade phase, as reported in e.g. #73 . Quick experiment:


services:
  netdisco-postgresql:
    image: netdisco/netdisco:latest-postgresql
    hostname: netdisco-postgresql
    volumes:
      - "./netdisco/pgdata:/var/lib/postgresql/data"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U netdisco -d netdisco"]
      interval: 5s
      retries: 20 
      start_period: 30s
      timeout: 10s
      
  netdisco-backend:
    image: netdisco/netdisco:latest-backend
    hostname: netdisco-backend
    init: true
    volumes:
      - "./netdisco/nd-site-local:/home/netdisco/nd-site-local"
      - "./netdisco/config:/home/netdisco/environments"
      - "./netdisco/logs:/home/netdisco/logs"
    environment:
      NETDISCO_DOMAIN:  discover
      NETDISCO_DB_HOST: netdisco-postgresql
    depends_on:
      netdisco-postgresql:
        condition: service_healthy
        restart: true

  netdisco-web:
    image: netdisco/netdisco:latest-web
    hostname: netdisco-web
    init: true
    volumes:
      - "./netdisco/nd-site-local:/home/netdisco/nd-site-local"
      - "./netdisco/config:/home/netdisco/environments"
    environment:
      NETDISCO_DOMAIN:  discover
      NETDISCO_DB_HOST: netdisco-postgresql
      IPV: 4
    ports:
      - "5000:5000"
    depends_on:
      netdisco-postgresql:
        condition: service_healthy
        restart: true

However it also swallows the Postgres output about incompatible major version files (see #76 ) even when doing docker-compose up in the foreground, plus it requires a slightly newer docker-compose. That's why I'd postpone this until after the other PR is established in the wild.

rc9000 avatar Dec 24 '24 00:12 rc9000