diff --git a/.github/workflows/provisioning-tests.yml b/.github/workflows/provisioning-tests.yml index 5af1594975..39319b979f 100644 --- a/.github/workflows/provisioning-tests.yml +++ b/.github/workflows/provisioning-tests.yml @@ -30,7 +30,7 @@ jobs: os: - ubuntu-20.04 # Ubuntu 20.04 "Focal Fossa" python-version: [ '3.11' ] - services: [ discovery+lms+forum ,registrar+lms, ecommerce+lms, edx_notes_api+lms, credentials+lms, xqueue, analyticsapi+insights+lms] + services: [ discovery+lms+forum ,registrar+lms, ecommerce+lms, edx_notes_api+lms, credentials+lms, xqueue, analyticsapi+insights+lms, edx-exams+lms] fail-fast: false # some services can be flaky; let others run to completion even if one fails steps: diff --git a/Makefile b/Makefile index aba37bc7e2..47da7cc155 100644 --- a/Makefile +++ b/Makefile @@ -407,6 +407,9 @@ dev.shell.analyticsapi: dev.shell.insights: docker compose exec insights env TERM=$(TERM) bash -c 'eval $$(source /edx/app/insights/insights_env; echo PATH="$$PATH";) && /bin/bash' +dev.shell.edx-exams: + docker exec -it edx.devstack.edx_exams env TERM=$(TERM) bash -c '/bin/bash' + dev.shell.%: ## Run a shell on the specified service's container. docker compose exec $* /bin/bash diff --git a/check.sh b/check.sh index 3c0781f025..b3bcdef65c 100755 --- a/check.sh +++ b/check.sh @@ -156,6 +156,12 @@ if should_check analyticsapi; then "curl --fail -L http://localhost:19001/health/" fi +if should_check edx-exams; then + echo "Running edX Exam Devstack tests: " + run_check edx-exams_heartbeat edx-exams \ + "curl --fail -L http://localhost:18740/health/" +fi + echo "Successful checks:${succeeded:- NONE}" echo "Failed checks:${failed:- NONE}" if [[ -z "$succeeded" ]] && [[ -z "$failed" ]]; then diff --git a/docker-compose-host.yml b/docker-compose-host.yml index 85f7a2a272..650a84e622 100644 --- a/docker-compose-host.yml +++ b/docker-compose-host.yml @@ -71,6 +71,10 @@ services: - ${DEVSTACK_WORKSPACE}/edx-analytics-data-api:/edx/app/analytics_api/analytics_api - ${DEVSTACK_WORKSPACE}/src:/edx/src - ${PWD}/py_configuration_files/analytics_data_api.py:/edx/app/analytics_api/analytics_api/analyticsdataserver/settings/devstack.py + edx-exams: + volumes: + - ${DEVSTACK_WORKSPACE}/edx-exams:/edx/app/edx-exams + # Note that frontends mount `src` to /edx/app/src instead of /edx/src. # See ADR #5 for rationale. diff --git a/docker-compose.yml b/docker-compose.yml index a165a6bf22..be1ef69b30 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -693,6 +693,28 @@ services: aliases: - edx.devstack.xqueue_consumer + edx-exams: + image: edxops/edx_exams + container_name: edx.devstack.edx_exams + hostname: edx_exams.devstack.edx + depends_on: + - lms + - mysql80 + command: bash -c 'while true; do python /edx/app/edx-exams/manage.py runserver 0.0.0.0:18740; sleep 2; done' + stdin_open: true + tty: true + environment: + DB_HOST: edx.devstack.mysql80 + DB_PORT: 3306 + DB_USER: exams001 + DB_PASSWORD: password + DJANGO_SETTINGS_MODULE: edx_exams.settings.devstack + working_dir: /edx/app/edx-exams/ + ports: + - "18740:18740" + volumes: + - /edx/var/edx-exams + # ========================================================================== # edX Microfrontends # diff --git a/docs/service_list.rst b/docs/service_list.rst index 092b8028c6..4a80a6b6f0 100644 --- a/docs/service_list.rst +++ b/docs/service_list.rst @@ -63,6 +63,8 @@ Instead of a service name or list, you can also run commands like ``make dev.pro +------------------------------------+-------------------------------------+----------------+--------------+ | `frontend-app-ora-grading`_ | http://localhost:1993 | MFE (React.js) | Extra | +------------------------------------+-------------------------------------+----------------+--------------+ +| `edx-exams`_ | http://localhost:18740 | Python/Django | Extra | ++------------------------------------+-------------------------------------+----------------+--------------+ Some common service combinations include: @@ -95,3 +97,4 @@ Some common service combinations include: .. _frontend-app-ora-grading: https://github.com/edx/frontend-app-ora-grading .. _insights: https://github.com/edx/edx-analytics-dashboard .. _analyticsapi: https://github.com/edx/edx-analytics-data-api +.. _edx-exams: https://github.com/edx/edx-exams diff --git a/options.mk b/options.mk index 5a4d9b4e2c..3615e63b93 100644 --- a/options.mk +++ b/options.mk @@ -67,7 +67,7 @@ credentials+discovery+ecommerce+edx_notes_api+forum+frontend-app-authn+frontend- # Separated by plus signs. # Separated by plus signs. Listed in alphabetical order for clarity. EDX_SERVICES ?= \ -analyticsapi+credentials+cms+cms-worker+cms_watcher+discovery+ecommerce+edx_notes_api+forum+frontend-app-account+frontend-app-learner-dashboard+frontend-app-learner-record+frontend-app-profile+frontend-app-authn+frontend-app-course-authoring+frontend-app-gradebook+frontend-app-ora-grading+frontend-app-learning+frontend-app-library-authoring+frontend-app-payment+frontend-app-program-console+frontend-app-publisher+insights+lms+lms-worker+lms_watcher+registrar+registrar-worker+xqueue+xqueue_consumer +analyticsapi+credentials+cms+cms-worker+cms_watcher+discovery+ecommerce+edx-exams+edx_notes_api+forum+frontend-app-account+frontend-app-learner-dashboard+frontend-app-learner-record+frontend-app-profile+frontend-app-authn+frontend-app-course-authoring+frontend-app-gradebook+frontend-app-ora-grading+frontend-app-learning+frontend-app-library-authoring+frontend-app-payment+frontend-app-program-console+frontend-app-publisher+insights+lms+lms-worker+lms_watcher+registrar+registrar-worker+xqueue+xqueue_consumer # Services with database migrations. # Should be a subset of $(EDX_SERVICES). diff --git a/provision-edx-exams.sh b/provision-edx-exams.sh new file mode 100755 index 0000000000..713610a710 --- /dev/null +++ b/provision-edx-exams.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -eu -o pipefail + +. scripts/colors.sh +set -x + +name="edx-exams" +port="18740" + +docker compose up -d lms +docker compose up -d ${name} + +# Run migrations +echo -e "${GREEN}Running migrations for ${name}...${NC}" +docker exec -t edx.devstack.edx_exams bash -c "cd /edx/app/edx-exams/ && make migrate" + +# Create superuser +echo -e "${GREEN}Creating super-user for ${name}...${NC}" +docker exec -t edx.devstack.edx_exams bash -c "echo 'from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser(\"edx\", \"edx@example.com\", \"edx\") if not User.objects.filter(username=\"edx\").exists() else None' | python /edx/app/edx-exams/manage.py shell" + +# Provision IDA User in LMS and +# create the DOT applications - one for single sign-on and one for backend service IDA-to-IDA authentication. +echo -e "${GREEN}Provisioning ${name}_worker in LMS...${NC}" +./provision-ida-user.sh ${name} ${name} ${port} + +docker compose restart ${name} diff --git a/provision-mysql80.sql b/provision-mysql80.sql index 19b32e0ebd..2ca8338e00 100644 --- a/provision-mysql80.sql +++ b/provision-mysql80.sql @@ -45,4 +45,8 @@ CREATE USER IF NOT EXISTS 'edxapp001'@'%' IDENTIFIED BY 'password'; GRANT ALL ON edxapp.* TO 'edxapp001'@'%'; GRANT ALL ON edxapp_csmh.* TO 'edxapp001'@'%'; +CREATE DATABASE IF NOT EXISTS `edx_exams`; +CREATE USER IF NOT EXISTS 'exams001'@'%' IDENTIFIED BY 'password'; +GRANT ALL ON `edx_exams`.* TO 'exams001'@'%'; + FLUSH PRIVILEGES; diff --git a/provision.sh b/provision.sh index cde27b6fcd..6e5e369da3 100755 --- a/provision.sh +++ b/provision.sh @@ -49,6 +49,7 @@ xqueue \ coursegraph \ insights \ analyticsapi \ +edx-exams \ " # What should we provision? diff --git a/repo.sh b/repo.sh index cb93108f63..d7a0924285 100755 --- a/repo.sh +++ b/repo.sh @@ -48,6 +48,7 @@ non_release_repos=( "https://github.com/openedx/frontend-app-account.git" "https://github.com/openedx/frontend-app-profile.git" "https://github.com/openedx/frontend-app-ora-grading.git" + "https://github.com/edx/edx-exams.git" ) ssh_repos=( @@ -78,6 +79,7 @@ non_release_ssh_repos=( "git@github.com:openedx/frontend-app-account.git" "git@github.com:openedx/frontend-app-profile.git" "git@github.com:openedx/frontend-app-ora-grading.git" + "git@github.com:edx/edx-exams.git" ) if [ -n "${OPENEDX_RELEASE}" ]; then