Create the uploads directory in the runtime image (PMS-757) #511
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-757-uploads-dir-in-image"
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?
PMS-757. Half of a two-repo fix; the volume itself is NiceGuyIT/docker #332, and this must merge and be built first.
The problem
Nothing on staging or production mounts a volume for uploads.
template/mokosh-server/compose.ymlgives theserverservice an image, environment, network, healthcheck and labels, and novolumes:key at all; the only declared volume belongs to postgres.ATTACHMENT_DIRis unset on both hosts, so it falls back to./attachmentsagainstWORKDIR /app, which is the container's writable layer, andpull_policy: alwaysrecreates that layer on every deploy.So every ticket-note attachment (PMS-483) and every tenant logo (MAPPS-429) is destroyed by the next deploy while its database row survives. For the logo that is worse than it sounds:
branding.logo_urlstill points at the serving route, so the request-form email renders a broken image rather than no image, which is the version a client sees.Not a regression in either ticket. It has been true since PMS-483 shipped the first upload path, and MAPPS-429 inherited it by reusing that storage pattern without anyone checking the pattern was deployed correctly. I reused it, so that one is mine.
Why this half goes first
Docker seeds an empty named volume from whatever the image holds at the mount point, ownership included. With no directory in the image, a fresh volume is root-owned, and this container runs as uid 1001. Attaching the volume without this change would break every upload that currently works, on the exact deploy meant to fix them.
/app/attachmentsrather than a new path, so the image, the code default and the mount all name the same place and a baredocker runbehaves like a deployment.Testing
just check-dockerpasses. Verified against a fully built runtime image rather than the builder stage, since the directory only exists in the latter:Nothing else changes: no code, no migration, no behaviour until the volume lands.