version: "2.1"
services:
  worker: &worker
    environment:
      - ACCOUNT_DEFAULT_HTTP_PROTOCOL=https
      - ALLOWED_HOSTS=developer.127.0.0.1.nip.io,beta.developer.127.0.0.1.nip.io,wiki.developer.127.0.0.1.nip.io,demos.developer.127.0.0.1.nip.io,api,localhost,web
      - ATTACHMENT_HOST=demos.developer.127.0.0.1.nip.io
      - CSRF_COOKIE_SECURE=True
      - DOMAIN=developer.127.0.0.1.nip.io
      - ENABLE_RESTRICTIONS_BY_HOST=True
      - PROTOCOL=https://
      - SESSION_COOKIE_SECURE=True
      - SITE_ID=2
      - SITE_URL=https://developer.127.0.0.1.nip.io
      - STATIC_URL=https://developer.127.0.0.1.nip.io/static/
      - WAFFLE_COOKIE_SECURE=True
  api:
    <<: *worker
  web:
    <<: *worker
    command: /bin/bash -c "/etc/nginx/ssl/generate_dev_cert.sh && gunicorn -w 4 --bind 0.0.0.0:8000 --access-logfile=- --timeout=120 --worker-class=meinheld.gmeinheld.MeinheldWorker kuma.wsgi:application"
    volumes:
      - ./:/app:z
      - ./etc/nginx/ssl:/etc/nginx/ssl
  nginx:
    image: nginx
    volumes:
      - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./etc/nginx/ssl:/etc/nginx/ssl
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - web
  kumascript:
    environment:
      - LIVE_SAMPLES_URL=https://demos.developer.127.0.0.1.nip.io
