aboutsummaryrefslogtreecommitdiff
path: root/deploy.sh
blob: 4c32b5b5683abcf79042331d36bb6a3892647caa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash

set -e

# Build static site
hugo

# Build comments app
pushd comments
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
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

# TODO set caddy back to online