From 1db7ad0581e7b51c472e03899c367ed61d24744c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 20 Nov 2018 02:16:23 +0100 Subject: Add deployment script To deploy, run $ make deploy This checks prerequisites and runs `scripts/deploy.sh`. Makefile: Include a new target that builds the Rust binaries for Linux using Docker. The script `rsync`s the website files to the server, moves some files around on the server, and runs the database migrations. Currently I'm getting an error at the database migration stage, as it seems I can't use `UTC_TIMESTAMP()` as a default column value. Need to correct that to get a clean deployment. --- scripts/deploy.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/deploy.sh (limited to 'scripts/deploy.sh') diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..a2bde7a --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -ex + + +source license-generator/.env + +echo 'Deploying...' + +rsync -avz \ + --exclude 'assets/stylesheets' \ + 400.html \ + 404.html \ + assets \ + doc \ + downloads \ + index.html \ + internal_error.html \ + license-generator/target/release/fulfillment \ + license-generator/target/release/license \ + robots.txt \ + thank-you.html \ + "$SSH_SERVER":"$REMOTE_PUBLIC_WWW/" + +rsync -avz \ + --exclude '.git' \ + license-generator/migrations \ + production-config \ + scripts \ + "$SSH_SERVER":~/ + + +echo 'Running post-deploy script...' +ssh "$SSH_SERVER" 'bash ~/scripts/post-deploy.sh' -- cgit v1.2.3