Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

2.6 KB
Raw Blame
services:
  e2e-agent-builder:
    build:
      context: ..
      dockerfile: e2e/Dockerfile.agent-builder
    volumes:
      - ./artifacts:/artifacts
    container_name: e2e-verification-agent-builder

  e2e-fixture-gen:
    build:
      context: .
      dockerfile: Dockerfile.fixture-gen
    volumes:
      - ./artifacts:/artifacts
      # The entrypoint spawns one sibling postgres:N container per supported
      # major (12..18) and pipes pg_dump out via docker exec, so it talks to
      # the host daemon the same way e2e-agent-runner does.
      - /var/run/docker.sock:/var/run/docker.sock
    container_name: e2e-verification-fixture-gen

  e2e-mock-server:
    build:
      context: .
      dockerfile: Dockerfile.mock-server
    volumes:
      - ./artifacts:/artifacts:ro
    container_name: e2e-verification-mock-server
    # Published to host so e2e-agent-runner (network_mode: host) can reach it
    # via 127.0.0.1:<port> — same path the spawned Postgres ports use. Host
    # port defaults to 4050; override via E2E_MOCK_SERVER_PORT in
    # agent/verification/e2e/.env if 4050 is already taken.
    ports:
      - "${E2E_MOCK_SERVER_PORT:-4050}:4050"
    healthcheck:
      test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:4050/health"]
      interval: 2s
      timeout: 5s
      retries: 10

  e2e-agent-runner:
    build:
      context: .
      dockerfile: Dockerfile.agent-runner
    volumes:
      - ./artifacts:/opt/agent/artifacts:ro
      - ./scripts:/opt/agent/scripts:ro
      # The agent's Docker SDK client spawns the ephemeral Postgres containers
      # on the host engine; pg_restore runs inside those containers (no host
      # client, no assets bundle). The scripts' docker CLI uses the same
      # socket. E2E_ENGINE_SOCKET swaps the engine for the agent only, e.g. a
      # Podman socket for `just e2e-podman`; the other services stay on Docker.
      - ${E2E_ENGINE_SOCKET:-/var/run/docker.sock}:/var/run/docker.sock
    # Mirrors production: the agent runs directly on the VM, so 127.0.0.1 IS
    # the host. Spawned Postgres containers publish 5432 to a random host port
    # bound to the host's 127.0.0.1 (dockerengine.go binds {HostIP:"127.0.0.1",
    # HostPort:"0"}); the agent-process verifier reaches them on that loopback.
    # A bridge-network runner cannot see those ports — its 127.0.0.1 is its
    # own. Linux-only; document accordingly.
    network_mode: host
    environment:
      - E2E_MOCK_SERVER_PORT=${E2E_MOCK_SERVER_PORT:-4050}
    depends_on:
      e2e-mock-server:
        condition: service_healthy
    container_name: e2e-verification-agent-runner
    command: ["bash", "/opt/agent/scripts/run-all.sh"]