
Linux VPS Hardening, Caddy HTTP/3, and Automated Encrypted Telegram Backups for Automation Pipelines
Andrés Morales
AI & Full-Stack Systems Architect
As a Senior Full-Stack & AI Automation Engineer, shipping features is only half the battle. If underlying infrastructure lacks determinism, resilience, and solid hardening, mission-critical pipelines will inevitably break under load.
Today in the studio, our focus shifted toward consolidating multi-repository architectures, technical reviews for studio briefs, and executing systematic server hardening across our Linux production VPS.

1. Today's Challenge: Deterministic Perimeter Defense and Zero-Cost Backups
Our AI pipelines and web systems demand low-maintenance high availability:
- Strict perimeter isolation by dropping all non-essential inbound ports.
- Active intrusion prevention targeting SSH and Docker authentication endpoints.
- Serving traffic with ultra-low latency through HTTP/3 (QUIC) and TLS 1.3 without manual certificate overhead.
- Off-host database snapshots stored automatically in a secure, accessible vault.

2. Infrastructure & Hardening Architecture
Our production setup leverages three defense layers:
- Network Perimeter (UFW): Strict drop policy (
DEFAULT_INPUT_POLICY="DROP"), exposing only port 22 (SSH secured by Ed25519 keys), 80 (HTTP redirect), and 443 (HTTPS/UDP for QUIC). - Intrusion Prevention (Fail2ban): Active jails for
sshdanddocker-authfeaturing exponential ban intervals. - Edge Reverse Proxy (Caddy Server): Native QUIC / HTTP/3 support and automated certificate lifecycle management via Let's Encrypt.
flowchart TD
Client([External Traffic]) -->|QUIC / HTTP/3 - Port 443| UFW[UFW Firewall - Strict Drop]
UFW --> Caddy[Caddy Edge Proxy - Auto TLS 1.3]
Caddy --> App[Next.js App / AI Pipelines]
F2B[Fail2ban Jails: sshd & docker-auth] -.->|Inspect & Ban| UFW
Cron[Daily Scheduled Cron] -->|pg_dump streaming| BackupScript[Encrypted Snapshot Script]
BackupScript -->|Telegram Bot HTTPS API| TelegramVault[(Private Telegram Vault)]
3. Automated Telegram Database Vault Backup
Instead of provisioning bloated storage pipelines for rapid daily rollbacks, we deployed a lightweight streaming bash pipeline dispatching snapshots to a dedicated private Telegram vault:
#!/usr/bin/env bash
set -euo pipefail
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
BACKUP_DIR="/var/backups/db"
FILENAME="db_snapshot_${TIMESTAMP}.sql.gz"
FILEPATH="${BACKUP_DIR}/${FILENAME}"
mkdir -p "${BACKUP_DIR}"
# Compressed stream snapshot
docker exec -t production-postgres-1 pg_dump -U "$DB_USER" "$DB_NAME" | gzip -9 > "${FILEPATH}"
# Ship to private Telegram vault
curl -s -F chat_id="${TELEGRAM_BACKUP_CHAT_ID}" \
-F document=@"${FILEPATH}" \
-F caption="🔒 Production DB Snapshot - ${TIMESTAMP}" \
"https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendDocument" > /dev/null
# Local cleanup (3-day rolling retention)
find "${BACKUP_DIR}" -type f -name "*.sql.gz" -mtime +3 -delete
4. Operational ROI and Reliability
Engineering efficiency comes from automating defensive posture and backup routines once, allowing total focus on core product architecture.

Looking to build scalable, automated, and hardened infrastructure for your digital products? Let's connect at andresmorales.com.co.
Need to automate your business operations or ship high-velocity web products?
I architect AI pipelines, modernize stacks with Next.js, and harden Linux infrastructure. Let’s talk architecture, scalability, and measurable ROI.
