forked from overhangio/tutor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: separate pip-install-mounted script
- Loading branch information
1 parent
610d26f
commit cc6e668
Showing
2 changed files
with
27 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
# Whenever edx-platform or installable packages (e.g., xblocks) 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. To fix this, we `pip install` edx-platform and every mounted | ||
# package ("/mnt/*") again, re-generating the egg-infos. This script is called | ||
# during LMS initialization, and can also be called separately by users. | ||
|
||
set -eu | ||
set -x # Echo out executed lines | ||
|
||
for mounted_dir in /openedx/edx-platform /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 -- generating now." | ||
pip install -e $mounted_dir | ||
fi | ||
done | ||
|
||
set +x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,15 @@ | ||
# The initialization job contains various re-install operations needed to be done | ||
# on mounted directories (edx-platform, /mnt/*xblock, /mnt/<edx-ora, search, enterprise>) | ||
# The initialization job contains various re-install and asset-symlinking | ||
# operations needed to be done on mounted directories (edx-platform, | ||
# /mnt/*xblock, /mnt/<edx-ora, search, enterprise>) | ||
|
||
echo "Performing additional setup for bind-mounted directories." | ||
set -x # Echo out executed lines | ||
|
||
cd /openedx/edx-platform || exit 1 | ||
cd /openedx/edx-platform || exit 1 # Fail early if edx-platform is missing | ||
|
||
# Whenever edx-platform or installable packages (e.g., xblocks) 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. To fix this, we `pip install` edx-platform (".") and every mounted | ||
# package ("./mnt/*") again, re-generating the egg-infos. | ||
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 -- generating now." | ||
pip install -e $mounted_dir | ||
fi | ||
done | ||
pip-install-mounted | ||
|
||
# The same problem exists for edx-platform's compiled frontend assets, but recompiling | ||
# them is very slow. So, instead of re-compiling, we create symlinks to an alternate | ||
# directory in which we expect them to have been cached (/openedx/assets). | ||
ln-assets /openedx/assets /openedx/edx-platform | ||
|
||
set -x | ||
set +x | ||
echo "Done setting up bind-mounted directories." |