Automatic Restart

πŸ“·

Watching a config for changes requires an upgraded subscription

Watching a config for changes is available with our Team and Enterprise plans. View our plans or book a demo for more details.

The Doppler CLI can automatically restart your process when your secrets change.

Usage

To enable auto restart of your process, pass the --watch flag to the doppler run command.

doppler run --watch -- ./your_command.sh

Technical Details

Doppler's CLI strongly prioritizes the uptime of your application. Your process is only restarted once the latest secrets are successfully fetched. Additionally, your initial command is executed immediately, before the CLI attempts to watch for changes. This ensures that an inability to watch for changes does not prevent your process from starting.

The CLI's restart logic is as follows:

  1. CLI receives message over long-lived HTTP connection indicating secrets have changed
  2. CLI fetches the latest secrets
  3. SIGTERM is sent to the originally started process
  4. CLI waits up to 10 seconds for the process to exit
  5. If process still hasn't exited, SIGKILL is sent
  6. If using --mount flag, secrets file is remounted with the latest secrets
  7. Originally provided command is re-run

Limitations

When multiple instances of the CLI are watching the same Doppler config, they will all receive the latest secrets at roughly the same time. This effectively means that all processes will be restarted at the same time. This can result in downtime when used in production. For production use cases, it is recommended to instead use the Doppler Kubernetes Operator.