mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-10 00:37:54 +00:00
fix: ensure mounted installable packages are installed as expected
Close #1016.
This commit is contained in:
parent
f211b982fd
commit
0e37449f40
1
changelog.d/20240315_163331_dawoud.sheraz_tutor_997.md
Normal file
1
changelog.d/20240315_163331_dawoud.sheraz_tutor_997.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
- [BugFix] Ensure mounted installable packages are installed as expected upon initialization. (by @dawoudsheraz)
|
@ -45,7 +45,7 @@ def _add_core_init_tasks() -> None:
|
|||||||
hooks.Filters.CLI_DO_INIT_TASKS.add_item(
|
hooks.Filters.CLI_DO_INIT_TASKS.add_item(
|
||||||
(
|
(
|
||||||
"lms",
|
"lms",
|
||||||
env.read_core_template_file("jobs", "init", "mounted-edx-platform.sh"),
|
env.read_core_template_file("jobs", "init", "mounted-directories.sh"),
|
||||||
),
|
),
|
||||||
# If edx-platform is mounted, then we may need to perform some setup
|
# If edx-platform is mounted, then we may need to perform some setup
|
||||||
# before other initialization scripts can be run.
|
# before other initialization scripts can be run.
|
||||||
|
43
tutor/templates/jobs/init/mounted-directories.sh
Normal file
43
tutor/templates/jobs/init/mounted-directories.sh
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# The initialization job contains various re-install operations needed to be done
|
||||||
|
# on mounted directories (edx-platform, /mnt/*xblock, /mnt/<edx-ora, search, enterprise>)
|
||||||
|
# 1. /mnt/*
|
||||||
|
# Whenever xblocks or other installable packages are mounted, during the image build, they are copied over to container
|
||||||
|
# and installed. This results in egg_info generation for the mounted directories. However, the egg_info is not carried
|
||||||
|
# over to host. When the containers are launched, the host directories without egg_info are mounted on runtime
|
||||||
|
# and disappear from pip list.
|
||||||
|
#
|
||||||
|
# 2. edx-platform
|
||||||
|
# When a new local copy of edx-platform is bind-mounted, certain build
|
||||||
|
# artifacts from the openedx image's edx-platform directory are lost.
|
||||||
|
# We regenerate them here.
|
||||||
|
|
||||||
|
|
||||||
|
for mounted_dir in /mnt/*; do
|
||||||
|
if [ -f $mounted_dir/setup.py ] && ! ls $mounted_dir/*.egg-info >/dev/null 2>&1 ; then
|
||||||
|
echo "Unable to locate egg-info in $mounted_dir"
|
||||||
|
pip install -e $mounted_dir
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -f /openedx/edx-platform/bindmount-canary ] ; then
|
||||||
|
# If this file exists, then edx-platform has not been bind-mounted,
|
||||||
|
# so no build artifacts need to be regenerated.
|
||||||
|
echo "Using edx-platform from image (not bind-mount)."
|
||||||
|
echo "No extra setup is required."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Performing additional setup for bind-mounted edx-platform."
|
||||||
|
set -x # Echo out executed lines
|
||||||
|
|
||||||
|
# Regenerate Open_edX.egg-info
|
||||||
|
pip install -e .
|
||||||
|
|
||||||
|
# Regenerate node_modules
|
||||||
|
npm clean-install
|
||||||
|
|
||||||
|
# Regenerate static assets.
|
||||||
|
openedx-assets build --env=dev
|
||||||
|
|
||||||
|
set -x
|
||||||
|
echo "Done setting up bind-mounted edx-platform."
|
@ -1,26 +0,0 @@
|
|||||||
# When a new local copy of edx-platform is bind-mounted, certain build
|
|
||||||
# artifacts from the openedx image's edx-platform directory are lost.
|
|
||||||
# We regenerate them here.
|
|
||||||
|
|
||||||
if [ -f /openedx/edx-platform/bindmount-canary ] ; then
|
|
||||||
# If this file exists, then edx-platform has not been bind-mounted,
|
|
||||||
# so no build artifacts need to be regenerated.
|
|
||||||
echo "Using edx-platform from image (not bind-mount)."
|
|
||||||
echo "No extra setup is required."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Performing additional setup for bind-mounted edx-platform."
|
|
||||||
set -x # Echo out executed lines
|
|
||||||
|
|
||||||
# Regenerate Open_edX.egg-info
|
|
||||||
pip install -e .
|
|
||||||
|
|
||||||
# Regenerate node_modules
|
|
||||||
npm clean-install
|
|
||||||
|
|
||||||
# Regenerate static assets.
|
|
||||||
openedx-assets build --env=dev
|
|
||||||
|
|
||||||
set -x
|
|
||||||
echo "Done setting up bind-mounted edx-platform."
|
|
Loading…
Reference in New Issue
Block a user