Skip to content

Commit 69337bc

Browse files
mfarhan943huniafatima-99iamsobanjaved
authored
Add enterprise subsidy to devstack (#84)
* feat: Add enterprise subsidy service to Devstack * fix: added db_name, removed memchached * chore: corrected path for settings file * chore: add check for enterprise subsidy back * fix: use devstack's memcached in enterprise-subsidy * fix: use hyphen in health check of enterprise-subsidy --------- Co-authored-by: Hunia Fatima <[email protected]> Co-authored-by: Muhammad Soban Javed <[email protected]>
1 parent edb6b53 commit 69337bc

File tree

12 files changed

+78
-3
lines changed

12 files changed

+78
-3
lines changed

.github/workflows/provisioning-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
os:
3131
- ubuntu-20.04 # Ubuntu 20.04 "Focal Fossa"
3232
python-version: [ '3.11' ]
33-
services: [ discovery+lms+forum ,registrar+lms, ecommerce+lms, edx_notes_api+lms, credentials+lms, xqueue, analyticsapi+insights+lms, designer+lms, enterprise-catalog+enterprise-access+lms, license-manager+lms]
33+
services: [ discovery+lms+forum ,registrar+lms, ecommerce+lms, edx_notes_api+lms, credentials+lms, xqueue, analyticsapi+insights+lms, designer+lms, enterprise-subsidy+enterprise-catalog+enterprise-access+lms, license-manager+lms]
3434
fail-fast: false # some services can be flaky; let others run to completion even if one fails
3535

3636
steps:

check.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ if should_check enterprise_access; then
120120
"curl --fail -L http://localhost:18130/health/"
121121
fi
122122

123+
if should_check enterprise-subsidy; then
124+
echo "Checking enterprise_subsidy health:"
125+
run_check enterprise-subsidy_heartbeat enterprise-subsidy \
126+
"curl --fail -L http://localhost:18280/health/"
127+
fi
128+
123129
if should_check discovery; then
124130
echo "Checking discovery health:"
125131
run_check discovery_heartbeat discovery \

docker-compose-host.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,16 @@ services:
9090
- ${DEVSTACK_WORKSPACE}/edx-analytics-data-api:/edx/app/analytics_api/analytics_api
9191
- ${DEVSTACK_WORKSPACE}/src:/edx/src
9292
- ${PWD}/py_configuration_files/analytics_data_api.py:/edx/app/analytics_api/analytics_api/analyticsdataserver/settings/devstack.py
93+
enterprise-subsidy:
94+
volumes:
95+
- ${DEVSTACK_WORKSPACE}/enterprise-subsidy:/edx/app/enterprise-subsidy
96+
- ${DEVSTACK_WORKSPACE}/src:/edx/src
97+
- ${PWD}/py_configuration_files/enterprise_subsidy.py:/edx/app/enterprise-subsidy/enterprise_subsidy/settings/devstack.py
98+
9399
enterprise-catalog:
94100
volumes:
95101
- ${DEVSTACK_WORKSPACE}/enterprise-catalog:/edx/app/enterprise_catalog/enterprise_catalog
102+
- ${PWD}/py_configuration_files/enterprise_catalog.py:/edx/app/enterprise_catalog/enterprise_catalog/settings/devstack.py
96103
enterprise-catalog-worker:
97104
volumes:
98105
- ${DEVSTACK_WORKSPACE}/enterprise-catalog:/edx/app/enterprise_catalog/enterprise_catalog
@@ -115,6 +122,7 @@ services:
115122
- ${DEVSTACK_WORKSPACE}/license-manager:/edx/app/license_manager
116123
- ${DEVSTACK_WORKSPACE}/src:/edx/src:cached
117124
- ${PWD}/py_configuration_files/license_manager.py:/edx/app/license_manager/license_manager/settings/devstack.py
125+
118126
# Note that frontends mount `src` to /edx/app/src instead of /edx/src.
119127
# See ADR #5 for rationale.
120128
frontend-app-account:

docker-compose.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,29 @@ services:
913913
stdin_open: true
914914
tty: true
915915

916+
enterprise-subsidy:
917+
image: edxops/enterprise-subsidy-dev
918+
container_name: edx.devstack.enterprise-subsidy
919+
hostname: enterprise-subsidy.devstack.edx
920+
depends_on:
921+
- mysql80
922+
- memcached
923+
command: bash -c 'while true; do python /edx/app/enterprise-subsidy/manage.py runserver 0.0.0.0:18280; sleep 2; done'
924+
stdin_open: true
925+
tty: true
926+
environment:
927+
DB_HOST: edx.devstack.mysql80
928+
DB_PORT: 3306
929+
DB_USER: subsidy001
930+
DB_PASSWORD: password
931+
DB_NAME: enterprise_subsidy
932+
DJANGO_SETTINGS_MODULE: enterprise_subsidy.settings.devstack
933+
working_dir: /edx/app/enterprise-subsidy
934+
ports:
935+
- "18280:18280"
936+
volumes:
937+
- /edx/var/enterprise-subsidy
938+
916939
# ==========================================================================
917940
# edX Microfrontends
918941
#

docs/service_list.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Instead of a service name or list, you can also run commands like ``make dev.pro
7373
+------------------------------------+-------------------------------------+----------------+--------------+
7474
| `enterprise-access`_ | http://localhost:18270 | Python/Django | Extra |
7575
+------------------------------------+-------------------------------------+----------------+--------------+
76+
| `enterprise-subsidy`_ | http://localhost:18280 | Python/Django | Extra |
77+
+------------------------------------+-------------------------------------+----------------+--------------+
7678

7779
Some common service combinations include:
7880

@@ -110,3 +112,4 @@ Some common service combinations include:
110112
.. _enterprise-catalog: https://github.com/openedx/enterprise-catalog
111113
.. _license-manager: https://github.com/openedx/license-manager
112114
.. _enterprise-access: https://github.com/openedx/enterprise-access
115+
.. _enterprise-subsidy: https://github.com/openedx/enterprise-subsidy

options.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ credentials+discovery+ecommerce+edx_notes_api+forum+frontend-app-authn+frontend-
6767
# Separated by plus signs.
6868
# Separated by plus signs. Listed in alphabetical order for clarity.
6969
EDX_SERVICES ?= \
70-
analyticsapi+codejail+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+designer+enterprise-access
70+
analyticsapi+codejail+enterprise-subsidy+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+designer+enterprise-access
7171

7272
# Services with database migrations.
7373
# Should be a subset of $(EDX_SERVICES).

provision-enterprise-subsidy.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
set -eu -o pipefail
3+
set -x
4+
5+
. scripts/colors.sh
6+
7+
name="enterprise-subsidy"
8+
port="18280"
9+
10+
docker compose up -d lms
11+
docker compose up -d ${name}
12+
13+
# Run migrations
14+
echo -e "${GREEN}Running migrations for ${name}...${NC}"
15+
docker compose exec ${name} bash -c "cd /edx/app/${name}/ && make migrate"
16+
17+
# Create superuser
18+
echo -e "${GREEN}Creating super-user for ${name}...${NC}"
19+
docker compose exec ${name} bash -c "echo 'from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser(\"edx\", \"[email protected]\", \"edx\") if not User.objects.filter(username=\"edx\").exists() else None' | python /edx/app/${name}/manage.py shell"
20+
21+
# Provision IDA User in LMS
22+
echo -e "${GREEN}Provisioning ${name}_worker in LMS...${NC}"
23+
24+
./provision-ida-user.sh ${name} ${name} ${port}

provision-mysql80.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,8 @@ CREATE USER IF NOT EXISTS 'edxapp001'@'%' IDENTIFIED BY 'password';
6161
GRANT ALL ON edxapp.* TO 'edxapp001'@'%';
6262
GRANT ALL ON edxapp_csmh.* TO 'edxapp001'@'%';
6363

64+
CREATE DATABASE IF NOT EXISTS enterprise_subsidy;
65+
CREATE USER IF NOT EXISTS 'subsidy001'@'%' IDENTIFIED BY 'password';
66+
GRANT ALL ON enterprise_subsidy.* TO 'subsidy001'@'%';
67+
6468
FLUSH PRIVILEGES;

provision.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ enterprise-catalog \
5353
license-manager \
5454
designer \
5555
enterprise-access \
56+
enterprise-subsidy \
5657
"
5758

5859
# What should we provision?

provision.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ GRANT ALL ON `reports`.* TO 'analytics001'@'%' IDENTIFIED BY 'password';
3636
CREATE DATABASE IF NOT EXISTS `reports_v1`;
3737
GRANT ALL ON `reports_v1`.* TO 'analytics001'@'%' IDENTIFIED BY 'password';
3838

39+
CREATE DATABASE IF NOT EXISTS enterprise_subsidy;
40+
CREATE USER IF NOT EXISTS 'subsidy001'@'%' IDENTIFIED BY 'password';
41+
GRANT ALL ON enterprise_subsidy.* TO 'subsidy001'@'%';
42+
3943
CREATE DATABASE IF NOT EXISTS `enterprise_catalog`;
4044
GRANT ALL ON `enterprise_catalog`.* TO 'catalog001'@'%' IDENTIFIED BY 'password';
4145

0 commit comments

Comments
 (0)