Rotate and revoke secrets without restarting containers or leaking snapshots
Every secret mutation on Gregale invalidates memory snapshots so restored VMs never serve stale keys, `--restart` performs a draining rolling replacement, and images with `com.gregale.secret-reload-signal` hot-reload in-process with verifiable acknowledgements.
Rotate or revoke application secrets on Gregale without stale memory snapshots surviving or blindly dropping live connections. Every secret update immediately invalidates existing memory snapshots so restored microVMs never serve revoked credentials, --restart runs a draining rolling replacement, and opted-in containers can hot-reload secrets in-process with verifiable application acknowledgements and durable revocation records.
Why secret rotation breaks on traditional PaaS platforms
On many PaaS providers, rotating a database password or third-party token forces a cold restart of running containers—or worse, snapshot-based scale-to-zero platforms risk waking paused containers with yesterday's environment values. Security teams also lack proof after an incident: deleting an env var in a dashboard does not verify whether every running process actually stopped using the old key.
Safe defaults: snapshot invalidation and draining restarts
By default on Gregale, secrets are write-only to the API, sealed at rest, and delivered into the guest only at wake:
gregale env set --app my-api STRIPE_SECRET_KEY="$STRIPE_SECRET_KEY"
gregale env rotate --app my-api DATABASE_URL="$NEW_DATABASE_URL" --restart
gregale env list --app my-api
gregale env unset --app my-api STRIPE_SECRET_KEY
Three platform guarantees prevent stale secrets even without application code changes:
- Automatic snapshot invalidation: Whenever a secret changes, existing memory snapshots are invalidated immediately. The next cold wake boots fresh with the updated environment before capturing a new snapshot, and
--restartprevents live processes carrying the old environment from ever being snapshotted. - Draining rolling replacement (
--restart): Gregale cold-boots replacement instances with the new values, routes traffic to them, waits for gateway convergence and in-flight requests to drain, and then tears down the old instances. - Version-fenced delivery states:
gregale env listtracks each key aspending,delivered, orfailedtied to exact wake and instance IDs, so racing observations from an older wake can never mark a newer version delivered.
For multi-service apps, project environment secrets (gregale environment secrets set shop production) share credentials across every service in the environment (up to Free 8, Hobby 25, Pro 50, Scale 100 per environment) without repeating per-app edits.
Zero-restart hot reload and startup readiness
Applications that can swap database pools or API clients inside a live process can opt in with an OCI image label:
LABEL com.gregale.secret-reload-signal="SIGHUP"
LABEL com.gregale.secret-reload-readiness="required"
- On start, after registering its signal handler (
SIGHUP,SIGUSR1, orSIGUSR2, distinct fromSTOPSIGNAL), the app writesready\ntoFAAS_SECRETS_RELOAD_READY_FILEso signals never arrive before handlers are installed. - When a secret changes, guest-init (polling every 10 seconds) writes an atomic mode-
0400snapshot{revision,secrets}on/tmptmpfs (FAAS_SECRETS_SNAPSHOT_FILE) and signals the workload. - After updating its internal pools/clients, the app can POST its self-attestation (
revision,status: "applied", andFAAS_SECRETS_RELOAD_GENERATION) toFAAS_SECRETS_RELOAD_ACK_ENDPOINT.
Process generations isolate restarts inside the VM so an exiting process's late acknowledgement can never overwrite a new process's status.
Verify rotation and revocation from CI or incident scripts
gregale env rotate --app my-api DATABASE_URL="$NEW_DATABASE_URL" --wait-for-ack
gregale env unset --app my-api COMPROMISED_KEY --wait-for-ack --timeout 2m
secrets rotate --wait-for-ackpolls the complete roster of authorized active runtimes until every reload-enabled target acknowledges the current revision, failing fast with a non-zero exit if any target lacks reload support or reports failure.gregale env unset --wait-for-ack --timeout 2mrecords a durable, value-free revocation record (queryable atGET /v1/apps/{slug}/secret-revocations/{id}) containing the exact target roster, status codes, and timestamps—and exits non-zero if any runtime times out or cannot live-reload.
What to expect and when to use --restart
- Self-attestation vs memory inspection: Application acknowledgements reflect trusted app self-reporting; removing a key from the projected file cannot purge credentials your app forgot to drop from heap variables.
- No handler? Use
--restart: Images withoutcom.gregale.secret-reload-signalcannot live-reload and fail--wait-for-ackintentionally rather than silently succeeding; use--restartfor apps that readprocess.envonly once at boot.
See Manage secrets, Set environment variables, How scaling to zero works, and Security.
Questions
- Can a restored scale-to-zero snapshot serve an old secret after rotation?
No. Rotating or deleting a secret immediately invalidates existing memory snapshots, forcing the next wake to cold-boot with the current secret versions before taking a fresh snapshot.
- How does zero-restart secret reload verify my app updated its pools?
Images with
com.gregale.secret-reload-signalreceive an atomic mode-0400snapshot file and process signal, and POST a generation-scoped self-attestation toFAAS_SECRETS_RELOAD_ACK_ENDPOINTchecked by--wait-for-ack.- What happens if my image does not handle reload signals?
Use
gregale env rotate --restartfor a draining rolling replacement. Commands with--wait-for-ackintentionally fail non-zero rather than pretending a non-reloading container rotated.