forked from GrapheneOS/ns1.grapheneos.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-static
executable file
·36 lines (27 loc) · 939 Bytes
/
deploy-static
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
30
31
32
33
34
35
36
#!/bin/bash
set -o errexit -o nounset -o pipefail
source venv/bin/activate
touch nginx-lock
exec {fd}< nginx-lock
if ! flock -n $fd; then
echo already deploying >&2
exit 1
fi
rsync -pcv --chmod=F755 --fsync --preallocate certbot-replicate root@0.ns2.grapheneos.org:/usr/local/bin/
rsync -pcv --chmod=F644 --fsync --preallocate replicate.conf root@0.ns2.grapheneos.org:/etc/systemd/system/certbot-renew.service.d/
. servers.sh
for server in ${servers[@]}; do
echo $server
remote=root@$server
rm -rf nginx-tmp
cp -a nginx nginx-tmp
if [[ $server == ns1.grapheneos.org ]]; then
sed -i s/{{subdomain}}/ns1/g nginx-tmp/nginx.conf
else
sed -i s/{{subdomain}}/ns2/g nginx-tmp/nginx.conf
fi
gixy nginx-tmp/nginx.conf
rsync -rpcv --chmod=D755,F644 --delete --fsync --preallocate nginx-tmp/{nginx.conf,mime.types} $remote:/etc/nginx/
ssh $remote nginx -s reload
echo
done