Docker Devstack – Multiple Releases – One Machine

I was able to get the edx.devstack.mysql not found error message removed, within the LMS container, by doing the following.

Under the .\devstack\docker-compose.yml file I updated the MySQL and MongoDB services to include the following default network aliases.

services:
  mongo:
    container_name: ${OPENEDX_RELEASE}.edx.devstack.mongo
    networks:
      default:
        aliases:
          - edx.devstack.mongo

  mysql:
    container_name: ${OPENEDX_RELEASE}.edx.devstack.mysql
    networks:
      default:
        aliases:
          - edx.devstack.mysql

We could have used a separate network devstack_default in the .\devstack\docker-compose.yml file by issuing the following, however, each service would also need to specify that it’s using that network as I have indicated in the LMS. I chose to not do this at the moment and just use the default network.

networks:
  devstack_default:
    driver: bridge

services:
  mongo:
    container_name: ${OPENEDX_RELEASE}.edx.devstack.mongo
    networks:
      devstack_default:
        aliases:
          - edx.devstack.mongo

  mysql:
    container_name: ${OPENEDX_RELEASE}.edx.devstack.mysql
    networks:
      devstack_default:
        aliases:
          - edx.devstack.mysql

  lms:
    container_name: ${OPENEDX_RELEASE}.edx.devstack.lms
    networks:
      - devstack_default

Naming each container with prefix hawthorn. helps isolate the containers per release allowing me to work on separate releases on the same machine.

I applied the network alias to the original service container name for all other services defined within .\devstack\docker-compose.yml file just to be safe.

  • chrome
  • elasticsearch
  • firefox
  • memcached
  • credentials
  • discovery
  • ecommerce
  • edx_notes_api
  • studio
  • forum
  • devpi

For the new container to be recognized on a docker command call we need to also update the .\devstack\Makefile to have this prefix as well. This is just one of several commands that we could find /replace edx.devstack with ${OPENEDX_RELEASE}. prefix.

lms-shell: ## Run a shell on the LMS container
	docker exec -it ${OPENEDX_RELEASE}.edx.devstack.lms env TERM=$(TERM) /edx/app/edxapp/devstack.sh open

I’m using the Shell environment variable $OPENEDX_RELEASE=hawthorn.master, however, we could setup a new Makefile variable OPENEDX_RELEASE_NAME=hawthorn if we needed to keep those independent. I think switching the Shell environment variable would be better.