version: "2"

services:
  web:
    build: "."
    links:
      - "db:postgres"
      - "es:es"
    ports:
      - "8009:80"
    volumes:
      - ".:/app:rw"
      - "./data:/data:rw"
    command: python manage.py runserver 0.0.0.0:80
    env_file: .env-local
    networks:
      - privatenetwork

  db:
    image: postgres:9.6-alpine
    environment:
      POSTGRES_DB: "db"
    volumes:
      - ".:/app:rw"
    networks:
      - privatenetwork

  es:
    image: elasticsearch:2.4-alpine
    ulimits:
      memlock:
        soft: 20480
        hard: 20480
    environment:
      ES_HEAP_SIZE: "24m"
      ES_JAVA_OPTS: "-server"
      MAX_LOCKED_MEMORY: 20480
      index.number_of_shards: 1
      index.number_of_replicas: 0
      network.tcp.block: 1
    expose:
      - "9200"
    networks:
      - privatenetwork


networks:
  privatenetwork:
