This is a quick setup guide for ubcpi developers to work with the docker-based Open edX devstack.
First we will setup the devstack containers. We will then integrate the ubcpi development.
- On the host machine, create a working directory (e.g. we will use
edx_devfor this setup guide). The setup process will create multiple sub-directories for edX sevices under this working directory. - Under
edx_dev, clone the repositoryhttps://github.com/edx/devstack.
git clone https://github.com/edx/devstack
- Follow the instructions on https://github.com/edx/devstack to setup the devstack. Once reached the step to start containers by executing
make dev.up, check the Studio and LMS containers are working by visiting the following URLs:
http://localhost:18010/
http://localhost:18000/
Refer to the devstack README for details on login information (email: edx@example.com, password: edx).
- The devstack comes with prod version of
ubcpimodule already. Make sure it can be added before setting up the containers to use development version. In Studio, create a new course or edit an existing course. - When viewing the course, on the top menu, select Settings > Advanced Settings
- Under the section
Advanced Module List, add"ubcpi"(with the double quotes) to the JSON list. e.g.
[
"ubcpi",
"oppia"
]
Click save.
- In Studio, edit the course. Create a new section, subsection, and then a New Unit. Multiple buttons ("Advanced", "Discussion", "HTML, "Problem", "Video"...) should be displayed. Click on the
Advancedbutton. - Make sure
Peer Instruction Question(i.e.ubcpi) is listed as one of the options. Select it to add to the course.
- The devstack setup process should created the directory
edx_dev/src. Change to that directory - Clone the
ubcpirepository by executing
git clone https://github.com/ubc/ubcpi
- In docker-based devstack, the Python
virtualenvis not persistent. We will need to install the the development version ofubcpieverytime the containers are restarted. Editdocker-compose.ymlunderedx_dev/devstack - Modify the sections for
lmsandstudiocontainers. Add thepip install -e /edx/src/ubcpicommand. e.g.:
lms:
- command: bash -c 'source /edx/app/edxapp/edxapp_env && while true; do python /edx/app/edxapp/edx-platform/manage.py lms runserver 0.0.0.0:18000 --settings devstack_docker; sleep 2; done'
+ command: bash -c 'source /edx/app/edxapp/edxapp_env && pip install -e /edx/src/ubcpi && while true; do python /edx/app/edxapp/edx-platform/manage.py lms runserver 0.0.0.0:18000 --settings devstack_docker; sleep 2; done'
container_name: edx.devstack.lms
depends_on:
- mysql
@@ -152,7 +152,7 @@ services:
- edxapp_lms_assets:/edx/var/edxapp/staticfiles/
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'
+ command: bash -c 'source /edx/app/edxapp/edxapp_env && pip install -e /edx/src/ubcpi && 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
- On the host, under the directory
edx_dev/devstack, restart the devstack containers by executing the commands:
make down && make dev.up
- When the containers are up, check the development
ubcpipackage is installed properly. Execute the following command to start a shell to thelmscontainer:
make lms-shell
- A shell to the
lmscontainer should be started. Execute the follow commands to check the package installation:
source ../edxapp_env
pip freeze | grep ubcpi
The result returned should be something like -e git+https://github.com/ubc/ubcpi@ff69bbb8042e3c2acb268e8d680c739f9d71be59#egg=ubcpi_xblock
- Make sure the package is pointing to the development git repository
- Type
exitto exit the shell. Do similar check on thestudiocontainer by starting a shell with the following command:
make studio-shell
- If checked OK, launch Studio in browser and try to add the component to a course.
If setup properly, changes make to the code under the host directory edx_dev/src/ubcpi should be reflected in the containers.