March 18, 2026 ErlangOTP
Understanding OTP Supervision Trees in Practice
After spending the last year maintaining a high-throughput Erlang service in production,
I've developed a much deeper appreciation for OTP's supervision model. What initially
seemed like boilerplate turned out to be one of the most elegant fault-tolerance
primitives I've encountered.
The key insight is that supervisors aren't just about restarting crashed processes —
they're about defining the semantics of failure in your system. A
one_for_one strategy says "this child is independent"; rest_for_one
says "children are ordered and dependent"; one_for_all says "these children
form a cohesive unit."
%% A simple supervisor with one_for_one strategy
init([]) ->
Children = [
#{id => worker_pool,
start => {worker_pool, start_link, []},
restart => permanent,
shutdown => 5000,
type => worker}
],
{ok, {#{strategy => one_for_one, intensity => 10, period => 60}, Children}}.
One pattern I've found particularly useful is the "let it crash" philosophy paired with
proper supervision boundaries. Instead of defensive coding with try/catch everywhere,
you define clean restart semantics and let the supervisor handle recovery.
Read more →
February 28, 2026 nginxInfrastructure
nginx Stream Module: TCP/UDP Proxying Done Right
Most engineers know nginx as an HTTP server and reverse proxy, but the
ngx_stream_core_module — available since nginx 1.9.0 — turns it into
a capable Layer 4 proxy. I recently used it to build a transparent TCP routing layer,
and it handled 50k concurrent connections on a single modest VPS.
The stream module's killer feature is ssl_preread: it can inspect the
TLS Client Hello to extract the SNI hostname without actually terminating TLS. This
lets you route traffic to different backends based on the target hostname — without
any certificate management at the proxy layer.
stream {
map $ssl_preread_server_name $backend {
api.example.com backend_api:8443;
app.example.com backend_app:8443;
default backend_default:8443;
}
server {
listen 443;
ssl_preread on;
proxy_pass $backend;
proxy_timeout 1d;
}
}
A few things to keep in mind: the stream block must live at the top level of
nginx.conf, not inside the http block. Also, the
proxy_buffer_size needs to be large enough to buffer the entire
Client Hello (16KB is safe).
Read more →
February 10, 2026 LinuxSecurity
Hardening a Linux Server in 2026: What Actually Matters
I've set up dozens of VPS instances over the years, and the security checklist has
evolved significantly. Some old advice (like disabling ping) is cargo-culted nonsense.
Here's what I actually do when spinning up a fresh Ubuntu 24.04 server.
SSH hardening is table stakes. Change the default port, disable
password authentication, use Ed25519 keys. Set AllowUsers explicitly.
Beyond that, I always configure fail2ban with a tight jail:
[sshd]
enabled = true
maxretry = 3
findtime = 120
bantime = 86400
iptables over ufw for production. UFW is convenient for development,
but for production I prefer explicit iptables rules I can reason about. My baseline:
DROP everything on INPUT by default, then ACCEPT only loopback, established connections,
ICMP, and the specific ports I need.
Rate-limiting at the firewall level is underrated. The
hashlimit module lets you limit new connections per source IP without
any application-layer involvement — cheap and effective against scanners.
Read more →
January 22, 2026 PythonFastAPI
FastAPI for Internal Tooling: Lessons from a Year in Production
Internal tools have different requirements than public APIs. You don't need OpenAPI
documentation, rate limiting at scale, or complex auth — but you do need things to
just work reliably when you SSH in at 2am to investigate an incident.
FastAPI hits a sweet spot for this use case. The automatic request validation via
Pydantic catches silly mistakes before they cause issues. The async support means
you can run subprocess commands concurrently without threads. And the dependency
injection system makes it trivial to add auth to every endpoint.
from fastapi import Depends, FastAPI
from fastapi.security import HTTPBasic, HTTPBasicCredentials
app = FastAPI(docs_url=None) # no public docs
security = HTTPBasic()
def require_auth(creds: HTTPBasicCredentials = Depends(security)):
# timing-safe comparison
if not secrets.compare_digest(creds.username, ADMIN_USER):
raise HTTPException(401)
# ...
One pattern I've found essential: use Server-Sent Events for log streaming rather
than WebSockets. SSE is simpler, works through any HTTP/1.1 proxy, and browser
support is universal. The sse-starlette library makes it trivial to
stream journalctl -f output to a browser.
Read more →