From 3f9ed5a8ddd2100899567061f50aa26b2e4eec64 Mon Sep 17 00:00:00 2001 From: Warren Christian <70002196+warrenchristian1telus@users.noreply.github.com> Date: Tue, 2 Jan 2024 16:05:54 -0800 Subject: [PATCH] Set cron-job and migrate-build-files env credentials to use moodle-secrets Added 10 second deley to file delete for migrate script --- openshift/migrate-build-files-job.yml | 18 ++++++++++++++- openshift/moodle-cron-job.yml | 28 ++++++++++++------------ openshift/scripts/migrate-build-files.sh | 3 ++- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/openshift/migrate-build-files-job.yml b/openshift/migrate-build-files-job.yml index e7e79f0..f22e35d 100644 --- a/openshift/migrate-build-files-job.yml +++ b/openshift/migrate-build-files-job.yml @@ -46,6 +46,22 @@ objects: - name: cron-config mountPath: /var/www/html/config.php subPath: config.php + env: + - name: DB_USER + valueFrom: + secretKeyRef: + name: moodle-secrets + key: database-user + - name: DB_NAME + valueFrom: + secretKeyRef: + name: moodle-secrets + key: database-name + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: moodle-secrets + key: database-password command: - bash - "-c" @@ -66,4 +82,4 @@ parameters: value: "moodle" - name: BUILD_TAG required: true - value: "dev" \ No newline at end of file + value: "dev" diff --git a/openshift/moodle-cron-job.yml b/openshift/moodle-cron-job.yml index 14da914..12facef 100644 --- a/openshift/moodle-cron-job.yml +++ b/openshift/moodle-cron-job.yml @@ -35,15 +35,24 @@ objects: path: ./.env defaultMode: 420 containers: - - name: moodle-cron-job-job + - name: ${BUILD_NAME} image: ${IMAGE_REPO}${BUILD_NAMESPACE}/${BUILD_NAME}:${BUILD_TAG} env: - - name: DB_NAME - value: ${DB_NAME} - name: DB_USER - value: ${DB_USER} + valueFrom: + secretKeyRef: + name: moodle-secrets + key: database-user + - name: DB_NAME + valueFrom: + secretKeyRef: + name: moodle-secrets + key: database-name - name: DB_PASSWORD - value: ${DB_PASSWORD} + valueFrom: + secretKeyRef: + name: moodle-secrets + key: database-password volumeMounts: - name: moodle-data mountPath: /var/www/html @@ -81,12 +90,3 @@ parameters: - name: BUILD_TAG required: true value: "dev" - - name: DB_USER - required: true - value: "moodle" - - name: DB_NAME - required: true - value: "moodle" - - name: DB_PASSWORD - required: true - value: "CHANGE_ME" diff --git a/openshift/scripts/migrate-build-files.sh b/openshift/scripts/migrate-build-files.sh index 0dbe75c..ee4007b 100644 --- a/openshift/scripts/migrate-build-files.sh +++ b/openshift/scripts/migrate-build-files.sh @@ -6,7 +6,8 @@ # echo "Delete Moodle config..." # rm -f /var/www/html/config.php -echo "Deleting shared Moodle files..." +echo "Deleting shared Moodle files... in 10...9...8..." +sleep 10 rm -rf /var/www/html/* # echo "Move Moodle web files to /tmp/old..." # mv /var/www/html/* /tmp/old