version: '2'

services:

  metrics:
     image: philhawthorne/docker-influxdb-grafana:latest
     restart: always
     ports:
       - "3003:3003"
       - "3004:8083"
       - "8086:8086"
       - "22022:22"
    
  postgresserver:
     image: postgres:alpine
     restart: always
     ports:
       - 5432:5432
     environment:
         POSTGRES_PASSWORD: letmein
     volumes:
       - /var/lib/ayanova/db:/var/lib/postgresql/data

  ayanova:
     image: gztw/ayanova:v8.0.0
     restart: always
     ports:
       - 7575:7575
     volumes:
       - /var/lib:/var/lib
     environment:
        AYANOVA_USE_URLS: http://*:7575
        AYANOVA_DB_CONNECTION: User ID=postgres;Password=letmein;Host=postgresserver;Port=5432;Database=AyaNova;Pooling=true;  
        AYANOVA_FOLDER_USER_FILES: /var/lib/ayanova/files/user    
        AYANOVA_FOLDER_BACKUP_FILES: /var/lib/ayanova/files/backup
        AYANOVA_LOG_PATH: /var/lib/ayanova
        AYANOVA_LOG_LEVEL: Info
        AYANOVA_METRICS_USE_INFLUXDB: "true"
        AYANOVA_METRICS_INFLUXDB_BASEURL: http://metrics:8086
#        AYANOVA_PERMANENTLY_ERASE_DATABASE: "true"
     build:
       context: ./ayanovadocker
       dockerfile: Dockerfile
     links:
       - postgresserver
     depends_on:
       - "postgresserver"

networks:
  default:
    external:
      name: docker-network
