fix(server): surface real provisioning error + always set service-user dolt identity - #17
Merged
Conversation
…r dolt identity
Two related fixes for the silent 'Failed to provision repo' 500 on every
fresh install:
1. versioning.router.ts: the catch-all on POST /repos used to return a
hardcoded 'Failed to provision repo' string, hiding whatever dolt
actually complained about (binary missing, identity unset, permissions,
etc.). Operators had to dig through journalctl to find the real cause.
Now the router returns the underlying err.message verbatim; same
500 status, but the client gets
'Failed to provision Dolt repo for X: dolt init exited with code 1: ...'
on its first try.
2. scripts/install.sh: a brand-new install (or any install where
ENV_FILE doesn't yet exist) used to try to dolt init the anti-tamper
license log AND let the systemd service run dolt init for repo
provisioning -- but the service user's identity was never configured,
so every dolt init exited 1 with 'empty ident name not allowed'.
Two compounding bugs:
a. The 'dolt config --global --add user.name/email' calls lived
inside the if [ ! -f ENV_FILE ] block, so they never ran on
reinstall/upgrade.
b. They ran as root (install.sh's UID), so the identity landed in
/root/.doltconfig instead of /var/lib/deltix/.doltconfig.
Fix: new ensure_dolt_identity_for_service_user() runs after the
chown, as 'sudo -u SERVICE_USER -H dolt config --global --add ...',
on every install (idempotent). The in-block root identity config
(for the one-time license-log dolt init) is kept; the license-log
dir is now chowned to the service user first.
277 unit tests pass; lint clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related fixes for 'Failed to provision repo' on fresh installs
1. router hides the real error
POST /api/v1/versioning/reposreturned a hardcoded'Failed to provision repo'500 on every provisioning failure. Operators had to dig throughjournalctlto find the real cause (dolt missing, identity unset, permissions, etc.).Fix: return
err.messageverbatim. Same 500, but the client now gets'Failed to provision Dolt repo for X: dolt init exited with code 1: ...'.2. install.sh never configured the service user's dolt identity
A fresh install would
dolt initthe anti-tamper license log AND let the systemd service rundolt initon every repo provision, but the service user's identity was never configured. Compound bugs:dolt config --globalcalls only ran insideif [ ! -f ENV_FILE ](so reinstalls never re-asserted)./root/.doltconfiginstead of/var/lib/deltix/.doltconfig.Fix: new
ensure_dolt_identity_for_service_user()runs after chown on every install, assudo -u SERVICE_USER -H dolt config --global --add .... Idempotent. Inner root-identity config kept for the one-time license-log init.Verified manually (live, this user)
deltix repo create mi-demopreviously failed with generic 500. After setting the identity as the service user (the manual fix the user applied),deltix repo createsucceeded. Both fixes now in code so no operator ever hits this again.277 unit tests pass; lint clean.