Make things more configurable

This commit is contained in:
Jonas Juselius
2019-10-17 16:05:47 +02:00
parent 53e25ffb22
commit 81717fe223
12 changed files with 154 additions and 43 deletions

View File

@@ -1,24 +1,27 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.."
TOP="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/.."
if [ $# = 0 ]; then
echo "usage: deploy.sh name ..."
exit 1
fi
if [ ! -f $DIR/clusters/$1/default.nix ]; then
if [ ! -f $TOP/clusters/$1/default.nix ]; then
echo "error: $1 does not contain a deployment"
exit 1
fi
# mkdir -p $1/gcroots
cd $TOP/clusters/$1
# echo "--- Securing certifiates"
# nix-build -o $1/gcroots/certs $1/build.nix
echo "--- Updating deployment"
nixops modify -d $1 $DIR/clusters/$1
nixops list | grep -q $1
if [ $? = 0 ]; then
echo "--- Updating deployment"
nixops modify -d $1 .
else
echo "--- Creating deployment"
nixops create -d $1 .
fi
echo "--- Deploying $1"
nixops deploy -d $* --allow-reboot