32 Commits
Author SHA1 Message Date
NetworkCatsandClaude Opus 5.5 c05b71e33b Raise rate limits
Each IP may now make 120 requests per minute instead of 60. Under
load the limit drops to 60 RPM once the site reaches 600 RPS and to
30 RPM at 1000 RPS, instead of 30 and 15 RPM at 200 and 300 RPS.

One page load makes three or four requests, and many visitors share
an IP behind carrier-grade NAT or an office gateway, so the old
limits throttled real users. The old global thresholds were also far
below what the host can serve. Update the FAQ in every locale to
match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:33:39 +08:00
NetworkCatsandClaude Opus 5.5 b8c5a7439c Fix fail2ban and disable SSH password logins
fs.nr_open = 65536 sat below systemd's default hard NOFILE limit
(524288), so any service without its own LimitNOFILE failed to restart
once the sysctl was applied (205/LIMITS); fail2ban was down after the
last deploy, and after a reboot ssh could be too. Leave nr_open at the
kernel default.

fail2ban also read /var/log/auth.log, which Debian 13 no longer
writes; read sshd's journal instead.

Disable password and keyboard-interactive SSH logins and allow root
with keys only. The drop-in is named 10-* so it wins over cloud-init's
50-cloud-init.conf, which turns password logins on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 21:58:38 +08:00
NetworkCatsandClaude Opus 5.5 712a82698e Fix Docker failing to start on first deploy
The firewall role's "Reload systemd" handler shadowed the docker role's
handler of the same name, and its flush_handlers ran the pending Docker
restart right after base lowered fs.nr_open, without a daemon-reload.
Docker then started without its LimitNOFILE override and systemd could
not apply the default limit (status=205/LIMITS).

Reload systemd inline in the firewall role instead of through a
handler, so other roles' handlers keep running at the end of the play,
and reload before ensuring Docker is running so a host left in this
state recovers on the next deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 21:41:25 +08:00
NetworkCatsandClaude Opus 5.5 cd46024a46 Restrict HTTPS to Cloudflare with UFW on the host
The Vultr firewall now only opens 443 (and SSH); the host decides who may
use it. Docker-published ports bypass UFW's INPUT rules, so the new
firewall role routes Docker traffic through UFW's route rules via the
DOCKER-USER chain and allows Cloudflare's IPv4 ranges on 443 with
`ufw route allow`. ufw-cloudflare-sync keeps those rules in step with
https://www.cloudflare.com/ips-v4 daily via a systemd timer, refusing
to touch the rules if the list looks wrong.

The role runs on every deploy, before HAProxy starts, and fails the
deploy if the filtering is not in place, since HAProxy trusts
CF-Connecting-IP from anything that reaches it. The plain UFW allows
for 80/443 are dropped from the base role as they never applied to
Docker-published ports.

Rotating the deploy SSH key now rebuilds the instance, because Vultr
only installs SSH keys at creation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 21:13:48 +08:00
NetworkCats 223eab2be9 Deploy Vultr High Frequency instance in SJC 2026-07-29 08:56:21 +08:00
NetworkCatsandClaude Opus 4.7 4ba00fadf5 feat: poll MMDB every 6 hours to mitigate upstream release drift
The daily scheduled update at 01:20 UTC was systematically lagging the
upstream mergedipdb release by 24h. The upstream cron nominally fires
at 01:00 UTC but GitHub Actions schedule latency shifts the actual
publish time anywhere from ~01:05 to ~06:00+ UTC, so any fixed
single-daily time misses the current release on delayed days.

Introduce DB_UPDATE_INTERVAL_HOURS (default 6, must divide 24 evenly),
shift the anchor DB_UPDATE_TIME_UTC default to 00:20, and replace
secs_until_next with secs_until_next_tick that schedules at anchor +
N*interval. Also set RUST_LOG=rustyip=info,warn in the Ansible env
template so the scheduler and "database updated successfully (N bytes)"
info logs are actually visible in docker logs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 07:26:57 +00:00
NetworkCatsandClaude Opus 4.7 d1280a46ac feat: force fresh MMDB download on every deploy
Wipe the target color's database volume before starting the container so
each push re-downloads the latest Merged-IP.mmdb. Gate /health on DB
readiness (503 until loaded) so HAProxy blue-green only flips traffic
once the new backend has a usable DB, and raise the Ansible health-wait
window from 120s to 360s to cover the download.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 07:05:57 +00:00
NetworkCats afb5bd4c9b downgrade to Vultr Regular Performance 1vCPU/1GB and tighten resource limits
Switch from High Frequency 2vCPU/2GB ($18/mo) to Regular Performance
1vCPU/1GB ($5/mo). Tighten HAProxy rate limits from 100/50/30 RPM to
60/30/15 RPM with lower global RPS thresholds (200/300 instead of
300/500). Reduce maxconn, socket buffers, file descriptor limits, and
Docker resource settings to fit within 1GB RAM constraints. Update all
user-facing content and translations across 14 locales.
2026-04-03 21:18:09 +08:00
NetworkCats ccfa7decda feat: schedule DB updates at fixed daily UTC time instead of interval
Replace DB_UPDATE_INTERVAL_HOURS with DB_UPDATE_TIME_UTC (HH:MM format,
default 01:20) so the database update runs at a predictable time each day.
This ensures the update happens 20 minutes after the upstream Merged IP
Data release at 01:00 UTC.
2026-03-22 16:43:02 +08:00
NetworkCats d078859c5c relax rate limits: 100/50/30 RPM tiers at 0/300/500 RPS thresholds 2026-03-22 14:13:12 +08:00
NetworkCats fb661933e8 fix(deploy): replace SIGHUP reload with container recreate to fix bind mount staleness
Docker file-level bind mounts track inodes, not paths. Ansible template
writes create new inodes, leaving the container reading orphaned files.
Replacing SIGHUP with force-recreate ensures fresh mounts every time,
eliminating the admin socket dependency entirely.
2026-03-20 09:40:56 +08:00
NetworkCats bd71dae443 fix(deploy): preserve bind mount inode with unsafe_writes for HAProxy config 2026-03-20 08:56:06 +08:00
NetworkCats 09f3b6bd72 fix(deploy): move HAProxy admin socket to /tmp for correct permissions
The named Docker volume created /var/run/haproxy owned by root:root,
preventing the haproxy user (uid 99) from creating the socket file.
2026-03-20 08:17:36 +08:00
NetworkCats f72cf8190b fix(deploy): retry admin socket command after HAProxy reload 2026-03-20 07:36:52 +08:00
NetworkCats 1c8f274453 refactor(deploy): use HAProxy admin socket instead of stats HTTP API 2026-03-20 07:01:09 +08:00
NetworkCats 258f68af5d fix(deploy): force server out of maintenance after HAProxy SIGHUP reload 2026-03-20 06:49:29 +08:00
NetworkCats 60e4f08fd3 docs: update installation guides for IPv4 domain configuration 2026-03-11 05:06:58 +08:00
NetworkCats d7f24cc0ab feat: update Ansible and deploy workflow for IPv4 domain support 2026-03-11 05:03:43 +08:00
NetworkCats 5565f4a0a5 feat: add HTTP port 80 support with Cloudflare-only firewall rules 2026-03-08 05:52:42 +08:00
NetworkCats 801ed1f45e fix: verify backend is UP in HAProxy before removing old container 2026-03-08 04:40:53 +08:00
NetworkCats bc282c4279 fix: allow HAProxy to start with unresolved inactive backend 2026-03-08 03:02:10 +08:00
NetworkCats f0b6a18083 fix: relax TLS cert permissions for HAProxy container access 2026-03-08 02:23:22 +08:00
NetworkCats e7fe02a3ea fix: correct HAProxy 3.3.4 config syntax in prod template 2026-03-07 22:49:36 +08:00
NetworkCats 865ebd5700 fix: increase deploy health check timeout and reduce start_period 2026-03-07 22:39:48 +08:00
NetworkCats 51701f7070 docs 2026-03-07 19:32:44 +08:00
NetworkCats 67c2f30731 update docs 2026-03-07 19:30:03 +08:00
NetworkCats a15486300e add note 2026-03-06 21:10:32 +08:00
NetworkCats a22ca3a8d1 docs: rewrite INSTALL.md for general users, move original to deploy/ 2026-03-06 00:37:18 +08:00
NetworkCats 6b2f0f745d feat: switch container registry from GHCR to Docker Hub 2026-03-06 00:05:06 +08:00
NetworkCats 282c07b8cd fix: improve blue-green deployment with rollback, graceful reload, and volume isolation 2026-03-05 23:38:23 +08:00
NetworkCats 6d18eecd3f feat: right-size production config for 10k maxconn with ECC cert support 2026-03-05 21:33:43 +08:00
NetworkCats 5ec9a53844 feat: add deployment infrastructure with Terraform, Ansible, and GitHub Actions 2026-03-05 21:12:50 +08:00