version: '2.4'

services:

  viur-db:
    container_name: viur-db
    image: postgres:13.4
    restart: always
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "postgres", "-d", "postgres"]
      interval: 10s
      timeout: 60s
      retries: 5
      start_period: 80s
    networks:
      viur:
    volumes:
      - viur-db:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: mysecretpassword

  viur-data-db:
    container_name: viur-data-db
    image: postgres:13.4
    restart: always
    networks:
      viur:
    volumes:
      - viur-data-db:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: mysecretpassword

  viur-redis-cache:
    container_name: viur-redis-cache
    image: redis:7.2.1
    restart: always
    networks:
      viur:
    command: '--requirepass mysecretpassword'

  viur:
    depends_on:
      viur-db:
        condition: service_healthy
      viur-data-db:
        condition: service_started
      viur-redis-cache:
        condition: service_started
    container_name: viur
    image: docker.viurdata.com/viur:latest
    volumes:
      - ./viur.conf:/app/conf/viur.conf
    restart: always
    ports:
      - "9000:9000"
    networks:
      viur:
    environment:
      DATABASE_URL: postgres://postgres:mysecretpassword@viur-db:5432/postgres
      DATABASE_CSV_URL: postgres://postgres:mysecretpassword@viur-data-db:5432/postgres
      REDIS_URL: redis://:mysecretpassword@viur-redis-cache:6379
      HOST: http://localhost:9000
      JAVA_OPTS: '-Xmx4096m'

volumes:
  viur-db:
  viur-data-db:

networks:
  viur:
