Skip to content
Prev Previous commit
#176 made retry timeout for rails scripts configurable
  • Loading branch information
Sgu74 committed Jan 29, 2026
commit 1c977f5ffc0fd4af2ec43361038067861cfe882c
6 changes: 6 additions & 0 deletions dogu.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@
"Name": "rack/bytesize_limit",
"Description": "Configure the maximum byte size of query strings that the redmine web server (rack) allows. The default is 4194304 (4 MiB). Depending on the available processing power setting this parameter to high might cause redmine to soft lock.",
"Optional": true
},
{
"Name": "rails_script_timeout",
"Description": "Define after how many seconds the execution of critical rails scripts in the startup process is terminated and tried again",
"Optional": true,
"Default": "180"
}
],
"Volumes": [
Expand Down
6 changes: 4 additions & 2 deletions resources/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,12 @@ function create_temporary_admin() {
local TMP_ADMIN_RANDOMIZED_STR
TMP_ADMIN_RANDOMIZED_STR="$(doguctl random -l 60)"
TMP_ADMIN_PASSWORD="${TMP_ADMIN_RANDOMIZED_STR}${TMP_ADMIN_PASSWORD_SUFFIX}"
RAILS_TIMEOUT="$(doguctl config rails_script_timeout)"

# In case we are in restart loop to prevent infinite admin users...
remove_last_temporary_admin

railsConsoleRetryOnce 180 "/rails_scripts/create_admin.rb" --username "${TMP_ADMIN_NAME}" --password "${TMP_ADMIN_PASSWORD}" || exit 1
railsConsoleRetryOnce "${RAILS_TIMEOUT}" "/rails_scripts/create_admin.rb" --username "${TMP_ADMIN_NAME}" --password "${TMP_ADMIN_PASSWORD}" || exit 1
doguctl config -e "last_tmp_admin" "${TMP_ADMIN_NAME}"
}

Expand All @@ -194,12 +195,13 @@ function remove_last_temporary_admin() {
local DEFAULT="<empty>"
local LAST_TMP_ADMIN
LAST_TMP_ADMIN="$(doguctl config -e --default "${DEFAULT}" last_tmp_admin)"
RAILS_TIMEOUT="$(doguctl config rails_script_timeout)"

if [ "${LAST_TMP_ADMIN}" != "${DEFAULT}" ]
then
echo "Removing last temporary admin..."
# shellcheck disable=SC1091
railsConsoleRetryOnce 180 "/rails_scripts/remove_user.rb" --username "${LAST_TMP_ADMIN}" || exit 1
railsConsoleRetryOnce "${RAILS_TIMEOUT}" "/rails_scripts/remove_user.rb" --username "${LAST_TMP_ADMIN}" || exit 1
doguctl config --rm last_tmp_admin
fi
}
Expand Down