version: '3'

services:

  nginx:
    image: docker.med-logic.ru/medicine-nginx:latest
    container_name: medicine2-nginx
    restart: "always"
    volumes:
      - medicine-public-data:/app/public:ro
    links:
      - "app:app-host"
    ports:
      - "810:80"
      - "811:443"
    networks:
      - default
      - medicine-network
    logging:
      driver: "json-file"
      options:
        max-size: "200k"
        max-file: "10"

  app:
    image: docker.med-logic.ru/medicine-app:latest
    container_name: medicine2-app
    restart: "always"
    environment:
      UWSGI_PROCESSES: 2
      UWSGI_THREADS: 2
    expose:
      - "840"
    command: /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
    volumes:
      - medicine-public-data:/app/public
      - ./.env:/app/.env
    networks:
      - default
      - medicine-network
    external_links:
      - "postgres:postgres-host"
      - "redis:redis-host"
    logging:
      driver: "json-file"
      options:
        max-size: "200k"
        max-file: "10"

  tasks:
    image: docker.med-logic.ru/medicine-app:latest
    container_name: medicine2-tasks
    restart: "always"
    command: /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord-tasks.conf
    volumes:
      - ./.env:/app/.env
      - medicine-public-data:/app/public
    networks:
      - default
      - medicine-network
    external_links:
      - "postgres:postgres-host"
      - "redis:redis-host"
    logging:
      driver: "json-file"
      options:
        max-size: "200k"
        max-file: "10"

volumes:
  medicine-public-data:

networks:
  medicine-network:
    external:
      name: "medicine-network"