diff --git a/Dockerfile b/Dockerfile index cde5512..e1cba04 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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) diff --git a/install.sh b/install.sh index 72474f4..a00e7f6 100755 --- a/install.sh +++ b/install.sh @@ -144,9 +144,13 @@ install_service_macos() { PLIST launchctl unload "$plist" 2>/dev/null || true - launchctl load "$plist" - say " ✅ launchd agent loaded (KeepAlive). logs: ~/Library/Logs/devbox.log" - say " stop: launchctl unload $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 }