Skip to content

Commit 731be3f

Browse files
committed
feat: Add enterprise subsidy service to Devstack
1 parent 4255f6a commit 731be3f

File tree

11 files changed

+75
-1
lines changed

11 files changed

+75
-1
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ dev.shell.analyticsapi:
407407
dev.shell.insights:
408408
docker compose exec insights env TERM=$(TERM) bash -c 'eval $$(source /edx/app/insights/insights_env; echo PATH="$$PATH";) && /bin/bash'
409409

410+
dev.shell.enterprise-subsidy:
411+
docker compose exec enterprise-subsidy env TERM=$(TERM) bash -c '/bin/bash'
412+
410413
dev.shell.%: ## Run a shell on the specified service's container.
411414
docker compose exec $* /bin/bash
412415

check.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ if should_check analyticsapi; then
156156
"curl --fail -L http://localhost:19001/health/"
157157
fi
158158

159+
if should_check enterprise-subsidy; then
160+
echo "Running Enterprise Subsidy Devstack tests: "
161+
run_check enterprise-subsidy_heartbeat enterprise-subsidy \
162+
"curl --fail -L http://localhost:18280/health/"
163+
fi
164+
159165
echo "Successful checks:${succeeded:- NONE}"
160166
echo "Failed checks:${failed:- NONE}"
161167
if [[ -z "$succeeded" ]] && [[ -z "$failed" ]]; then

docker-compose-host.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ services:
7171
- ${DEVSTACK_WORKSPACE}/edx-analytics-data-api:/edx/app/analytics_api/analytics_api
7272
- ${DEVSTACK_WORKSPACE}/src:/edx/src
7373
- ${PWD}/py_configuration_files/analytics_data_api.py:/edx/app/analytics_api/analytics_api/analyticsdataserver/settings/devstack.py
74+
enterprise-subsidy:
75+
volumes:
76+
- ${DEVSTACK_WORKSPACE}/enterprise-subsidy:/edx/app/enterprise-subsidy
77+
- ${DEVSTACK_WORKSPACE}/src:/edx/src
7478

7579
# Note that frontends mount `src` to /edx/app/src instead of /edx/src.
7680
# See ADR #5 for rationale.

docker-compose.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,29 @@ services:
693693
aliases:
694694
- edx.devstack.xqueue_consumer
695695

696+
enterprise-subsidy:
697+
image: edxops/enterprise-subsidy-dev
698+
container_name: edx.devstack.enterprise-subsidy
699+
hostname: enterprise-subsidy.devstack.edx
700+
depends_on:
701+
- mysql80
702+
- memcached
703+
command: bash -c 'while true; do python /edx/app/enterprise-subsidy/manage.py runserver 0.0.0.0:18280; sleep 2; done'
704+
stdin_open: true
705+
tty: true
706+
environment:
707+
DB_HOST: edx.devstack.mysql80
708+
DB_PORT: 3306
709+
DB_USER: subsidy001
710+
DB_PASSWORD: password
711+
DJANGO_SETTINGS_MODULE: enterprise_subsidy.settings.devstack
712+
MEMCACHE_HOST: memcached.devstack.edx:11211
713+
working_dir: /edx/app/enterprise-subsidy
714+
ports:
715+
- "18280:18280"
716+
volumes:
717+
- /edx/var/enterprise-subsidy
718+
696719
# ==========================================================================
697720
# edX Microfrontends
698721
#

docs/service_list.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ Instead of a service name or list, you can also run commands like ``make dev.pro
6363
+------------------------------------+-------------------------------------+----------------+--------------+
6464
| `frontend-app-ora-grading`_ | http://localhost:1993 | MFE (React.js) | Extra |
6565
+------------------------------------+-------------------------------------+----------------+--------------+
66+
| `enterprise-subsidy`_ | http://localhost:18280 | Python/Django | Extra |
67+
+------------------------------------+-------------------------------------+----------------+--------------+
6668

6769
Some common service combinations include:
6870

@@ -95,3 +97,4 @@ Some common service combinations include:
9597
.. _frontend-app-ora-grading: https://github.com/edx/frontend-app-ora-grading
9698
.. _insights: https://github.com/edx/edx-analytics-dashboard
9799
.. _analyticsapi: https://github.com/edx/edx-analytics-data-api
100+
.. _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+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
70+
analyticsapi+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
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
@@ -45,4 +45,8 @@ CREATE USER IF NOT EXISTS 'edxapp001'@'%' IDENTIFIED BY 'password';
4545
GRANT ALL ON edxapp.* TO 'edxapp001'@'%';
4646
GRANT ALL ON edxapp_csmh.* TO 'edxapp001'@'%';
4747

48+
CREATE DATABASE IF NOT EXISTS enterprise_subsidy;
49+
CREATE USER IF NOT EXISTS 'subsidy001'@'%' IDENTIFIED BY 'password';
50+
GRANT ALL ON enterprise_subsidy.* TO 'subsidy001'@'%';
51+
4852
FLUSH PRIVILEGES;

provision.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ xqueue \
4949
coursegraph \
5050
insights \
5151
analyticsapi \
52+
enterprise-subsidy \
5253
"
5354

5455
# What should we provision?

provision.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,9 @@ GRANT ALL ON `reports`.* TO 'analytics001'@'%' IDENTIFIED BY 'password';
3333
CREATE DATABASE IF NOT EXISTS `reports_v1`;
3434
GRANT ALL ON `reports_v1`.* TO 'analytics001'@'%' IDENTIFIED BY 'password';
3535

36+
CREATE DATABASE IF NOT EXISTS enterprise_subsidy;
37+
CREATE USER IF NOT EXISTS 'subsidy001'@'%' IDENTIFIED BY 'password';
38+
GRANT ALL ON enterprise_subsidy.* TO 'subsidy001'@'%';
39+
3640

3741
FLUSH PRIVILEGES;

0 commit comments

Comments
 (0)