version: "2.1"

services:
  lms_watcher:
    command: bash -c 'cd /edx/app/edxapp/edx-platform && source ../edxapp_env && while true; do paver watch_assets --w=$$ASSET_WATCHER_TIMEOUT; sleep 2; done'
    container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.lms_watcher"
    environment:
      BOK_CHOY_HOSTNAME: edx.devstack.lms_watcher
      ASSET_WATCHER_TIMEOUT: 12
    image: edxops/edxapp:${OPENEDX_RELEASE:-latest}
    volumes:
      - ${DEVSTACK_WORKSPACE}/edx-platform:/edx/app/edxapp/edx-platform:cached
      - edxapp_lms_assets:/edx/var/edxapp/staticfiles/
      - edxapp_node_modules:/edx/app/edxapp/edx-platform/node_modules
      - ${DEVSTACK_WORKSPACE}/src:/edx/src:cached
      - ${DEVSTACK_WORKSPACE}/edx-themes:/edx/app/edx-themes:cached
    networks:
      default:
        aliases:
          - edx.devstack.lms_watcher

  studio_watcher:
    command: bash -c 'cd /edx/app/edxapp/edx-platform && source ../edxapp_env && while true; do paver watch_assets --w=$$ASSET_WATCHER_TIMEOUT; sleep 2; done'
    container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.studio_watcher"
    environment:
      BOK_CHOY_HOSTNAME: edx.devstack.studio_watcher
      ASSET_WATCHER_TIMEOUT: 12
    image: edxops/edxapp:${OPENEDX_RELEASE:-latest}
    volumes:
      - edxapp_studio_assets:/edx/var/edxapp/staticfiles/
      - ${DEVSTACK_WORKSPACE}/edx-platform:/edx/app/edxapp/edx-platform:cached
      - edxapp_node_modules:/edx/app/edxapp/edx-platform/node_modules
      - ${DEVSTACK_WORKSPACE}/src:/edx/src:cached
      - ${DEVSTACK_WORKSPACE}/edx-themes:/edx/app/edx-themes:cached
    networks:
      default:
        aliases:
          - edx.devstack.studio_watcher

volumes:
  edxapp_lms_assets:
  edxapp_studio_assets:
  edxapp_node_modules:
