[damned-lies] feat: use variables in entrypoint.sh
- From: Guillaume Bernard <gbernard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] feat: use variables in entrypoint.sh
- Date: Tue, 10 May 2022 08:30:02 +0000 (UTC)
commit 39edfc2dd606868f7236a1ff89631089c865d905
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date: Mon May 9 15:06:22 2022 +0200
feat: use variables in entrypoint.sh
containers/production/build_buildah_production.sh | 2 +-
containers/production/entrypoint.sh | 35 ++++++++++++-----------
2 files changed, 20 insertions(+), 17 deletions(-)
---
diff --git a/containers/production/build_buildah_production.sh
b/containers/production/build_buildah_production.sh
index d22c1ff9..e1ccb2fc 100755
--- a/containers/production/build_buildah_production.sh
+++ b/containers/production/build_buildah_production.sh
@@ -4,7 +4,7 @@
declare -r PROCESS_USER="l10n"
# DAMNED_LIES_CONTAINER_CODE_DIRECTORY: where is located project code
-declare -r DAMNED_LIES_CONTAINER_CODE_DIRECTORY="/l10n"
+declare -r DAMNED_LIES_CONTAINER_CODE_DIRECTORY="/${PROCESS_USER}"
# THIS_SCRIPT_DIRECTORY: the current script directory name
THIS_SCRIPT_DIRECTORY="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
diff --git a/containers/production/entrypoint.sh b/containers/production/entrypoint.sh
index 8a1641d3..010182b1 100755
--- a/containers/production/entrypoint.sh
+++ b/containers/production/entrypoint.sh
@@ -1,29 +1,32 @@
#!/bin/bash
+declare -r DAMNED_LIES_PROJECT_DIRECTORY="/${USER}"
+declare -r LOCAL_SETTINGS_FILE="${DAMNED_LIES_PROJECT_DIRECTORY}/damnedlies/damnedlies/local_settings.py"
+declare -r SSH_CONFIG_URL="https://gitlab.gnome.org/Infrastructure/damned-lies/-/raw/oscp/httpd/ssh_config"
-sed -i "s/\$DB_NAME/${DB_NAME}/" /l10n/damnedlies/damnedlies/local_settings.py
-sed -i "s/\$DB_USER/${DB_USER}/" /l10n/damnedlies/damnedlies/local_settings.py
-sed -i "s/\$DB_PASSWORD/${DB_PASSWORD}/" /l10n/damnedlies/damnedlies/local_settings.py
-sed -i "s/\$DB_HOST/${DB_HOST}/" /l10n/damnedlies/damnedlies/local_settings.py
-sed -i "s/\$DB_PORT/${DB_PORT}/" /l10n/damnedlies/damnedlies/local_settings.py
-sed -i "s/\$SECRET_KEY/${SECRET_KEY}/" /l10n/damnedlies/damnedlies/local_settings.py
-sed -i "s/\$SENTRY_DSN/${SENTRY_DSN}/" /l10n/damnedlies/damnedlies/local_settings.py
-sed -i "s/\$GITLAB_TOKEN/${GITLAB_TOKEN}/" /l10n/damnedlies/damnedlies/local_settings.py
+sed -i "s/\$DB_NAME/${DB_NAME}/" "${LOCAL_SETTINGS_FILE}"
+sed -i "s/\$DB_USER/${DB_USER}/" "${LOCAL_SETTINGS_FILE}"
+sed -i "s/\$DB_PASSWORD/${DB_PASSWORD}/" "${LOCAL_SETTINGS_FILE}"
+sed -i "s/\$DB_HOST/${DB_HOST}/" "${LOCAL_SETTINGS_FILE}"
+sed -i "s/\$DB_PORT/${DB_PORT}/" "${LOCAL_SETTINGS_FILE}"
+sed -i "s/\$SECRET_KEY/${SECRET_KEY}/" "${LOCAL_SETTINGS_FILE}"
+sed -i "s/\$SENTRY_DSN/${SENTRY_DSN}/" "${LOCAL_SETTINGS_FILE}"
+sed -i "s/\$GITLAB_TOKEN/${GITLAB_TOKEN}/" "${LOCAL_SETTINGS_FILE}"
-echo 'Populating .ssh for the l10n user'
-mkdir -p /home/l10n/.ssh
-ln -s /home/l10n/.ssh_secret/ssh-privatekey /home/l10n/.ssh/ssh-privatekey
-ln -s /home/l10n/.ssh_secret/.gitconfig /home/l10n/.gitconfig
-wget https://gitlab.gnome.org/Infrastructure/damned-lies/-/raw/oscp/httpd/ssh_config -O
/home/l10n/.ssh/config
+echo "Populating .ssh for the ${USER} user"
+mkdir -p "${HOME}/.ssh"
+ln -s "${HOME}/.ssh_secret/ssh-privatekey" "${HOME}/.ssh/ssh-privatekey"
+ln -s "${HOME}/.ssh_secret/.gitconfig" "${HOME}/.gitconfig"
+wget "${SSH_CONFIG_URL}" -O "${HOME}.ssh/config"
echo 'Applying migrations'
-/l10n/venv/bin/python manage.py migrate
+"${DAMNED_LIES_PROJECT_DIRECTORY}/venv/bin/python" manage.py migrate
echo 'Generating static files'
-/l10n/venv/bin/python manage.py collectstatic
+"${DAMNED_LIES_PROJECT_DIRECTORY}/venv/bin/python" manage.py collectstatic
echo 'Compiling translations'
-/l10n/venv/bin/python manage.py compile-trans
+"${DAMNED_LIES_PROJECT_DIRECTORY}/venv/bin/python" manage.py compile-trans
if [ $# -eq 0 ]; then
exec httpd -DFOREGROUND
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]