version: "2.1"

services:
  xqueue:
    container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.xqueue"
    image: edxops/xqueue:${OPENEDX_RELEASE:-latest}
    command: bash -c 'source /edx/app/xqueue/xqueue_env && while true; do python /edx/app/xqueue/xqueue/manage.py runserver 0.0.0.0:18040 ; sleep 2; done'
    volumes:
      - ${DEVSTACK_WORKSPACE}/xqueue:/edx/app/xqueue/xqueue:cached
    # depends_on: even though we need mysql, we can't refer to it because it's started in the other compose file
    networks:
      default:
        aliases:
          - edx.devstack.xqueue
    ports:
      - 18040:18040

  xqueue_consumer:
    container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.xqueue_consumer"
    image: edxops/xqueue:${OPENEDX_RELEASE:-latest}
    command: bash -c 'source /edx/app/xqueue/xqueue_env && while true; do python /edx/app/xqueue/xqueue/manage.py run_consumer ; sleep 2; done'
    volumes:
      - ${DEVSTACK_WORKSPACE}/xqueue:/edx/app/xqueue/xqueue:cached
    networks:
      default:
        aliases:
          - edx.devstack.xqueue_consumer
    # depends_on: even though we need mysql, we can't refer to it because it's started in the other compose file
