fix: social-preview images + absolute URLs + OCI-safe healthcheck - #1
Merged
Conversation
iMessage and other link-unfurl services blew up the portrait logo into a huge hero image: og:image pointed at logo.png (421x548) via a relative URL. - add static/og-banner.png (1200x630) β landscape social card - add static/icon.png (512x512) β square favicon + apple-touch-icon - homepage: og:image -> banner, absolute URL, width/height/type/alt, twitter:card=summary_large_image - paste pages: drop og:image so unfurls fall back to the compact card (an encrypted paste has nothing to preview) - point favicon / apple-touch-icon at the square icon
podman build produces OCI-format images, which silently drop the Dockerfile
HEALTHCHECK instruction ("HEALTHCHECK is not supported for OCI image format").
The probe was effectively absent from every podman-built image.
- remove HEALTHCHECK from the Dockerfile
- add a healthcheck: block to the ghostbit service in docker-compose.yml
- add Health* keys to the Podman Quadlet example in the README
The liveness probe now behaves identically whether the image is built by
podman or docker.
Social-preview meta tags (og:image, og:url) need absolute URLs that link-unfurl bots can reach. They were derived from request.base_url, which behind a TLS-terminating proxy with TRUST_PROXY_HEADERS=false would emit an internal http:// origin a scraper cannot fetch. - new BASE_URL setting (pydantic-settings), fail-fast on a malformed value - abs_url() template helper: BASE_URL when set, else the request origin - base.html / paste.html build og:image and og:url through abs_url() - document BASE_URL in .env.example, README and docs/configuration.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Sharing a Ghostbit link (iMessage, Slack, β¦) rendered a huge blown-up logo:
og:imagepointed at the portrait logo (421Γ548) via a relative URL, sounfurl bots stretched it into the hero-image slot.
Rebuilding the image to ship that fix surfaced a second issue:
podman buildproduces OCI-format images, which silently drop the Dockerfile
HEALTHCHECK("not supported for OCI image format") β the liveness probe was effectively
absent from every podman-built image.
Changes
Social previews
static/og-banner.png(1200Γ630) β landscape social cardstatic/icon.png(512Γ512) β square favicon + apple-touch-iconog:imageβ banner, absolute URL,width/height/type/alt,twitter:card=summary_large_imageog:imageso unfurls fall back to the compact card (an encrypted paste has nothing to preview)Absolute URLs
BASE_URLsetting +abs_url()template helper:og:image/og:urluseBASE_URLwhen configured, else the request originhttp://origin.env.example, README,docs/configuration.md; a malformed value fails fast at startupHealthcheck
HEALTHCHECKfrom the Dockerfile (dropped by OCI builds anyway)healthcheck:block to theghostbitservice indocker-compose.ymlHealth*keys to the Podman Quadlet example in the README127.0.0.1, notlocalhost: busyboxwgetresolveslocalhostto[::1], but uvicorn binds IPv4 only β the originallocalhostprobe never actually workedTests
ruff check+ruff format --checkclean, 84/84 pytest pass (+3 new: og:image is absolute, paste page omits og:image,abs_urlBASE_URL override)podman healthcheck runβhealthyog-banner.png/icon.pngserved 200 from inside the containerRisks