version: '2'
services:
  fabmanager:
    image: sleede/fab-manager
    environment:
      RAILS_ENV: production
      RACK_ENV: production
    env_file:
      - ./config/env
    user: USER_ID
    volumes:
      - ./public/packs:/usr/src/app/public/packs
      - ./public/uploads:/usr/src/app/public/uploads
      - ./invoices:/usr/src/app/invoices
      - ./payment_schedules:/usr/src/app/payment_schedules
      - ./exports:/usr/src/app/exports
      - ./imports:/usr/src/app/imports
      - ./supporting_document_files:/usr/src/app/supporting_document_files
      - ./log:/var/log/supervisor
      - ./plugins:/usr/src/app/plugins
      - ./accounting:/usr/src/app/accounting
      - ./config/auth_provider.yml:/usr/src/app/config/auth_provider.yml
    depends_on:
      - postgres
      - redis
      - elasticsearch
    restart: always
  postgres:
    image: postgres:9.6
    volumes:
      - ./postgresql:/var/lib/postgresql/data
    restart: always
    environment:
      POSTGRES_HOST_AUTH_METHOD: trust
  elasticsearch:
    image: elasticsearch:5.6
    environment:
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m -Dlog4j2.formatMsgNoLookups=true"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - ./elasticsearch/config:/usr/share/elasticsearch/config
      - ./elasticsearch:/usr/share/elasticsearch/data
    restart: always
  redis:
    image: redis:6-alpine
    volumes:
      - ./redis:/data
    restart: always
  nginx:
    image: nginx:latest
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./config/nginx:/etc/nginx/conf.d
      - ./letsencrypt/etc:/etc/letsencrypt
      - ./log:/var/log/nginx
    volumes_from:
      - fabmanager:ro
    links:
      - fabmanager:fabmanager
    restart: always
