Fix the tunnel's error 1000 and notes sync, move maintenance to 05:00
nginx's network aliases for the public names vanish while it is stopped, so cloudflared fell through to public DNS, got Cloudflare's own IPs and visitors saw error 1000 on every deploy. nginx now has a fixed address and cloudflared pins both names to it, so a stopped nginx is a plain 502. The same aliases sent silverbullet-git's pushes to ssh://DOMAIN:2222 to nginx, which has no 2222: nothing has pushed since 2026-10-15. It now maps DOMAIN to the host gateway, where gitea publishes that port. The weekly maintenance restarts dockerd and every container; at 01:00 it kept catching late-night SilverBullet saves. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -2,7 +2,10 @@ name: Weekly Maintenance
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 1 * * 0"
|
# 05:00 UTC Sunday (06:00 in BST). The upgrade restarts dockerd and
|
||||||
|
# every container, so it runs when nobody is likely to be mid-edit;
|
||||||
|
# 01:00 kept catching late-night SilverBullet saves.
|
||||||
|
- cron: "0 5 * * 0"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -275,6 +275,17 @@ against a name it covers. `https://nginx` would fail that check and need No
|
|||||||
TLS Verify. The flip side: **an expired certificate now takes the tunnel down
|
TLS Verify. The flip side: **an expired certificate now takes the tunnel down
|
||||||
with a 502**, which is why renewal over DNS-01 (step 5) matters.
|
with a 502**, which is why renewal over DNS-01 (step 5) matters.
|
||||||
|
|
||||||
|
An alias only exists while nginx is running, so cloudflared also pins both
|
||||||
|
names to nginx's fixed address (`172.28.255.251`) with `extra_hosts`. Without
|
||||||
|
that, while nginx is stopped for a deploy or the weekly maintenance, the name
|
||||||
|
falls through to public DNS, resolves to Cloudflare itself, and visitors see
|
||||||
|
Cloudflare error 1000 instead of a 502.
|
||||||
|
|
||||||
|
The aliases have a side effect for anything else on `app-network` that uses
|
||||||
|
the public name for a port nginx does not serve. `silverbullet-git` pushes to
|
||||||
|
Gitea's SSH on `<DOMAIN>:2222`, so it maps `<DOMAIN>` to the host gateway
|
||||||
|
instead, where Gitea publishes that port.
|
||||||
|
|
||||||
Setup, once:
|
Setup, once:
|
||||||
|
|
||||||
1. Cloudflare dashboard → the domain must be on Cloudflare DNS.
|
1. Cloudflare dashboard → the domain must be on Cloudflare DNS.
|
||||||
|
|||||||
@@ -146,6 +146,11 @@ services:
|
|||||||
aliases:
|
aliases:
|
||||||
- ${DOMAIN}
|
- ${DOMAIN}
|
||||||
- www.${DOMAIN}
|
- www.${DOMAIN}
|
||||||
|
# Fixed for cloudflared's extra_hosts (see there): an alias only
|
||||||
|
# exists while nginx is running, and this address is pinned to the
|
||||||
|
# same names for when it is not. Top of the /16 beside cloudflared's,
|
||||||
|
# away from docker's dynamic allocations.
|
||||||
|
ipv4_address: 172.28.255.251
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 80:80
|
||||||
- 443:443
|
- 443:443
|
||||||
@@ -227,6 +232,15 @@ services:
|
|||||||
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN:-}
|
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN:-}
|
||||||
depends_on:
|
depends_on:
|
||||||
- nginx
|
- nginx
|
||||||
|
# Pins the tunnel origin's names to nginx's fixed address. nginx's aliases
|
||||||
|
# vanish while it is stopped (every deploy and the weekly maintenance), and
|
||||||
|
# docker's DNS then forwards the name to public DNS, which answers with
|
||||||
|
# Cloudflare's own IPs: the tunnel sent requests back to the edge and
|
||||||
|
# visitors got error 1000. /etc/hosts wins over DNS, so a stopped nginx is
|
||||||
|
# now a refused connection, which cloudflared reports as a plain 502.
|
||||||
|
extra_hosts:
|
||||||
|
- "${DOMAIN}:172.28.255.251"
|
||||||
|
- "www.${DOMAIN}:172.28.255.251"
|
||||||
networks:
|
networks:
|
||||||
app-network:
|
app-network:
|
||||||
ipv4_address: 172.28.255.250
|
ipv4_address: 172.28.255.250
|
||||||
@@ -453,6 +467,13 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
|
# The vault's remotes are ssh://git@DOMAIN:2222/..., but nginx's network
|
||||||
|
# aliases make DOMAIN resolve to nginx on app-network, which has no :2222,
|
||||||
|
# so every pull and push was refused. /etc/hosts wins over Docker's DNS, so
|
||||||
|
# this sends DOMAIN back to the host, where gitea publishes 2222. The name
|
||||||
|
# is unchanged, so known_hosts still matches.
|
||||||
|
extra_hosts:
|
||||||
|
- "${DOMAIN}:host-gateway"
|
||||||
# Same uid SilverBullet writes as, so commits don't leave root-owned objects
|
# Same uid SilverBullet writes as, so commits don't leave root-owned objects
|
||||||
# in .git that the host user can no longer clean up.
|
# in .git that the host user can no longer clean up.
|
||||||
user: "1000:1000"
|
user: "1000:1000"
|
||||||
|
|||||||
Reference in New Issue
Block a user