No description
  • JavaScript 84%
  • HTML 6.7%
  • CSS 6.2%
  • Dockerfile 3.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
whisper 16651219d4 chore(deploy): fit the ssc app-tier compose contract
The cluster deploys this as an `ssc` app: it layers its own
compose.override.yml (published port on the tailnet ip, rendered env file,
data mount) over ours, and compose merges those lists. So the base file has
to stop declaring ports, env_file and volumes or a server would publish the
port twice and mount two things at /app/data. It also errors outright on a
missing .env, which no server checkout has.

- docker-compose.yml: one service, build only
- Dockerfile: ENV PORT=3000 / DATA_DIR=/app/data, so the container side of
  the contract is fixed and only the published port varies
- README/.env.example: local runs pass port + env file + data folder on the
  command line; deployment status corrected
2026-11-08 16:46:56 -08:00
public feat(upload): per-photo uploads with progress, configurable limits, data-dir preflight 2026-10-25 18:45:26 -07:00
server feat(upload): per-photo uploads with progress, configurable limits, data-dir preflight 2026-10-25 18:45:26 -07:00
test feat(upload): per-photo uploads with progress, configurable limits, data-dir preflight 2026-10-25 18:45:26 -07:00
.dockerignore test: gate, cookie persistence, gated upload, feed, delete ownership 2026-10-25 18:01:28 -07:00
.env.example chore(deploy): fit the ssc app-tier compose contract 2026-11-08 16:46:56 -08:00
.gitignore scaffold: package with photo-feed git dependency and env example 2026-10-25 18:01:28 -07:00
docker-compose.yml chore(deploy): fit the ssc app-tier compose contract 2026-11-08 16:46:56 -08:00
Dockerfile chore(deploy): fit the ssc app-tier compose contract 2026-11-08 16:46:56 -08:00
package-lock.json feat(upload): per-photo uploads with progress, configurable limits, data-dir preflight 2026-10-25 18:45:26 -07:00
package.json scaffold: package with photo-feed git dependency and env example 2026-10-25 18:01:28 -07:00
README.md chore(deploy): fit the ssc app-tier compose contract 2026-11-08 16:46:56 -08:00

littlebabyredcat

A digital shrine for Redcat: pick photos from your phone, add them to one endless wall of her. Passphrase, not accounts. Dockerized, with a bind-mounted data folder you can copy or back up.

Built on photo-feed for the upload and feed mechanics; this repo owns the gate, the pages, and the copy.

Run locally

Requires Node 22+.

npm install
cp .env.example .env   # set SHRINE_PASS and COOKIE_SECRET
npm start              # http://localhost:3000
  • / — the shrine: dedication and the endless feed (public).
  • /contribute — upload page; asks for the passphrase once, then a signed cookie remembers the browser for a year.
  • POST /gate — the passphrase check behind that cookie.

Uploads are sent one photo per request, three in flight, with a progress bar. A failure costs one photo rather than the whole selection, and the server never buffers a camera roll in memory. The selection itself has no total cap; the API guards each request with MAX_FILES (default 25) and MAX_FILE_MB (default 20). The contribute page reads GET /api/limits and warns about oversized photos before uploading. Without JavaScript the form posts everything in one request, so the 25-file cap applies there.

Photos land in ./data (images/, thumbnails/, images.json); the feed API is GET /api/photos (cursor-paginated, newest first) and GET /api/mine lists what your own cookie uploaded.

Run with Docker

cp .env.example .env   # SHRINE_PASS, COOKIE_SECRET
docker build -t littlebabyredcat .
docker run --rm -p 3000:3000 --env-file .env -v ./data:/app/data littlebabyredcat

Photos live in ./data, so deleting the container loses nothing — the folder is the shrine. On SELinux hosts add :Z to the volume (-v ./data:/app/data:Z).

docker-compose.yml deliberately holds one service and nothing else — no ports, no env_file, no volumes. That is the shape the cluster's ssc app tier expects: it layers its own compose.override.yml over this file (published port on the server's tailnet IP, a rendered env file, the data mount) and Compose merges those lists, so a second ports or volumes entry here would publish a port twice and put two mounts on the same target. Locally, pass the port, env file and data folder on the command line instead, as above.

The app listens on 3000 and reads its data from /app/data — both are baked into the image (ENV PORT / ENV DATA_DIR), so the container's side of the contract never varies. Only the published host port changes: -p 3002:3000 puts the shrine at http://localhost:3002 while a proxy keeps pointing at 3000.

The image is built in two stages: git is installed only in the build stage so npm ci can clone the photo-feed dependency; the runtime image stays on plain node:22-slim and runs as the unprivileged node user (uid 1000).

Changing .env

.env is read at container start, so a running container keeps its old values — after editing it, remove the container and start it again with the docker run line above. (In the cluster the env file is rendered by the deployment tool from its own secrets copy; ssc app update <name> is the equivalent.)

Values are literal — do not quote them. Podman's env-file parser keeps the quote characters, so SHRINE_PASS="i love redcat" makes the passphrase "i love redcat" including quotes, and every login fails. Spaces need no escaping: SHRINE_PASS=i love redcat is correct. The server warns at startup if SHRINE_PASS or COOKIE_SECRET has surrounding quotes, stray whitespace, or a CRLF carriage return.

If the passphrase is rejected

The server prints the length of the configured passphrase at startup and of each rejected attempt — never the value:

[config] gate passphrase loaded (13 chars), cookie secret loaded (44 chars)
[gate] passphrase mismatch: submitted 13 chars, configured 14 chars
  • configured ≠ what you typed (length): the container is running a different environment. .env is only read at start — remove and re-run:

    docker rm -f littlebabyredcat 2>/dev/null
    docker ps -a                      # nothing shrine-ish should remain
    docker run --rm -p 3000:3000 --env-file .env -v ./data:/app/data littlebabyredcat
    

    A restart alone reuses the existing container's environment, and Ctrl-C on a foreground run can leave the old container serving.

  • Every password is rejected, including ones that should work: check which container is actually serving the URL: docker inspect <id> --format '{{range .Config.Env}}{{println .}}{{end}}' | grep -E 'SHRINE_PASS|PORT|DATA_DIR'. If the host port and the proxy upstream disagree, you can be talking to an old container on the old port.

  • configured length is one or two longer than expected: a stray \r (CRLF), trailing space, or inline comment became part of the value. Inspect the exact bytes:

    podman exec <container> sh -c 'printf %s "$SHRINE_PASS" | od -An -c'
    

Data folder ownership

The container writes as uid 1000. On rootful Docker that means chown -R 1000:1000 data/ on the host. On rootless Podman do not do that — container uid 1000 is mapped to a subuid, so the host-side owner has to be set from inside the user namespace:

mkdir -p data
podman unshare chown -R 1000:1000 data/

Without it, the feed works but every upload fails with EACCES: permission denied, mkdir '/app/data/images'.

Tests

npm test

Covers gate rejection/acceptance, cookie persistence, gated uploads, the public feed, delete ownership (403 for a different browser's cookie), and clean SIGTERM shutdown.

Deployment status

Live at https://littlebabyredcat.natdecker.com, from the Stone Soup Cluster's app tier: one container per server, data bind-mounted from the server, route and TLS on the cluster gateway. Deploying is a push plus the cluster CLI's app update; nothing in this repo knows the host name or the ports.