Dev Notes Archive

Personal collection of development notes, snippets and troubleshooting guides. Mostly Rust, infrastructure and backend stuff.

Setting up Rust cross-compilation for ARM64

March 28, 2026

Quick guide on configuring rustup target add aarch64-unknown-linux-gnu and setting up linkers. Covers both native and cross-compilation workflows with Cargo. Also includes notes on using cross tool from cross-rs for Docker-based builds.

rustarm64cross-compilation

PostgreSQL query optimization notes

March 15, 2026

Collection of EXPLAIN ANALYZE patterns and index strategies that improved our API response times from 200ms to under 15ms. Key takeaway: partial indexes on filtered columns made the biggest difference. Also covers pg_stat_statements for finding slow queries.

postgresqlperformanceindexing

Docker multi-stage builds cheatsheet

February 22, 2026

Minimal Dockerfiles for Go, Rust and Node.js services. Final images under 20MB using scratch and alpine bases. Includes a comparison table of image sizes and build times across different strategies. See also the official Docker docs.

dockerdevopsoptimization

Nginx reverse proxy with WebSocket support

February 10, 2026

Configuration snippets for proxying WebSocket connections through nginx, including timeout tuning and proxy_set_header Upgrade forwarding. Solved the annoying 60s disconnect issue with proxy_read_timeout 3600s.

nginxwebsocketinfrastructure

Tokio async runtime: common pitfalls

January 25, 2026

Notes on blocking the Tokio runtime with CPU-heavy work, why spawn_blocking exists, and how select! cancellation works. Spent two days debugging a deadlock that turned out to be a std::sync::Mutex held across an .await point. Use tokio::sync::Mutex instead.

rusttokioasync

SSH tunneling and port forwarding recipes

January 12, 2026

Cheatsheet for local/remote/dynamic port forwarding with ssh -L, ssh -R, and ssh -D. Includes a ProxyJump setup for accessing services behind a bastion host without exposing them to the internet.

sshnetworkingsecurity

Monitoring Rust services with Prometheus + Grafana

December 18, 2025

Setup guide for exposing /metrics endpoint from rust-prometheus and building Grafana dashboards. Covers histogram buckets for latency tracking, counter vs gauge usage, and alerting on error rate spikes via Alertmanager.

rustmonitoringprometheus

TLS certificate management with Let's Encrypt

November 30, 2025

Automated cert renewal using Certbot with nginx plugin. Includes systemd timer setup for auto-renewal and testing with --dry-run. Also notes on wildcard certs via DNS-01 challenge with Cloudflare API.

tlsletsencryptsecurity

Redis caching patterns for REST APIs

October 15, 2025

Cache-aside, write-through, and write-behind patterns implemented with redis-rs. Key insight: use SETEX with TTL instead of manual expiry. Reduced database load by 70% on our heaviest endpoint. Also covers cache invalidation strategies — still the hardest problem in CS.

rediscachingbackend

systemd service files for Rust binaries

September 8, 2025

Template for running Rust services as systemd units with proper Restart=on-failure, logging to journald, and resource limits. Includes hardening options: ProtectSystem=strict, NoNewPrivileges=true, PrivateTmp=true.

systemdlinuxdeployment