services:
  reitti:
    image: dedicatedcode/reitti:latest
    ports:
      - 8080:8080
    depends_on:
      rabbitmq:
        condition: service_healthy
      postgis:
        condition: service_healthy
        restart: true
      redis:
        condition: service_healthy
    environment:
      PHOTON_BASE_URL: http://photon:2322
  postgis:
    image: postgis/postgis:17-3.5-alpine
    environment:
      POSTGRES_USER: reitti
      POSTGRES_PASSWORD: reitti
      POSTGRES_DB: reittidb
    volumes:
      - postgis-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U reitti -d reittidb"]
      interval: 10s
      timeout: 5s
      retries: 5
  rabbitmq:
    image: rabbitmq:3-management-alpine
    environment:
      RABBITMQ_DEFAULT_USER: reitti
      RABBITMQ_DEFAULT_PASS: reitti
    volumes:
      - rabbitmq-data:/var/lib/rabbitmq
    healthcheck:
      test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"]
      interval: 30s
      timeout: 10s
      retries: 5
  redis:
    image: redis:7-alpine
    volumes:
      - redis-data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
  photon:
    image: rtuszik/photon-docker:latest
    environment:
      - UPDATE_STRATEGY=PARALLEL
      - COUNTRY_CODE=de #set your main country code here to save space or drop this line to fetch the whole index.
    volumes:
      - photon-data:/photon/photon_data
volumes:
  postgis-data:
  rabbitmq-data:
  redis-data:
  photon-data:
