Squashed 'spiffworkflow-backend/' changes from 3fff3539..593f33ca

593f33ca wait for db to be ready option
706094a8 demo env and no ssl for spiff realm on that env

git-subtree-dir: spiffworkflow-backend
git-subtree-split: 593f33ca52ffb049fefd529c3a6bc011cb62e950
This commit is contained in:
burnettk 2022-10-16 22:32:16 -04:00
parent f21d0ef3a9
commit 71e189afbc
3 changed files with 37 additions and 1 deletions

View File

@ -10,6 +10,11 @@ set -o errtrace -o errexit -o nounset -o pipefail
# run migrations # run migrations
export FLASK_APP=/app/src/spiffworkflow_backend export FLASK_APP=/app/src/spiffworkflow_backend
if [[ "${WAIT_FOR_DB_TO_BE_READY:-}" == "true" ]]; then
echo 'Waiting for db to be ready...'
poetry run python ./bin/wait_for_db_to_be_ready.py
fi
if [[ "${DOWNGRADE_DB:-}" == "true" ]]; then if [[ "${DOWNGRADE_DB:-}" == "true" ]]; then
echo 'Downgrading database...' echo 'Downgrading database...'
poetry run flask db downgrade poetry run flask db downgrade

View File

@ -26,7 +26,7 @@
"oauth2DeviceCodeLifespan": 600, "oauth2DeviceCodeLifespan": 600,
"oauth2DevicePollingInterval": 5, "oauth2DevicePollingInterval": 5,
"enabled": true, "enabled": true,
"sslRequired": "external", "sslRequired": "NONE",
"registrationAllowed": false, "registrationAllowed": false,
"registrationEmailAsUsername": false, "registrationEmailAsUsername": false,
"rememberMe": false, "rememberMe": false,
@ -1254,6 +1254,7 @@
"secret": "JXeQExm0JhQPLumgHtIIqf52bDalHz0q", "secret": "JXeQExm0JhQPLumgHtIIqf52bDalHz0q",
"redirectUris": [ "redirectUris": [
"http://localhost:7000/*", "http://localhost:7000/*",
"http://67.205.133.116:7000/*",
"http://167.172.242.138:7000/*" "http://167.172.242.138:7000/*"
], ],
"webOrigins": [], "webOrigins": [],
@ -1523,6 +1524,7 @@
"clientAuthenticatorType": "client-secret", "clientAuthenticatorType": "client-secret",
"redirectUris": [ "redirectUris": [
"http://localhost:7001/*", "http://localhost:7001/*",
"http://67.205.133.116:7000/*",
"http://167.172.242.138:7001/*" "http://167.172.242.138:7001/*"
], ],
"webOrigins": ["*"], "webOrigins": ["*"],
@ -1591,6 +1593,7 @@
"secret": "6o8kIKQznQtejHOdRhWeKorBJclMGcgA", "secret": "6o8kIKQznQtejHOdRhWeKorBJclMGcgA",
"redirectUris": [ "redirectUris": [
"http://localhost:7001/*", "http://localhost:7001/*",
"http://67.205.133.116:7000/*",
"http://167.172.242.138:7001/*" "http://167.172.242.138:7001/*"
], ],
"webOrigins": [], "webOrigins": [],

View File

@ -0,0 +1,28 @@
"""Grabs tickets from csv and makes process instances."""
from spiffworkflow_backend import get_hacked_up_app_for_script
from flask_bpmn.models.db import db
import sqlalchemy
import time
def try_to_connect(start_time: float) -> None:
try:
db.first_or_404('select 1')
except sqlalchemy.exc.DatabaseError as exception:
if time.time() - start_time > 15:
raise exception
else:
time.sleep(1)
try_to_connect(start_time)
def main() -> None:
"""Main."""
app = get_hacked_up_app_for_script()
start_time = time.time()
with app.app_context():
try_to_connect(start_time)
if __name__ == "__main__":
main()