version: '2'

services:

  postgres:
    image: postgres
    hostname: postgres
    environment:
      POSTGRES_USER: pootle
      POSTGRES_PASSWORD: cNEujap1w6OMSDGDIeE5TYS7aKl
      POSTGRES_DB: pootle

  elasticsearch:
    image: elasticsearch
    hostname: elasticsearch

  redis:
    image: redis
    hostname: redis

  nginx:
    image: nginx
    hostname: nginx
    volumes_from:
      - pootle

  pootle:
    build:
      context: .
    command: runserver --insecure 0.0.0.0:8000
    ports:
      - "127.0.0.1:8000:8000"
    volumes:
      - ./pootle.conf:/etc/pootle/pootle.conf
      - /var/www/pootle/static
      - /var/www/pootle/media
    environment: &app_env
      POOTLE_SETTINGS: "/etc/pootle/pootle.conf"
    depends_on:
      - postgres
      - redis
      - elasticsearch

  rqworker:
    build:
      context: .
    command: rqworker
    depends_on:
      - pootle
    volumes_from:
      - pootle
    environment:
      <<: *app_env

version: '2'

volumes:
  assets:
  media:

services:

  postgres:
    image: postgres
    hostname: postgres
    environment:
      POSTGRES_USER: pootle
      POSTGRES_PASSWORD: cNEujap1w6OMSDGDIeE5TYS7aKl
      POSTGRES_DB: pootle

  elasticsearch:
    image: elasticsearch
    hostname: elasticsearch

  redis:
    image: redis
    hostname: redis

  nginx:
    image: nginx
    hostname: nginx
    links:
      - pootle
    volumes:
      - ./nginx/pootle-http.conf:/etc/nginx/conf.d/default.conf
      - ./nginx/uwsgi_params:/etc/nginx/uwsgi_params
      - assets:/var/www/pootle/assets
      - media:/var/www/pootle/media

  pootle:
    build:
      context: .
    command: [
      'uwsgi',
      '--master',
      '--http', '0.0.0.0:8000',
      '--wsgi-file', '/etc/pootle/wsgi.py',
      '--callable', 'application'
    ]
    volumes:
      - ./wsgi.py:/etc/pootle/wsgi.py
      - ./pootle.conf:/etc/pootle/pootle.conf
      - assets:/var/www/pootle/assets
      - media:/var/www/pootle/media
    environment: &app_env
      DJANGO_SETTINGS_MODULE: "pootle.settings"
      POOTLE_SETTINGS: "/etc/pootle/pootle.conf"
    depends_on:
      - postgres
      - redis
      - elasticsearch

  rqworker:
    build:
      context: .
    command: ['pootle', 'rqworker']
    depends_on:
      - pootle
    volumes_from:
      - pootle
    environment:
      <<: *app_env

Use name volumes and nginx for serving static files and proxying to uwsgi
Use name volumes and nginx for serving static files and proxying to uwsgi
