Add container service files and docker README

This commit is contained in:
Edvard
2019-02-11 11:26:12 +01:00
parent e4968c4a75
commit e6e66d58dd
7 changed files with 83 additions and 6 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/bin/sh
# Runs the migrations and starts the lightSync and continuousLogSync services
# Exit if the variable tests fail
set -e
# Check the database variables are set
test $DATABASE_NAME
test $DATABASE_HOSTNAME
test $DATABASE_PORT
test $DATABASE_USER
test $DATABASE_PASSWORD
# Construct the connection string for postgres
CONNECT_STRING=postgresql://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOSTNAME:$DATABASE_PORT/$DATABASE_NAME?sslmode=disable
echo "Connecting with: $CONNECT_STRING"
set +e
# Run the DB migrations
./goose postgres "$CONNECT_STRING" up
if [ $? -eq 0 ]; then
# Fire up the services
rc-service lightSync start
rc-service continuousLogSync start
else
echo "Could not run migrations. Are the database details correct?"
fi