diff --git a/Makefile b/Makefile index aba37bc7e2..0d2778b97c 100644 --- a/Makefile +++ b/Makefile @@ -407,6 +407,9 @@ dev.shell.analyticsapi: dev.shell.insights: docker compose exec insights env TERM=$(TERM) bash -c 'eval $$(source /edx/app/insights/insights_env; echo PATH="$$PATH";) && /bin/bash' +dev.shell.designer: + docker exec -it edx.devstack.designer env TERM=$(TERM) bash -c '/bin/bash' + dev.shell.%: ## Run a shell on the specified service's container. docker compose exec $* /bin/bash diff --git a/docker-compose-host.yml b/docker-compose-host.yml index 5941bfbdc2..493ae35fd8 100644 --- a/docker-compose-host.yml +++ b/docker-compose-host.yml @@ -39,6 +39,9 @@ services: registrar: volumes: - ${DEVSTACK_WORKSPACE}/registrar:/edx/app/registrar + designer: + volumes: + - ${DEVSTACK_WORKSPACE}/portal-designer:/edx/app/designer registrar-worker: volumes: - ${DEVSTACK_WORKSPACE}/registrar:/edx/app/registrar diff --git a/docker-compose.yml b/docker-compose.yml index a165a6bf22..0fcf1856da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -693,6 +693,32 @@ services: aliases: - edx.devstack.xqueue_consumer + designer: + image: portal-designer-designer + container_name: edx.devstack.designer + volumes: + - .:/edx/app/designer + command: bash -c 'while true; do python /edx/app/designer/manage.py runserver 0.0.0.0:18808; sleep 2; done' + ports: + - "18809:18808" + depends_on: + - mysql80 + networks: + default: + aliases: + - edx.devstack.designer + # Allows attachment to this container using 'docker attach '. + stdin_open: true + tty: true + environment: + DJANGO_SETTINGS_MODULE: designer.settings.devstack + ENABLE_DJANGO_TOOLBAR: 1 + DB_HOST: edx.devstack.mysql80 + DB_NAME: designer + DB_PORT: 3306 + DB_USER: designer001 + DB_PASSWORD: password + # ========================================================================== # edX Microfrontends # @@ -910,3 +936,4 @@ volumes: mysql57_data: mysql80_data: redis_data: + designer_mysql: diff --git a/docs/service_list.rst b/docs/service_list.rst index 092b8028c6..05dd34f893 100644 --- a/docs/service_list.rst +++ b/docs/service_list.rst @@ -63,6 +63,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 | +------------------------------------+-------------------------------------+----------------+--------------+ +| `designer`_ | http://localhost:3307 | Python/Django | Extra | ++------------------------------------+-------------------------------------+----------------+--------------+ Some common service combinations include: @@ -95,3 +97,4 @@ 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 +.. _designer: https://github.com/edx/portal-designer diff --git a/options.mk b/options.mk index 5a4d9b4e2c..a3e4021eaa 100644 --- a/options.mk +++ b/options.mk @@ -61,7 +61,7 @@ ALWAYS_CACHE_PROGRAMS ?= false # The current value was chosen such that it would not change the existing # Devstack behavior. DEFAULT_SERVICES ?= \ -credentials+discovery+ecommerce+edx_notes_api+forum+frontend-app-authn+frontend-app-gradebook+frontend-app-payment+frontend-app-publisher+frontend-app-learning+lms+cms +credentials+discovery+ecommerce+edx_notes_api+forum+frontend-app-authn+frontend-app-gradebook+frontend-app-payment+frontend-app-publisher+frontend-app-learning+lms+cms+designer # All edX services, whether or not they are run by default. # Separated by plus signs. diff --git a/provision-designer.sh b/provision-designer.sh new file mode 100755 index 0000000000..edc84bf33f --- /dev/null +++ b/provision-designer.sh @@ -0,0 +1,35 @@ +name="designer" +port="18808" + +docker-compose up -d --build + +# Install requirements +# Can be skipped right now because we're using the --build flag on docker-compose. This will need to be changed once we move to devstack. + +# Wait for MySQL +echo "Waiting for MySQL" +until docker exec -i designer.mysql mysql -u root -se "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = 'root')" &> /dev/null +do + printf "." + sleep 1 +done +sleep 5 + +# Run migrations +echo -e "${GREEN}Running migrations for ${name}...${NC}" +docker exec -t designer.app bash -c "cd /edx/app/${name}/ && make migrate" + +# Create superuser +echo -e "${GREEN}Creating super-user for ${name}...${NC}" +docker exec -t designer.app 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}" +docker exec -t edx.devstack.lms bash -c "source /edx/app/edxapp/edxapp_env && python /edx/app/edxapp/edx-platform/manage.py lms --settings=devstack_docker manage_user ${name}_worker ${name}_worker@example.com --staff --superuser" + +# Create the DOT applications - one for single sign-on and one for backend service IDA-to-IDA authentication. +docker exec -t edx.devstack.lms bash -c "source /edx/app/edxapp/edxapp_env && python /edx/app/edxapp/edx-platform/manage.py lms --settings=devstack_docker create_dot_application --grant-type authorization-code --skip-authorization --redirect-uris 'http://localhost:${port}/complete/edx-oauth2/' --client-id '${name}-sso-key' --client-secret '${name}-sso-secret' --scopes 'user_id' ${name}-sso ${name}_worker" +docker exec -t edx.devstack.lms bash -c "source /edx/app/edxapp/edxapp_env && python /edx/app/edxapp/edx-platform/manage.py lms --settings=devstack_docker create_dot_application --grant-type client-credentials --client-id '${name}-backend-service-key' --client-secret '${name}-backend-service-secret' ${name}-backend-service ${name}_worker" + +# Restart designer app +docker-compose stop designer diff --git a/provision-mysql80.sql b/provision-mysql80.sql index 19b32e0ebd..c296d68069 100644 --- a/provision-mysql80.sql +++ b/provision-mysql80.sql @@ -10,6 +10,10 @@ CREATE DATABASE IF NOT EXISTS discovery; CREATE USER IF NOT EXISTS 'discov001'@'%' IDENTIFIED BY 'password'; GRANT ALL ON discovery.* TO 'discov001'@'%'; +CREATE DATABASE IF NOT EXISTS designer; +CREATE USER IF NOT EXISTS 'designer001'@'%' IDENTIFIED BY 'password'; +GRANT ALL ON designer.* TO 'designer001'@'%'; + CREATE DATABASE IF NOT EXISTS ecommerce; CREATE USER IF NOT EXISTS 'ecomm001'@'%' IDENTIFIED BY 'password'; GRANT ALL ON ecommerce.* TO 'ecomm001'@'%'; diff --git a/provision.sh b/provision.sh index cde27b6fcd..8f43e33755 100755 --- a/provision.sh +++ b/provision.sh @@ -49,6 +49,7 @@ xqueue \ coursegraph \ insights \ analyticsapi \ +designer \ " # What should we provision? diff --git a/provision.sql b/provision.sql index 0b672c9986..4776b63e37 100644 --- a/provision.sql +++ b/provision.sql @@ -33,5 +33,8 @@ 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 designer; +GRANT ALL ON discovery.* TO 'designer001'@'%' IDENTIFIED BY 'password'; + FLUSH PRIVILEGES; diff --git a/repo.sh b/repo.sh index cb93108f63..fe09e81cb1 100755 --- a/repo.sh +++ b/repo.sh @@ -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/edx/portal-designer.git" ) non_release_repos=( @@ -66,6 +67,7 @@ ssh_repos=( "git@github.com:openedx/frontend-app-publisher.git" "git@github.com:edx/edx-analytics-dashboard.git" "git@github.com:edx/edx-analytics-data-api.git" + "git@github.com:edx/portal-designer.git" ) non_release_ssh_repos=(