raw-URLs, OIDC-Discovery-Formulierung, Platzhalter per sed im Workflow, Markdown-Links, Fehlercodes, HB_AUTH_PROVIDERS-Default, exec -T, wc-c-Hinweis, FORK.md-Hinweis. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
172 lines
8.8 KiB
Markdown
172 lines
8.8 KiB
Markdown
# Homebrewery OIDC fork
|
|
|
|
This fork extends [naturalcrit/homebrewery](https://github.com/naturalcrit/homebrewery)
|
|
for self-hosting while preserving its complete upstream history and MIT license.
|
|
Keep fork changes small and isolated in modules or configuration so upstream
|
|
updates remain practical to merge.
|
|
|
|
## Remotes and branches
|
|
|
|
- `origin`: `https://git.morlana.online/f.weber/homebrewery-oidc.git`
|
|
- `upstream`: `https://github.com/naturalcrit/homebrewery.git`
|
|
- `main`: reviewed integration branch for this fork.
|
|
- `upstream`: pristine upstream `master`; never add fork commits here.
|
|
|
|
The initial import (2026-11-24) is upstream commit
|
|
`6d219487de77f42868e38beeee0e4e7e9fb38679` (10,360 reachable commits, after tag `v3.21.0`).
|
|
Both `main` and `upstream` initially point to that exact commit. The one-time
|
|
import into the empty repository is the only direct-to-`main` exception.
|
|
|
|
## Reproducible upstream sync
|
|
|
|
Start from a clean working tree. Configure the upstream remote once after cloning:
|
|
|
|
```sh
|
|
git clone https://git.morlana.online/f.weber/homebrewery-oidc.git
|
|
cd homebrewery-oidc
|
|
git remote add upstream https://github.com/naturalcrit/homebrewery.git
|
|
```
|
|
|
|
For each update (choose a unique branch name):
|
|
|
|
```sh
|
|
git fetch origin
|
|
git switch main
|
|
git merge --ff-only origin/main
|
|
git switch -c sync/upstream-YYYY-MM-DD
|
|
git fetch upstream
|
|
UPSTREAM_SHA=$(git rev-parse upstream/master)
|
|
git merge "$UPSTREAM_SHA"
|
|
# Resolve conflicts, preserving the fork's isolated features; commit if needed.
|
|
npm ci # lockfile-exact; needs Node 26 (on the VM use the container below)
|
|
npm run build
|
|
npm test
|
|
npm run lint:dry
|
|
git push -u origin sync/upstream-YYYY-MM-DD
|
|
```
|
|
|
|
Open a PR against `main`, name the merged upstream commit (`$UPSTREAM_SHA`) and
|
|
the imported range `origin/upstream..$UPSTREAM_SHA`, include validation results, and request Archimedes' review (Claudia reviews Archimedes' own PRs).
|
|
Do not merge your own PR. Do not rebase or squash imported upstream history.
|
|
After the reviewed sync merges, advance the pristine tracking branch to exactly
|
|
the upstream commit that was merged into `main` (never to a newer, unreviewed
|
|
`upstream/master`):
|
|
|
|
```sh
|
|
git fetch origin
|
|
UPSTREAM_SHA=<upstream commit named in the sync PR>
|
|
git merge-base --is-ancestor "$UPSTREAM_SHA" origin/main &&
|
|
git merge-base --is-ancestor origin/upstream "$UPSTREAM_SHA" &&
|
|
git push origin "$UPSTREAM_SHA:refs/heads/upstream"
|
|
```
|
|
|
|
The first check ensures the commit really is merged into `main`; the second
|
|
prevents `upstream` from moving backwards or onto rewritten history. The push is
|
|
not a force push. Afterwards `git log origin/upstream..origin/main` shows exactly
|
|
the fork delta. If upstream rewrites history,
|
|
stop for review instead of force-pushing. Never merge `main` into `upstream`.
|
|
Use a feature branch from current `main` and a reviewed PR for fork changes.
|
|
Keep credentials in the environment; never put tokens in remote URLs or files.
|
|
|
|
## CI and container image
|
|
|
|
Fork-owned Gitea Actions workflows live in `.gitea/workflows/`. The upstream CI in
|
|
`.github/` and `.circleci/` stays untouched (it does not run on Gitea) so upstream
|
|
merges remain conflict-free.
|
|
|
|
| Workflow | Trigger | What it does |
|
|
| --- | --- | --- |
|
|
| `ci.yml` | pull requests, push to `main` | `npm ci` (includes the Vite build via `postinstall`), `npm run lint:dry`, `npm run stylelint:dry`, `npm test`. Upstream currently has ESLint warnings but no errors; warnings do not fail the job. The tests need no MongoDB. |
|
|
| `image.yml` | push to `main`, tags `v*`, manual | builds `docker/Dockerfile` (same as Compose) and pushes `git.morlana.online/f.weber/homebrewery-oidc`; release tags `vX.Y.Z` additionally go to Docker Hub (`<DOCKER_HUB_USER>/homebrewery-oidc`) |
|
|
| `dockerhub-sync.yml` | manual (input `version`) | copies an already built `vX.Y.Z` image from Gitea to Docker Hub without rebuilding (same digest); sets `latest` only if the version is the highest release |
|
|
| `dockerhub-description.yml` | release tag `vX.Y.Z`, push to `main` touching `docs/dockerhub/README.md`, manual | sets the Docker Hub overview from `docs/dockerhub/README.md` (English, < 25,000 bytes, absolute links only) plus a short description (≤ 100 characters), using `peter-evans/dockerhub-description`; skipped with a warning if `DOCKER_HUB_USER`/`DOCKER_HUB_TOKEN` are missing (the token needs Read, Write and Delete); `<DOCKER_HUB_USER>` in the file is replaced by the secret at publish time. A maintenance tag on an older commit overwrites the description with that older text; the first run needs the Hub repository to exist (created by `image.yml`) |
|
|
|
|
The authoritative image definition is `docker/Dockerfile` with
|
|
`docker/Dockerfile.dockerignore` (BuildKit picks it up automatically for `context: .`).
|
|
Compose (`docker-compose.override.yml`) builds the same file, so the published registry
|
|
image matches the one built locally. The upstream `Dockerfile` stays unchanged and is not
|
|
used by the fork. No configuration or secret is baked into the image: configure the
|
|
container at runtime through environment variables (for example `MONGODB_URI`;
|
|
`NODE_ENV=docker` is preset) or by mounting `config/docker.json`; `server/config.js`
|
|
reads argv, then env, then that file, then `config/default.json`. The container exits if
|
|
MongoDB is unreachable.
|
|
|
|
Image tags:
|
|
|
|
| Event | Tags |
|
|
| --- | --- |
|
|
| push to `main` | `main`, `sha-<7 chars>` |
|
|
| tag `vX.Y.Z` | `vX.Y.Z`, `latest`, `sha-<7 chars>` (pre-release tags such as `v1.0.0-rc.1` get no `latest`) |
|
|
|
|
Docker Hub receives only release tags `vX.Y.Z` (as `vX.Y.Z` and `latest`, same build and
|
|
digest as in Gitea). `main`, `sha-*` and pre-releases are never pushed there. If the secrets
|
|
`DOCKER_HUB_USER` and `DOCKER_HUB_TOKEN` (access token with Read & Write) are missing, the
|
|
Docker Hub part is skipped with a warning and the Gitea push is unaffected. To backfill a
|
|
version, run `dockerhub-sync.yml` with e.g. `v1.0.0`.
|
|
|
|
`buildcache` is the BuildKit layer cache, not a runnable image.
|
|
|
|
Running the published image (Compose template with PostgreSQL 18, OIDC, Git backend and image upload, German): [docs/deploy/README.md](docs/deploy/README.md).
|
|
|
|
Runner and repository settings (repository → Settings → Actions):
|
|
|
|
- **Runner:** jobs use `runs-on: ubuntu-latest` (public runner, as in the DnD Character Manager).
|
|
- **Secret `REGISTRY_TOKEN`:** access token of an account with write access to the
|
|
`f.weber` packages, scope `write:package`. Without it the workflow falls back to the
|
|
automatic `GITEA_TOKEN`, which may not be allowed to push packages.
|
|
- **Variable `REGISTRY_USER`** (optional): owner of `REGISTRY_TOKEN`; defaults to the repository owner.
|
|
- **Variable `CI_CACHE`** (optional): `true` enables the npm cache. Leave it unset until the
|
|
act_runner cache server is reachable from job containers; otherwise every cache step
|
|
waits for a connection timeout.
|
|
- **Variable `IMAGE_PLATFORMS`** (optional): defaults to `linux/amd64`.
|
|
|
|
## Fork roadmap
|
|
|
|
These are planned features, not functionality delivered by the initial import:
|
|
|
|
| Milestone | Scope |
|
|
| --- | --- |
|
|
| [M0](https://git.morlana.online/f.weber/homebrewery-oidc/milestone/4) | Upstream import, CI, development setup |
|
|
| [M1](https://git.morlana.online/f.weber/homebrewery-oidc/milestone/5) | OIDC login |
|
|
| [M2](https://git.morlana.online/f.weber/homebrewery-oidc/milestone/6) | PostgreSQL backend (PostgreSQL 18+) |
|
|
| [M3](https://git.morlana.online/f.weber/homebrewery-oidc/milestone/7) | Git backend including sharing |
|
|
| [M4](https://git.morlana.online/f.weber/homebrewery-oidc/milestone/8) | Image uploads to the Git repository |
|
|
|
|
Track implementation and review status on the
|
|
[roadmap board](https://git.morlana.online/f.weber/homebrewery-oidc/projects/2).
|
|
|
|
## Local startup
|
|
|
|
Consult `package.json` for the actual engine requirements: this imported revision
|
|
requires Node >=26.4.0 and npm >=10.8 <12. The older Node guidance in the upstream
|
|
README (v16+) does not match this revision. MongoDB must be >= 4.4, the minimum
|
|
supported by the bundled MongoDB driver (7.7).
|
|
|
|
```sh
|
|
export NODE_ENV=local
|
|
export MONGODB_URI=mongodb://127.0.0.1:27017/homebrewery
|
|
npm install # also runs the production asset build via postinstall
|
|
npm start # http://localhost:8000
|
|
```
|
|
|
|
### Development VM
|
|
|
|
The VM runs Node 24, and its CPU lacks AVX, so MongoDB >= 5.0 exits immediately
|
|
(code 132). Do not install Node system-wide; use disposable containers instead:
|
|
|
|
```sh
|
|
docker network create hb-dev
|
|
docker run -d --name hb-mongo --network hb-dev --memory 400m \
|
|
mongo:4.4 --wiredTigerCacheSizeGB 0.25
|
|
docker run --rm --name hb-app --network hb-dev --memory 1200m \
|
|
--user "$(id -u):$(id -g)" -e HOME=/tmp -e NODE_ENV=local \
|
|
-e MONGODB_URI=mongodb://hb-mongo:27017/homebrewery \
|
|
-p 127.0.0.1:8000:8000 -v "$PWD":/app -w /app \
|
|
node:26 sh -c 'npm install && npm start'
|
|
# when finished
|
|
docker rm -f hb-app hb-mongo && docker network rm hb-dev
|
|
```
|
|
|
|
MongoDB 4.4 is end-of-life: use it only with disposable test data. Verified on
|
|
2026-11-24 with `node:26` (Node 26.13.1, npm 11.20.0) and `mongo:4.4`.
|