From 4e3da952cdb4b642359c524619ad7c8116b547ef Mon Sep 17 00:00:00 2001 From: hblankenship Date: Tue, 24 Dec 2024 11:43:33 -0600 Subject: [PATCH 1/3] extract first boot portion of script --- .dryrunsecurity.yaml | 1 + Dockerfile.django-debian | 1 + docker/entrypoint-first-boot.sh | 35 +++++++++++++++++++++++++++++++ docker/entrypoint-initializer.sh | 36 ++------------------------------ 4 files changed, 39 insertions(+), 34 deletions(-) create mode 100644 docker/entrypoint-first-boot.sh diff --git a/.dryrunsecurity.yaml b/.dryrunsecurity.yaml index da92963ddac..cca95d16109 100644 --- a/.dryrunsecurity.yaml +++ b/.dryrunsecurity.yaml @@ -52,6 +52,7 @@ sensitiveCodepaths: - 'docker/entrypoint-celery-beat.sh' - 'docker/entrypoint-celery-worker.sh' - 'docker/entrypoint-initializer.sh' + - 'docker/entrypoint-first-boot.sh' - 'docker/entrypoint-nginx.sh' - 'docker/entrypoint-uwsgi.sh' - 'docker/wait-for-it.sh' diff --git a/Dockerfile.django-debian b/Dockerfile.django-debian index 26c27cad391..663a75e884d 100644 --- a/Dockerfile.django-debian +++ b/Dockerfile.django-debian @@ -71,6 +71,7 @@ COPY \ docker/entrypoint-celery-beat.sh \ docker/entrypoint-celery-worker.sh \ docker/entrypoint-initializer.sh \ + docker/entrypoint-first-boot.sh \ docker/entrypoint-uwsgi.sh \ docker/entrypoint-uwsgi-dev.sh \ docker/entrypoint-unit-tests.sh \ diff --git a/docker/entrypoint-first-boot.sh b/docker/entrypoint-first-boot.sh new file mode 100644 index 00000000000..ffc782b4ccc --- /dev/null +++ b/docker/entrypoint-first-boot.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# called from entrypoint-initializer.sh when no admin user exists (first boot) +cat </dev/null) ; do + echo "Loading $i" + python3 manage.py loaddata "${i%.*}" + done + + echo "Installing watson search index" + python3 manage.py installwatson + + # surveys fixture needs to be modified as it contains an instance dependant polymorphic content id + echo "Migration of textquestions for surveys" + python3 manage.py migrate_textquestions \ No newline at end of file diff --git a/docker/entrypoint-initializer.sh b/docker/entrypoint-initializer.sh index 08e77dc46ca..e5145af0196 100755 --- a/docker/entrypoint-initializer.sh +++ b/docker/entrypoint-initializer.sh @@ -138,40 +138,8 @@ fi if [ -z "${ADMIN_EXISTS}" ] then -cat </dev/null) ; do - echo "Loading $i" - python3 manage.py loaddata "${i%.*}" - done - - echo "Installing watson search index" - python3 manage.py installwatson - - # surveys fixture needs to be modified as it contains an instance dependant polymorphic content id - echo "Migration of textquestions for surveys" - python3 manage.py migrate_textquestions - + ./entrypoint-first-boot.sh + create_announcement_banner initialize_data fi From f4de86c3bcc07f540c02c3be137d0a9cdc5ce323 Mon Sep 17 00:00:00 2001 From: hblankenship Date: Tue, 24 Dec 2024 13:32:06 -0600 Subject: [PATCH 2/3] added first boot script --- Dockerfile.django-alpine | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.django-alpine b/Dockerfile.django-alpine index 97bb4411796..cfef58fa32c 100644 --- a/Dockerfile.django-alpine +++ b/Dockerfile.django-alpine @@ -68,6 +68,7 @@ COPY \ docker/entrypoint-celery-beat.sh \ docker/entrypoint-celery-worker.sh \ docker/entrypoint-initializer.sh \ + docker/entrypoint-first-boot.sh \ docker/entrypoint-uwsgi.sh \ docker/entrypoint-uwsgi-dev.sh \ docker/entrypoint-unit-tests.sh \ From 14d03ab8ab2973661c7a092528df8cd7d14dfec2 Mon Sep 17 00:00:00 2001 From: hblankenship Date: Tue, 24 Dec 2024 13:43:51 -0600 Subject: [PATCH 3/3] needs space --- docker/entrypoint-initializer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint-initializer.sh b/docker/entrypoint-initializer.sh index e5145af0196..45a67105109 100755 --- a/docker/entrypoint-initializer.sh +++ b/docker/entrypoint-initializer.sh @@ -138,7 +138,7 @@ fi if [ -z "${ADMIN_EXISTS}" ] then - ./entrypoint-first-boot.sh + . /entrypoint-first-boot.sh create_announcement_banner initialize_data