diff options
author | EuAndreh <eu@euandre.org> | 2019-06-05 16:38:53 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-06-05 16:42:06 -0300 |
commit | 54fd61c887f266f8e2e6b1419a86fc6681116069 (patch) | |
tree | 74a9923d75be46dad6c967acd271cdb5d80fca45 /deploy.sh | |
parent | Use =nix build= instead of =nix-build= (diff) | |
download | server-54fd61c887f266f8e2e6b1419a86fc6681116069.tar.gz server-54fd61c887f266f8e2e6b1419a86fc6681116069.tar.xz |
Use Ansible instead of Bash for provisioning
The deployment is not quite working, and I'm unable to test right now:
DigitalOcean is returning 503 for my requests.
As of this commit, I can run =ansible-playbook provider.yml= more than once and
it will actually be idempotent.
Notes:
- SSH fingerprint are now taken from the public key file instead of manually
supplying it in the terraform template using the =digitalocean_ssh_key=
resource;
- use Ansible instead of ad-hoc Bash scripts for provisioning the Droplets
created by Terraform;
- use the =filename.env.extension= to create the concrete files in CI;
- use the =user_data= to add the know SSH key pair to the newly created Droplet;
- add =rotate-ssh-keys.sh= utils;
Diffstat (limited to 'deploy.sh')
-rwxr-xr-x | deploy.sh | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 9172803..0000000 --- a/deploy.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -cd "$(dirname "${BASH_SOURCE[0]}")" - -apt_wait() { - local i=0 - tput sc - while fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do - case $((i % 4)) in - 0 ) j="-" ;; - 1 ) j="\\" ;; - 2 ) j="|" ;; - 3 ) j="/" ;; - esac - tput rc - echo -en "\r[$j] Waiting for other software managers to finish..." - sleep 0.5 - ((i=i+1)) - done -} - -apt_wait - -echo "Ubuntu update and install docker-compose..." -ssh "$TLD" sudo apt-get update -ssh "$TLD" sudo apt-get upgrade -y -ssh "$TLD" sudo apt-get install -y docker-compose -ssh "$TLD" sudo apt-get autoremove -y -echo "Done." - -echo "Copy over files..." -ssh "$TLD" mkdir -p /home/vps/ -ssh "$TLD" 'grep /home/vps/ /root/.profile || echo "cd /home/vps/" >> /root/.profile' -scp ./scripts/box/bash-aliases.sh "$TLD":/root/.bash_aliases -envsubst < docker-compose.yaml | ssh "$TLD" 'cat > /home/vps/docker-compose.yaml' -echo "Done." - -echo "Restart docker-compose" -ssh "$TLD" "cd /home/vps/ && docker-compose pull" -ssh "$TLD" "cd /home/vps/ && docker-compose up -d" -echo "Done." |