Skip to content

feat: add configurable proxy timeout for public database connections#8429

Closed
sushi-levanter wants to merge 1 commit intocoollabsio:v4.xfrom
sushi-levanter:fix/configurable-db-proxy-timeout
Closed

feat: add configurable proxy timeout for public database connections#8429
sushi-levanter wants to merge 1 commit intocoollabsio:v4.xfrom
sushi-levanter:fix/configurable-db-proxy-timeout

Conversation

@sushi-levanter
Copy link
Copy Markdown

/claim #7743

Problem

The nginx TCP proxy for publicly exposed databases uses the default proxy_timeout of 10 minutes. This causes long-running queries and idle database connections to be dropped unexpectedly — a significant issue for production workloads.

Solution

Added a dedicated "Proxy Timeout (seconds)" field to all 8 database types, as requested by @zachlatta in the issue discussion.

How it works

  • Default: 0 (no timeout) — maps to proxy_timeout 365d in nginx, effectively disabling the idle timeout
  • Custom value — any positive integer sets the timeout in seconds (e.g., 3600 = 1 hour)
  • Also adds proxy_connect_timeout 60s for connection establishment

Changes

New file:

  • database/migrations/2026_02_18_000001_add_public_proxy_timeout_to_database_tables.php — adds public_proxy_timeout (integer, default 0) to all 9 database tables

Modified (17 files):

  • app/Actions/Database/StartDatabaseProxy.php — reads timeout value and sets proxy_timeout + proxy_connect_timeout in nginx stream config
  • 8 Livewire components (Clickhouse, Dragonfly, KeyDB, MariaDB, MongoDB, MySQL, PostgreSQL, Redis) — adds property, validation rule, and model sync
  • 8 Blade templates — adds the timeout input field in the Proxy section

Design decisions

  • Simple integer field in seconds — per @zachlatta's preference for a dedicated timeout field with a default
  • Consistent across all database types — applied uniformly to all 8 standalone types + service databases
  • Backward compatible — default of 0 (no timeout) means existing databases work better than before with no action needed
  • Minimal footprint — 129 lines added, 0 removed, no new dependencies

Testing

  • All PHP files pass syntax validation
  • Nginx config generation verified to produce valid stream block with timeout directives
  • Migration includes proper rollback support

Closes #7743

Add a 'Proxy Timeout' field to all 8 database types (PostgreSQL, MySQL,
MariaDB, Redis, KeyDB, Dragonfly, MongoDB, ClickHouse) and service
databases.

Previously, the nginx TCP proxy used the default 10-minute timeout,
causing long-running database queries and idle connections to be
dropped unexpectedly.

Changes:
- Add public_proxy_timeout column (integer, default 0) to all database
  tables via migration
- Update StartDatabaseProxy to set proxy_timeout in nginx stream config
  (0 = no timeout, maps to 365d; positive value = timeout in seconds)
- Add proxy_connect_timeout of 60s for connection establishment
- Add Livewire property, validation, and sync for all 8 database
  components
- Add UI input field in proxy section of all database settings views

Default behavior (0) effectively removes the timeout, matching user
expectations for persistent database connections.

Closes #7743
@algora-pbc algora-pbc bot added the 🙋 Bounty claim Issues or PRs that have a Bounty ready to be claimed. label Feb 18, 2026
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🙋 Bounty claim Issues or PRs that have a Bounty ready to be claimed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Don't timeout public database proxies after 10 min

3 participants