diff --git a/.github/workflows/provisioning-tests.yml b/.github/workflows/provisioning-tests.yml index 82963d0d35..bbaff013c4 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, enterprise-catalog+lms, license-manager+lms] + services: [ discovery+lms+forum ,registrar+lms, ecommerce+lms, edx_notes_api+lms, credentials+lms, xqueue, analyticsapi+insights+lms, enterprise-subsidy+enterprise-catalog+lms, license-manager+lms] fail-fast: false # some services can be flaky; let others run to completion even if one fails steps: diff --git a/check.sh b/check.sh index f010e39299..b229f7bfc5 100755 --- a/check.sh +++ b/check.sh @@ -162,6 +162,12 @@ if should_check license-manager; then "curl --fail -L http://localhost:18170/health/" fi +if should_check enterprise-subsidy; then + echo "Running Enterprise Subsidy Devstack tests: " + run_check enterprise-subsidy \ + "curl --fail -L http://localhost:18280/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 7690fc5a81..740675dfca 100644 --- a/docker-compose-host.yml +++ b/docker-compose-host.yml @@ -71,9 +71,16 @@ 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 + enterprise-subsidy: + volumes: + - ${DEVSTACK_WORKSPACE}/enterprise-subsidy:/edx/app/enterprise-subsidy + - ${DEVSTACK_WORKSPACE}/src:/edx/src + - ${PWD}/py_configuration_files/enterprise_subsidy.py:/edx/app/enterprise-subsidy/enterprise_subsidy/settings/devstack.py + enterprise-catalog: volumes: - ${DEVSTACK_WORKSPACE}/enterprise-catalog:/edx/app/enterprise_catalog/enterprise_catalog + - ${PWD}/py_configuration_files/enterprise_catalog.py:/edx/app/enterprise_catalog/enterprise_catalog/settings/devstack.py enterprise-catalog-worker: volumes: - ${DEVSTACK_WORKSPACE}/enterprise-catalog:/edx/app/enterprise_catalog/enterprise_catalog diff --git a/docker-compose.yml b/docker-compose.yml index a155675a46..c8a99005a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -835,6 +835,29 @@ services: stdin_open: true tty: true + enterprise-subsidy: + image: edxops/enterprise-subsidy-dev + container_name: edx.devstack.enterprise-subsidy + hostname: enterprise-subsidy.devstack.edx + depends_on: + - mysql80 + - memcached + command: bash -c 'while true; do python /edx/app/enterprise-subsidy/manage.py runserver 0.0.0.0:18280; sleep 2; done' + stdin_open: true + tty: true + environment: + DB_HOST: edx.devstack.mysql80 + DB_PORT: 3306 + DB_USER: subsidy001 + DB_PASSWORD: password + DJANGO_SETTINGS_MODULE: enterprise_subsidy.settings.devstack + MEMCACHE_HOST: memcached.devstack.edx:11211 + working_dir: /edx/app/enterprise-subsidy + ports: + - "18280:18280" + volumes: + - /edx/var/enterprise-subsidy + # ========================================================================== # edX Microfrontends # diff --git a/docs/service_list.rst b/docs/service_list.rst index 930465758c..9d93c6f374 100644 --- a/docs/service_list.rst +++ b/docs/service_list.rst @@ -65,6 +65,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 | +------------------------------------+-------------------------------------+----------------+--------------+ +| `enterprise-subsidy`_ | http://localhost:18280 | Python/Django | Extra | ++------------------------------------+-------------------------------------+----------------+--------------+ | `enterprise-catalog`_ | http://localhost:18160/ | Python/Django | Extra | +------------------------------------+-------------------------------------+----------------+--------------+ @@ -99,5 +101,6 @@ 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 +.. _enterprise-subsidy: https://github.com/openedx/enterprise-subsidy .. _enterprise-catalog: https://github.com/openedx/enterprise-catalog .. _license-manager: https://github.com/openedx/license-manager diff --git a/options.mk b/options.mk index bf3b0cd7d5..58224d09f0 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+enterprise-catalog+license-manager +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+enterprise-catalog+enterprise-subsidy+license-manager # Services with database migrations. # Should be a subset of $(EDX_SERVICES). diff --git a/provision-enterprise-subsidy.sh b/provision-enterprise-subsidy.sh new file mode 100755 index 0000000000..30c82155a6 --- /dev/null +++ b/provision-enterprise-subsidy.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -eu -o pipefail +set -x + +. scripts/colors.sh + +name="enterprise-subsidy" +port="18280" + +docker compose up -d lms +docker compose up -d ${name} + +# Run migrations +echo -e "${GREEN}Running migrations for ${name}...${NC}" +docker compose exec ${name} bash -c "cd /edx/app/${name}/ && make migrate" + +# Create superuser +echo -e "${GREEN}Creating super-user for ${name}...${NC}" +docker compose exec ${name} 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/${name}/manage.py shell" + +# Provision IDA User in LMS +echo -e "${GREEN}Provisioning ${name}_worker in LMS...${NC}" + +./provision-ida-user.sh ${name} ${name} ${port} diff --git a/provision-mysql80.sql b/provision-mysql80.sql index 724a84bb39..0277eed36f 100644 --- a/provision-mysql80.sql +++ b/provision-mysql80.sql @@ -53,4 +53,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 enterprise_subsidy; +CREATE USER IF NOT EXISTS 'subsidy001'@'%' IDENTIFIED BY 'password'; +GRANT ALL ON enterprise_subsidy.* TO 'subsidy001'@'%'; + FLUSH PRIVILEGES; diff --git a/provision.sh b/provision.sh index d27a2d6f33..989f006dea 100755 --- a/provision.sh +++ b/provision.sh @@ -49,6 +49,7 @@ xqueue \ coursegraph \ insights \ analyticsapi \ +enterprise-subsidy \ enterprise-catalog \ license-manager \ " diff --git a/provision.sql b/provision.sql index c0d3a96d64..2635587e70 100644 --- a/provision.sql +++ b/provision.sql @@ -33,6 +33,10 @@ GRANT ALL ON `reports`.* TO 'analytics001'@'%' IDENTIFIED BY 'password'; CREATE DATABASE IF NOT EXISTS `reports_v1`; GRANT ALL ON `reports_v1`.* TO 'analytics001'@'%' IDENTIFIED BY 'password'; +CREATE DATABASE IF NOT EXISTS enterprise_subsidy; +CREATE USER IF NOT EXISTS 'subsidy001'@'%' IDENTIFIED BY 'password'; +GRANT ALL ON enterprise_subsidy.* TO 'subsidy001'@'%'; + CREATE DATABASE IF NOT EXISTS `enterprise_catalog`; GRANT ALL ON `enterprise_catalog`.* TO 'catalog001'@'%' IDENTIFIED BY 'password'; diff --git a/repo.sh b/repo.sh index 7a31b729db..7630803fa8 100755 --- a/repo.sh +++ b/repo.sh @@ -50,6 +50,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/openedx/enterprise-subsidy.git" ) ssh_repos=( @@ -82,6 +83,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:openedx/enterprise-subsidy.git" ) if [ -n "${OPENEDX_RELEASE}" ]; then