Merge pull request 'feat(docker): Compose-Dev-Setup (App, Mongo, Postgres 18, Keycloak, authentik)' (#14) from feat/compose-dev-setup into main
This commit was merged in pull request #14.
This commit is contained in:
8 files changed
+261
No files matched your search
@@ -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://keycloak.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://authentik.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
|
||||
@@ -15,3 +15,4 @@ startMViewer.bat
|
||||
.vscode
|
||||
|
||||
coverage
|
||||
.env
|
||||
@@ -90,6 +90,23 @@ If you still have problems, post in [Our Subreddit](https://www.reddit.com/r/hom
|
||||
|
||||
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://keycloak.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://authentik.localhost:9000/application/o/homebrewery/.well-known/openid-configuration` |
|
||||
|
||||
Hinweise: Die IdPs laufen unter `keycloak.localhost:8080` bzw. `authentik.localhost:9000` (Issuer für Browser und App-Container identisch, Bindung nur an 127.0.0.1; `*.localhost` löst moderne Browser/OS automatisch auf, sonst `127.0.0.1 keycloak.localhost authentik.localhost` in `/etc/hosts`). Ports nur ändern, wenn Redirect-/Issuer-Einstellungen mitgezogen werden. 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. Der authentik-Blueprint wird beim Erststart automatisch angewendet (dauert einige Minuten, bis die Discovery-URL 200 liefert).
|
||||
|
||||
### Running the application on FreeBSD or FreeNAS
|
||||
|
||||
Please see the docs here: [README.FreeBSD.md](./README.FREEBSD.md)
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# 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: ${KEYCLOAK_PORT:-8080}
|
||||
# Einheitlicher Issuer für Browser (Host) und App-Container: http://keycloak.localhost:8080
|
||||
KC_HOSTNAME: http://keycloak.localhost:8080
|
||||
volumes:
|
||||
- ./docker/keycloak/realm-homebrewery.json:/opt/keycloak/data/import/realm-homebrewery.json:ro
|
||||
ports:
|
||||
- "127.0.0.1:${KEYCLOAK_PORT:-8080}:${KEYCLOAK_PORT:-8080}"
|
||||
networks:
|
||||
default:
|
||||
aliases: [keycloak.localhost]
|
||||
|
||||
# --- 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"
|
||||
AUTHENTIK_LISTEN__HTTP: 0.0.0.0:${AUTHENTIK_PORT:-9000}
|
||||
volumes:
|
||||
- ./docker/authentik/blueprints:/blueprints/custom:ro
|
||||
ports:
|
||||
- "127.0.0.1:${AUTHENTIK_PORT:-9000}:${AUTHENTIK_PORT:-9000}"
|
||||
# Einheitlicher Issuer: http://authentik.localhost:9000 (Browser und App-Container)
|
||||
networks:
|
||||
default:
|
||||
aliases: [authentik.localhost]
|
||||
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:
|
||||
@@ -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,10 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
.git
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
.npm-cache
|
||||
.runtime-tmp
|
||||
tests
|
||||
docker-compose*.yml
|
||||
@@ -0,0 +1,53 @@
|
||||
version: 1
|
||||
metadata:
|
||||
name: Homebrewery Dev
|
||||
entries:
|
||||
- model: authentik_blueprints.metaapplyblueprint
|
||||
attrs:
|
||||
identifiers:
|
||||
name: Default - Provider authorization flow (implicit consent)
|
||||
required: true
|
||||
- model: authentik_blueprints.metaapplyblueprint
|
||||
attrs:
|
||||
identifiers:
|
||||
name: Default - Provider invalidation flow
|
||||
required: true
|
||||
- model: authentik_blueprints.metaapplyblueprint
|
||||
attrs:
|
||||
identifiers:
|
||||
name: System - OAuth2 Provider - Scopes
|
||||
required: true
|
||||
- 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
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"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", "post.logout.redirect.uris": "+" }
|
||||
}
|
||||
],
|
||||
"users": [
|
||||
{
|
||||
"username": "testuser",
|
||||
"email": "testuser@example.test",
|
||||
"emailVerified": true,
|
||||
"firstName": "Test",
|
||||
"lastName": "User",
|
||||
"enabled": true,
|
||||
"credentials": [{ "type": "password", "value": "testuser-dev", "temporary": false }]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user