From deac0c4c73cb309a572f1b4369002270bfe2ae5b Mon Sep 17 00:00:00 2001 From: Livvy Mackintosh Date: Tue, 23 May 2017 01:11:00 +0200 Subject: [PATCH] Update utility scripts in /bin --- bin/{build-ojuso-map => ojusomap-build} | 0 bin/ojusomap-gen-env-sh | 12 ++++++++++++ bin/{mixin-secrets => ojusomap-mixin-secrets} | 9 +++++++-- bin/ojusomap-redeploy | 6 ++++++ 4 files changed, 25 insertions(+), 2 deletions(-) rename bin/{build-ojuso-map => ojusomap-build} (100%) create mode 100755 bin/ojusomap-gen-env-sh rename bin/{mixin-secrets => ojusomap-mixin-secrets} (73%) create mode 100755 bin/ojusomap-redeploy diff --git a/bin/build-ojuso-map b/bin/ojusomap-build similarity index 100% rename from bin/build-ojuso-map rename to bin/ojusomap-build diff --git a/bin/ojusomap-gen-env-sh b/bin/ojusomap-gen-env-sh new file mode 100755 index 0000000..1b558dd --- /dev/null +++ b/bin/ojusomap-gen-env-sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Spit out environment variables from ./environment and +# compiles them into a bash script that will export them + +THISDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +ENV_FILE=$THISDIR/../environment +TARGET=$THISDIR/../environment.sh +echo "#!/bin/bash" > $TARGET +sudo cat $ENV_FILE\ + | sed -e '/^#/d;/^$/d;s/ /\\ /g;s//\\>/g'\ + | sed -e 's/^/export /g' >> $TARGET +chmod +x $TARGET diff --git a/bin/mixin-secrets b/bin/ojusomap-mixin-secrets similarity index 73% rename from bin/mixin-secrets rename to bin/ojusomap-mixin-secrets index aae1d87..aecc5db 100755 --- a/bin/mixin-secrets +++ b/bin/ojusomap-mixin-secrets @@ -1,7 +1,7 @@ #!/bin/bash # -# Generates a fancy docker-compose.yml based on the template by -# mixing in production secrets. +# Generates a fancy environment varibale file based a template by +# mixing in production secrets from locally set variables. # # Olivia Mackintosh @@ -24,6 +24,11 @@ if [ -z "$SECRET_KEY" ]; then exit 1 fi +if [ -z "$WEBLATE_ADMIN_PASSWORD" ]; then + echo "Error: Please set \$WEBLATE_ADMIN_PASSWORD" + exit 1 +fi + # Make sure only root can access and then # sub in the environment variables. sudo chown root:root $TARGET diff --git a/bin/ojusomap-redeploy b/bin/ojusomap-redeploy new file mode 100755 index 0000000..26e30d4 --- /dev/null +++ b/bin/ojusomap-redeploy @@ -0,0 +1,6 @@ +#!/bin/bash +# Redeploys the OjusoMap stack +THISDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +cd $THISDIR/../ +sudo docker-compose up -d --build map +cd $THISDIR