diff options
| author | Paul Buetow <paul@buetow.org> | 2024-03-13 09:00:12 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-03-14 23:57:14 +0200 |
| commit | 438f47bccab4fa8128e085131fbd9dc499fd07b3 (patch) | |
| tree | 3d4f20b3aa1c9270835f0b7bf1c83d38b6488f45 /frontends/scripts | |
| parent | b2958427dee916d933f2b4c51f4fe22e307a8cf1 (diff) | |
failover DNS to fishfinger
Diffstat (limited to 'frontends/scripts')
| -rw-r--r-- | frontends/scripts/acme.sh.tpl | 13 | ||||
| -rw-r--r-- | frontends/scripts/gemtexter.sh.tpl | 14 | ||||
| -rw-r--r-- | frontends/scripts/rsync.sh.tpl | 6 |
3 files changed, 20 insertions, 13 deletions
diff --git a/frontends/scripts/acme.sh.tpl b/frontends/scripts/acme.sh.tpl index 0d2dd3c..2b588f4 100644 --- a/frontends/scripts/acme.sh.tpl +++ b/frontends/scripts/acme.sh.tpl @@ -1,12 +1,15 @@ #!/bin/sh -<% - our $primary = $is_primary->($vio0_ip); - our $prefix = $primary ? '' : 'www.'; --%> +MY_IP=`ifconfig vio0 | awk '$1 == "inet" { print $2 }'` function handle_cert { host=$1 + host_ip=`host $host | awk '/has address/ { print $(NF) }'` + if [ "$MY_IP" != "$host_ip" ]; then + echo "Not serving $host, skipping..." + return + fi + # Create symlink, so that relayd also can read it. crt_path=/etc/ssl/$host if [ -e $crt_path.crt ]; then @@ -19,10 +22,12 @@ function handle_cert { has_update=no <% for my $host (@$acme_hosts) { -%> +<% for my $prefix ('', 'www.', 'mirror.') { -%> handle_cert <%= $prefix.$host %> if [ $? -eq 0 ]; then has_update=yes fi +<% } -%> <% } -%> # Current server's FQDN (e.g. for mail server certs) diff --git a/frontends/scripts/gemtexter.sh.tpl b/frontends/scripts/gemtexter.sh.tpl index df6fca9..ebd25d8 100644 --- a/frontends/scripts/gemtexter.sh.tpl +++ b/frontends/scripts/gemtexter.sh.tpl @@ -19,6 +19,10 @@ function ensure_site { ln -s $basename www.$basename fi + if [ ! -e mirror.$basename ]; then + ln -s $basename mirror.$basename + fi + if [ ! -d $basename ]; then git clone $repo -b $branch --single-branch $basename else @@ -43,10 +47,13 @@ function ensure_links { if [ ! -e www.$target ]; then ln -s $basename www.$target fi + + if [ ! -e mirror.$target ]; then + ln -s $basename mirror.$target + fi } -<% if ($is_primary->($vio0_ip)) { %> -for site in foo.zone paul.buetow.org; do +for site in foo.zone paul.buetow.org snonux.foo; do ensure_site \ /var/gemini/$site \ https://codeberg.org/snonux/$site \ @@ -58,6 +65,3 @@ for site in foo.zone paul.buetow.org; do done ensure_links /var/gemini/paul.buetow.org buetow.org -ensure_links /var/gemini/paul.buetow.org snonux.foo -<% } %> - diff --git a/frontends/scripts/rsync.sh.tpl b/frontends/scripts/rsync.sh.tpl index c55a86b..8d7004b 100644 --- a/frontends/scripts/rsync.sh.tpl +++ b/frontends/scripts/rsync.sh.tpl @@ -2,7 +2,5 @@ PATH=$PATH:/usr/local/bin -<% unless ($is_primary->($vio0_ip)) { %> -/usr/local/bin/rsync -av --delete rsync://blowfish.buetow.org/publicgemini/ /var/gemini -/usr/local/bin/rsync -av --delete rsync://blowfish.buetow.org/publichttp/ /var/www/htdocs -<% } %> +# disabled, as pulled directly from codeberg now +exit 0 |
