惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Latest
Security Latest
T
The Exploit Database - CXSecurity.com
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
Help Net Security
Help Net Security
PCI Perspectives
PCI Perspectives
T
The Blog of Author Tim Ferriss
H
Heimdal Security Blog
The Register - Security
The Register - Security
Schneier on Security
Schneier on Security
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
L
LangChain Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
MongoDB | Blog
MongoDB | Blog
美团技术团队
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog
C
Cybersecurity and Infrastructure Security Agency CISA
月光博客
月光博客
B
Blog RSS Feed
Cyberwarzone
Cyberwarzone
U
Unit 42
AWS News Blog
AWS News Blog
F
Fortinet All Blogs
L
LINUX DO - 最新话题
GbyAI
GbyAI
T
Threat Research - Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
Attack and Defense Labs
Attack and Defense Labs
Engineering at Meta
Engineering at Meta
MyScale Blog
MyScale Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
V2EX - 技术
V2EX - 技术
Y
Y Combinator Blog
T
Tailwind CSS Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Recorded Future
Recorded Future
TaoSecurity Blog
TaoSecurity Blog
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
M
MIT News - Artificial intelligence
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Hacker News: Front Page

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How I Set Up HAProxy + ProxySQL on a Single OVH VPS for My Solo SaaS
DockSky · 2026-06-23 · via DEV Community

TL;DR: I needed to expose MySQL on the internet without getting scanned into oblivion within 48 hours. I stacked HAProxy in front of ProxySQL in front of MySQL. It works. I also spent six hours fighting a proxy that reads its config file once in its life, then pretends it never met you.

The problem (or: why I didn't just buy an $80/month RDS)

I'm building DockSky, an indie SaaS, solo, on an 8 GB OVH VPS for about €14/month. No ops team. No "managed database" budget. Just me, Docker, and optimism.

Except DockSky isn't just a REST API with Postgres behind it. The product is managed multi-tenant MySQL: each customer gets their own MySQL user, their own credentials, real isolation. Not a tenant_id column and a prayer.

For that to work, I need external MySQL access on port 6033, without leaving MySQL wide open on the internet like a vending machine at 3 a.m.

Before ProxySQL, I already had HAProxy forwarding traffic to MySQL. It worked. In the sense that nobody had tried SELECT * FROM users WHERE 1=1 on me yet.

What I was missing:

  • Rate limiting at the network layer (a bot opening 500 connections is trivial)
  • Connection pooling (my VPS has 8 GB of RAM, not a datacenter)
  • A layer to route multi-tenant users without hand-editing MySQL every time someone signs up

So: a network gateway and a SQL gateway. Two tools, two jobs. Like a bouncer at the club door and another at the VIP bar. Except nobody's paying cover yet. Still in beta.


The architecture (Post-it edition)

Internet (port 6033, the only MySQL port open in UFW)
    ↓
HAProxy          → "Be nice, but not too many connections"
    ↓
ProxySQL         → "Does your user exist? Is this query acceptable?"
    ↓
MySQL 8.x        → localhost only, like a well-behaved introvert

On the side, Traefik handles HTTPS for admin interfaces:

  • haproxy-stats.docksky.fr to see if everything's green
  • proxysql-admin.docksky.fr to stare at tables I only half understand

I created the subdomains via the OVH DNS API. Because clicking 40 times in the OVH panel is the kind of task that makes me want to quit software and open a food truck.


What I actually deployed

1. Lock down MySQL (finally)

MySQL only listens locally:

ports:
  - "127.0.0.1:3306:3306"

Want my data? Get in line. Like the post office, but with rate limiting.

2. HAProxy: friendly but firm bouncer

Frontend on *:6033, backend to proxysql:6032:

stick-table type ip size 100k expire 30s store conn_cur,conn_rate(3s)
tcp-request connection track-sc0 src
tcp-request connection track-sc1 src
tcp-request connection reject if { sc0_conn_cur ge 5 }
tcp-request connection reject if { sc1_conn_rate ge 10 }

Human translation: 5 simultaneous connections max per IP, 10 new connections max every 3 seconds. Enough for an honest client. Not enough for a script kiddie with a for loop and too much free time.

3. ProxySQL: the six-hour side quest

Docker service with:

  • a template proxysql.cnf.template (no secrets in git, I learned that lesson earlier)
  • a custom entrypoint that generates config at startup
  • tmpfs on /var/lib/proxysql (more on that, it's the plot twist)
  • beta user sync from MySQL into ProxySQL at boot (otherwise every new DockSky customer means a manual intervention, and I don't have a support team)

The entrypoint waits for ProxySQL to be ready, then syncs users. Because ProxySQL takes 25 to 30 seconds to wake up. Like me, but without coffee.

4. Version everything before the VPS explodes

I spun up a docksky-infra repo with a full disaster recovery procedure. Because one day the VPS will die (Murphy's Law, Docker edition) and I don't want to rebuild this from memory on a Sunday night.


What broke (the part Dev.to loves)

Issue #1: Docker Compose 1.29.2

Symptom: KeyError: 'ContainerConfig'. Couldn't recreate containers.

My reaction: "It's not me, it's Docker." (Spoiler: it was Docker.)

Fix: upgrade to Docker Compose v2. docker compose, no hyphen. Like switching from a bike to a car, except the car costs fewer nerves.


Issue #2: ProxySQL and the ghost config file

The trap that ate six hours.

First boot: everything works. I think I'm a genius.

Container restart: Access denied. I think I'm an idiot.

Official docs, one killer sentence:

"After first startup the DB file is used instead of the config file"

ProxySQL creates an internal SQLite database on first boot. Then it ignores your .cnf like an ex ignoring your texts.

I tried:

  • --initial → nope
  • deleting the volume → the DB comes back, poltergeist style
  • native env vars → ProxySQL doesn't care

What actually works:

  1. tmpfs on /var/lib/proxysql. SQLite dies on every restart, ProxySQL is forced to reread the template
  2. custom entrypoint generates /etc/proxysql.cnf with real passwords (sed first, then perl when sed started giving me side-eye)
  3. wait 30 seconds before testing. Otherwise you think it's broken when it's just slow

Trade-off: any live change in ProxySQL (INSERT INTO mysql_users, etc.) vanishes on restart. Source of truth is the template. Not the moody SQLite database.


Issue #3: HAProxy declares ProxySQL dead

Logs: Access denied for user 'monitor'

I'd set option mysql-check user monitor. Except in ProxySQL, monitor is for watching MySQL backends, not for saying "hey, you alive?" to the proxy itself.

Fix:

option tcp-check

Port open? It's UP. Stoic philosophy for healthchecks.


Issue #4: Two stick-tables, one angry HAProxy

Symptom: crash loop, stick-table name 'mysql-in' conflicts

I'd declared two separate tables. HAProxy doesn't share well. One table, two counters. Like a Paris studio, but for IPs.


Issue #5: envsubst doesn't exist in Alpine

Logs: envsubst: command not found

The ProxySQL image is minimal. I'd copied a 2019 Stack Overflow tutorial. Classic.

Fix: sed, then perl. The current wrapper uses perl. At some point you stop fighting sed and accept defeat with dignity.


Issue #6: The silent restart (a few weeks later)

ProxySQL refused connections after a restart. No noise. No email. No "sorry boss."

I caught it in metrics within 5 minutes. Fixed in 30. That's exactly why I have healthchecks and a dashboard. Not to look good on a "our stack" slide.


What's running today

Component Role Status
MySQL 8.4 Data ✅ localhost only
ProxySQL 2.7 Pooling + multi-tenant users
HAProxy 2.8 Network rate limiting ✅ healthy
Traefik HTTPS admin + rest of DockSky

UFW: only 6033 is open for MySQL. Everything else goes through Traefik or stays on localhost. My security policy is "paranoid, but not paranoid enough to shut everything down and work from a Raspberry Pi in a closet."


Is it worth it for a solo SaaS?

Honestly: it depends.

Yes if:

  • you want multi-tenant MySQL without paying €80/month for managed DB
  • you'll read the docs when things break (and they will)
  • you document everything, because future you remembers nothing

No if:

  • you want to sleep without thinking about ProxySQL
  • you have 50 customers and no monitoring
  • you hate proxies with a SQLite personality disorder

For DockSky today, it's the right trade-off. A €14 VPS, a stack I understand layer by layer, and an infra repo I can rebuild from scratch if OVH decides on a Tuesday that my server has lived its best life.


What I learned

  1. Upgrade your tooling before adding a critical service. Docker Compose v2 saved me before ProxySQL even showed up.
  2. Read the official docs. The SQLite sentence was there. I just took 4 hours to find it.
  3. Simple healthchecks beat clever ones. TCP check is ugly but works.
  4. Wait 30 seconds. ProxySQL isn't lazy. It's… deliberate.
  5. Version everything. Shout-out to my dated docker-compose.yml backup from November 17, 2025.
  6. Monitor. A proxy that dies quietly is a proxy you discover when a customer DMs you.

The punchline

Here's the part that still makes me laugh.

The original project this stack was built for? I abandoned it. Dead. RIP. Somewhere in a folder with a name I try not to open.

But HAProxy, ProxySQL, the OVH VPS, the disaster recovery repo, the "wait 30 seconds or you'll think it's broken" wisdom? All of that got recycled into DockSky. Same infrastructure, different dream. Like keeping the engine from a car you totaled and dropping it into something that actually runs.

So no, I wouldn't recommend building this stack just to abandon the product. But if you're a solo dev who's already paid the tuition in broken healthchecks and angry SQLite databases, you might as well reuse the homework.

Questions? I'm at docksky.fr. Contact form. No Telegram bot that replies "have you tried turning it off and on again."


Stack: OVH VPS 8 GB · Debian · Docker Compose v2 · Traefik · HAProxy 2.8 · ProxySQL 2.7 · MySQL 8.4 · lots of logs