on master help sign in
Eliminate deploy scripts
commit281472e627f460aa46b37bd45883501350767cd1 authorRyan Trinkle <ryan.trinkle@gmail.com> dateSun 4 Feb 2018, 17:04 (9 years ago) parent5034979
2 files changed−55
deploy−26 set-deploy−29
deploydeleted−26
@@ -1,26 +0,0 @@
1−#!/usr/bin/env bash
2−set -eux
3−
4−DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5−
6−HOSTNAME="$1"
7−shift
8−CONFIG="$1"
9−shift
10−
11−# Check preconditions
12−#diff <(ls ../config) <(ls config) # We don't want to deploy if we have the wrong set of config files
13−
14−eval "$(ssh-agent)"
15−ssh-add "$CONFIG/ssh_key"
16−
17−RESULT="$(nix-build --no-out-link -A completeServer.aws.system --argstr hostName "$HOSTNAME" "$@")"
18−
19−nix-copy-closure -v --to root@"$HOSTNAME" --gzip "$RESULT"
20−
21−"$DIR/deploy-config" "ssh" root@"$HOSTNAME" "$CONFIG"
22−
23−ssh root@"$HOSTNAME" bash -x <<EOF
24−nix-env -p /nix/var/nix/profiles/system --set "$RESULT"
25−/nix/var/nix/profiles/system/bin/switch-to-configuration switch
26−EOF
set-deploydeleted−29
@@ -1,29 +0,0 @@
1−#!/usr/bin/env bash
2−set -euo pipefail
3−
4−# When given a designated directory and a private key file
5−# this script will create a directory layout that is suitable
6−# for an obelisk project
7−
8−REPO=$(git config --get remote.origin.url)
9−
10−LOC=$1
11−KEY=$(readlink -f "$2")
12−
13−cd $LOC
14−echo "creating $LOC/deploy...\n"
15−mkdir deploy
16−cd deploy
17−
18−echo "creating $LOC/deploy/config...\n"
19−mkdir config
20−
21−echo "copying ssh key $LOC/deploy/ssh_key...\n"
22−cp "$KEY" ssh_key
23−chmod 700 ssh_key
24−
25−echo "cloning repository...\n"
26−git clone "$REPO" src
27−cd src
28−echo "updating repository submodules...\n"
29−git submodule update --init --recursive