This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
entrypoint for docker image, apply migration on start up
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
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
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,21 @@ | ||
#!/bin/sh | ||
# Runs the db migrations and starts the service | ||
|
||
set +x | ||
|
||
# Construct the connection string for postgres | ||
VDB_PG_CONNECT=postgresql://$CACHE_DATABASE_USER:$CACHE_DATABASE_PASSWORD@$CACHE_DATABASE_HOSTNAME:$CACHE_DATABASE_PORT/$CACHE_DATABASE_NAME?sslmode=disable | ||
|
||
# Run the DB migrations | ||
echo "Connecting with: $VDB_PG_CONNECT" | ||
echo "Running database migrations" | ||
goose -table goose_db_version_trace -dir migrations postgres "$VDB_PG_CONNECT" up | ||
|
||
# If the db migrations ran without err | ||
if [[ $? -ne 0 ]]; then | ||
echo "Could not run migrations. Are the database details correct?" | ||
exit 1 | ||
fi | ||
|
||
echo "Running the Tracing-API process" | ||
exec tracer "$@" |