From 7f452d9852ee61f15adfc7db6d60329d250135e5 Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Thu, 22 Aug 2024 16:46:02 +0500 Subject: [PATCH] refactor: remove paver utility commands usage --- Makefile | 4 ++-- docker-compose-watchers.yml | 4 ++-- docs/devstack_faq.rst | 4 ++-- docs/testing_and_debugging.rst | 15 ++------------- docs/troubleshoot_general_tips.rst | 8 ++++---- provision-lms.sh | 6 +++--- 6 files changed, 15 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index f0ea7516db..17360b11d3 100644 --- a/Makefile +++ b/Makefile @@ -493,10 +493,10 @@ $(foreach asset_service,$(ASSET_SERVICES_LIST),\ dev.static: | $(_asset_compilation_targets) dev.static.lms: - docker compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform/ && paver update_assets lms' + docker compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform/ && npm run build && ./manage.py lms collectstatic --noinput' dev.static.cms: - docker compose exec -T cms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform/ && paver update_assets cms' + docker compose exec -T cms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform/ && npm run build && ./manage.py cms collectstatic --no-input' dev.static.%: ## Rebuild static assets for the specified service's container. docker compose exec -T $* bash -c 'source /edx/app/$*/$*_env && cd /edx/app/$*/$*/ && make static' diff --git a/docker-compose-watchers.yml b/docker-compose-watchers.yml index 12d17b2f96..de8a9dfac1 100644 --- a/docker-compose-watchers.yml +++ b/docker-compose-watchers.yml @@ -1,6 +1,6 @@ services: lms_watcher: - command: bash -c 'cd /edx/app/edxapp/edx-platform && source ../edxapp_env && while true; do paver watch_assets --w=$$ASSET_WATCHER_TIMEOUT; sleep 2; done' + command: bash -c 'cd /edx/app/edxapp/edx-platform && source ../edxapp_env && while true; do npm run watch --w=$$ASSET_WATCHER_TIMEOUT; sleep 2; done' container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.lms_watcher" environment: FRONTEND_TEST_SERVER_HOSTNAME: edx.devstack.lms_watcher @@ -18,7 +18,7 @@ services: - edx.devstack.lms_watcher cms_watcher: - command: bash -c 'cd /edx/app/edxapp/edx-platform && source ../edxapp_env && while true; do paver watch_assets --w=$$ASSET_WATCHER_TIMEOUT; sleep 2; done' + command: bash -c 'cd /edx/app/edxapp/edx-platform && source ../edxapp_env && while true; do npm run watch --w=$$ASSET_WATCHER_TIMEOUT; sleep 2; done' container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.cms_watcher" environment: FRONTEND_TEST_SERVER_HOSTNAME: edx.devstack.cms_watcher diff --git a/docs/devstack_faq.rst b/docs/devstack_faq.rst index 5776ac0968..048420228d 100644 --- a/docs/devstack_faq.rst +++ b/docs/devstack_faq.rst @@ -39,7 +39,7 @@ Unlike the ``node_modules`` directory, the ``virtualenv`` used to run Python code in a Docker container only exists inside that container. Changes made to a container's filesystem are not saved when the container exits, so if you manually install or upgrade Python packages in a container (via -``pip install``, ``paver install_python_prereqs``, etc.), they will no +``pip install``, ``pip install -r requirements/edx/base.txt``, etc.), they will no longer be present if you restart the container. (Devstack Docker containers lose changes made to the filesystem when you reboot your computer, run ``make remove-containers``, restart or upgrade Docker itself, etc.) If you want to ensure @@ -78,7 +78,7 @@ JavaScript packages for Node.js are installed into the ``node_modules`` directory of the local git repository checkout which is synced into the corresponding Docker container. Hence these can be upgraded via any of the usual methods for that service (``npm install``, -``paver install_node_prereqs``, etc.), and the changes will persist between +``npm clean-install``, etc.), and the changes will persist between container restarts. How do I rebuild static assets? diff --git a/docs/testing_and_debugging.rst b/docs/testing_and_debugging.rst index 4103777e7f..98d110425e 100644 --- a/docs/testing_and_debugging.rst +++ b/docs/testing_and_debugging.rst @@ -49,19 +49,8 @@ Running LMS and CMS Tests ---------------------------- After entering a shell for the appropriate service via ``make lms-shell`` or -``make cms-shell``, you can run any of the usual paver commands from the -`edx-platform testing documentation`_. Examples: - -.. code:: sh - - paver run_quality - paver test_a11y - paver test_bokchoy - paver test_js - paver test_lib - paver test_python - -Tests can also be run individually. Example: +``make cms-shell``, you can run commands from the `edx-platform testing documentation`_ +Tests can be run individually. Example: .. code:: sh diff --git a/docs/troubleshoot_general_tips.rst b/docs/troubleshoot_general_tips.rst index 4fe283de9d..78ad835c3c 100644 --- a/docs/troubleshoot_general_tips.rst +++ b/docs/troubleshoot_general_tips.rst @@ -37,13 +37,13 @@ To fix this situation, change the owner back to yourself outside of the containe Running LMS commands within a container --------------------------------------- -Most of the ``paver`` commands require a settings flag. If omitted, the flag defaults to -``devstack``. If you run into issues running ``paver`` commands in a docker container, you should append +Most of the commands require a settings flag. If omitted, the flag defaults to +``devstack``. If you run into issues running commands in a docker container, you should append the ``devstack_docker`` flag. For example: .. code:: sh - $ paver update_assets --settings=devstack_docker + $ npm run build && ./manage.py lms collectstatic --no-input --settings=devstack_docker Resource busy or locked ----------------------- @@ -266,7 +266,7 @@ The fix is to get a new auth session. You can do any of the following: Missing vendor file node_modules/backbone.paginator/lib/backbone.paginator.js ----------------------------------------------------------------------------- This message sometimes appears when provisioning. The root cause of this is as yet unknown but the most effective workaround seems to be -to shell into the LMS (``make lms-shell`` in devstack) and run ``npm ci``, followed by ``paver update_assets``. +to shell into the LMS (``make lms-shell`` in devstack) and run ``npm ci``, followed by ``npm run build && ./manage.py lms collectstatic --no-input && ./manage.py cms collectstatic``. See `the github issue`_ to follow the work being done on the resolution. .. _the github issue: https://github.com/openedx/devstack/issues/1072 diff --git a/provision-lms.sh b/provision-lms.sh index 23d4016619..c1ee7c4ce5 100755 --- a/provision-lms.sh +++ b/provision-lms.sh @@ -19,7 +19,7 @@ done for app in "${apps[@]}"; do docker compose exec -T $app bash -e -c 'apt-get update && apt-get -y install --no-install-recommends git' - docker compose exec -T $app bash -e -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && NO_PYTHON_UNINSTALL=1 paver install_prereqs' + docker compose exec -T $app bash -e -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && NO_PYTHON_UNINSTALL=1 pip install -e . -r requirements/edx/base.txt -r requirements/edx/assets.txt && npm clean-install' #Installing prereqs crashes the process docker compose restart $app @@ -75,11 +75,11 @@ done # Fix missing vendor file by clearing the cache -docker compose exec -T lms bash -e -c 'rm /edx/app/edxapp/edx-platform/.prereqs_cache/Node_prereqs.sha1' +# docker compose exec -T lms bash -e -c 'rm /edx/app/edxapp/edx-platform/.prereqs_cache/Node_prereqs.sha1' # Create static assets for both LMS and CMS for app in "${apps[@]}"; do - docker compose exec -T $app bash -e -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && paver update_assets --settings devstack_docker' + docker compose exec -T $app bash -e -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && npm run build && ./manage.py lms collectstatic --noinput --settings devstack_docker && ./manage.py cms collectstatic --noinput --settings devstack_docker' done # Allow LMS SSO for CMS