services:
  postgresql:
    image: postgres:17.0-bullseye
    container_name: svacer-postgres
    restart: always
    shm_size: 1g
    environment:
      - POSTGRES_DB=svace
      - POSTGRES_USER=svace
      - POSTGRES_PASSWORD=svace
      - POSTGRES_ROOT_PASSWORD=svace
    volumes:
      - svacer-postgres:/var/lib/postgresql/data
    networks:
      svacer:
    healthcheck:
      test: pg_isready -U svace
      interval: 8s
      start_period: 16s
      timeout: 4s
      retries: 4

  svacer:
    image: ispras/svacer:10-0-0
    container_name: svacer
    restart: always
    shm_size: 1g
    depends_on:
      postgresql:
        condition: service_healthy
    ports:
      - "3002:3002"
      - "8080:8080"
    environment:
      - SVACER_PG_URL=postgres://svace:svace@postgresql:5432/svace
      - STORE=/data/store
    volumes:
      - svacer-object-store:/data/store
    networks:
      svacer:
    healthcheck:
      test: curl --fail http://localhost:8080/api/health || exit 1
      interval: 8s
      start_period: 16s
      timeout: 4s
      retries: 4

volumes:
  svacer-postgres:
  svacer-object-store:

networks:
  svacer:
