Skip to content

Commit

Permalink
Move Registrar into main docker-compose files and Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
kdmccormick authored May 3, 2019
1 parent f33d5dc commit 44c9b10
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 178 deletions.
21 changes: 18 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -313,25 +313,38 @@ meant to be user-facing, the "homepage" may be the API root.
+---------------------+-------------------------------------+
| Studio/CMS | http://localhost:18010/ |
+---------------------+-------------------------------------+
| Registrar | http://localhost:18734/ |
+---------------------+-------------------------------------+

Useful Commands
---------------

``make dev.up`` can take a long time, as it starts all services, whether or not
you need them. To instead only start a single service and its dependencies, run
``make dev.up.<service>``. For example, the following will bring up LMS
(along with Memcached, MySQL, and devpi), but it will not bring up Discovery,
Credentials, etc:

.. code:: sh
make dev.up.lms
Sometimes you may need to restart a particular application server. To do so,
simply use the ``docker-compose restart`` command:

.. code:: sh
docker-compose restart <service>
``<service>`` should be replaced with one of the following:
In all the above commands, ``<service>`` should be replaced with one of the following:

- credentials
- discovery
- ecommerce
- lms
- edx_notes_api
- studio
- registrar

If you'd like to add some convenience make targets, you can add them to a ``local.mk`` file, ignored by git.

Expand Down Expand Up @@ -641,12 +654,11 @@ start up the containers as usual with:
This command starts each relevant container with the equivalent of the '--it' option,
allowing a developer to attach to the process once the process is up and running.

To attach to the LMS/Studio containers and their process, use either:
To attach to a container and its process, use ``make <service>-attach``. For example:

.. code:: sh
make lms-attach
make studio-attach
Set a PDB breakpoint anywhere in the code using:

Expand All @@ -668,6 +680,9 @@ or a manual Docker command to bring down the container:
docker kill $(docker ps -a -q --filter="name=edx.devstack.<container name>")
Alternatively, some terminals allow detachment from a running container with the
``Ctrl-P, Ctrl-Q`` key sequence.

Running LMS and Studio Tests
----------------------------

Expand Down
8 changes: 7 additions & 1 deletion docker-compose-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ services:
volumes:
- ${DEVSTACK_WORKSPACE}/gradebook:/edx/app/gradebook:cached
- gradebook_node_modules:/edx/app/gradebook/node_modules

registrar:
volumes:
- ${DEVSTACK_WORKSPACE}/registrar:/edx/app/registrar/registrar
registrar-worker:
volumes:
- ${DEVSTACK_WORKSPACE}/registrar:/edx/app/registrar/registrar

volumes:
credentials_node_modules:
discovery_node_modules:
Expand Down
9 changes: 0 additions & 9 deletions docker-compose-registrar-host.yml

This file was deleted.

10 changes: 0 additions & 10 deletions docker-compose-registrar-sync.yml

This file was deleted.

68 changes: 0 additions & 68 deletions docker-compose-registrar.yml

This file was deleted.

5 changes: 5 additions & 0 deletions docker-compose-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ services:
forum:
volumes:
- forum-sync:/edx/app/forum/cs_comments_service:nocopy
registrar:
volumes:
- registrar-sync:/edx/app/registrar/registrar:nocopy

volumes:
credentials-sync:
Expand All @@ -31,3 +34,5 @@ volumes:
external: true
forum-sync:
external: true
registrar-sync:
external: true
68 changes: 68 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ services:
volumes:
- mysql_data:/var/lib/mysql

redis:
container_name: edx.devstack.redis
hostname: redis.devstack.edx
image: redis:2.8
command: redis-server --requirepass password

# edX services
credentials:
command: bash -c 'source /edx/app/credentials/credentials_env && while true; do python /edx/app/credentials/credentials/manage.py runserver 0.0.0.0:18150; sleep 2; done'
Expand Down Expand Up @@ -183,6 +189,68 @@ services:
ENABLE_DJANGO_TOOLBAR: 1
ELASTICSEARCH_URL: "http://edx.devstack.elasticsearch:9200"

registrar:
command: bash -c 'source /edx/app/registrar/registrar_env && while true; do python /edx/app/registrar/registrar/manage.py runserver 0.0.0.0:18734; sleep 2; done'
container_name: edx.devstack.registrar
hostname: registrar.devstack.edx
depends_on:
- discovery
- lms
- mysql
- memcached
- redis
- registrar-worker
# Allows attachment to the registrar service using 'docker attach <containerID>'.
stdin_open: true
tty: true
environment:
DB_HOST: edx.devstack.mysql
DB_NAME: registrar
DB_PORT: 3306
DB_USER: registrar001
DB_PASSWORD: password
LMS_HOST: http://localhost:18000
MEMCACHE_HOST: edx.devstack.memcached
DJANGO_SETTINGS_MODULE: registrar.settings.devstack
CELERY_BROKER_TRANSPORT: redis
CELERY_BROKER_HOSTNAME: edx.devstack.redis:6379
CELERY_BROKER_VHOST: 10
CELERY_BROKER_PASSWORD: password
image: edxops/registrar:${OPENEDX_RELEASE:-latest}
ports:
- "18734:18734"
volumes:
- /edx/var/registrar/

registrar-worker:
command: bash -c 'source /edx/app/registrar/registrar_env && cd /edx/app/registrar/registrar && celery -A registrar worker -l debug -c 2'
container_name: edx.devstack.registrar-worker
hostname: registrar-worker.devstack.edx
depends_on:
- lms
- mysql
- redis
stdin_open: true
tty: true
environment:
DB_HOST: edx.devstack.mysql
DB_NAME: registrar
DB_PORT: 3306
DB_USER: registrar001
DB_PASSWORD: password
LMS_HOST: http://localhost:18000
MEMCACHE_HOST: edx.devstack.memcached
DJANGO_SETTINGS_MODULE: registrar.settings.devstack
CELERY_BROKER_TRANSPORT: redis
CELERY_BROKER_HOSTNAME: edx.devstack.redis:6379
CELERY_BROKER_VHOST: 10
CELERY_BROKER_PASSWORD: password
image: edxops/registrar:${OPENEDX_RELEASE:-latest}
ports:
- "18735:18735"
volumes:
- /edx/var/registrar/

studio:
command: bash -c 'source /edx/app/edxapp/edxapp_env && while true; do python /edx/app/edxapp/edx-platform/manage.py cms runserver 0.0.0.0:18010 --settings devstack_docker; sleep 2; done'
container_name: edx.devstack.studio
Expand Down
35 changes: 0 additions & 35 deletions docker-sync-registrar.yml

This file was deleted.

5 changes: 5 additions & 0 deletions docker-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ syncs:
host_disk_mount_mode: 'cached'
src: '../cs_comments_service/'
sync_excludes: [ '.git', '.idea' ]

regsistrar-sync:
host_disk_mount_mode: 'cached'
src: '../registrar/'
sync_excludes: [ '.git', '.idea' ]
22 changes: 22 additions & 0 deletions provision-registrar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

name=registrar
port=18734

docker-compose $DOCKER_COMPOSE_FILES up -d $name

echo -e "${GREEN}Installing requirements for ${name}...${NC}"
docker exec -t edx.devstack.${name} bash -c 'source /edx/app/registrar/registrar_env && cd /edx/app/registrar/registrar && make requirements' -- "$name"

echo -e "${GREEN}Running migrations for ${name}...${NC}"
docker exec -t edx.devstack.${name} bash -c 'source /edx/app/registrar/registrar_env && cd /edx/app/registrar/registrar && make migrate' -- "$name"

echo -e "${GREEN}Creating super-user for ${name}...${NC}"
docker exec -t edx.devstack.${name} bash -c 'source /edx/app/registrar/registrar_env && cd /edx/app/registrar/registrar && make createsuperuser' -- "$name"

./provision-ida-user.sh ${name} ${name} ${port}

# Compile static assets last since they are absolutely necessary for all services. This will allow developers to get
# started if they do not care about static assets
echo -e "${GREEN}Compiling static assets for ${name}...${NC}"
docker exec -t edx.devstack.${name} bash -c ' if ! source /edx/app/registrar/registrar_env && cd /edx/app/registrar/registrar && make static 2>registrar_make_static.err; then echo "------- Last 100 lines of stderr"; tail regsitrar_make_static.err -n 100; echo "-------"; fi;' -- "$name"
1 change: 1 addition & 0 deletions provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ docker-compose $DOCKER_COMPOSE_FILES up -d studio
./provision-e2e.sh
./provision-forum.sh
./provision-notes.sh
./provision-registrar.sh

docker image prune -f

Expand Down
52 changes: 0 additions & 52 deletions registrar.mk

This file was deleted.

Loading

0 comments on commit 44c9b10

Please sign in to comment.