version: '2'
services:
  fabmanager:
    image: sleede/fab-manager
    environment:
      RAILS_ENV: production
      RACK_ENV: production
    env_file:
      - /home/core/fabmanager/config/env
    volumes:
      - /home/core/fabmanager/public/assets:/usr/src/app/public/assets
      - /home/core/fabmanager/public/uploads:/usr/src/app/public/uploads
      - /home/core/fabmanager/invoices:/usr/src/app/invoices
      - /home/core/fabmanager/exports:/usr/src/app/exports
      - /home/core/fabmanager/log:/var/log/supervisor
      - /home/core/fabmanager/plugins:/usr/src/app/plugins
    depends_on:
      - postgres
      - redis
      - elasticsearch
    restart: always

  postgres:
    image: postgres:9.4
    volumes:
      - /home/core/fabmanager/postgresql:/var/lib/postgresql/data
    restart: always

  elasticsearch:
    image: elasticsearch:1.7
    volumes:
      - /home/core/fabmanager/elasticsearch:/usr/share/elasticsearch/data
    restart: always

  redis:
    image: redis:3.0
    volumes:
      - /home/core/fabmanager/redis:/data
    restart: always

  nginx:
    image: nginx:1.9
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /home/core/fabmanager/config/nginx:/etc/nginx/conf.d
      - /home/core/fabmanager/letsencrypt/etc:/etc/letsencrypt
      - /home/core/fabmanager/log:/var/log/nginx
    volumes_from:
      - fabmanager:ro
    links:
      - fabmanager:fabmanager
    restart: always
