Menu

Post image 1
Post image 2
1 / 2
0

Laravel multitenancy on Octane without leaking PDOs

DEV Community·Leonce Medewanou·21 days ago
#xTrmW2gX
#laravel#php#webdev#tenant#request#connection
Reading 0:00
15s threshold

If you're running multitenancy on Laravel Octane using the pattern most quick-start guides show, you have a bug. Either you're leaking the previous tenant's PDO into the next request (a security incident waiting for a paging shift), or you're burning a fresh TCP + TLS + auth handshake on every request (latency you'll feel the moment your tenant database lives in another region). This isn't a theoretical problem. It's the first thing that breaks when you move a hand-rolled Laravel multitenant app from FPM to Octane. Packages like Stancl/tenancy paper over a lot of this with bootstrappers, but if you're rolling your own tenant switching (or you've inherited a codebase that does), the Octane migration is where it bites you. I ran into this building NightOwl , a performant dashboard on top of a self-hosted monitoring agent . Customers run the agent in their Laravel app and own the PostgreSQL the agent writes to; our API reads from those customer-owned databases on demand. Here's what actually works.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More