Skip to content

Better Dependencies in docker-compose.yml #77

@rc9000

Description

@rc9000

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions