From 40168681f4b9ce85f37b86c3f71bb48b8fcaced2 Mon Sep 17 00:00:00 2001 From: Bobby Novak <176936850+rnovak338@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:49:29 -0500 Subject: [PATCH] Refactor create_staffusers to work with .profile and run.sh (#4516) * Refactor create_staffusers to work with .profile and run.sh * Reference util_startup.sh in create_staffusers * Add context to sandbox README --- backend/.profile | 7 +++++++ backend/run.sh | 4 +++- backend/tools/create_staffusers.sh | 10 ++++++++++ terraform/sandbox/README.md | 10 ++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 backend/tools/create_staffusers.sh diff --git a/backend/.profile b/backend/.profile index 544a2ee1c..80e641fa0 100644 --- a/backend/.profile +++ b/backend/.profile @@ -15,6 +15,7 @@ source tools/api_standup.sh source tools/run_collectstatic.sh source tools/seed_cog_baseline.sh source tools/materialized_views.sh +source tools/create_staffusers.sh ##### # SETUP THE CGOV ENVIRONMENT @@ -55,6 +56,12 @@ if [[ "$CF_INSTANCE_INDEX" == 0 ]]; then # materialized_views # gonogo "materialized_views" + + ##### + # CREATE STAFF USERS + # Prepares staff users for Django admin + create_staffusers + gonogo "create_staffusers" fi # Make psql usable by scripts, for debugging, etc. diff --git a/backend/run.sh b/backend/run.sh index 791b7695f..cdb84ea6c 100755 --- a/backend/run.sh +++ b/backend/run.sh @@ -14,6 +14,7 @@ source tools/api_teardown.sh source tools/migrate_app_tables.sh source tools/api_standup.sh source tools/seed_cog_baseline.sh +source tools/create_staffusers.sh ##### # SETUP THE LOCAL ENVIRONMENT @@ -52,7 +53,8 @@ gonogo "seed_cog_baseline" ##### # CREATE STAFF USERS # Prepares staff users for Django admin -python manage.py create_staffusers +create_staffusers +gonogo "create_staffusers" ##### # LAUNCH THE APP diff --git a/backend/tools/create_staffusers.sh b/backend/tools/create_staffusers.sh new file mode 100644 index 000000000..658d67c42 --- /dev/null +++ b/backend/tools/create_staffusers.sh @@ -0,0 +1,10 @@ +##### +# CREATE STAFF USERS +# Prepares staff users for Django admin +source tools/util_startup.sh + +function create_staffusers { + startup_log "CREATE_STAFFUSERS" "BEGIN" + python manage.py create_staffusers + startup_log "CREATE_STAFFUSERS" "END" +} diff --git a/terraform/sandbox/README.md b/terraform/sandbox/README.md index d2a75222f..c1a647405 100644 --- a/terraform/sandbox/README.md +++ b/terraform/sandbox/README.md @@ -128,6 +128,16 @@ This assumes you have a `sandbox.tfvars` and `backend.tfvars` in `terraform/shar Next, run `./plan.sh` script. You should see it creating ~20 resources in a clean environment, or updating a few. Finally, run `./apply.sh` script and wait. +--- + +**NOTE** - If you would like to monitor the deploy logs as `./apply.sh` is running, start up a new terminal and run: +``` +cf t -s sandbox +cf logs gsa-fac +``` + +--- + # What is missing/omitted from Sandbox The following resources were intentionally left out from the sandbox environment. Part of that is the lack of necessity for such things, and an attempt to have a more lightweight environment, that only runs the bare minimum to bring up the system. - Logshipper Module