From 9b4612f46569aaf783487597a8691af719de301d Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Thu, 14 Nov 2024 18:15:46 +0500 Subject: [PATCH 1/9] refactor: paver deprecation --- playbooks/roles/aws_devstack/tasks/main.yml | 2 +- playbooks/roles/edxapp/defaults/main.yml | 3 - playbooks/roles/edxapp/tasks/main.yml | 9 --- .../edxapp/tasks/service_variant_config.yml | 4 +- .../templates/edx/bin/edxapp-update-assets.j2 | 5 +- .../roles/test_build_server/defaults/main.yml | 19 ------- .../files/test-development-environment.sh | 56 ------------------- .../roles/test_build_server/meta/main.yml | 26 --------- .../roles/test_build_server/tasks/main.yml | 48 ---------------- util/jenkins/app-container-provisioner.sh | 2 +- 10 files changed, 7 insertions(+), 167 deletions(-) delete mode 100644 playbooks/roles/test_build_server/defaults/main.yml delete mode 100755 playbooks/roles/test_build_server/files/test-development-environment.sh delete mode 100644 playbooks/roles/test_build_server/meta/main.yml delete mode 100644 playbooks/roles/test_build_server/tasks/main.yml diff --git a/playbooks/roles/aws_devstack/tasks/main.yml b/playbooks/roles/aws_devstack/tasks/main.yml index 91263ea4c45..5b8628f9c6a 100644 --- a/playbooks/roles/aws_devstack/tasks/main.yml +++ b/playbooks/roles/aws_devstack/tasks/main.yml @@ -37,7 +37,7 @@ cd edx-repos/devstack/ make dev.pull.large-and-slow make dev.up.lms - . /home/ubuntu/.profile && docker compose exec lms env TERM=xterm-256color bash -c 'make requirements && npm ci && paver update_assets && python manage.py lms migrate' + . /home/ubuntu/.profile && docker compose exec lms env TERM=xterm-256color bash -c 'make requirements && npm ci && npm run build && ./manage.py lms collectstatic --noinput && ./manage.py cms collectstatic && python manage.py lms migrate' async: 1800 poll: 10 become_user: ubuntu diff --git a/playbooks/roles/edxapp/defaults/main.yml b/playbooks/roles/edxapp/defaults/main.yml index 666132d4be3..de3f47a7756 100644 --- a/playbooks/roles/edxapp/defaults/main.yml +++ b/playbooks/roles/edxapp/defaults/main.yml @@ -487,9 +487,6 @@ EDXAPP_CMS_STATIC_URL_BASE: "{{ EDXAPP_STATIC_URL_BASE }}" # does not affect verified students EDXAPP_PAID_COURSE_REGISTRATION_CURRENCY: ['usd', '$'] -# Configure paver tasks in edx-platform to skip Python/Ruby/Node installation -EDXAPP_NO_PREREQ_INSTALL: 1 - # whether to setup the python codejail or not EDXAPP_PYTHON_SANDBOX: true # this next setting, if true, turns on actual sandbox enforcement. If not true, diff --git a/playbooks/roles/edxapp/tasks/main.yml b/playbooks/roles/edxapp/tasks/main.yml index a2ed29b126f..8e6d57440a6 100644 --- a/playbooks/roles/edxapp/tasks/main.yml +++ b/playbooks/roles/edxapp/tasks/main.yml @@ -49,15 +49,6 @@ - devstack - devstack:install -- name: add paver autocomplete to bashrc - lineinfile: - dest: /root/.bashrc - line: "source {{ edxapp_code_dir }}/scripts/paver_autocomplete.sh" - when: devstack is defined and devstack - tags: - - devstack - - devstack:install - - name: create edxapp log dir file: path: "{{ edxapp_log_dir }}" diff --git a/playbooks/roles/edxapp/tasks/service_variant_config.yml b/playbooks/roles/edxapp/tasks/service_variant_config.yml index 9bc6e411509..7ed54e904b6 100644 --- a/playbooks/roles/edxapp/tasks/service_variant_config.yml +++ b/playbooks/roles/edxapp/tasks/service_variant_config.yml @@ -312,8 +312,8 @@ - gather_static_assets - assets -# Gather assets using paver if possible -- name: "gather static assets with paver and pull translations" +# Build static assets if possible +- name: "gather static assets" command: "{{ COMMON_BIN_DIR }}/edxapp-update-assets" when: celery_worker is not defined and not devstack tags: diff --git a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 index fe3dc8fc89d..516d399634d 100644 --- a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 +++ b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 @@ -4,10 +4,11 @@ {% for override in edxapp_staticfiles_storage_overrides %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" "STATICFILES_STORAGE={{ override }}" \ - {{ edxapp_venv_bin }}/paver update_assets --debug-collect --settings=$EDX_PLATFORM_SETTINGS + {{ edxapp_venv_bin }}/npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS {% endfor %} {% else %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ - {{ edxapp_venv_bin }}/paver update_assets --debug-collect --settings $EDX_PLATFORM_SETTINGS + {{ edxapp_venv_bin }}/npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS {% endif %} + \ No newline at end of file diff --git a/playbooks/roles/test_build_server/defaults/main.yml b/playbooks/roles/test_build_server/defaults/main.yml deleted file mode 100644 index 300843ef990..00000000000 --- a/playbooks/roles/test_build_server/defaults/main.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -# -# edX Configuration -# -# github: https://github.com/openedx/configuration -# wiki: https://openedx.atlassian.net/wiki/display/OpenOPS -# code style: https://openedx.atlassian.net/wiki/display/OpenOPS/Ansible+Code+Conventions -# license: https://github.com/openedx/configuration/blob/master/LICENSE.TXT -# -## -# Defaults for role test_build_server -# - -# -# vars are namespace with the module name. -# -test_build_server_user: jenkins -test_build_server_repo_path: /home/jenkins -TEST_EDX_PLATFORM_VERSION: master diff --git a/playbooks/roles/test_build_server/files/test-development-environment.sh b/playbooks/roles/test_build_server/files/test-development-environment.sh deleted file mode 100755 index 03b409e725c..00000000000 --- a/playbooks/roles/test_build_server/files/test-development-environment.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash -set -e -################################################################################ -# This executes a small subset of the edx-platform tests. It is intended as -# a means of testing newly provisioned AMIs for our jenkins workers. -# -# The two main things that happen here: -# 1. The setup from edx-platform/scripts/all-tests.sh, the script that is -# run by the jenkins workers to kick off tests. -# 2. The paver command for tests, coverage and quality reports are run. -# For the tests, it runs only a small number of test cases for each -# test suite. -############################################################################### - -# Doing this rather than copying the file into the scripts folder so that -# this file doesn't get cleaned out by the 'git clean' in all-tests.sh. -cd edx-platform-clone - -# This will run all of the setup it usually runs, but none of the -# tests because TEST_SUITE isn't defined. -export PYTHON_VERSION=3.8 -source scripts/jenkins-common.sh - -case "$1" in - "unit") - - # Now we can run a subset of the tests via paver. - # Run some of the common/lib unit tests - paver test_lib -t common/lib/xmodule/xmodule/tests/test_stringify.py - - # Generate some coverage reports - # Since `TEST_SUITE` is not set, change the coverage file written by the - # previous test to a generic one. - cp reports/common_lib_xmodule.coverage reports/.coverage - paver coverage - - # Run some of the djangoapp unit tests - paver test_system -t lms/djangoapps/courseware/tests/tests.py - paver test_system -t cms/djangoapps/course_creators/tests/test_views.py - ;; - - "js") - - # Run some of the javascript unit tests - paver test_js_run -s lms-coffee - ;; - - "quality") - # Generate quality reports - paver run_quality - ;; - - *) - echo "args required" - exit 1 -esac diff --git a/playbooks/roles/test_build_server/meta/main.yml b/playbooks/roles/test_build_server/meta/main.yml deleted file mode 100644 index 39c023632c8..00000000000 --- a/playbooks/roles/test_build_server/meta/main.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -# -# edX Configuration -# -# github: https://github.com/openedx/configuration -# wiki: https://openedx.atlassian.net/wiki/display/OpenOPS -# code style: https://openedx.atlassian.net/wiki/display/OpenOPS/Ansible+Code+Conventions -# license: https://github.com/openedx/configuration/blob/master/LICENSE.TXT -# -## -# Role includes for role test_build_server -# -# Example: -# -# dependencies: -# - { -# role: my_role -# my_role_var0: "foo" -# my_role_var1: "bar" -# } - -#### INTENTIONALLY LEFT BLANK #### - -# Since this is a test role, it should not install anything extra onto the -# target machine, thus altering the system under test. Be careful when -# adding dependencies. diff --git a/playbooks/roles/test_build_server/tasks/main.yml b/playbooks/roles/test_build_server/tasks/main.yml deleted file mode 100644 index d2a93b8aeea..00000000000 --- a/playbooks/roles/test_build_server/tasks/main.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -# -# edX Configuration -# -# github: https://github.com/openedx/configuration -# wiki: https://openedx.atlassian.net/wiki/display/OpenOPS -# code style: https://openedx.atlassian.net/wiki/display/OpenOPS/Ansible+Code+Conventions -# license: https://github.com/openedx/configuration/blob/master/LICENSE.TXT -# -# -# -# Tasks for role test_build_server -# -# Overview: -# -# -# Dependencies: -# -# -# Example play: -# - -- name: Create clone of edx-platform - git: - repo: "https://github.com/openedx/edx-platform.git" - dest: "{{ test_build_server_repo_path }}/edx-platform-clone" - version: "{{ TEST_EDX_PLATFORM_VERSION }}" - become_user: "{{ test_build_server_user }}" - -- name: get xargs limit - shell: "xargs --show-limits" - -- name: Copy test-development-environment.sh to somewhere the jenkins user can access it - copy: - src: test-development-environment.sh - dest: "{{ test_build_server_repo_path }}" - mode: 0755 - -- name: Validate build environment - shell: "bash test-development-environment.sh {{ item }}" - args: - chdir: "{{ test_build_server_repo_path }}/" - environment: - PYTHON_VERSION: "3.8" - become_user: "{{ test_build_server_user }}" - with_items: - - "unit" - - "js" diff --git a/util/jenkins/app-container-provisioner.sh b/util/jenkins/app-container-provisioner.sh index 1542b360d53..bcd686de93f 100644 --- a/util/jenkins/app-container-provisioner.sh +++ b/util/jenkins/app-container-provisioner.sh @@ -123,7 +123,7 @@ fi if [[ ${app_service_name} == 'lms' ]]; then # temporary hack, create npm-install.log file touch /edx/app/edxapp/edx-platform/test_root/log/npm-install.log - docker run --network=host --rm -u='root' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/${app_service_name}.yml -e CMS_CFG=/edx/etc/cms.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /var/tmp/cms.yml:/edx/etc/cms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/${app_name}:/edx/var/${app_name} -v /edx/app/edxapp/edx-platform/test_root/log/npm-install.log:/edx/app/edxapp/edx-platform/test_root/log/npm-install.log -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest paver update_assets --debug-collect --settings=docker-production + docker run --network=host --rm -u='root' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/${app_service_name}.yml -e CMS_CFG=/edx/etc/cms.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -e EDXAPP_STATIC_ROOT_ENV=/edx/var/edxapp/staticfiles -e STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles -e STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /var/tmp/cms.yml:/edx/etc/cms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/${app_name}:/edx/var/${app_name} -v /edx/app/edxapp/edx-platform/test_root/log/npm-install.log:/edx/app/edxapp/edx-platform/test_root/log/npm-install.log -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest npm run build && ./manage.py lms collectstatic --noinput --debug-collect --settings=docker-production && ./manage.py cms collectstatic --noinput --debug-collect --settings=docker-production fi # Generate docker-compose file for app service From 746fd17694de1c227de492f177678263989e4457 Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Mon, 18 Nov 2024 20:10:56 +0500 Subject: [PATCH 2/9] build: remove paver related flags not needed anymore --- docker/build/edxapp/ansible_overrides.yml | 1 - playbooks/roles/edxapp/defaults/main.yml | 1 - playbooks/vagrant-analytics.yml | 1 - util/jenkins/app-container-provisioner.sh | 10 +++++----- util/jenkins/demo-course-provisioner.sh | 10 +++++----- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/docker/build/edxapp/ansible_overrides.yml b/docker/build/edxapp/ansible_overrides.yml index d39e164b9c4..2593321997d 100644 --- a/docker/build/edxapp/ansible_overrides.yml +++ b/docker/build/edxapp/ansible_overrides.yml @@ -12,7 +12,6 @@ edxapp_npm_production: "no" EDXAPP_LMS_GUNICORN_EXTRA_CONF: 'reload = True' -EDXAPP_NO_PREREQ_INSTALL: 0 COMMON_SSH_PASSWORD_AUTH: "yes" EDXAPP_CMS_BASE: "edx.devstack.studio:18010" EDXAPP_OAUTH_ENFORCE_SECURE: false diff --git a/playbooks/roles/edxapp/defaults/main.yml b/playbooks/roles/edxapp/defaults/main.yml index de3f47a7756..9d4328e06d9 100644 --- a/playbooks/roles/edxapp/defaults/main.yml +++ b/playbooks/roles/edxapp/defaults/main.yml @@ -1169,7 +1169,6 @@ edxapp_helper_scripts: edxapp_environment_default: LANG: "{{ EDXAPP_LANG }}" - NO_PREREQ_INSTALL: "{{ EDXAPP_NO_PREREQ_INSTALL }}" SKIP_WS_MIGRATIONS: 1 PATH: "{{ edxapp_deploy_path }}" # the settings module for edxapp, DJANGO_SETTINGS_MODULE diff --git a/playbooks/vagrant-analytics.yml b/playbooks/vagrant-analytics.yml index 8fb1a9eb496..a3697fec7be 100644 --- a/playbooks/vagrant-analytics.yml +++ b/playbooks/vagrant-analytics.yml @@ -7,7 +7,6 @@ devstack: true disable_edx_services: true mongo_enable_journal: false - EDXAPP_NO_PREREQ_INSTALL: 0 COMMON_SSH_PASSWORD_AUTH: "yes" EDXAPP_LMS_BASE: 127.0.0.1:8000 EDXAPP_OAUTH_ENFORCE_SECURE: false diff --git a/util/jenkins/app-container-provisioner.sh b/util/jenkins/app-container-provisioner.sh index bcd686de93f..7580a051618 100644 --- a/util/jenkins/app-container-provisioner.sh +++ b/util/jenkins/app-container-provisioner.sh @@ -84,10 +84,10 @@ chown :www-data /edx/etc/${app_service_name}.yml if [[ ${app_service_name} == 'lms' || ${app_service_name} == 'cms' ]]; then # run migrations - docker run --network=host --rm -u='www-data' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e ${app_cfg}=/edx/etc/${app_service_name}.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py ${app_service_name} showmigrations --database default - docker run --network=host --rm -u='www-data' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e ${app_cfg}=/edx/etc/${app_service_name}.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py ${app_service_name} migrate --database default --noinput - docker run --network=host --rm -u='www-data' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e ${app_cfg}=/edx/etc/${app_service_name}.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py ${app_service_name} showmigrations --database student_module_history - docker run --network=host --rm -u='www-data' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e ${app_cfg}=/edx/etc/${app_service_name}.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py ${app_service_name} migrate --database student_module_history --noinput + docker run --network=host --rm -u='www-data' -e SKIP_WS_MIGRATIONS="1" -e ${app_cfg}=/edx/etc/${app_service_name}.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py ${app_service_name} showmigrations --database default + docker run --network=host --rm -u='www-data' -e SKIP_WS_MIGRATIONS="1" -e ${app_cfg}=/edx/etc/${app_service_name}.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py ${app_service_name} migrate --database default --noinput + docker run --network=host --rm -u='www-data' -e SKIP_WS_MIGRATIONS="1" -e ${app_cfg}=/edx/etc/${app_service_name}.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py ${app_service_name} showmigrations --database student_module_history + docker run --network=host --rm -u='www-data' -e SKIP_WS_MIGRATIONS="1" -e ${app_cfg}=/edx/etc/${app_service_name}.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py ${app_service_name} migrate --database student_module_history --noinput else # Run app migrations docker run --network=host --rm -u='www-data' -e ${app_cfg}=/edx/etc/${app_service_name}.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.settings.production -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /edx/var/${app_name}:/edx/var/${app_name} -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py migrate @@ -123,7 +123,7 @@ fi if [[ ${app_service_name} == 'lms' ]]; then # temporary hack, create npm-install.log file touch /edx/app/edxapp/edx-platform/test_root/log/npm-install.log - docker run --network=host --rm -u='root' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/${app_service_name}.yml -e CMS_CFG=/edx/etc/cms.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -e EDXAPP_STATIC_ROOT_ENV=/edx/var/edxapp/staticfiles -e STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles -e STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /var/tmp/cms.yml:/edx/etc/cms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/${app_name}:/edx/var/${app_name} -v /edx/app/edxapp/edx-platform/test_root/log/npm-install.log:/edx/app/edxapp/edx-platform/test_root/log/npm-install.log -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest npm run build && ./manage.py lms collectstatic --noinput --debug-collect --settings=docker-production && ./manage.py cms collectstatic --noinput --debug-collect --settings=docker-production + docker run --network=host --rm -u='root' -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/${app_service_name}.yml -e CMS_CFG=/edx/etc/cms.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -e STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles -e STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /var/tmp/cms.yml:/edx/etc/cms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/${app_name}:/edx/var/${app_name} -v /edx/app/edxapp/edx-platform/test_root/log/npm-install.log:/edx/app/edxapp/edx-platform/test_root/log/npm-install.log -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest npm run build && ./manage.py lms collectstatic --noinput --debug-collect --settings=docker-production && ./manage.py cms collectstatic --noinput --debug-collect --settings=docker-production fi # Generate docker-compose file for app service diff --git a/util/jenkins/demo-course-provisioner.sh b/util/jenkins/demo-course-provisioner.sh index 651444c6850..2c9349bd456 100644 --- a/util/jenkins/demo-course-provisioner.sh +++ b/util/jenkins/demo-course-provisioner.sh @@ -17,20 +17,20 @@ chmod 777 /edx/var/edxapp/data git clone https://github.com/openedx/openedx-demo-course.git /edx/app/demo/edx-demo-course # import demo course -docker run --network=host --rm -u='www-data' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e CMS_CFG=/edx/etc/cms.yml -e DJANGO_SETTINGS_MODULE=cms.envs.docker-production -e SERVICE_VARIANT=cms -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/cms.yml:/edx/etc/cms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/app/demo:/edx/app/demo -v /edx/var/edxapp:/edx/var/edxapp -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py cms import /edx/var/edxapp/data /edx/app/demo/edx-demo-course +docker run --network=host --rm -u='www-data' -e SKIP_WS_MIGRATIONS="1" -e CMS_CFG=/edx/etc/cms.yml -e DJANGO_SETTINGS_MODULE=cms.envs.docker-production -e SERVICE_VARIANT=cms -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/cms.yml:/edx/etc/cms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/app/demo:/edx/app/demo -v /edx/var/edxapp:/edx/var/edxapp -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py cms import /edx/var/edxapp/data /edx/app/demo/edx-demo-course # Create admin and demo users -docker run --network=host --rm -u='www-data' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/lms.yml -e DJANGO_SETTINGS_MODULE=lms.envs.docker-production -e SERVICE_VARIANT=lms -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/lms.yml:/edx/etc/lms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/edxapp:/edx/var/edxapp -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py lms manage_user edx edx@example.com --initial-password-hash \$admin_password --superuser --staff +docker run --network=host --rm -u='www-data' -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/lms.yml -e DJANGO_SETTINGS_MODULE=lms.envs.docker-production -e SERVICE_VARIANT=lms -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/lms.yml:/edx/etc/lms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/edxapp:/edx/var/edxapp -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py lms manage_user edx edx@example.com --initial-password-hash \$admin_password --superuser --staff for user in honor audit verified staff ; do email="\$user@example.com" # Set staff flag for staff user if [[ \$user == "staff" ]] ; then - docker run --network=host --rm -u='www-data' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/lms.yml -e DJANGO_SETTINGS_MODULE=lms.envs.docker-production -e SERVICE_VARIANT=lms -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/lms.yml:/edx/etc/lms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/edxapp:/edx/var/edxapp -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py lms manage_user \$user \$email --initial-password-hash \$demo_hashed_password --staff + docker run --network=host --rm -u='www-data' -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/lms.yml -e DJANGO_SETTINGS_MODULE=lms.envs.docker-production -e SERVICE_VARIANT=lms -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/lms.yml:/edx/etc/lms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/edxapp:/edx/var/edxapp -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py lms manage_user \$user \$email --initial-password-hash \$demo_hashed_password --staff else - docker run --network=host --rm -u='www-data' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/lms.yml -e DJANGO_SETTINGS_MODULE=lms.envs.docker-production -e SERVICE_VARIANT=lms -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/lms.yml:/edx/etc/lms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/edxapp:/edx/var/edxapp -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py lms manage_user \$user \$email --initial-password-hash \$demo_hashed_password + docker run --network=host --rm -u='www-data' -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/lms.yml -e DJANGO_SETTINGS_MODULE=lms.envs.docker-production -e SERVICE_VARIANT=lms -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/lms.yml:/edx/etc/lms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/edxapp:/edx/var/edxapp -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py lms manage_user \$user \$email --initial-password-hash \$demo_hashed_password fi # Enroll users in the demo course - docker run --network=host --rm -u='www-data' -e NO_PREREQ_INSTALL="1" -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/lms.yml -e DJANGO_SETTINGS_MODULE=lms.envs.docker-production -e SERVICE_VARIANT=lms -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/lms.yml:/edx/etc/lms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/edxapp:/edx/var/edxapp -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py lms enroll_user_in_course -e \$email -c course-v1:edX+DemoX+Demo_Course + docker run --network=host --rm -u='www-data' -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/lms.yml -e DJANGO_SETTINGS_MODULE=lms.envs.docker-production -e SERVICE_VARIANT=lms -e EDX_PLATFORM_SETTINGS=docker-production -v /edx/etc/lms.yml:/edx/etc/lms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/edxapp:/edx/var/edxapp -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest python3 manage.py lms enroll_user_in_course -e \$email -c course-v1:edX+DemoX+Demo_Course done EOF } From 6e532b951feec9129d5314a41cab07651a562dd9 Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Mon, 18 Nov 2024 21:08:58 +0500 Subject: [PATCH 3/9] build: update npm path in edxapp pipeline --- .../roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 index 516d399634d..8996719b639 100644 --- a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 +++ b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 @@ -4,11 +4,11 @@ {% for override in edxapp_staticfiles_storage_overrides %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" "STATICFILES_STORAGE={{ override }}" \ - {{ edxapp_venv_bin }}/npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS + npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS {% endfor %} {% else %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ - {{ edxapp_venv_bin }}/npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS + npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS {% endif %} \ No newline at end of file From 9a68df6388c15039a5bfe7153d8a74eb8a31eaeb Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Mon, 18 Nov 2024 21:42:55 +0500 Subject: [PATCH 4/9] fix: remove debug-collect flag --- .../roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 | 4 ++-- util/jenkins/app-container-provisioner.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 index 8996719b639..217660bd760 100644 --- a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 +++ b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 @@ -4,11 +4,11 @@ {% for override in edxapp_staticfiles_storage_overrides %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" "STATICFILES_STORAGE={{ override }}" \ - npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS + npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS {% endfor %} {% else %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ - npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --debug-collect --settings=$EDX_PLATFORM_SETTINGS + npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS {% endif %} \ No newline at end of file diff --git a/util/jenkins/app-container-provisioner.sh b/util/jenkins/app-container-provisioner.sh index 7580a051618..9bb32c1a08a 100644 --- a/util/jenkins/app-container-provisioner.sh +++ b/util/jenkins/app-container-provisioner.sh @@ -123,7 +123,7 @@ fi if [[ ${app_service_name} == 'lms' ]]; then # temporary hack, create npm-install.log file touch /edx/app/edxapp/edx-platform/test_root/log/npm-install.log - docker run --network=host --rm -u='root' -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/${app_service_name}.yml -e CMS_CFG=/edx/etc/cms.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -e STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles -e STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /var/tmp/cms.yml:/edx/etc/cms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/${app_name}:/edx/var/${app_name} -v /edx/app/edxapp/edx-platform/test_root/log/npm-install.log:/edx/app/edxapp/edx-platform/test_root/log/npm-install.log -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest npm run build && ./manage.py lms collectstatic --noinput --debug-collect --settings=docker-production && ./manage.py cms collectstatic --noinput --debug-collect --settings=docker-production + docker run --network=host --rm -u='root' -e SKIP_WS_MIGRATIONS="1" -e LMS_CFG=/edx/etc/${app_service_name}.yml -e CMS_CFG=/edx/etc/cms.yml -e DJANGO_SETTINGS_MODULE=${app_service_name}.envs.docker-production -e SERVICE_VARIANT=${app_service_name} -e EDX_PLATFORM_SETTINGS=docker-production -e STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles -e STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio -v /edx/etc/${app_service_name}.yml:/edx/etc/${app_service_name}.yml -v /var/tmp/cms.yml:/edx/etc/cms.yml -v /edx/var/edx-themes:/edx/var/edx-themes -v /edx/var/${app_name}:/edx/var/${app_name} -v /edx/app/edxapp/edx-platform/test_root/log/npm-install.log:/edx/app/edxapp/edx-platform/test_root/log/npm-install.log -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock ${app_repo}:latest npm run build && ./manage.py lms collectstatic --noinput --settings=docker-production && ./manage.py cms collectstatic --noinput --settings=docker-production fi # Generate docker-compose file for app service From ea9267e93728ee872de000d1ba78cee0fd62b709 Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Wed, 20 Nov 2024 14:55:51 +0500 Subject: [PATCH 5/9] build: deprecate paver from update_assets jinja script --- playbooks/roles/aws_devstack/tasks/main.yml | 2 +- .../templates/edx/bin/edxapp-update-assets.j2 | 22 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/playbooks/roles/aws_devstack/tasks/main.yml b/playbooks/roles/aws_devstack/tasks/main.yml index 5b8628f9c6a..7edf55b4bf2 100644 --- a/playbooks/roles/aws_devstack/tasks/main.yml +++ b/playbooks/roles/aws_devstack/tasks/main.yml @@ -37,7 +37,7 @@ cd edx-repos/devstack/ make dev.pull.large-and-slow make dev.up.lms - . /home/ubuntu/.profile && docker compose exec lms env TERM=xterm-256color bash -c 'make requirements && npm ci && npm run build && ./manage.py lms collectstatic --noinput && ./manage.py cms collectstatic && python manage.py lms migrate' + . /home/ubuntu/.profile && docker compose exec lms env TERM=xterm-256color bash -c 'make requirements && npm ci && npm run build && ./manage.py lms collectstatic --noinput && ./manage.py cms collectstatic --noinput && python manage.py lms migrate' async: 1800 poll: 10 become_user: ubuntu diff --git a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 index 217660bd760..e6edaa60765 100644 --- a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 +++ b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 @@ -3,12 +3,26 @@ {% if edxapp_staticfiles_storage_overrides %} {% for override in edxapp_staticfiles_storage_overrides %} sudo -E -H -u {{ edxapp_user }} \ - env "PATH=$PATH" "STATICFILES_STORAGE={{ override }}" \ - npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS + env "PATH=$PATH" \ + "STATICFILES_STORAGE={{ override }}" \ + "STATIC_ROOT=/edx/var/edxapp/staticfiles" \ + "STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles" \ + "STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio" \ + npm install \ + && npm run webpack --config webpack.config.js \ + && npm run compile-sass \ + && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS \ + && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS {% endfor %} {% else %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ - npm run build && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS + "STATIC_ROOT=/edx/var/edxapp/staticfiles" \ + "STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles" \ + "STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio" \ + npm install \ + && npm run webpack --config webpack.config.js \ + && npm run compile-sass \ + && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS \ + && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS {% endif %} - \ No newline at end of file From 8d4235760e8ecc92bfc105890e3d38b475f3faf0 Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Tue, 26 Nov 2024 18:02:10 +0500 Subject: [PATCH 6/9] build: skip using webpack config --- .../roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 index e6edaa60765..69d1cced17b 100644 --- a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 +++ b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 @@ -9,7 +9,7 @@ sudo -E -H -u {{ edxapp_user }} \ "STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles" \ "STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio" \ npm install \ - && npm run webpack --config webpack.config.js \ + && npm run webpack \ && npm run compile-sass \ && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS \ && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS @@ -21,7 +21,7 @@ sudo -E -H -u {{ edxapp_user }} \ "STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles" \ "STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio" \ npm install \ - && npm run webpack --config webpack.config.js \ + && npm run webpack \ && npm run compile-sass \ && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS \ && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS From a2dbc1f260e14fa660424471079691dd293d62ab Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Wed, 27 Nov 2024 19:31:40 +0500 Subject: [PATCH 7/9] fix: include webpack_config_path --- .../roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 index 69d1cced17b..28e980dc151 100644 --- a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 +++ b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 @@ -5,6 +5,7 @@ sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ "STATICFILES_STORAGE={{ override }}" \ + "WEBPACK_CONFIG_PATH=webpack.prod.config.js" \ "STATIC_ROOT=/edx/var/edxapp/staticfiles" \ "STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles" \ "STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio" \ @@ -17,6 +18,7 @@ sudo -E -H -u {{ edxapp_user }} \ {% else %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ + "WEBPACK_CONFIG_PATH=webpack.prod.config.js" \ "STATIC_ROOT=/edx/var/edxapp/staticfiles" \ "STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles" \ "STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio" \ From e6162fc7b807ad054fd49a477c3b07191fbe517a Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Wed, 27 Nov 2024 20:44:11 +0500 Subject: [PATCH 8/9] build: explicitly pass on staticfiles_storage env parameter --- .../roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 index 28e980dc151..b15d506064c 100644 --- a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 +++ b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 @@ -5,7 +5,6 @@ sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ "STATICFILES_STORAGE={{ override }}" \ - "WEBPACK_CONFIG_PATH=webpack.prod.config.js" \ "STATIC_ROOT=/edx/var/edxapp/staticfiles" \ "STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles" \ "STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio" \ @@ -18,7 +17,7 @@ sudo -E -H -u {{ edxapp_user }} \ {% else %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ - "WEBPACK_CONFIG_PATH=webpack.prod.config.js" \ + "STATICFILES_STORAGE=django.contrib.staticfiles.storage.StaticFilesStorage" \ "STATIC_ROOT=/edx/var/edxapp/staticfiles" \ "STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles" \ "STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio" \ From baa64ef1bbf7822575b8ea06fb8d56656d61eb45 Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Tue, 3 Dec 2024 20:08:08 +0500 Subject: [PATCH 9/9] build: update compil-sass theme-dir flags --- .../edxapp/templates/edx/bin/edxapp-update-assets.j2 | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 index b15d506064c..1d7a9c65a21 100644 --- a/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 +++ b/playbooks/roles/edxapp/templates/edx/bin/edxapp-update-assets.j2 @@ -4,26 +4,18 @@ {% for override in edxapp_staticfiles_storage_overrides %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ - "STATICFILES_STORAGE={{ override }}" \ - "STATIC_ROOT=/edx/var/edxapp/staticfiles" \ - "STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles" \ - "STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio" \ npm install \ && npm run webpack \ - && npm run compile-sass \ + && npm run compile-sass -- --theme-dir /edx/var/edx-themes/edx-themes/edx-platform --theme-dir /edx/app/edxapp/edx-platform/themes \ && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS \ && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS {% endfor %} {% else %} sudo -E -H -u {{ edxapp_user }} \ env "PATH=$PATH" \ - "STATICFILES_STORAGE=django.contrib.staticfiles.storage.StaticFilesStorage" \ - "STATIC_ROOT=/edx/var/edxapp/staticfiles" \ - "STATIC_ROOT_LMS=/edx/var/edxapp/staticfiles" \ - "STATIC_ROOT_CMS=/edx/var/edxapp/staticfiles/studio" \ npm install \ && npm run webpack \ - && npm run compile-sass \ + && npm run compile-sass -- --theme-dir /edx/var/edx-themes/edx-themes/edx-platform --theme-dir /edx/app/edxapp/edx-platform/themes \ && {{ edxapp_venv_bin }}/python manage.py lms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS \ && {{ edxapp_venv_bin }}/python manage.py cms collectstatic --noinput --settings=$EDX_PLATFORM_SETTINGS {% endif %}