Skip to content

Commit 47c0f3a

Browse files
committed
feat: add enterprise-access to devstack
1 parent 4255f6a commit 47c0f3a

File tree

10 files changed

+119
-2
lines changed

10 files changed

+119
-2
lines changed

check.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ if should_check ecommerce; then
114114
"curl --fail -L http://localhost:18130/health/"
115115
fi
116116

117+
if should_check enterprise_access; then
118+
echo "Checking enterprise-access health:"
119+
run_check enterprise_access_heartbeat enterprise-access \
120+
"curl --fail -L http://localhost:18130/health/"
121+
fi
122+
117123
if should_check discovery; then
118124
echo "Checking discovery health:"
119125
run_check discovery_heartbeat discovery \

docker-compose-host.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ services:
2020
- ecommerce_tox:/edx/app/ecommerce/ecommerce/.tox
2121
- ${DEVSTACK_WORKSPACE}/src:/edx/src
2222
- ${PWD}/py_configuration_files/ecommerce.py:/edx/app/ecommerce/ecommerce/ecommerce/settings/devstack.py
23+
enterprise-access:
24+
volumes:
25+
- ${DEVSTACK_WORKSPACE}/enterprise-access:/edx/app/enterprise-access/
26+
- ${DEVSTACK_WORKSPACE}/src:/edx/src
27+
enterprise-access-worker:
28+
volumes:
29+
- ${DEVSTACK_WORKSPACE}/enterprise-access:/edx/app/enterprise-access/
2330
forum:
2431
volumes:
2532
- ${DEVSTACK_WORKSPACE}/cs_comments_service:/edx/app/forum/cs_comments_service

docker-compose.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,69 @@ services:
386386
ELASTICSEARCH_URL: "http://edx.devstack.elasticsearch710:9200"
387387
ELASTICSEARCH_DSL: "http://edx.devstack.elasticsearch710:9200"
388388

389+
enterprise-access:
390+
image: edxops/enterprise-access-dev
391+
container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.enterprise-access"
392+
hostname: enterprise-access.devstack.edx
393+
command: bash -c 'while true; do python /edx/app/enterprise-access/manage.py runserver 0.0.0.0:18270; sleep 2; done'
394+
ports:
395+
- "18270:18270"
396+
depends_on:
397+
- mysql80
398+
- memcached
399+
- enterprise-access-worker
400+
networks:
401+
default:
402+
aliases:
403+
- edx.devstack.enterprise-access
404+
stdin_open: true
405+
tty: true
406+
environment:
407+
CELERY_ALWAYS_EAGER: 'false'
408+
CELERY_BROKER_TRANSPORT: redis
409+
CELERY_BROKER_HOSTNAME: edx.devstack.redis:6379
410+
CELERY_BROKER_VHOST: 0
411+
CELERY_BROKER_PASSWORD: password
412+
DJANGO_SETTINGS_MODULE: enterprise_access.settings.devstack
413+
DJANGO_WATCHMAN_TIMEOUT: 30
414+
ENABLE_DJANGO_TOOLBAR: 1
415+
DB_HOST: edx.devstack.mysql80
416+
DB_NAME: enterprise_access
417+
DB_PORT: 3306
418+
DB_USER: enterprise_access001
419+
DB_PASSWORD: password
420+
421+
enterprise-access-worker:
422+
image: edxops/enterprise-access-dev
423+
command: bash -c 'cd /edx/app/enterprise-access/ && celery -A enterprise_access worker -l DEBUG'
424+
container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.enterprise-access-worker"
425+
hostname: enterprise-access-worker.devstack.edx
426+
depends_on:
427+
- mysql80
428+
- memcached
429+
environment:
430+
CELERY_ALWAYS_EAGER: 'false'
431+
CELERY_BROKER_TRANSPORT: redis
432+
CELERY_BROKER_HOSTNAME: edx.devstack.redis:6379
433+
CELERY_BROKER_VHOST: 0
434+
CELERY_BROKER_PASSWORD: password
435+
DJANGO_SETTINGS_MODULE: enterprise_access.settings.devstack
436+
COLUMNS: 80
437+
DB_HOST: edx.devstack.mysql80
438+
DB_NAME: enterprise_access
439+
DB_PORT: 3306
440+
DB_USER: enterprise_access001
441+
DB_PASSWORD: password
442+
networks:
443+
default:
444+
aliases:
445+
- edx.devstack.enterprise-access-worker
446+
ports:
447+
- "18271:18271"
448+
restart: always
449+
stdin_open: true
450+
tty: true
451+
389452
forum:
390453
command: bash -c 'source /edx/app/forum/ruby_env && source /edx/app/forum/devstack_forum_env && cd /edx/app/forum/cs_comments_service && bundle install && while true; do ./bin/unicorn -c config/unicorn_tcp.rb -I .; sleep 2; done'
391454
container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.forum"

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-access`_ | http://localhost:18270 | 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-access: https://github.com/openedx/enterprise-access

options.mk

Lines changed: 2 additions & 2 deletions
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+credentials+cms+cms-worker+cms_watcher+discovery+ecommerce+edx_notes_api+enterprise-access+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).
@@ -76,7 +76,7 @@ analyticsapi+credentials+cms+cms-worker+cms_watcher+discovery+ecommerce+edx_note
7676
# Note: This list should contain _all_ db-backed services, even if not
7777
# configured to run; the list will be filtered later against $(DEFAULT_SERVICES).
7878
DB_SERVICES ?= \
79-
credentials+cms+discovery+ecommerce+lms+registrar
79+
credentials+cms+discovery+ecommerce+enterprise-access+lms+registrar
8080

8181
# Services with static assets to be built.
8282
# Should be a subset of $(EDX_SERVICES).

provision-enterprise-access.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
set -euf -o pipefail
2+
3+
. scripts/colors.sh
4+
5+
name="enterprise-access"
6+
port="18270"
7+
8+
docker-compose up -d $name
9+
10+
# Run migrations
11+
echo -e "${GREEN}Running migrations for ${name}...${NC}"
12+
docker compose exec -T ${name} bash -e -c "cd /edx/app/enterprise-access/ && make migrate" -- "$name"
13+
# docker compose exec -T ${name} bash -e -c 'source /edx/app/credentials/credentials_env && cd /edx/app/credentials/credentials && make migrate' -- "$name"
14+
15+
# Create superuser
16+
echo -e "${GREEN}Creating super-user for ${name}...${NC}"
17+
docker compose exec -T ${name} bash -e -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/enterprise-access/manage.py shell" -- "$name"
18+
19+
./provision-ida-user.sh ${name} ${name} ${port}
20+
21+
# Create system wide enterprise role assignment
22+
# TODO: this is a pretty complex oneline, we should probably eventually convert this to a management command.
23+
echo -e "${GREEN}Creating system wide enterprise user role assignment for ${name}...${NC}"
24+
docker compose exec -T lms bash -e -c "source /edx/app/edxapp/edxapp_env && echo 'from django.contrib.auth import get_user_model; from enterprise.models import SystemWideEnterpriseUserRoleAssignment, SystemWideEnterpriseRole; User = get_user_model(); worker_user = User.objects.get(username=\"${name}_worker\"); operator_role = SystemWideEnterpriseRole.objects.get(name=\"enterprise_openedx_operator\"); assignment = SystemWideEnterpriseUserRoleAssignment.objects.get_or_create(user=worker_user, role=operator_role, applies_to_all_contexts=True);' | /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py lms shell" -- lms
25+
26+
# Restart enterprise.catalog app and worker containers
27+
# docker-compose restart app
28+
make dev.restart-devserver.enterprise-access

provision-mysql80.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ CREATE DATABASE IF NOT EXISTS ecommerce;
1414
CREATE USER IF NOT EXISTS 'ecomm001'@'%' IDENTIFIED BY 'password';
1515
GRANT ALL ON ecommerce.* TO 'ecomm001'@'%';
1616

17+
CREATE DATABASE IF NOT EXISTS enterprise_access;
18+
CREATE USER IF NOT EXISTS 'enterprise_access001'@'%' IDENTIFIED BY 'password';
19+
GRANT ALL ON enterprise_access.* TO 'enterprise_access001'@'%';
20+
1721
CREATE DATABASE IF NOT EXISTS notes;
1822
CREATE USER IF NOT EXISTS 'notes001'@'%' IDENTIFIED BY 'password';
1923
GRANT ALL ON notes.* TO 'notes001'@'%';

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-access \
5253
"
5354

5455
# What should we provision?

provision.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ GRANT ALL ON discovery.* TO 'discov001'@'%' IDENTIFIED BY 'password';
77
CREATE DATABASE IF NOT EXISTS ecommerce;
88
GRANT ALL ON ecommerce.* TO 'ecomm001'@'%' IDENTIFIED BY 'password';
99

10+
CREATE DATABASE IF NOT EXISTS enterprise_access;
11+
GRANT ALL ON enterprise_access.* TO 'enterprise_access001'@'%' IDENTIFIED BY 'password';
12+
1013
CREATE DATABASE IF NOT EXISTS notes;
1114
GRANT ALL ON notes.* TO 'notes001'@'%' IDENTIFIED BY 'password';
1215

repo.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ repos=(
3636
"https://github.com/openedx/frontend-app-publisher.git"
3737
"https://github.com/edx/edx-analytics-dashboard.git"
3838
"https://github.com/edx/edx-analytics-data-api.git"
39+
"https://github.com/openedx/enterprise-access.git"
3940
)
4041

4142
non_release_repos=(
@@ -66,6 +67,7 @@ ssh_repos=(
6667
"[email protected]:openedx/frontend-app-publisher.git"
6768
"[email protected]:edx/edx-analytics-dashboard.git"
6869
"[email protected]:edx/edx-analytics-data-api.git"
70+
"[email protected]:openedx/enterprise-access.git"
6971
)
7072

7173
non_release_ssh_repos=(

0 commit comments

Comments
 (0)