License re-activation at boot from config/env key #157
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Cordy/Cairn#157
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Question 6 of #138, folded into this milestone as its own small issue (it is independent of the statestore work and can ship first).
Change: at boot, if license state is absent but a key is present in
config.license.keyorCAIRN_LICENSE_KEY(env already wins per config.go), perform the same activation call the UI paste triggers and persist the result. Worst case after losing state entirely: one HTTPS call to the license server on boot. With #153 the license state survives anyway; this covers the fresh-instance and disaster-recovery paths, and the air-gapped variant (a pre-signed license blob supplied as a file) should be confirmed to still work (#91 owns the air-gap policy question).Failure handling: activation failure at boot logs loudly and continues unlicensed exactly as if no key were configured — a license-server outage must never take a customer's file server down. The monthly check-in + grace window machinery is untouched.
Mattermost/GitLab store uploaded licenses in the DB precisely so upgrades cannot eat them; this is the same guarantee without a database.
Shipped in v0.5.1 (PR #161), live on the dogfood.
Turned out the naive version already existed — boot blind-
SetKeyedcfg.License.Key— hiding a real bug: a stale config key would clobber a UI-installed or check-in-rotated renewal on every restart. The fix isManager.EnsureKey: parse the configured key, adopt it only when it reaches further than the installed license (none/expired → adopt; later expiry → adopt; otherwise keep — every path logged distinctly). Losing the state file now self-heals from config/env exactly as this issue asked, and renewals win regardless of which side they came from. Failure semantics as specced: rejected configured key logs a warning and the server continues; check-in machinery untouched;CheckinURL:""offline mode unaffected (#91 keeps the air-gap policy question). Comparator covered across all five orderings; garbage-key rejection tested against a real Manager instance.