version: '2'

services:
  rabbit:
    hostname: rabbit
    image: rabbitmq:3
    environment:
      - RABBITMQ_DEFAULT_USER=admin
      - RABBITMQ_DEFAULT_PASS=mypass
    ports:
      - "5672:5672"

  helios:
    build: .
    ports:
      - "8666:8000"
    links:
      - rabbit
    depends_on:
      - rabbit
    environment:
      DATABASE_URL: "postgres://db:db@host.docker.internal:5432/helios"
      CELERY_BROKER_URL: "amqp://admin:mypass@rabbit:5672"
      ALLOWED_HOSTS: 127.0.0.1,localhost
      URL_HOST: http://localhost:8666
      PIRATI_REALM_URL: "http://host.docker.internal:8080/auth/realms/master"
      PIRATI_CLIENT_ID: "helios"
      PIRATI_CLIENT_SECRET: ""
      # localhost only!
      OAUTHLIB_INSECURE_TRANSPORT: 1

  worker:
    build: .
    links:
      - rabbit
    depends_on:
      - rabbit
    command: bash run_worker.sh
    environment:
      DATABASE_URL: "postgres://db:db@host.docker.internal:5432/helios"
      CELERY_BROKER_URL: "amqp://admin:mypass@rabbit:5672"
      ALLOWED_HOSTS: 127.0.0.1,localhost
      URL_HOST: http://localhost:8666
