New recipe hopps (accounting app)
This commit is contained in:
+142
@@ -6,3 +6,145 @@ DOMAIN=hopps.example.com
|
||||
#EXTRA_DOMAINS=', `www.hopps.example.com`'
|
||||
|
||||
LETS_ENCRYPT_ENV=production
|
||||
|
||||
ENABLE_BACKUPS=true
|
||||
COMPOSE_FILE="compose.yml"
|
||||
|
||||
|
||||
# Copy to .env and fill in. Everything without a value below is required,
|
||||
# unless its comment says optional or it belongs to a part you did not enable.
|
||||
# `docker compose up -d` will refuse to work properly without them.
|
||||
|
||||
# ------------------------------------------------------- identity provider --
|
||||
# Who manages the user accounts:
|
||||
# keycloak Hopps's own Keycloak (default). Fill in block B below; the
|
||||
# Keycloak overlay is already in COMPOSE_FILE.
|
||||
# authentik An existing Authentik instance. Fill in block A below and
|
||||
# remove docker-compose.keycloak.yaml from COMPOSE_FILE.
|
||||
HOPPS_AUTH_PROVIDER=authentik
|
||||
|
||||
|
||||
# ------------------------------------------------------------- public URLs --
|
||||
# How the browser reaches each component. For a real deployment put a reverse
|
||||
# proxy with TLS in front and use https:// hostnames here. No trailing slash.
|
||||
PUBLIC_SPA_URL=https://$DOMAIN
|
||||
PUBLIC_ORG_URL=https://org.$DOMAIN
|
||||
|
||||
# ------------------------------------------------------------- tenancy -----
|
||||
# single: this installation serves exactly one association. The organization is
|
||||
# created once during the initial setup in the browser; afterwards there
|
||||
# is no sign-up, the SaaS-only admin API is off, and anyone who can log in
|
||||
# but is not a member of the organization is told to ask for an invitation.
|
||||
# multi: the hosted SaaS behaviour - anyone can register an organization.
|
||||
# Switching an existing installation from multi to single refuses to start while
|
||||
# the database holds more than one organization.
|
||||
HOPPS_TENANCY_MODE=single
|
||||
|
||||
# ------------------------------------------------------------ branding -----
|
||||
VITE_TITLE=Hopps
|
||||
VITE_GENERAL_DATE_FORMAT=dd.MM.yyyy
|
||||
|
||||
# ------------------------------------------- Impressum & Datenschutz --------
|
||||
# You are responsible for the legal pages of your instance. Two ways to provide
|
||||
# them (a URL wins over a mounted file; leave both empty to hide the page):
|
||||
# 1. Link an existing page:
|
||||
# HOPPS_IMPRINT_URL=https://example.org/impressum
|
||||
# HOPPS_PRIVACY_URL=https://example.org/datenschutz
|
||||
# 2. Mount your own content: enable the `./legal:/app/legal:ro` volume in
|
||||
# docker-compose.yaml and drop impressum.html / datenschutz.html in ./legal.
|
||||
# See legal/README.md for details and templates.
|
||||
HOPPS_IMPRINT_URL=
|
||||
HOPPS_PRIVACY_URL=
|
||||
|
||||
# ============================================================================
|
||||
# A) Authentik (HOPPS_AUTH_PROVIDER=authentik)
|
||||
# ============================================================================
|
||||
# Required with HOPPS_AUTH_PROVIDER=authentik, ignored otherwise.
|
||||
# People log in with their Authentik account. Registering an organization
|
||||
# creates the founder's account there, and inviting someone links their
|
||||
# existing account or creates one.
|
||||
# Setup in Authentik: README.md, "Identity provider".
|
||||
|
||||
# Uncomment to enable Authentik authentication
|
||||
COMPOSE_FILE="$COMPOSE_FILE:compose.authentik.yml"
|
||||
|
||||
# Issuer of the Hopps application in Authentik, exactly as its
|
||||
# /.well-known/openid-configuration reports it, trailing slash included, e.g.
|
||||
# https://auth.example.org/application/o/hopps/
|
||||
# Opened by the browser, so it must be publicly reachable.
|
||||
PUBLIC_OIDC_ISSUER_URL=https://auth.example.com/application/o/hopps/
|
||||
# Client ID of the OAuth2/OpenID provider behind that application.
|
||||
OIDC_CLIENT_ID=hopps
|
||||
|
||||
# Base URL of Authentik, no trailing slash, e.g. https://auth.example.org
|
||||
# Authentik builds the set-password links from it, so use the address invited
|
||||
# people can open.
|
||||
AUTHENTIK_URL=https://auth.example.com
|
||||
# Token of a service account allowed to view, create and delete users
|
||||
# (Directory -> Tokens and App passwords, intent "API").
|
||||
#AUTHENTIK_API_TOKEN=
|
||||
# Optional. UUID of an Authentik "Email" stage that mails invited people their
|
||||
# set-password link. Left empty, the inviting admin gets the link to pass on.
|
||||
#AUTHENTIK_EMAIL_STAGE_ID=
|
||||
# Authentik secret
|
||||
SECRET_AUTHENTIK_CLIENT_SECRET_VERSION=v1
|
||||
SECRET_DB_PASSWORD_VERSION=v1
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# B) Keycloak (HOPPS_AUTH_PROVIDER=keycloak)
|
||||
# ============================================================================
|
||||
# Required with HOPPS_AUTH_PROVIDER=keycloak (the default), together with
|
||||
# docker-compose.keycloak.yaml in COMPOSE_FILE. Ignored otherwise.
|
||||
#PUBLIC_KEYCLOAK_URL=http://localhost:8092
|
||||
#KEYCLOAK_PORT=8092
|
||||
# Bound to 127.0.0.1 only. Web UI of the mail catcher Keycloak sends through.
|
||||
#MAILPIT_UI_PORT=8025
|
||||
|
||||
#KEYCLOAK_ADMIN=admin
|
||||
#KEYCLOAK_ADMIN_PASSWORD=
|
||||
|
||||
# Uncomment and set to "xforwarded" when Keycloak sits behind a reverse proxy that
|
||||
# terminates TLS. Leave it out entirely otherwise - an empty value is rejected.
|
||||
#KC_PROXY_HEADERS=xforwarded
|
||||
|
||||
# --------------------------------- Keycloak: brokering to another provider --
|
||||
# Optional: let people sign in at Keycloak with an existing OpenID Connect
|
||||
# provider (Authentik, Entra ID, Google Workspace, another Keycloak, ...) in
|
||||
# addition to a password managed there. Accounts are still created in Keycloak.
|
||||
# Leave IDP_ENABLED=false to keep Keycloak logins only.
|
||||
#
|
||||
# Applied on the FIRST start only, together with the rest of the realm. To add a
|
||||
# provider to a running installation, use the Keycloak admin console instead
|
||||
# (Identity providers -> OpenID Connect v1.0).
|
||||
#
|
||||
# Whitelist this redirect URI at the provider:
|
||||
# <PUBLIC_KEYCLOAK_URL>/realms/quarkus/broker/<IDP_ALIAS>/endpoint
|
||||
#
|
||||
# Setup walkthrough, including a local Authentik to test against: EXTERNAL-IDP.md
|
||||
#IDP_ENABLED=false
|
||||
# Internal name. Appears in the redirect URI above and selects the button logo
|
||||
# in the login theme - see EXTERNAL-IDP.md, "Showing the provider's logo".
|
||||
#IDP_ALIAS=oidc
|
||||
# Button caption on the login page.
|
||||
#IDP_DISPLAY_NAME=Single sign-on
|
||||
#IDP_CLIENT_ID=
|
||||
#IDP_CLIENT_SECRET=
|
||||
|
||||
# Endpoints, straight from the provider's /.well-known/openid-configuration.
|
||||
# authorization_endpoint and end_session_endpoint are opened in the user's
|
||||
# BROWSER; the others are called by Keycloak itself and may use an internal
|
||||
# address. IDP_ISSUER must match the "iss" claim byte for byte, trailing slash
|
||||
# included. https:// is required unless REALM_SSL_REQUIRED is relaxed.
|
||||
#IDP_AUTHORIZATION_URL=
|
||||
#IDP_TOKEN_URL=
|
||||
#IDP_USERINFO_URL=
|
||||
#IDP_JWKS_URL=
|
||||
#IDP_LOGOUT_URL=
|
||||
#IDP_ISSUER=
|
||||
|
||||
# LOCAL TESTING ONLY. Keycloak refuses plain-http identity provider URLs; setting
|
||||
# this to "none" turns that check off so a local Authentik can be used without TLS.
|
||||
# Never set this in a real deployment - it also disables Keycloak's own HTTPS
|
||||
# requirement for the realm. See EXTERNAL-IDP.md, "Trying it locally with Authentik".
|
||||
#REALM_SSL_REQUIRED=external
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
|
||||
<!-- metadata -->
|
||||
|
||||
* **Maintainer**:
|
||||
* **Maintainer**: Local-IT: [@moritz](https://git.coopcloud.tech/moritz), [@simon](https://git.coopcloud.tech/simon), [@carla](https://git.coopcloud.tech/carla)
|
||||
* **Category**: Apps
|
||||
* **Status**: 0
|
||||
* **Image**: [`hopps`](https://hub.docker.com/r/hopps), 4, upstream
|
||||
* **Status**: 3
|
||||
* **Image**: [`hopps`](https://github.com/hopps-app/hopps), 4, upstream
|
||||
* **Healthcheck**: No
|
||||
* **Backups**: No
|
||||
* **Backups**: Yes
|
||||
* **Email**: No
|
||||
* **Tests**: No
|
||||
* **SSO**: No
|
||||
* **SSO**: Yes (via Authentik)
|
||||
|
||||
<!-- endmetadata -->
|
||||
|
||||
@@ -22,4 +22,4 @@
|
||||
* `abra app config <app-name>`
|
||||
* `abra app deploy <app-name>`
|
||||
|
||||
For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech).
|
||||
For more, see the Readme of Hopps: https://github.com/hopps-app/hopps/blob/main/infrastructure/hopps-app/README.md.
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# Set any config versions here
|
||||
# Docs: https://docs.coopcloud.tech/maintainers/handbook/#manage-configs
|
||||
|
||||
export PG_BACKUP_VERSION=v2
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
services:
|
||||
app:
|
||||
environment:
|
||||
OIDC_CLIENT_SECRET_FILE: /run/secrets/authentik_client_secret
|
||||
secrets:
|
||||
- authentik_client_secret
|
||||
|
||||
secrets:
|
||||
authentik_client_secret:
|
||||
external: true
|
||||
name: ${STACK_NAME}_authentik_client_secret_${SECRET_AUTHENTIK_CLIENT_SECRET_VERSION}
|
||||
+164
-8
@@ -1,7 +1,7 @@
|
||||
---
|
||||
services:
|
||||
app:
|
||||
image: nginx:1.27.5
|
||||
image: ghcr.io/hopps-app/hopps/frontend:2.5.0
|
||||
networks:
|
||||
- proxy
|
||||
deploy:
|
||||
@@ -9,7 +9,7 @@ services:
|
||||
condition: on-failure
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=8080"
|
||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||
@@ -20,20 +20,176 @@ services:
|
||||
# - "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.replacement=https://${DOMAIN}/$${2}"
|
||||
# - "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.permanent=true"
|
||||
## Redirect HTTP to HTTPS
|
||||
# - "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.scheme=https"
|
||||
# - "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.permanent=true"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.scheme=https"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.permanent=true"
|
||||
## When you're ready for release, run "abra recipe sync <name>" to set this
|
||||
- "coop-cloud.${STACK_NAME}.version="
|
||||
- "coop-cloud.${STACK_NAME}.version=1.0.0+2.5.0"
|
||||
environment:
|
||||
VITE_TITLE: ${VITE_TITLE:-Hopps}
|
||||
VITE_GENERAL_DATE_FORMAT: ${VITE_GENERAL_DATE_FORMAT:-dd.MM.yyyy}
|
||||
VITE_API_ORG_URL: ${PUBLIC_ORG_URL}
|
||||
# -- login at the external OIDC provider (the browser talks to it directly)
|
||||
VITE_OIDC_PROVIDER_URL: ${PUBLIC_OIDC_ISSUER_URL:-}
|
||||
VITE_OIDC_CLIENT_ID: ${OIDC_CLIENT_ID:-}
|
||||
# Authentik only issues a refresh token when offline_access is requested.
|
||||
VITE_OIDC_SCOPE: ${OIDC_SCOPE:-openid profile email offline_access}
|
||||
# Impressum / Datenschutzerklärung. Either link an external page here, or
|
||||
# mount your own content via the volume below. See legal/README.md.
|
||||
HOPPS_IMPRINT_URL: ${HOPPS_IMPRINT_URL:-}
|
||||
HOPPS_PRIVACY_URL: ${HOPPS_PRIVACY_URL:-}
|
||||
# healthcheck:
|
||||
# test: ["CMD", "curl", "-f", "http://localhost"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 10
|
||||
# start_period: 1m
|
||||
|
||||
# ---------------------------------------------------------------- backend ---
|
||||
org:
|
||||
image: ghcr.io/hopps-app/hopps/org:2.5.0
|
||||
networks:
|
||||
- proxy
|
||||
- internal
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.swarm.network=proxy"
|
||||
- "traefik.http.services.${STACK_NAME}-org.loadbalancer.server.port=8080"
|
||||
- "traefik.http.routers.${STACK_NAME}-org.rule=Host(`org.${DOMAIN}`)"
|
||||
- "traefik.http.routers.${STACK_NAME}-org.entrypoints=web-secure"
|
||||
- "traefik.http.routers.${STACK_NAME}-org.tls=true"
|
||||
- "traefik.http.routers.${STACK_NAME}-org.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||
## Edit the following line if you are using one, but not both, "Redirect" sections below
|
||||
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirectscheme,${STACK_NAME}-redirecthostname"
|
||||
## Redirect from EXTRA_DOMAINS to DOMAIN
|
||||
# - "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.regex=^http[s]?://([^/]*)/(.*)"
|
||||
# - "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.replacement=https://${DOMAIN}/$${2}"
|
||||
# - "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.permanent=true"
|
||||
## Redirect HTTP to HTTPS
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.scheme=https"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.permanent=true"
|
||||
## Enable backups: https://docs.coopcloud.tech/maintainers/handbook/#how-do-i-configure-backuprestore
|
||||
# - "backupbot.backup=true"
|
||||
- "backupbot.backup=${ENABLE_BACKUPS:-true}"
|
||||
# - "backupbot.backup.path=/some/path"
|
||||
environment:
|
||||
# -- database
|
||||
QUARKUS_DATASOURCE_USERNAME: hopps
|
||||
QUARKUS_DATASOURCE_PASSWORD:
|
||||
QUARKUS_DATASOURCE_PASSWORD_FILE: /run/secrets/db_password
|
||||
QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://postgres:5432/org
|
||||
|
||||
# -- tenancy: one association per installation (see .env.example)
|
||||
HOPPS_TENANCY_MODE: ${HOPPS_TENANCY_MODE:-single}
|
||||
|
||||
# -- authentication against the external OIDC provider
|
||||
# Discovery may use an address only the container can reach (OIDC_INTERNAL_URL);
|
||||
# the issuer inside the tokens is the public one the browser used, so it is
|
||||
# asserted separately.
|
||||
QUARKUS_OIDC_AUTH_SERVER_URL: ${PUBLIC_OIDC_ISSUER_URL:-}
|
||||
QUARKUS_OIDC_TOKEN_ISSUER: ${PUBLIC_OIDC_ISSUER_URL:-}
|
||||
QUARKUS_OIDC_CLIENT_ID: ${OIDC_CLIENT_ID:-}
|
||||
QUARKUS_OIDC_APPLICATION_TYPE: service
|
||||
# Who manages the member accounts, set in .env: "authentik" (an existing
|
||||
# instance, configured through the OIDC_* and AUTHENTIK_* variables) or
|
||||
# "keycloak" (Hopps's own, needs docker-compose.keycloak.yaml).
|
||||
HOPPS_AUTH_PROVIDER: ${HOPPS_AUTH_PROVIDER:?set HOPPS_AUTH_PROVIDER in .env to authentik or keycloak}
|
||||
# -- Authentik only
|
||||
HOPPS_AUTHENTIK_URL: ${AUTHENTIK_URL:-}
|
||||
HOPPS_AUTHENTIK_API_TOKEN: ${AUTHENTIK_API_TOKEN:-}
|
||||
HOPPS_AUTHENTIK_EMAIL_STAGE_ID: ${AUTHENTIK_EMAIL_STAGE_ID:-}
|
||||
|
||||
# -- the SPA is served from a different origin than the API
|
||||
QUARKUS_HTTP_CORS_ENABLED: "true"
|
||||
QUARKUS_HTTP_CORS_ORIGINS: ${PUBLIC_SPA_URL}
|
||||
|
||||
# -- uploaded files (receipts, logos, bank import files) on a local volume.
|
||||
# Works with a single org container only: the directory is not shared.
|
||||
HOPPS_STORAGE_TYPE: local
|
||||
HOPPS_STORAGE_LOCAL_ROOT: /var/lib/hopps/storage
|
||||
|
||||
# -- e-invoice reader. Other receipts are marked for manual entry unless
|
||||
# docker-compose.document-ai.yaml is enabled.
|
||||
HOPPS_ZUGFERD_SERVICE_URL: http://zugferd:8080
|
||||
secrets:
|
||||
- db_password
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost"]
|
||||
test: ["CMD-SHELL", "curl -sf http://localhost:9000/q/health/ready || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
start_period: 40s
|
||||
|
||||
# Back this volume up together with postgres_data.
|
||||
volumes:
|
||||
- org_storage:/var/lib/hopps/storage
|
||||
|
||||
zugferd:
|
||||
image: ghcr.io/hopps-app/hopps/zugferd:2.5.0
|
||||
networks:
|
||||
- internal
|
||||
# expose:
|
||||
# - "8080"
|
||||
environment:
|
||||
HOPPS_AZURE_OPENAI_RESOURCE_NAME: "disabled"
|
||||
HOPPS_AZURE_OPENAI_DEPLOYMENT_NAME: gpt-4o-mini
|
||||
HOPPS_AZURE_OPENAI_KEY: "disabled"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -sf http://localhost:9000/q/health/ready || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
start_period: 40s
|
||||
|
||||
# ------------------------------------------------------------ persistence --
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
networks:
|
||||
- internal
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_USER: hopps
|
||||
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
|
||||
# Created on the first start with an empty volume.
|
||||
POSTGRES_DB: org
|
||||
secrets:
|
||||
- db_password
|
||||
configs:
|
||||
- source: pg_backup
|
||||
target: /pg_backup.sh
|
||||
mode: 0555
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
labels:
|
||||
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
||||
backupbot.backup.pre-hook: "/pg_backup.sh backup"
|
||||
backupbot.backup.volumes.postgres_data.path: "backup.sql"
|
||||
backupbot.restore.post-hook: "/pg_backup.sh restore"
|
||||
healthcheck:
|
||||
test: "pg_isready"
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
retries: 5
|
||||
start_period: 1m
|
||||
|
||||
configs:
|
||||
pg_backup:
|
||||
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
||||
file: pg_backup.sh
|
||||
|
||||
secrets:
|
||||
db_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
org_storage:
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
internal:
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
BACKUP_FILE='/var/lib/postgresql/data/backup.sql'
|
||||
|
||||
function backup {
|
||||
export PGPASSWORD=$(cat $POSTGRES_PASSWORD_FILE)
|
||||
pg_dump -U ${POSTGRES_USER} ${POSTGRES_DB} > $BACKUP_FILE
|
||||
}
|
||||
|
||||
function restore {
|
||||
cd $PGDATA
|
||||
restore_config(){
|
||||
# Restore allowed connections
|
||||
cat pg_hba.conf.bak > pg_hba.conf
|
||||
su postgres -c 'pg_ctl reload'
|
||||
}
|
||||
# Don't allow any other connections than local
|
||||
cp pg_hba.conf pg_hba.conf.bak
|
||||
echo "local all all trust" > pg_hba.conf
|
||||
su postgres -c 'pg_ctl reload'
|
||||
trap restore_config EXIT INT TERM
|
||||
|
||||
# Recreate Database
|
||||
psql -U ${POSTGRES_USER} -d postgres -c "DROP DATABASE ${POSTGRES_DB} WITH (FORCE);"
|
||||
createdb -U ${POSTGRES_USER} ${POSTGRES_DB}
|
||||
psql -U ${POSTGRES_USER} -d ${POSTGRES_DB} -1 -f $BACKUP_FILE
|
||||
|
||||
trap - EXIT INT TERM
|
||||
restore_config
|
||||
}
|
||||
|
||||
"$@"
|
||||
|
||||
Reference in New Issue
Block a user