-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to initialise the database
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
# Initialise stepup database schemas: middleware, gateway, webauthn | ||
# Note: tiqr is not included in this script | ||
|
||
# This script is idempotent, if run a second time it upgrades the Doctrine managed schema's (middleware, gateway, webauthn) | ||
# to the latest versions and push the latest middleware configuration, whitelist and institution configuration | ||
|
||
# Get the directory of this script | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# Check that the docker compose "stepup" project is running by getting the ID of the project "stepup" | ||
running=$(docker compose -p stepup -f docker-compose.yml ls --filter "name=stepup" -q) | ||
if [ -z "$running" ]; then | ||
# No ID. The project is not running | ||
echo "Error: The docker compose project \"stepup\" is not running" | ||
exit 1 | ||
fi | ||
|
||
# Initialize the middleware & gateway database schemas | ||
echo "Initializing/upgrading the middleware & gateway database schemas" | ||
if ! docker compose -f "${DIR}/docker-compose.yml" exec middleware /var/www/html/bin/console doctrine:migrations:migrate --env=prod --em=deploy --no-interaction; then | ||
echo "Error initializing the middleware & gateway database schemas" | ||
echo "" | ||
exit 1 | ||
fi | ||
echo "Middleware & gateway database schemas initialized/upgraded" | ||
echo "" | ||
|
||
# WebAuthn migrations are currently broken | ||
|
||
# Initialize the webauthn database schema | ||
#echo "Initializing/upgrading the webauthn database schema" | ||
#if ! docker compose -f "${DIR}/docker-compose.yml" exec webauthn php /var/www/html/bin/console doctrine:migrations:migrate --env=prod --no-interaction; then | ||
# echo "Error initializing the webauthn database schema" | ||
# echo "" | ||
# exit 1 | ||
#fi | ||
#echo "Webauthn database schemas initialized/upgraded" | ||
#echo "" | ||
|
||
# Push middleware configuration | ||
echo "Pushing new middleware configuration" | ||
if ! "${DIR}/middleware/middleware-push-config.sh"; then | ||
echo "Error pushing new middleware configuration" | ||
echo "" | ||
exit 1 | ||
fi | ||
echo "" | ||
|
||
echo "Pushing new institution whitelist" | ||
if ! "${DIR}/middleware/middleware-push-whitelist.sh"; then | ||
echo "Error pushing new institution whitelist" | ||
echo "" | ||
exit 1 | ||
fi | ||
echo "" | ||
|
||
echo "Pushing new institution configuraton" | ||
if ! "${DIR}/middleware/middleware-push-institution.sh"; then | ||
echo "Error pushing new institution whitelist" | ||
echo "" | ||
exit 1 | ||
fi | ||
echo "" |