Skip to content

feat: config reloading with fsnotify, poller fallback, and signals - #2161

Merged
cstockton merged 8 commits into
masterfrom
cs/feat-config-reloads-poller
Sep 16, 2025
Merged

cstockton merged 8 commits into
masterfrom
cs/feat-config-reloads-poller

Conversation

@cstockton

@cstockton cstockton commented Sep 10, 2025 •

Copy link
Copy Markdown
Contributor

Summary
This PR introduces additional configuration reloading options. Previously, Auth only supported fsnotify for watching .env changes, which fails on some filesystems. This implementation adds a poller fallback mode and a signal-triggered reloads.

Config reloader

  • Multi-source triggers:
    • fsnotify for .env changes where supported
      • poller fallback that diffs directory contents for filesystems without notification support
    • POSIX signals (default SIGUSR1) for operator initiated reloads (i.e. systemctl reoad)
  • Debounce via GracePeriodInterval to coalesce bursts of changes into a single reload.
  • Invalid configs are logged but ignored, last good configuration continues to serve.

Wiring & observability

  • Update serve_cmd to construct NewReloader from ReloadingConfiguration and log enabled modes/intervals.
  • Graceful shutdown handled independently of reloads.
  • Errors from watchers and pollers logged clearly, fallbacks engaged automatically when possible.

Configuration knobs (GOTRUE_RELOADING_*)

  • NotifyEnabled (default true)
  • PollerEnabled (default true), PollerInterval (default 10s)
  • SignalEnabled (default false), SignalNumber (default 10 / SIGUSR1)
  • GracePeriodInterval (default 5s)

Tests

  • End-to-end reloader tests: fsnotify happy path, poller fallback, signal path, debounce, invalid configs.
  • Poller unit tests for detection semantics and concurrency guard.

@coveralls

coveralls commented Sep 10, 2025 •

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 17770053349

Details

  • 224 of 224 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 67.949%

Totals Coverage Status
Change from base Build 17769379196: 0.3%
Covered Lines: 12934
Relevant Lines: 19035

💛 - Coveralls

* add reloader with multi-source triggers: fsnotify, filesystem poller,
  and POSIX signals (default SIGUSR1).
* all reloader types debounce via grace period to coalesce bursts of config
  changes into a single reload
* update serve_cmd to wire in reloader, logs enabled modes and intervals
  and exits gracefully on context cancel or shutdown
* extend GlobalConfiguration with ReloadingConfiguration startup knobs.
* implement poller to scan directory snapshots when notify unavailable,
  supporting k8s projected volumes without inotify
* add signal reload path for operator workflows (systemd reload, kubectl
  exec kill -USR1, etc)
* tests updated and added to maintain 100% coverage
@cstockton
cstockton force-pushed the cs/feat-config-reloads-poller branch from 2524039 to 1806995 Compare September 11, 2025 16:58
@cstockton cstockton changed the title feat: support polling in config reloader feat: config reloading with fsnotify, poller fallback, and signals Sep 11, 2025
@cstockton
cstockton marked this pull request as ready for review September 11, 2025 17:36
@cstockton
cstockton requested a review from a team as a code owner September 11, 2025 17:36
@cstockton
cstockton merged commit c77d512 into master Sep 16, 2025
@cstockton
cstockton deleted the cs/feat-config-reloads-poller branch September 16, 2025 15:07
cemalkilic pushed a commit that referenced this pull request Sep 23, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.180.0](v2.179.0...v2.180.0)
(2025-09-23)


### Features

* add OAuth client type
([#2152](#2152))
([b118f1f](b118f1f))
* add phone to sms webhook payload
([#2160](#2160))
([d475ac1](d475ac1))
* background template reloading p1 - baseline decomposition
([#2148](#2148))
([746c937](746c937))
* config reloading with fsnotify, poller fallback, and signals
([#2161](#2161))
([c77d512](c77d512))
* enhance issuer URL validation in OAuth server metadata
([#2164](#2164))
([a9424d2](a9424d2))
* implement OAuth2 authorization endpoint
([#2107](#2107))
([5318552](5318552))
* **oauth2:** add `/oauth/token` endpoint
([#2159](#2159))
([a89a0b0](a89a0b0))
* **oauth2:** add admin endpoint to regenerate OAuth client secrets
([#2170](#2170))
([0bd1c28](0bd1c28))
* **oauth2:** return redirect_uri on GET authorization
([#2175](#2175))
([b0a0c3e](b0a0c3e))
* **oauth2:** use `id` field as the public client_id
([#2154](#2154))
([86b7de4](86b7de4))
* **openapi:** add OAuth 2.1 server endpoints and clarify OAuth modes
([#2165](#2165))
([1f804a2](1f804a2))
* password changed email notification
([#2176](#2176))
([fe0fd04](fe0fd04))
* support `transfer_sub` in apple id tokens
([#2162](#2162))
([8a71006](8a71006))


### Bug Fixes

* ensure request context exists in API db operations
([#2171](#2171))
([060a992](060a992))
* **makefile:** remove invalid @ symbol from shell commands
([#2168](#2168))
([e6afe45](e6afe45))
* **oauth2:** switch to Origin header for request validation
([#2174](#2174))
([42bc9ab](42bc9ab))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fadymak pushed a commit that referenced this pull request Sep 30, 2025
…2161)

**Summary**
This PR introduces additional configuration reloading options.
Previously, Auth only supported fsnotify for watching `.env` changes,
which fails on some filesystems. This implementation adds a poller
fallback mode and a signal-triggered reloads.

**Config reloader**

* Multi-source triggers:
  * **fsnotify** for `.env` changes where supported
* **poller fallback** that diffs directory contents for filesystems
without notification support
* **POSIX signals** (default `SIGUSR1`) for operator initiated reloads
(i.e. `systemctl reoad`)
* Debounce via `GracePeriodInterval` to coalesce bursts of changes into
a single reload.
* Invalid configs are logged but ignored, last good configuration
continues to serve.

**Wiring & observability**

* Update `serve_cmd` to construct `NewReloader` from
`ReloadingConfiguration` and log enabled modes/intervals.
* Graceful shutdown handled independently of reloads.
* Errors from watchers and pollers logged clearly, fallbacks engaged
automatically when possible.

**Configuration knobs** (`GOTRUE_RELOADING_*`)

* `NotifyEnabled` (default true)
* `PollerEnabled` (default true), `PollerInterval` (default 10s)
* `SignalEnabled` (default false), `SignalNumber` (default 10 / SIGUSR1)
* `GracePeriodInterval` (default 5s)

**Tests**

* End-to-end reloader tests: fsnotify happy path, poller fallback,
signal path, debounce, invalid configs.
* Poller unit tests for detection semantics and concurrency guard.

---------

Co-authored-by: Chris Stockton <[email protected]>
fadymak pushed a commit that referenced this pull request Sep 30, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.180.0](v2.179.0...v2.180.0)
(2025-09-23)


### Features

* add OAuth client type
([#2152](#2152))
([b118f1f](b118f1f))
* add phone to sms webhook payload
([#2160](#2160))
([d475ac1](d475ac1))
* background template reloading p1 - baseline decomposition
([#2148](#2148))
([746c937](746c937))
* config reloading with fsnotify, poller fallback, and signals
([#2161](#2161))
([c77d512](c77d512))
* enhance issuer URL validation in OAuth server metadata
([#2164](#2164))
([a9424d2](a9424d2))
* implement OAuth2 authorization endpoint
([#2107](#2107))
([5318552](5318552))
* **oauth2:** add `/oauth/token` endpoint
([#2159](#2159))
([a89a0b0](a89a0b0))
* **oauth2:** add admin endpoint to regenerate OAuth client secrets
([#2170](#2170))
([0bd1c28](0bd1c28))
* **oauth2:** return redirect_uri on GET authorization
([#2175](#2175))
([b0a0c3e](b0a0c3e))
* **oauth2:** use `id` field as the public client_id
([#2154](#2154))
([86b7de4](86b7de4))
* **openapi:** add OAuth 2.1 server endpoints and clarify OAuth modes
([#2165](#2165))
([1f804a2](1f804a2))
* password changed email notification
([#2176](#2176))
([fe0fd04](fe0fd04))
* support `transfer_sub` in apple id tokens
([#2162](#2162))
([8a71006](8a71006))


### Bug Fixes

* ensure request context exists in API db operations
([#2171](#2171))
([060a992](060a992))
* **makefile:** remove invalid @ symbol from shell commands
([#2168](#2168))
([e6afe45](e6afe45))
* **oauth2:** switch to Origin header for request validation
([#2174](#2174))
([42bc9ab](42bc9ab))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants