---
version: '2'

networks:
  xos:
    external: true

services:

  xos_db:
    image: xosproject/xos-postgres
    networks:
      - xos
    expose:
      - "5432"

  xos_bootstrap_ui:
    image: xosproject/xos
    networks:
      - xos
    command: python /opt/xos/manage.py runserver 0.0.0.0:9998 --insecure --makemigrations
    environment:
        - CONFIG_DIR
    ports:
        - "9998:9998"
    links:
        - xos_db
    volumes:
      - ../setup:/root/setup:ro
      - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config
      - ./xos_cord_config:/opt/xos/xos_configuration/xos_cord_config:ro
      - ../../xos_services:/opt/xos_services
      - ../../xos_libraries:/opt/xos_libraries

  xos_synchronizer_onboarding:
    image: xosproject/xos
    networks:
      - xos
    command: bash -c "cd /opt/xos/synchronizers/onboarding; ./run.sh"
#    command: sleep 86400
    labels:
        org.xosproject.kind: synchronizer
        org.xosproject.target: onboarding
    links:
        - xos_db
    volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - ./key_import:/opt/xos/key_import:ro
        - ./onboarding-docker-compose:/opt/xos/synchronizers/onboarding/docker-compose
        - ../../xos_services:/opt/xos_services
    logging:
      driver: "json-file"
      options:
        max-size: "1000k"
        max-file: "5"

  xos_synchronizer_openstack:
    command: bash -c "sleep 120; python /opt/xos/synchronizers/openstack/xos-synchronizer.py"
    image: xosproject/xos-synchronizer-openstack
    networks:
      - xos
    labels:
        org.xosproject.kind: synchronizer
        org.xosproject.target: openstack
    links:
        - xos_db
    extra_hosts:
        - ctl:${MYIP}
    volumes:
        - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
        - ../setup:/root/setup:ro
        - ./xos_cord_config:/opt/xos/xos_configuration/xos_cord_config:ro
        - ./images:/opt/xos/images:ro
    logging:
      driver: "json-file"
      options:
        max-size: "1000k"
        max-file: "5"
