fix(docker): chown /data so the non-root hub can write its DB 🐳🔑
The image runs as uid 10001; the VOLUME /data was root-owned so sqlite/blob writes failed and the container exited on boot. Create + chown /data to the devbox user before VOLUME/USER (a named volume inherits the image dir's ownership). Verified on real arm64 docker (.13): builds, runs non-root, serves /metrics + dashboard /api/state, 31.9MB. Also made install.sh's service setup non-fatal (a failing systemctl --user / launchctl over headless SSH warns + continues instead of aborting the whole install) — fleet-verified: systemd user service enabled w/ Restart=always, NRestarts proved self-heal.
This commit is contained in:
parent
44e142fdf0
commit
94f7d3e782
2 changed files with 15 additions and 7 deletions
|
|
@ -18,6 +18,9 @@ FROM alpine:3.20
|
|||
# ca-certificates + tzdata for correct TLS/timestamps; wget (busybox) backs the healthcheck.
|
||||
RUN apk add --no-cache ca-certificates tzdata && adduser -D -u 10001 devbox
|
||||
COPY --from=build /out/devbox-hub /usr/local/bin/devbox-hub
|
||||
# Own /data BEFORE declaring the volume + dropping root, so the non-root user can
|
||||
# write the sqlite DB + blobs (a named volume inherits the image dir's ownership).
|
||||
RUN mkdir -p /data && chown devbox:devbox /data
|
||||
USER devbox
|
||||
VOLUME /data
|
||||
# 8088 = hub API · 8099 = live dashboard (only reachable if you enable --dashboard)
|
||||
|
|
|
|||
15
install.sh
15
install.sh
|
|
@ -144,9 +144,13 @@ install_service_macos() {
|
|||
</dict></plist>
|
||||
PLIST
|
||||
launchctl unload "$plist" 2>/dev/null || true
|
||||
launchctl load "$plist"
|
||||
if launchctl load "$plist" 2>/dev/null; then
|
||||
say " ✅ launchd agent loaded (KeepAlive). logs: ~/Library/Logs/devbox.log"
|
||||
say " stop: launchctl unload $plist"
|
||||
else
|
||||
say " ⚠️ wrote $plist but 'launchctl load' failed (run it from a desktop session, not SSH):"
|
||||
say " launchctl load $plist"
|
||||
fi
|
||||
}
|
||||
|
||||
install_service_linux() {
|
||||
|
|
@ -166,14 +170,15 @@ RestartSec=3
|
|||
[Install]
|
||||
WantedBy=default.target
|
||||
UNIT
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now devbox.service
|
||||
if command -v systemctl >/dev/null 2>&1 &&
|
||||
systemctl --user daemon-reload 2>/dev/null &&
|
||||
systemctl --user enable --now devbox.service 2>/dev/null; then
|
||||
loginctl enable-linger "$USER" 2>/dev/null || say " (run 'sudo loginctl enable-linger $USER' so it starts before login)"
|
||||
say " ✅ systemd user service enabled (Restart=always). logs: journalctl --user -u devbox -f"
|
||||
say " stop: systemctl --user disable --now devbox"
|
||||
else
|
||||
say " wrote $unit — no systemd here; start manually with: $DEVBOX start"
|
||||
say " ⚠️ wrote $unit, but couldn't enable it via 'systemctl --user' (no user session bus is"
|
||||
say " common over headless SSH). Enable from a desktop login: systemctl --user enable --now devbox"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue