Skip to content

Media/reindex in settings - #126

Merged
ssavutu merged 6 commits into
mainfrom
media/reindex-in-settings
Jul 31, 2026
Merged

Media/reindex in settings#126
ssavutu merged 6 commits into
mainfrom
media/reindex-in-settings

Conversation

@ssavutu

@ssavutu ssavutu commented Jul 31, 2026

Copy link
Copy Markdown
Member

No description provided.

ssavutu and others added 6 commits July 31, 2026 02:16
The CephFS corpus arrives owned by whoever ran the rsync, mode 755,
while the backend container runs as uid 10001. Nothing in the read path
notices, so uploads fail long after media serving looks healthy -- and
the failure surfaces as "failed to store upload" rather than "failed to
create upload directory", because MkdirAll returns nil for a directory
that already exists and every migrated YYYY/MM directory does.

The handler discarded the underlying error, so the log said only
"status 500". It now logs it: a full volume, an unmounted tree and a
permission problem all reach the client as the same message and need
very different fixes.

deploy/README.md gains the write check and the setfacl grant. The
existing media section only ever verified that Nginx could read.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The CephFS mount carries `acl`, which makes it look like the tooling is
present; Ubuntu server images do not ship setfacl. Records the package
and a setgid fallback for hosts where installing it is unwelcome.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
adminCommentConditions has always excluded them, which left
GetApprovedCommentsByArticleSlug as the one place they still surfaced.
They are automated link notifications rather than anything a reader
wrote, and in the migrated WordPress data they are almost entirely SEO
spam: 155 rows sourced from domains like weddingdressesideas.com and
garciniacambogia-reviews.org, every one of them approved by WordPress.

Same predicate as the admin path, so the two agree. Rows stay in the
table.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…s in RAM

The migrated WordPress corpus contains unresized camera originals up to
~77 MiB (largest: 2025/07/BZ9A5771.jpg), so the 25 MiB cap rejected files
the newsroom demonstrably produces. Raise the default to 90 MiB, chosen to
sit under Cloudflare's 100 MB request-body limit on the tunnel fronting
Delta -- past that a body clears Nginx and the backend but dies at the edge
with an error the CMS never sees.

ParseMultipartForm was being handed the size limit as its argument, but that
argument is the in-memory buffer threshold, not the cap (MaxBytesReader has
always been what enforces the cap). At 90 MiB that would let a single upload
pin its full size in RAM, plus the ~10 MiB of slack Go adds on top. Give it
a fixed 8 MiB instead and let the rest spill to temp files; the write path
already streams and only reads image headers for dimensions, so a large
upload now costs container disk rather than memory.

Nginx's client_max_body_size moves to 91m to stay just above the backend,
and the body/proxy timeouts go to 300s so a 90 MiB upload over a slow uplink
is not killed mid-flight. MEDIA_MAX_UPLOAD_BYTES is also plumbed through
Compose and the env template -- it was read by the backend but never passed
in, so the cap could previously only be changed by editing Go.

Deploying this needs both halves: reinstall the Nginx site and reload, and
recreate the backend slots. The smaller of the two limits silently wins.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comment out the Newsletter entry and its Mail import, leaving a note on
how to restore both.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…itor

New CMS users were promoted to admin whenever CMS_AUTO_PROMOTE_ALL_ADMINS was
set, and existing users were re-promoted on every login. Drop the flag and give
new accounts the editor role instead.

The first user to log in against an empty cms_users table is still bootstrapped
as an admin so a fresh install has someone who can manage roles. The count and
the insert share a transaction with a locking read so two simultaneous first
logins can't both come out as admin.

Existing admins keep their role; this only governs account creation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ssavutu
ssavutu merged commit f0fa6d5 into main Jul 31, 2026
6 checks passed
@ssavutu
ssavutu deleted the media/reindex-in-settings branch July 31, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant