feat(docker): Compose-Dev-Setup mit Profilen postgres, keycloak, authentik
PR Check / limit-pull-requests (pull_request_target) Skipped

Eigenes docker/Dockerfile, docker-compose.override.yml (Upstream-Compose unverändert),
Keycloak-Realm-Import, authentik-Blueprint, .env.example, README-Abschnitt.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
dev-bot BotandClaude Sonnet 5.5 committed 2026-11-24 18:50:06 +00:00
1 parent 8c112f50e6
commit 8f06133181
6 files changed
+376 -149

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
# Kopieren nach .env. Nur Entwicklungswerte – keine echten Secrets einchecken.
APP_PORT=8000
MONGODB_URI=mongodb://mongodb/homebrewery
MONGO_TAG=8
# Profil postgres
POSTGRES_DB=homebrewery
POSTGRES_USER=homebrewery
POSTGRES_PASSWORD=homebrewery-dev
POSTGRES_PORT=5432
# Profil keycloak (Discovery: http://localhost:8080/realms/homebrewery/.well-known/openid-configuration)
KEYCLOAK_TAG=26.4
KEYCLOAK_PORT=8080
KEYCLOAK_ADMIN=admin
KEYCLOAK_ADMIN_PASSWORD=admin-dev
# Profil authentik (Discovery: http://localhost:9000/application/o/homebrewery/.well-known/openid-configuration)
AUTHENTIK_TAG=2026.2
AUTHENTIK_PORT=9000
AUTHENTIK_SECRET_KEY=dev-only-insecure-secret-key-change-me
AUTHENTIK_DB_PASSWORD=authentik-dev
AUTHENTIK_BOOTSTRAP_PASSWORD=admin-dev
+166 -149
View File
@@ -1,149 +1,166 @@
# The Homebrewery
[![Homebrewery](https://circleci.com/gh/naturalcrit/homebrewery/tree/master.svg?style=svg)](https://app.circleci.com/pipelines/github/naturalcrit/homebrewery?branch=master)
The Homebrewery is a tool for making authentic looking [D&D content][dnd-content-url]
using [Markdown][markdown-url]. It is distributed under the terms of the [MIT License](./license).
[dnd-content-url]: https://dnd.wizards.com/products/tabletop-games/rpg-products/rpg_playershandbook
[markdown-url]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
## Quick Start
The easiest way to get started using The Homebrewery is to use it
[on our website][homebrewery-url]. The code is open source, so feel free to
clone it and tinker with it. If you want to make changes to the code, you can run
your own local version for testing by following the installation instructions
below.
[homebrewery-url]: https://homebrewery.naturalcrit.com
### Installation
First, install three programs that The Homebrewery requires to run and retrieve
updates:
1. install [node](https://nodejs.org/en/), version v16 or higher.
1. install [mongodb](https://www.mongodb.com/try/download/community) (Community version)
For the easiest installation, follow these steps:
1. In the installer, uncheck the option to run as a service.
1. You can install MongoDB Compass if you want a GUI to view your database documents.
1. If you install any version over 6.0, you will have to install [MongoDB Shell](https://www.mongodb.com/try/download/shell).
1. Go to the C:\ drive and create a folder called "data".
1. Inside the "data" folder, create a new folder called "db".
1. Open a command prompt or other terminal and navigate to your MongoDB install folder (C:\Program Files\Mongo\Server\6.0\bin).
1. In the command prompt, run "mongod", which will start up your local database server.
1. While MongoD is running, open a second command prompt and navigate to the MongoDB install folder.
1. Search in Windows for "Advanced system settings" and open it.
1. Click "Environment variables", find the "path" variable, and double-click to open it.
1. Click "New" and paste in the path to the MongoDB "bin" folder.
1. Click "OK" three times to close all the windows.
1. In the second command prompt, run "mongo", which allows you to edit the database.
1. Type `use homebrewery` to create The Homebrewery database. You should see `switched to db homebrewery`.
1. Type `db.brews.insertOne({"title":"test"})` to create a blank document. You should see `{
acknowledged: true,
insertedId: ObjectId("63c2fce9e5ac5a94fe2410cf")
}`
1. install [git](https://git-scm.com/downloads) (select the option that allows Git to run from the command prompt).
Checkout the repo ([documentation][github-clone-repo-docs-url]):
```
git clone https://github.com/naturalcrit/homebrewery.git
```
[github-clone-repo-docs-url]: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/cloning-a-repository
Second, you will need to add the environment variable `NODE_ENV=local` to allow
the project to run locally.
You can set this **temporarily** (until you close the terminal) in your shell of choice with admin privileges:
* Windows Powershell: `$env:NODE_ENV="local"`
* Windows CMD: `set NODE_ENV=local`
* Linux / macOS: `export NODE_ENV=local`
If you want to add this variable **permanently** the steps are as follows:
1. Search in Windows for "Advanced system settings" and open it.
1. Click "Environment variables".
1. In System Variables, click "New"
1. Click "New" and write `NODE_ENV` as a name and `local` as the value.
1. Click "OK" three times to close all the windows.
This can be undone at any time if needed.
Third, you will need to install the Node dependencies, compile the app, and run
it using the two commands:
1. `npm install`
1. `npm start`
When the Homebrewery server is started for the first time, it will modify the database to create the indexes required for better Homebrewery performance. This may take a few moments to complete for each index, dependent on how much content is in your local database - a brand new, empty database should be done in seconds.
On completion, you should be able to go to [http://localhost:8000](http://localhost:8000) in your browser and use The Homebrewery offline.
If you had any issue at all, here are some links that may be useful:
- [Course](https://learn.mongodb.com/courses/m103-basic-cluster-administration) on cluster administration, useful for beginners
- [Mongo community forums](https://www.mongodb.com/community/forums/)
- Useful Stack Overflow links for your most probable errors: [1](https://stackoverflow.com/questions/44962540/mongod-and-mongo-commands-not-working-on-windows-10), [2](https://stackoverflow.com/questions/15053893/mongo-command-not-recognized-when-trying-to-connect-to-a-mongodb-server/41507803#41507803), [3](https://stackoverflow.com/questions/51224959/mongo-is-not-recognized-as-an-internal-or-external-command-operable-program-o)
If you still have problems, post in [Our Subreddit](https://www.reddit.com/r/homebrewery/) and we will help you.
### Running the application via Docker
Please see the docs here: [README.DOCKER.md](./README.DOCKER.md)
### Running the application on FreeBSD or FreeNAS
Please see the docs here: [README.FreeBSD.md](./README.FREEBSD.md)
### Standalone PHB Stylesheet
If you just want the stylesheet that is generated to make pages look like they
are from the Player's Handbook, you will find it in the
[phb.standalone.css](./phb.standalone.css) file.
If you are developing locally and would like to generate your own, follow the
above steps and then run `npm run phb`.
## Issues, Suggestions, and Bugs
If you run into any issues using The Homebrewery or have suggestions for
improvement, please submit an issue [on GitHub][repo-issues-url].
You can also get help for issues on the subreddit [r/homebrewery][subreddit-url]
[repo-issues-url]: https://github.com/naturalcrit/homebrewery/issues
[subreddit-url]: https://www.reddit.com/r/homebrewery
## Changelog
You can check out the [changelog](./changelog.md).
## License
This project is licensed under the [MIT license](./license), which means you
are free to use The Homebrewery in any way that you want, except for claiming
that you made it yourself.
If you wish to sell, or in some way gain profit for, what's created on this site,
it's your responsibility to ensure you have the proper licenses/rights for any
images or resources used.
## Contributing
You are welcome to contribute to the development and maintenance of the
project! There are several ways of doing that:
- At the moment, we have a huge backlog of [issues][repo-issues-url] and some
of them are outdated, duplicates, or don't contain any useful info. To help, you can [mark duplicates][github-mark-duplicate-url], try to
reproduce some complex or weird issues, try finding a workaround for a
reported bug, or just mention our issue managers team to let them know about
outdated issues via `@naturalcrit/issue-managers`.
- Our [subreddit][subreddit-url] is constantly growing and there are number of
bug reports. Any help with sorting them out is very welcome.
- And of course you can contribute by fixing a bug or implementing a new
feature by yourself, we are waiting for your
[pull requests][github-pr-docs-url]!
Anyway, if you would like to get in touch with the team and discuss/coordinate
your contribution to the project, please join our [gitter chat][gitter-url].
[github-mark-duplicate-url]: https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/about-duplicate-issues-and-pull-requests
[github-pr-docs-url]: https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request
[gitter-url]: https://gitter.im/naturalcrit/Lobby
# The Homebrewery
[![Homebrewery](https://circleci.com/gh/naturalcrit/homebrewery/tree/master.svg?style=svg)](https://app.circleci.com/pipelines/github/naturalcrit/homebrewery?branch=master)
The Homebrewery is a tool for making authentic looking [D&D content][dnd-content-url]
using [Markdown][markdown-url]. It is distributed under the terms of the [MIT License](./license).
[dnd-content-url]: https://dnd.wizards.com/products/tabletop-games/rpg-products/rpg_playershandbook
[markdown-url]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
## Quick Start
The easiest way to get started using The Homebrewery is to use it
[on our website][homebrewery-url]. The code is open source, so feel free to
clone it and tinker with it. If you want to make changes to the code, you can run
your own local version for testing by following the installation instructions
below.
[homebrewery-url]: https://homebrewery.naturalcrit.com
### Installation
First, install three programs that The Homebrewery requires to run and retrieve
updates:
1. install [node](https://nodejs.org/en/), version v16 or higher.
1. install [mongodb](https://www.mongodb.com/try/download/community) (Community version)
For the easiest installation, follow these steps:
1. In the installer, uncheck the option to run as a service.
1. You can install MongoDB Compass if you want a GUI to view your database documents.
1. If you install any version over 6.0, you will have to install [MongoDB Shell](https://www.mongodb.com/try/download/shell).
1. Go to the C:\ drive and create a folder called "data".
1. Inside the "data" folder, create a new folder called "db".
1. Open a command prompt or other terminal and navigate to your MongoDB install folder (C:\Program Files\Mongo\Server\6.0\bin).
1. In the command prompt, run "mongod", which will start up your local database server.
1. While MongoD is running, open a second command prompt and navigate to the MongoDB install folder.
1. Search in Windows for "Advanced system settings" and open it.
1. Click "Environment variables", find the "path" variable, and double-click to open it.
1. Click "New" and paste in the path to the MongoDB "bin" folder.
1. Click "OK" three times to close all the windows.
1. In the second command prompt, run "mongo", which allows you to edit the database.
1. Type `use homebrewery` to create The Homebrewery database. You should see `switched to db homebrewery`.
1. Type `db.brews.insertOne({"title":"test"})` to create a blank document. You should see `{
acknowledged: true,
insertedId: ObjectId("63c2fce9e5ac5a94fe2410cf")
}`
1. install [git](https://git-scm.com/downloads) (select the option that allows Git to run from the command prompt).
Checkout the repo ([documentation][github-clone-repo-docs-url]):
```
git clone https://github.com/naturalcrit/homebrewery.git
```
[github-clone-repo-docs-url]: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/cloning-a-repository
Second, you will need to add the environment variable `NODE_ENV=local` to allow
the project to run locally.
You can set this **temporarily** (until you close the terminal) in your shell of choice with admin privileges:
* Windows Powershell: `$env:NODE_ENV="local"`
* Windows CMD: `set NODE_ENV=local`
* Linux / macOS: `export NODE_ENV=local`
If you want to add this variable **permanently** the steps are as follows:
1. Search in Windows for "Advanced system settings" and open it.
1. Click "Environment variables".
1. In System Variables, click "New"
1. Click "New" and write `NODE_ENV` as a name and `local` as the value.
1. Click "OK" three times to close all the windows.
This can be undone at any time if needed.
Third, you will need to install the Node dependencies, compile the app, and run
it using the two commands:
1. `npm install`
1. `npm start`
When the Homebrewery server is started for the first time, it will modify the database to create the indexes required for better Homebrewery performance. This may take a few moments to complete for each index, dependent on how much content is in your local database - a brand new, empty database should be done in seconds.
On completion, you should be able to go to [http://localhost:8000](http://localhost:8000) in your browser and use The Homebrewery offline.
If you had any issue at all, here are some links that may be useful:
- [Course](https://learn.mongodb.com/courses/m103-basic-cluster-administration) on cluster administration, useful for beginners
- [Mongo community forums](https://www.mongodb.com/community/forums/)
- Useful Stack Overflow links for your most probable errors: [1](https://stackoverflow.com/questions/44962540/mongod-and-mongo-commands-not-working-on-windows-10), [2](https://stackoverflow.com/questions/15053893/mongo-command-not-recognized-when-trying-to-connect-to-a-mongodb-server/41507803#41507803), [3](https://stackoverflow.com/questions/51224959/mongo-is-not-recognized-as-an-internal-or-external-command-operable-program-o)
If you still have problems, post in [Our Subreddit](https://www.reddit.com/r/homebrewery/) and we will help you.
### Running the application via Docker
Please see the docs here: [README.DOCKER.md](./README.DOCKER.md)
### Lokal starten / Selbst hosten (Fork homebrewery-oidc)
```bash
cp .env.example .env # optional, alle Werte haben Entwicklungs-Defaults
docker compose up --build # App + MongoDB -> http://localhost:8000
```
`docker-compose.override.yml` (wird automatisch geladen) und `docker/` enthalten die Fork-Erweiterungen; `docker-compose.yml` bleibt Upstream-identisch.
| Profil | Start | Ergebnis |
|---|---|---|
| `postgres` | `docker compose --profile postgres up -d postgres` | PostgreSQL 18 auf `127.0.0.1:5432` (ab M2) |
| `keycloak` | `docker compose --profile keycloak up -d` | Keycloak :8080, Realm `homebrewery`, Client `homebrewery`/`dev-only-client-secret`, Nutzer `testuser`/`testuser-dev`, Admin `admin`/`admin-dev`. Discovery: `http://localhost:8080/realms/homebrewery/.well-known/openid-configuration` (Start dauert 1–2 Min.) |
| `authentik` | `docker compose --profile authentik up -d` | authentik :9000, Provider/App `homebrewery` per Blueprint, gleicher Client und Nutzer, Admin `akadmin`/`admin-dev`. Discovery: `http://localhost:9000/application/o/homebrewery/.well-known/openid-configuration` |
Hinweise: Alle Zugangsdaten sind reine Dev-Werte, für den Betrieb in `.env` ersetzen. MongoDB 5+ benötigt eine CPU mit AVX; auf älteren CPUs/VMs `MONGO_TAG=4.4` setzen. Falls der authentik-Blueprint beim allerersten Start wegen noch laufender Standard-Blueprints fehlschlägt: `docker compose exec authentik ak apply_blueprint /blueprints/custom/homebrewery.yaml`.
### Running the application on FreeBSD or FreeNAS
Please see the docs here: [README.FreeBSD.md](./README.FREEBSD.md)
### Standalone PHB Stylesheet
If you just want the stylesheet that is generated to make pages look like they
are from the Player's Handbook, you will find it in the
[phb.standalone.css](./phb.standalone.css) file.
If you are developing locally and would like to generate your own, follow the
above steps and then run `npm run phb`.
## Issues, Suggestions, and Bugs
If you run into any issues using The Homebrewery or have suggestions for
improvement, please submit an issue [on GitHub][repo-issues-url].
You can also get help for issues on the subreddit [r/homebrewery][subreddit-url]
[repo-issues-url]: https://github.com/naturalcrit/homebrewery/issues
[subreddit-url]: https://www.reddit.com/r/homebrewery
## Changelog
You can check out the [changelog](./changelog.md).
## License
This project is licensed under the [MIT license](./license), which means you
are free to use The Homebrewery in any way that you want, except for claiming
that you made it yourself.
If you wish to sell, or in some way gain profit for, what's created on this site,
it's your responsibility to ensure you have the proper licenses/rights for any
images or resources used.
## Contributing
You are welcome to contribute to the development and maintenance of the
project! There are several ways of doing that:
- At the moment, we have a huge backlog of [issues][repo-issues-url] and some
of them are outdated, duplicates, or don't contain any useful info. To help, you can [mark duplicates][github-mark-duplicate-url], try to
reproduce some complex or weird issues, try finding a workaround for a
reported bug, or just mention our issue managers team to let them know about
outdated issues via `@naturalcrit/issue-managers`.
- Our [subreddit][subreddit-url] is constantly growing and there are number of
bug reports. Any help with sorting them out is very welcome.
- And of course you can contribute by fixing a bug or implementing a new
feature by yourself, we are waiting for your
[pull requests][github-pr-docs-url]!
Anyway, if you would like to get in touch with the team and discuss/coordinate
your contribution to the project, please join our [gitter chat][gitter-url].
[github-mark-duplicate-url]: https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/about-duplicate-issues-and-pull-requests
[github-pr-docs-url]: https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request
[gitter-url]: https://gitter.im/naturalcrit/Lobby
+104
View File
@@ -0,0 +1,104 @@
# Wird von `docker compose` automatisch zusätzlich zu docker-compose.yml (Upstream) geladen.
# Enthält alle Fork-Erweiterungen, damit docker-compose.yml unverändert bleibt.
services:
mongodb:
image: mongo:${MONGO_TAG:-8}
healthcheck:
test: ["CMD-SHELL", "mongosh --quiet --eval \"db.adminCommand('ping')\" || mongo --quiet --eval \"db.adminCommand('ping')\""]
interval: 10s
timeout: 5s
retries: 10
homebrewery:
build:
context: .
dockerfile: docker/Dockerfile
depends_on:
mongodb:
condition: service_healthy
environment:
MONGODB_URI: ${MONGODB_URI:-mongodb://mongodb/homebrewery}
ports: !override
- "${APP_PORT:-8000}:8000"
# --- Profil: postgres (ab M2) ---
postgres:
profiles: ["postgres"]
image: postgres:18
environment:
POSTGRES_DB: ${POSTGRES_DB:-homebrewery}
POSTGRES_USER: ${POSTGRES_USER:-homebrewery}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-homebrewery-dev}
volumes:
- pgdata:/var/lib/postgresql
ports:
- "127.0.0.1:${POSTGRES_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 10
# --- Profil: keycloak (Test-IdP, Realm "homebrewery") ---
keycloak:
profiles: ["keycloak"]
image: quay.io/keycloak/keycloak:${KEYCLOAK_TAG:-26.4}
command: ["start-dev", "--import-realm"]
environment:
KC_BOOTSTRAP_ADMIN_USERNAME: ${KEYCLOAK_ADMIN:-admin}
KC_BOOTSTRAP_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:-admin-dev}
KC_HTTP_PORT: 8080
KC_HOSTNAME_STRICT: "false"
volumes:
- ./docker/keycloak/realm-homebrewery.json:/opt/keycloak/data/import/realm-homebrewery.json:ro
ports:
- "${KEYCLOAK_PORT:-8080}:8080"
# --- Profil: authentik (Test-IdP, per Blueprint vorkonfiguriert) ---
authentik-db:
profiles: ["authentik"]
image: postgres:18
environment:
POSTGRES_DB: authentik
POSTGRES_USER: authentik
POSTGRES_PASSWORD: ${AUTHENTIK_DB_PASSWORD:-authentik-dev}
volumes:
- authentikdb:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U authentik -d authentik"]
interval: 10s
timeout: 5s
retries: 10
authentik:
profiles: ["authentik"]
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG:-2026.2}
command: server
environment: &authentik-env
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY:-dev-only-insecure-secret-key-change-me}
AUTHENTIK_POSTGRESQL__HOST: authentik-db
AUTHENTIK_POSTGRESQL__USER: authentik
AUTHENTIK_POSTGRESQL__NAME: authentik
AUTHENTIK_POSTGRESQL__PASSWORD: ${AUTHENTIK_DB_PASSWORD:-authentik-dev}
AUTHENTIK_BOOTSTRAP_PASSWORD: ${AUTHENTIK_BOOTSTRAP_PASSWORD:-admin-dev}
AUTHENTIK_BOOTSTRAP_EMAIL: admin@example.test
AUTHENTIK_ERROR_REPORTING__ENABLED: "false"
volumes:
- ./docker/authentik/blueprints:/blueprints/custom:ro
ports:
- "${AUTHENTIK_PORT:-9000}:9000"
depends_on:
authentik-db:
condition: service_healthy
authentik-worker:
profiles: ["authentik"]
image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG:-2026.2}
command: worker
environment: *authentik-env
volumes:
- ./docker/authentik/blueprints:/blueprints/custom:ro
depends_on:
authentik-db:
condition: service_healthy
volumes:
pgdata:
authentikdb:
+11
View File
@@ -0,0 +1,11 @@
# Eigenes Dockerfile für den Fork (Upstream-Dockerfile erwartet eine nicht eingecheckte config/docker.json).
FROM node:26.4.0-alpine
RUN apk --no-cache add git
ENV NODE_ENV=docker
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts
COPY . .
RUN npm run build
EXPOSE 8000
CMD [ "npm", "start" ]
@@ -0,0 +1,38 @@
version: 1
metadata:
name: Homebrewery Dev
entries:
- model: authentik_core.user
identifiers:
username: testuser
attrs:
name: Test User
email: testuser@example.test
password: testuser-dev
is_active: true
- model: authentik_providers_oauth2.oauth2provider
id: provider
identifiers:
name: homebrewery
attrs:
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
client_type: confidential
client_id: homebrewery
client_secret: dev-only-client-secret
redirect_uris:
- matching_mode: regex
url: http://localhost:8000/.*
- matching_mode: regex
url: http://homebrewery.local.naturalcrit.com:8000/.*
signing_key: !Find [authentik_crypto.certificatekeypair, [name, authentik Self-signed Certificate]]
property_mappings:
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, openid]]
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, profile]]
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, email]]
- model: authentik_core.application
identifiers:
slug: homebrewery
attrs:
name: Homebrewery
provider: !KeyOf provider
+34
View File
@@ -0,0 +1,34 @@
{
"realm": "homebrewery",
"enabled": true,
"registrationAllowed": false,
"loginWithEmailAllowed": true,
"sslRequired": "none",
"clients": [
{
"clientId": "homebrewery",
"name": "Homebrewery (Dev)",
"enabled": true,
"protocol": "openid-connect",
"publicClient": false,
"secret": "dev-only-client-secret",
"standardFlowEnabled": true,
"directAccessGrantsEnabled": false,
"redirectUris": ["http://localhost:8000/*", "http://homebrewery.local.naturalcrit.com:8000/*"],
"webOrigins": ["+"],
"attributes": { "pkce.code.challenge.method": "S256" },
"defaultClientScopes": ["openid", "profile", "email"]
}
],
"users": [
{
"username": "testuser",
"email": "testuser@example.test",
"emailVerified": true,
"firstName": "Test",
"lastName": "User",
"enabled": true,
"credentials": [{ "type": "password", "value": "testuser-dev", "temporary": false }]
}
]
}