aboutsummaryrefslogtreecommitdiff
path: root/deploy.sh
diff options
context:
space:
mode:
authorMartin Ashby <martin@ashbysoft.com>2022-12-30 18:34:59 +0000
committerMartin Ashby <martin@ashbysoft.com>2022-12-30 18:34:59 +0000
commit18d599a56064f96b9662e90fccddc36081425c5d (patch)
treea3963905ebbb81191e930342720510dfac98c3f2 /deploy.sh
parentfd330cb15d5247a467d086d9b227b56ab4bd2879 (diff)
downloadmfashby.net-18d599a56064f96b9662e90fccddc36081425c5d.tar.gz
mfashby.net-18d599a56064f96b9662e90fccddc36081425c5d.tar.bz2
mfashby.net-18d599a56064f96b9662e90fccddc36081425c5d.tar.xz
mfashby.net-18d599a56064f96b9662e90fccddc36081425c5d.zip
Update deploy script to do all the builds before copies
Also use rsync instead of scp, it's a bit quicker
Diffstat (limited to 'deploy.sh')
-rwxr-xr-xdeploy.sh24
1 files changed, 18 insertions, 6 deletions
diff --git a/deploy.sh b/deploy.sh
index d66afa0..67c978d 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -2,17 +2,29 @@
set -e
-# Copy static site
+# Build static site
hugo
-scp -r public/* root@rpi3:/var/www/mfashby.net/
-# build & install comments app
+# Build comments app
pushd comments
-RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc" cargo build --target=aarch64-unknown-linux-gnu --release
+if [ $(uname -m) != "aarch64" ]
+then
+ RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc"
+fi
+cargo build --target=aarch64-unknown-linux-gnu --release
+popd
+
+# TODO update caddy with offline message while site being updated
+
+# Copy static site
+rsync -rz public/* root@rpi3:/var/www/mfashby.net
+
+# Copy comments app and reboot
ssh root@rpi3 -C systemctl stop comments
-scp target/aarch64-unknown-linux-gnu/release/comments root@rpi3:/usr/local/bin/comments
-scp comments.service root@rpi3:/etc/systemd/system/comments.service
+rsync comments/target/aarch64-unknown-linux-gnu/release/comments root@rpi3:/usr/local/bin/comments
+rsync comments/comments.service root@rpi3:/etc/systemd/system/comments.service
ssh root@rpi3 -C systemctl daemon-reload
ssh root@rpi3 -C systemctl restart comments
popd
+# TODO set caddy back to online