Skip to content

Commit

Permalink
Merge branch 'master' into farhan/add-enterprise-subsidy
Browse files Browse the repository at this point in the history
  • Loading branch information
huniafatima-arbi committed Jan 6, 2025
2 parents 731be3f + 6d5392b commit 89e5f46
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/provisioning-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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, enterprise-catalog+lms]
fail-fast: false # some services can be flaky; let others run to completion even if one fails

steps:
Expand Down
10 changes: 10 additions & 0 deletions docker-compose-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ services:
- ${DEVSTACK_WORKSPACE}/enterprise-subsidy:/edx/app/enterprise-subsidy
- ${DEVSTACK_WORKSPACE}/src:/edx/src

enterprise-catalog:
volumes:
- ${DEVSTACK_WORKSPACE}/enterprise-catalog:/edx/app/enterprise_catalog/enterprise_catalog
enterprise-catalog-worker:
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-curations-worker:
volumes:
- ${DEVSTACK_WORKSPACE}/enterprise-catalog:/edx/app/enterprise_catalog/enterprise_catalog
# Note that frontends mount `src` to /edx/app/src instead of /edx/src.
# See ADR #5 for rationale.
frontend-app-account:
Expand Down
76 changes: 76 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,82 @@ services:
aliases:
- edx.devstack.xqueue_consumer

enterprise-catalog:
image: edxops/enterprise-catalog-dev
container_name: edx.devstack.enterprise-catalog
hostname: enterprise-catalog.devstack.edx
command: bash -c 'while true; do python /edx/app/enterprise_catalog/enterprise_catalog/manage.py runserver 0.0.0.0:18160; sleep 2; done'
ports:
- "18160:18160"
depends_on:
- memcached
- mysql80
- enterprise-catalog-worker
networks:
default:
aliases:
- edx.devstack.enterprise-catalog
# Allows attachment to this container using 'docker attach <containerID>'.
stdin_open: true
tty: true
environment:
CELERY_ALWAYS_EAGER: 'false'
CELERY_BROKER_TRANSPORT: redis
CELERY_BROKER_HOSTNAME: edx.devstack.redis:6379
CELERY_BROKER_VHOST: 0
CELERY_BROKER_PASSWORD: password
DJANGO_SETTINGS_MODULE: enterprise_catalog.settings.devstack
ENABLE_DJANGO_TOOLBAR: 1
DB_HOST: edx.devstack.mysql80
DB_NAME: enterprise_catalog
DB_PORT: 3306
DB_USER: catalog001
DB_PASSWORD: 'password'

enterprise-catalog-worker:
image: edxops/enterprise-catalog-dev
command: bash -c 'cd /edx/app/enterprise_catalog/enterprise_catalog && celery -A enterprise_catalog worker -Q enterprise_catalog.default -l DEBUG'
container_name: edx.devstack.enterprise.catalog.worker
depends_on:
- mysql80
environment:
CELERY_ALWAYS_EAGER: 'false'
CELERY_BROKER_TRANSPORT: redis
CELERY_BROKER_HOSTNAME: edx.devstack.redis:6379
CELERY_BROKER_VHOST: 0
CELERY_BROKER_PASSWORD: password
DJANGO_SETTINGS_MODULE: enterprise_catalog.settings.devstack
COLUMNS: 80
hostname: worker.catalog.enterprise
ports:
- "18161:18161"
restart: always
# Allows attachment to this container using 'docker attach <containerID>'.
stdin_open: true
tty: true

enterprise-catalog-curations-worker:
image: edxops/enterprise-catalog-dev
command: bash -c 'cd /edx/app/enterprise_catalog/enterprise_catalog && celery -A enterprise_catalog worker -Q enterprise_catalog.curations -l DEBUG'
container_name: enterprise.catalog.curations
depends_on:
- mysql80
environment:
CELERY_ALWAYS_EAGER: 'false'
CELERY_BROKER_TRANSPORT: redis
CELERY_BROKER_HOSTNAME: edx.devstack.redis:6379
CELERY_BROKER_VHOST: 0
CELERY_BROKER_PASSWORD: password
DJANGO_SETTINGS_MODULE: enterprise_catalog.settings.devstack
COLUMNS: 80
hostname: curations.catalog.enterprise
ports:
- "18162:18162"
restart: always
# Allows attachment to this container using 'docker attach <containerID>'.
stdin_open: true
tty: true

enterprise-subsidy:
image: edxops/enterprise-subsidy-dev
container_name: edx.devstack.enterprise-subsidy
Expand Down
3 changes: 3 additions & 0 deletions docs/service_list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Instead of a service name or list, you can also run commands like ``make dev.pro
+------------------------------------+-------------------------------------+----------------+--------------+
| `enterprise-subsidy`_ | http://localhost:18280 | Python/Django | Extra |
+------------------------------------+-------------------------------------+----------------+--------------+
| `enterprise-catalog`_ | http://localhost:18160/ | Python/Django | Extra |
+------------------------------------+-------------------------------------+----------------+--------------+

Some common service combinations include:

Expand Down Expand Up @@ -98,3 +100,4 @@ Some common service combinations include:
.. _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
2 changes: 1 addition & 1 deletion options.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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+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
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

# Services with database migrations.
# Should be a subset of $(EDX_SERVICES).
Expand Down
20 changes: 20 additions & 0 deletions provision-enterprise-catalog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name="enterprise-catalog"
port="18160"

docker compose up -d $name

# Run migrations
echo -e "${GREEN}Running migrations for ${name}...${NC}"
docker compose exec -T ${name} bash -c "cd /edx/app/${name}/${name}/ && make migrate"

echo -e "${GREEN}Installing requirements for ${name}...${NC}"
docker compose exec -T ${name} bash -e -c 'cd /edx/app/enterprise-catalog/ && make requirements' -- "$name"

# Create superuser
echo -e "${GREEN}Creating super-user for ${name}...${NC}"
docker compose exec -T ${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}/${name}/manage.py shell"

./provision-ida-user.sh ${name} ${name} ${port}

# Restart enterprise.catalog app and worker containers
docker compose restart enterprise-catalog enterprise-catalog-worker
4 changes: 4 additions & 0 deletions provision-mysql80.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ CREATE DATABASE IF NOT EXISTS credentials;
CREATE USER IF NOT EXISTS 'credentials001'@'%' IDENTIFIED BY 'password';
GRANT ALL ON credentials.* TO 'credentials001'@'%';

CREATE DATABASE IF NOT EXISTS enterprise_catalog;
CREATE USER IF NOT EXISTS 'catalog001'@'%' IDENTIFIED BY 'password';
GRANT ALL ON enterprise_catalog.* TO 'catalog001'@'%';

CREATE DATABASE IF NOT EXISTS discovery;
CREATE USER IF NOT EXISTS 'discov001'@'%' IDENTIFIED BY 'password';
GRANT ALL ON discovery.* TO 'discov001'@'%';
Expand Down
3 changes: 2 additions & 1 deletion provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This script will provision the services specified in the argument list,
# or all services if no arguments are provided.
#
# Non-existant services will be ignored.
# Non-existent services will be ignored.
# Specifying services more than once will cause them to be provisioned more
# than once.
#
Expand Down Expand Up @@ -50,6 +50,7 @@ coursegraph \
insights \
analyticsapi \
enterprise-subsidy \
enterprise-catalog \
"

# What should we provision?
Expand Down
2 changes: 2 additions & 0 deletions provision.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ 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';

FLUSH PRIVILEGES;
2 changes: 2 additions & 0 deletions repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ repos=(
"https://github.com/openedx/frontend-app-publisher.git"
"https://github.com/edx/edx-analytics-dashboard.git"
"https://github.com/edx/edx-analytics-data-api.git"
"https://github.com/openedx/enterprise-catalog.git"
)

non_release_repos=(
Expand All @@ -57,6 +58,7 @@ ssh_repos=(
"[email protected]:openedx/cs_comments_service.git"
"[email protected]:edx/ecommerce.git"
"[email protected]:openedx/edx-notes-api.git"
"[email protected]:openedx/enterprise-catalog.git"
"[email protected]:openedx/edx-platform.git"
"[email protected]:openedx/xqueue.git"
"[email protected]:edx/edx-analytics-dashboard.git"
Expand Down
8 changes: 4 additions & 4 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ iniconfig==2.0.0
# via
# -r requirements/test.txt
# pytest
packaging==24.1
packaging==24.2
# via
# -r requirements/pip-tools.txt
# -r requirements/test.txt
Expand Down Expand Up @@ -60,17 +60,17 @@ pyproject-hooks==1.2.0
# -r requirements/pip-tools.txt
# build
# pip-tools
pytest==8.3.3
pytest==8.3.4
# via -r requirements/test.txt
pyyaml==6.0.2
# via
# -r requirements/base.txt
# -r requirements/test.txt
tox==4.23.2
# via -r requirements/dev.in
virtualenv==20.27.1
virtualenv==20.28.0
# via tox
wheel==0.44.0
wheel==0.45.1
# via
# -r requirements/pip-tools.txt
# pip-tools
Expand Down
6 changes: 3 additions & 3 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jinja2==3.1.4
# via sphinx
markupsafe==3.0.2
# via jinja2
nh3==0.2.18
nh3==0.2.19
# via readme-renderer
packaging==24.1
packaging==24.2
# via sphinx
pbr==6.1.0
# via stevedore
Expand Down Expand Up @@ -81,7 +81,7 @@ sphinxcontrib-qthelp==2.0.0
# via sphinx
sphinxcontrib-serializinghtml==2.0.0
# via sphinx
stevedore==5.3.0
stevedore==5.4.0
# via doc8
typing-extensions==4.12.2
# via pydata-sphinx-theme
Expand Down
4 changes: 2 additions & 2 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ build==1.2.2.post1
# via pip-tools
click==8.1.7
# via pip-tools
packaging==24.1
packaging==24.2
# via build
pip-tools==7.4.1
# via -r requirements/pip-tools.in
pyproject-hooks==1.2.0
# via
# build
# pip-tools
wheel==0.44.0
wheel==0.45.1
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
Expand Down
4 changes: 2 additions & 2 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#
# make upgrade
#
wheel==0.44.0
wheel==0.45.1
# via -r requirements/pip.in

# The following packages are considered to be unsafe in a requirements file:
pip==24.2
# via
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
# -r requirements/pip.in
setuptools==75.3.0
setuptools==75.6.0
# via -r requirements/pip.in
4 changes: 2 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
#
iniconfig==2.0.0
# via pytest
packaging==24.1
packaging==24.2
# via pytest
pexpect==4.9.0
# via -r requirements/test.in
pluggy==1.5.0
# via pytest
ptyprocess==0.7.0
# via pexpect
pytest==8.3.3
pytest==8.3.4
# via -r requirements/test.in
pyyaml==6.0.2
# via -r requirements/base.txt

0 comments on commit 89e5f46

Please sign in to comment.