Plugins: drop the plugins.json migration, and the volume it needed
The project has no public installs, so there is nothing to migrate from. MigrateLegacyFile, the file-backed Store it read through, PLUGINS_FILE and the legacy path threaded through the Server all go. What is left is one store, PocketBase, and a plugins package that touches no filesystem at all. That was the last thing keeping api_data alive, so the volume goes too. All four compose files now declare exactly one volume, pb_data, and the standalone API Server compose declares none - it talks to an external PocketBase and has nothing of its own to keep. Backing up the stack is backing up one path again. Both images get simpler for it. The API Server image loses VOLUME /data and the su-exec entrypoint that existed only to fix a mounted volume's ownership, so it goes back to a plain USER app; its working directory is now /app and holds nothing. The AIO image loses its second volume and chowns only /pb/pb_data. One consequence worth stating plainly, because it is a small regression rather than a no-op. The panel's Settings -> PocketBase and Settings -> Web App screens write .env in the working directory, which is now ephemeral. In the multi-container stack that changes nothing: compose sets all five of those keys as container environment, and loadDotEnv only applies a key that is not already set, so the file could never win a restart there anyway. In the AIO image it did win for POCKETBASE_ADMIN_EMAIL/_PASSWORD, which are not in that container's environment - so a service account fixed from the panel now lasts only until the container is recreated. Both READMEs say so. Moving those two screens into the app_settings singleton would close it properly; the PocketBase URL and credentials cannot follow, since they are how the database is reached in the first place. go build, go vet and go test ./... pass; the compose files parse and each resolves to a single pb_data volume. Not verified: no Docker CLI here, so neither image was built. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
660af5736a
commit
ee4ac441be
27 files changed
+107
-503
No files matched your search
+12
-15
@@ -16,7 +16,6 @@
|
||||
# -e DRIVERVAULT_SUPERADMIN_EMAIL=owner@example.com \
|
||||
# -e DRIVERVAULT_SUPERADMIN_PASSWORD=change-me \
|
||||
# -v drivervault_pb:/pb/pb_data \
|
||||
# -v drivervault_api:/data \
|
||||
# drivervault-aio
|
||||
#
|
||||
# Then: web app on http://host/ and PocketBase admin on http://host:8070/_/
|
||||
@@ -162,12 +161,11 @@ stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
; API Server: wait for PocketBase to be healthy, then start. It runs from /data
|
||||
; because it writes the panel .env relative to its working directory, and /data
|
||||
; is the volume that keeps it across container recreates. (Plugin settings live
|
||||
; in PocketBase, under /pb/pb_data.)
|
||||
; API Server: wait for PocketBase to be healthy, then start. It keeps no state
|
||||
; on disk — plugin settings, like everything else it owns, live in PocketBase —
|
||||
; so its working directory is just a place to run from.
|
||||
[program:api-server]
|
||||
directory=/data
|
||||
directory=/app
|
||||
user=app
|
||||
command=/bin/sh -c 'until wget -qO- http://127.0.0.1:8070/api/health >/dev/null 2>&1; do echo "waiting for pocketbase..."; sleep 1; done; exec /usr/local/bin/api-server'
|
||||
priority=20
|
||||
@@ -190,13 +188,13 @@ stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
SUPERVISOR
|
||||
|
||||
# The entrypoint stays root only long enough to make the two volumes writable by
|
||||
# the app user, then hands off to supervisord. The chown matters for volumes
|
||||
# created by an earlier build of this image, when both services ran as root.
|
||||
# The entrypoint stays root only long enough to make the data volume writable by
|
||||
# the app user, then hands off to supervisord. The chown matters for a host bind
|
||||
# mount, which arrives owned by root rather than inheriting the image's owner.
|
||||
RUN cat > /entrypoint.sh <<'ENTRY'
|
||||
#!/bin/sh
|
||||
set -e
|
||||
for dir in /pb/pb_data /data; do
|
||||
for dir in /pb/pb_data; do
|
||||
mkdir -p "$dir"
|
||||
if [ "$(stat -c %U "$dir" 2>/dev/null)" != "app" ]; then
|
||||
echo "entrypoint: taking ownership of $dir"
|
||||
@@ -214,7 +212,6 @@ ENV API_ADDR=:8080 \
|
||||
POCKETBASE_URL=http://127.0.0.1:8070 \
|
||||
CORS_ALLOW_ORIGINS=http://localhost:8090 \
|
||||
AUTH_USERS_COLLECTION=users \
|
||||
PLUGINS_FILE=/data/plugins.json \
|
||||
WEBAPP_URL=http://127.0.0.1:80
|
||||
|
||||
# Required at runtime (no safe defaults): PB_ADMIN_EMAIL, PB_ADMIN_PASSWORD.
|
||||
@@ -229,12 +226,12 @@ ENV API_ADDR=:8080 \
|
||||
# base, or set OCPP_REQUIRE_TLS=false on a trusted network.
|
||||
# Pass them with `docker run -e ...`.
|
||||
|
||||
# pb_data holds the database — including the plugin settings; /data holds the
|
||||
# .env the panel rewrites when a superadmin retargets PocketBase. Both are
|
||||
# pb_data holds everything that persists — the database, the uploads, and the
|
||||
# server settings that used to sit in a file beside the binary. It is the only
|
||||
# volume: the API Server keeps no state on disk. Both directories are
|
||||
# pre-created and owned by app so a fresh named volume inherits that ownership.
|
||||
RUN mkdir -p /pb/pb_data /data && chown -R app:app /pb /data
|
||||
RUN mkdir -p /pb/pb_data /app && chown -R app:app /pb /app
|
||||
VOLUME /pb/pb_data
|
||||
VOLUME /data
|
||||
# 80 = Web App, 8070 = PocketBase admin, 8080 = API Server + embedded API panel
|
||||
# (also the /ocpp/{serial} endpoint chargers dial into).
|
||||
EXPOSE 80 8070 8080
|
||||
|
||||
Reference in new issue
Block a user