annotate host/update2.sh @ 2134:de3107eb911f

improve previous
author Violet7
date Fri, 16 Jan 2026 17:59:40 -0800
parents c3b4c19f2d8a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1628
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 #!/bin/bash
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 set -e
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 ../scripts/build-luan.sh
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 mkdir -p local
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 mkdir -p logs
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 rm -f logs/*
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 hg identify >logs/changeset.txt
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10
2037
a4435e2e3417 Edit scripts to use acme-tiny
Violet7
parents: 2015
diff changeset
11 if [ ! -f local/tiny_account.key ]; then
2096
c5b2b0bb841e inline update_ssl_conf.sh
Violet7
parents: 2037
diff changeset
12 echo "Register letsencrypt (tiny-acme)"
c5b2b0bb841e inline update_ssl_conf.sh
Violet7
parents: 2037
diff changeset
13 openssl genrsa 4096 >local/tiny_account.key
2015
61b0cc7db09c Manually specify letsencrypt server due to acme default server change (to zerossl)
Violet7
parents: 1632
diff changeset
14 fi
1630
b735ed134662 add nginx and ssl for host
fffilimonov
parents: 1629
diff changeset
15
2133
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
16 nginx_conf_dir=$(
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
17 for d in \
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
18 /usr/local/etc/nginx/servers \
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
19 /etc/nginx/conf.d; do
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
20 if [ -d "$d" ]; then
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
21 echo "$d"
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
22 break
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
23 fi
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
24 done
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
25 )
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
26
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
27 if [ -n "$nginx_conf_dir" ]; then
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
28 echo "using nginx conf dir: $nginx_conf_dir"
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
29 else
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
30 echo "ERROR: No nginx conf dir found.\nFind it and add it to update2.sh."
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
31 exit 1
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
32 fi
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
33
2037
a4435e2e3417 Edit scripts to use acme-tiny
Violet7
parents: 2015
diff changeset
34 # id -gn gets the name of the primary group of the current user (staff)
2133
c3b4c19f2d8a attempt to autodetect and use nginx confs dir
Violet7
parents: 2129
diff changeset
35 luan startup/nginx/nginx.conf.luan $(pwd) $nginx_conf_dir $(whoami) $(id -gn) | sudo tee $nginx_conf_dir/luanhost.conf >/dev/null
2134
de3107eb911f improve previous
Violet7
parents: 2133
diff changeset
36 # DON'T put this in the auto-loaded configs dir,
de3107eb911f improve previous
Violet7
parents: 2133
diff changeset
37 # it is not meant to be loaded on its own.
de3107eb911f improve previous
Violet7
parents: 2133
diff changeset
38 luan startup/nginx/nginx.default.conf.luan $(pwd) >$(pwd)/local/luanhost.default.conf
1628
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39
2096
c5b2b0bb841e inline update_ssl_conf.sh
Violet7
parents: 2037
diff changeset
40 # this is done because the nginx conf uses absolute paths
c5b2b0bb841e inline update_ssl_conf.sh
Violet7
parents: 2037
diff changeset
41 # and this breaks sites when the luan/host directory is moved
2102
3112b06ab447 add host/update.luan
Franklin Schmidt <fschmidt@gmail.com>
parents: 2099
diff changeset
42 luan classpath:luan/host/update.luan
2096
c5b2b0bb841e inline update_ssl_conf.sh
Violet7
parents: 2037
diff changeset
43
1628
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 echo Starting...
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 ./start.sh