forked from openedx-unsupported/devstack
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: set edx.org theme as default for edx-platform and MFEs in devst…
…ack provisioning
- Loading branch information
1 parent
a10a269
commit d77cf27
Showing
4 changed files
with
56 additions
and
1 deletion.
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
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
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
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,47 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script sets up the edX theme in LMS and CMS. | ||
|
||
REPO_URL="https://github.com/edx/edx-themes" | ||
THEME_DIR="/edx/src/edx-themes/edx-platform" | ||
DEVSTACK_FILE="../edx-platform/lms/envs/devstack.py" | ||
|
||
# Clone the edx-themes repository into the src directory | ||
cd ../src | ||
if [ ! -d "edx-themes" ]; then | ||
git clone "$REPO_URL" | ||
else | ||
echo "Directory 'edx-themes' already exists. Skipping clone." | ||
fi | ||
cd ../devstack | ||
|
||
# Uncomment relevant lines in the devstack.py file | ||
sed -i '' "s|^# from .common import _make_mako_template_dirs|from .common import _make_mako_template_dirs|" "$DEVSTACK_FILE" | ||
sed -i '' "s|^# ENABLE_COMPREHENSIVE_THEMING = True|ENABLE_COMPREHENSIVE_THEMING = True|" "$DEVSTACK_FILE" | ||
sed -i '' "s|^# COMPREHENSIVE_THEME_DIRS = \[|COMPREHENSIVE_THEME_DIRS = \[|" "$DEVSTACK_FILE" | ||
sed -i '' "s|^# \"/edx/app/edxapp/edx-platform/themes/\"| \"/edx/app/edxapp/edx-platform/themes/\",|" "$DEVSTACK_FILE" | ||
sed -i '' "/COMPREHENSIVE_THEME_DIRS = \[/a\\ | ||
\"$THEME_DIR\", | ||
" "$DEVSTACK_FILE" | ||
sed -i '' "s|^# \]|]|" "$DEVSTACK_FILE" # Uncomment the closing bracket | ||
sed -i '' "s|^# TEMPLATES\[1\]\[\"DIRS\"\] = _make_mako_template_dirs|TEMPLATES[1][\"DIRS\"] = _make_mako_template_dirs|" "$DEVSTACK_FILE" | ||
sed -i '' "s|^# derive_settings(__name__)|derive_settings(__name__)|" "$DEVSTACK_FILE" | ||
|
||
|
||
# Add the theme directory to COMPREHENSIVE_THEME_DIRS if not already present | ||
if ! grep -qF "$THEME_DIR" "$DEVSTACK_FILE"; then | ||
sed -i '' "/COMPREHENSIVE_THEME_DIRS = \[/a\\ | ||
\"$THEME_DIR\", | ||
" "$DEVSTACK_FILE" | ||
fi | ||
|
||
# Set the theme site-wide | ||
SERVICE_NAME="mysql80" | ||
DATABASE="edxapp" | ||
THEME_NAME="edx.org-next" | ||
SITE_ID=1 | ||
|
||
docker compose exec -T "$SERVICE_NAME" mysql -e " | ||
USE $DATABASE; | ||
INSERT INTO theming_sitetheme (theme_dir_name, site_id) VALUES ('$THEME_NAME', $SITE_ID); | ||
" |