22 Commits

Author SHA1 Message Date
41ad58f47d trying to use minio_root_pass_file 2025-11-06 14:59:24 -05:00
720d305d66 attempt at minio_pass_file 2025-11-06 14:38:08 -05:00
7846746050 working other than minio_root_password_file 2025-11-06 14:25:27 -05:00
9c6bb70b7a working with abra recipe lint 2025-11-06 14:06:33 -05:00
54acd65edd working before secret shortening 2025-11-06 12:46:06 -05:00
82ca119cdb working on nginx.conf.tmpl 2025-11-05 11:29:51 -05:00
761320788b working with secrets 2025-11-04 14:20:01 -05:00
8bda1893f3 working with secrets 2025-11-04 14:15:59 -05:00
6a0ebbd641 Database working with secrets 2025-11-04 12:37:37 -05:00
d863bdbe81 db password stops working with secret 2025-11-02 14:36:44 -05:00
3e4cf66594 still working 2025-11-02 14:19:06 -05:00
3a33573fba no unique db_password secret 2025-11-02 14:13:20 -05:00
293dd80e53 Attempt at universal abra wrapper 2025-11-01 16:26:05 -04:00
664d0df1f6 almost working secrets 2025-10-31 15:43:20 -04:00
184255b249 almost working with docker secrets 2025-10-31 15:36:14 -04:00
51c939dd2c working on secrets 2025-10-31 13:14:12 -04:00
9a4d5058f9 Add alias of lasuite-app instead of app to prevent docker DNS name conflict 2025-10-31 11:21:36 -04:00
3wc
079d0d4bbd chore: publish 0.2.1+v3.4.2 release 2025-10-08 11:38:04 -04:00
9a190c92cb Merge pull request 'Fix poorly formed json in OIDC_AUTH_REQUEST_EXTRA_PARAMS' (#7) from notplants/lasuite-docs:fix-json into main
Reviewed-on: #7
Reviewed-by: trav <trav@teafry.me>
2025-10-08 15:33:42 +00:00
20649c56d7 Fix poorly formed json in OIDC_AUTH_REQUEST_EXTRA_PARAMS 2025-09-25 17:43:03 -04:00
2f60ed1ec5 chore: publish 0.2.0+v3.4.2 release 2025-07-29 11:35:23 +01:00
3wc
5ba322a5f0 Migrate outstanding TODOs to repo issues 2025-06-12 15:42:41 +01:00
7 changed files with 175 additions and 86 deletions

View File

@ -8,12 +8,25 @@ DOMAIN=lasuite-docs.example.com
LETS_ENCRYPT_ENV=production
##############################################################################
# BASIC SETTINGS
# SECRETS
##############################################################################
# FIXME: Move to Docker secret
DJANGO_SECRET_KEY=ThisIsAnExampleKeyForDevPurposeOnly
# FIXME: Move to docker secret
DJANGO_SUPERUSER_PASSWORD=admin
# abbreviations are to fit abra 12 char secret recommendation
# DJANGO_SECRET_KEY
SECRET_DJANGO_SK_VERSION=v1
# ODIC_RP_CLIENT_SECRET
SECRET_OIDC_RPCS_VERSION=v1
# DJANGO_SUPERUSER_PASSWORD
SECRET_DJANGO_SP_VERSION=v1
# MINIO_ROOT_PASSWORD
SECRET_MINIO_RP_VERSION=v1
# MINIO_ROOT_USER
SECRET_MINIO_RU_VERSION=v1
# COLLABORATION_SERVER_SECRET
SECRET_COLLAB_SS_VERSION=v1
# POSTGRES_PASSWORD
SECRET_POSTGRES_P_VERSION=v1
# Y_PROVIDER_API_KEY
SECRET_Y_API_KEY_VERSION=v1
##############################################################################
# EMAIL
@ -27,20 +40,19 @@ DJANGO_EMAIL_PORT=1025
# SINGLE SIGN ON
##############################################################################
# NOTE: OpenID Connect (OIDC) single sign-on is **required**, see recipe README
OIDC_OP_JWKS_ENDPOINT=https://auth.${DOMAIN}/realms/impress/protocol/openid-connect/certs
OIDC_OP_AUTHORIZATION_ENDPOINT=https://auth.${DOMAIN}/realms/impress/protocol/openid-connect/auth
OIDC_OP_TOKEN_ENDPOINT=https://auth.${DOMAIN}/realms/impress/protocol/openid-connect/token
OIDC_OP_USER_ENDPOINT=https://auth.${DOMAIN}/realms/impress/protocol/openid-connect/userinfo
OIDC_RP_CLIENT_ID=impress
# FIXME: Move to docker secret
OIDC_RP_CLIENT_SECRET=example
OIDC_REALM=yourkeycloakrealm
OIDC_OP_JWKS_ENDPOINT=https://auth.${DOMAIN}/realms/${OIDC_REALM}/protocol/openid-connect/certs
OIDC_OP_AUTHORIZATION_ENDPOINT=https://auth.${DOMAIN}/realms/${OIDC_REALM}/protocol/openid-connect/auth
OIDC_OP_TOKEN_ENDPOINT=https://auth.${DOMAIN}/realms/${OIDC_REALM}/protocol/openid-connect/token
OIDC_OP_USER_ENDPOINT=https://auth.${DOMAIN}/realms/${OIDC_REALM}/protocol/openid-connect/userinfo
OIDC_RP_CLIENT_ID=yourkeycloakclientid
OIDC_RP_SIGN_ALGO=RS256
OIDC_RP_SCOPES="openid email"
LOGIN_REDIRECT_URL=https://${DOMAIN}
LOGIN_REDIRECT_URL_FAILURE=https://${DOMAIN}
LOGOUT_REDIRECT_URL=https://${DOMAIN}
OIDC_REDIRECT_ALLOWED_HOSTS='["https://auth.${DOMAIN}", "https://${DOMAIN}"]'
OIDC_AUTH_REQUEST_EXTRA_PARAMS="{'acr_values'='eidas1'}"
OIDC_AUTH_REQUEST_EXTRA_PARAMS='{"acr_values": "eidas1"}'
##############################################################################
# LOGGING

33
TODO.md
View File

@ -1,33 +0,0 @@
# TODO
## Must
- [x] Fix image uploads
- [x] Update recipe metadata
- [x] External OIDC server (+ move options to `.env.sample`)
- [x] Customisable Django `DJANGO_SECRET_KEY` and `DJANGO_SUPERUSER_PASSWORD`
- [ ] Versioned recipe release
- [x] `backup-bot-two` labels
- [x] Fix Django admin static files
## Should
- [ ] Move secrets to Docker secrets
- [ ] Postgres password
- [ ] y-provider key
- [ ] OIDC secret
- [ ] SMTP password
- [ ] Minio password / `AWS_S3_SECRET_ACCESS_KEY`
- [x] Initial setup documentation
- [x] Move Minio bootstrap & DB migrate to `abra.sh` commands
- [ ] Expose options in `.env.sample`:
- [ ] Branding
- [x] Logging
- [x] SMTP
- [ ] Increase image upload filesize
## Could
- [ ] External Minio service
- [ ] Recipe CI tests
- [ ] Configurable image upload filesize

23
abra-entrypoint.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/sh
set -e
[ -f /run/secrets/postgres_p ] && export DB_PASSWORD="$(cat /run/secrets/postgres_p)"
[ -f /run/secrets/django_sk ] && export DJANGO_SECRET_KEY="$(cat /run/secrets/django_sk)"
#[ -f /run/secrets/minio_rp ] && export MINIO_ROOT_PASSWORD="$(cat /run/secrets/minio_rp)"
[ -f /run/secrets/minio_rp ] && export AWS_S3_SECRET_ACCESS_KEY="$(cat /run/secrets/minio_rp)"
[ -f /run/secrets/minio_ru ] && export AWS_S3_ACCESS_KEY_ID="$(cat /run/secrets/minio_ru)"
[ -f /run/secrets/django_sp ] && export DJANGO_SUPERUSER_PASSWORD="$(cat /run/secrets/django_sp)"
[ -f /run/secrets/oidc_rpcs ] && export OIDC_RP_CLIENT_SECRET="$(cat /run/secrets/oidc_rpcs)"
[ -f /run/secrets/collab_ss ] && export COLLABORATION_SERVER_SECRET="$(cat /run/secrets/collab_ss)"
[ -f /run/secrets/y_api_key ] && export Y_PROVIDER_API_KEY="$(cat /run/secrets/y_api_key)"
# if not in "env" mode, then execute the original entrypoint and command
if [ ! "$1" = "-e" ]; then
ORIGINAL_ENTRYPOINT="$1"
shift
if [ -n "$ORIGINAL_ENTRYPOINT" ] && [ "$ORIGINAL_ENTRYPOINT" != "null" ]; then
exec "$ORIGINAL_ENTRYPOINT" "$@"
else
exec "$@"
fi
fi

11
abra.sh
View File

@ -1,12 +1,15 @@
# Set any config versions here
# Docs: https://docs.coopcloud.tech/maintainers/handbook/#manage-configs
export NGINX_CONF_VERSION=v2
export ABRA_ENTRYPOINT_VERSION=v4
export NGINX_CONF_VERSION=v3
export PG_BACKUP_VERSION=v3
# environment() {
# # TODO: Add file_env here
# }
environment() {
# this exports all the secrets as environment variables
source /abra-entrypoint.sh -e
}
migrate() {
environment
python manage.py migrate --noinput
}

View File

@ -5,9 +5,9 @@
x-common-env: &common-env
DJANGO_CONFIGURATION: Production
DJANGO_ALLOWED_HOSTS: "*"
DJANGO_SECRET_KEY:
# DJANGO_SECRET_KEY supplied via secrets
DJANGO_SETTINGS_MODULE: impress.settings
DJANGO_SUPERUSER_PASSWORD:
# DJANGO_SUPERUSER_PASSWORD supplied via secrets
# Logging
# Set to DEBUG level for dev only
LOGGING_LEVEL_HANDLERS_CONSOLE:
@ -27,9 +27,8 @@ x-common-env: &common-env
# Media
STORAGES_STATICFILES_BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
AWS_S3_ENDPOINT_URL: http://minio:9000
AWS_S3_ACCESS_KEY_ID: user
# FIXME: Move to docker secret
AWS_S3_SECRET_ACCESS_KEY: password
# AWS_S3_ACCESS_KEY_ID supplied via secret (this is same MINIO_ROOT_USER)
# AWS_S3_SECRET_ACCESS_KEY supplied via secret (this is same as MINIO_ROOT_PASSWORD)
MEDIA_BASE_URL: https://${DOMAIN}
AWS_STORAGE_BUCKET_NAME: docs-media-storage
# OIDC - settings from .env, see .env.sample
@ -38,7 +37,7 @@ x-common-env: &common-env
OIDC_OP_TOKEN_ENDPOINT:
OIDC_OP_USER_ENDPOINT:
OIDC_RP_CLIENT_ID:
OIDC_RP_CLIENT_SECRET:
# OIDC_RP_CLIENT_SECRET supplied via secrets
OIDC_RP_SIGN_ALGO:
OIDC_RP_SCOPES:
LOGIN_REDIRECT_URL:
@ -46,7 +45,7 @@ x-common-env: &common-env
LOGOUT_REDIRECT_URL:
OIDC_REDIRECT_ALLOWED_HOSTS:
OIDC_AUTH_REQUEST_EXTRA_PARAMS:
# AI
# AI (Fixme: remove?)
AI_FEATURE_ENABLED: "false"
AI_BASE_URL: https://openaiendpoint.com
AI_API_KEY: password
@ -58,40 +57,37 @@ x-postgres-env: &postgres-env
# Postgresql db container configuration
POSTGRES_DB: docs
POSTGRES_USER: docs
# FIXME: Move to docker secret
POSTGRES_PASSWORD: password
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_p
# App database configuration
DB_HOST: db
DB_NAME: docs
DB_USER: docs
# FIXME: Move to docker secret
DB_PASSWORD: password
DB_PORT: 5432
# DB_PASSWORD supplied via secrets (this is same as POSTGRES_PASSWORD)
x-yprovider-env: &yprovider-env
COLLABORATION_LOGGING: "true"
Y_PROVIDER_API_KEY: foobar
# Y_PROVIDER_API_KEY supplied via secrets
COLLABORATION_API_URL: http://y-provider:4444/api/
COLLABORATION_SERVER_ORIGIN: https://${DOMAIN}
COLLABORATION_SERVER_SECRET: my-secret
# COLLABORATION_SERVER_SECRET supplied via secrets
COLLABORATION_BACKEND_BASE_URL: https://${DOMAIN}
COLLABORATION_WS_URL: wss://${DOMAIN}/collaboration/ws/
x-minio-env: &minio-env
MINIO_ROOT_USER: user
# FIXME: Move to docker secret
MINIO_ROOT_PASSWORD: password
MINIO_ROOT_USER_FILE: /run/secrets/minio_ru
MINIO_ROOT_PASSWORD_FILE: /run/secrets/minio_rp
services:
app:
image: lasuite/impress-frontend:v3.3.0
image: lasuite/impress-frontend:v3.4.2
networks:
- backend
- backend
deploy:
labels:
- "traefik.enable=false"
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
- "coop-cloud.${STACK_NAME}.version=0.1.0+v3.3.0"
- "coop-cloud.${STACK_NAME}.version=0.2.1+v3.4.2"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
interval: 15s
@ -100,32 +96,74 @@ services:
start_period: 10s
backend:
image: lasuite/impress-backend:v3.3.0
image: lasuite/impress-backend:v3.4.2
networks:
- backend
environment:
<<: [*common-env, *postgres-env, *yprovider-env]
healthcheck:
test: ["CMD", "python", "manage.py", "check"]
test: ["CMD", "/abra-entrypoint.sh", "python", "manage.py", "check"]
interval: 15s
timeout: 30s
retries: 20
start_period: 10s
command: ["gunicorn", "-c", "/usr/local/etc/gunicorn/impress.py", "impress.wsgi:application"]
entrypoint: ["/abra-entrypoint.sh", "/usr/local/bin/entrypoint"]
configs:
- source: abra_entrypoint
target: /abra-entrypoint.sh
mode: 0555
secrets:
- django_sk
- django_sp
- oidc_rpcs
- collab_ss
- minio_rp
- postgres_p
- y_api_key
celery:
image: lasuite/impress-backend:v3.3.0
image: lasuite/impress-backend:v3.4.2
networks:
- backend
command: ["celery", "-A", "impress.celery_app", "worker", "-l", "INFO"]
environment:
<<: [*common-env, *postgres-env, *yprovider-env]
entrypoint: ["/abra-entrypoint.sh", "/usr/local/bin/entrypoint"]
configs:
- source: abra_entrypoint
target: /abra-entrypoint.sh
mode: 0555
secrets:
- django_sk
- django_sp
- oidc_rpcs
- collab_ss
- minio_rp
- postgres_p
- y_api_key
y-provider:
image: lasuite/impress-y-provider:v3.3.0
image: lasuite/impress-y-provider:v3.4.2
networks:
- backend
environment: *yprovider-env
command: ["yarn", "start"]
entrypoint: ["/abra-entrypoint.sh", "/usr/local/bin/entrypoint"]
configs:
- source: abra_entrypoint
target: /abra-entrypoint.sh
mode: 0555
# NOTE: healthcheck - `wget` is available in the container, but `wget http://localhost:4444` gives a 403
secrets:
- django_sk
- django_sp
- oidc_rpcs
- collab_ss
- minio_rp
- postgres_p
- y_api_key
db:
image: postgres:16
@ -151,9 +189,11 @@ services:
- source: pg_backup
target: /pg_backup.sh
mode: 0555
secrets:
- postgres_p
redis:
image: redis:5
image: redis:8
networks:
- backend
@ -162,18 +202,23 @@ services:
image: minio/mc:RELEASE.2025-05-21T01-59-54Z
environment: *minio-env
networks:
- backend
- backend
entrypoint: >
sh -c "
/usr/bin/mc alias set docs http://minio:9000 $${MINIO_ROOT_USER} $${MINIO_ROOT_PASSWORD} && \
/usr/bin/mc mb --ignore-existing docs/docs-media-storage && \
/usr/bin/mc version enable docs/docs-media-storage && \
exit 0;"
MINIO_ROOT_USER=\"\$$(cat /run/secrets/minio_ru)\" &&
MINIO_ROOT_PASSWORD=\"\$$(cat /run/secrets/minio_rp)\" &&
/usr/bin/mc alias set docs http://minio:9000 \$${MINIO_ROOT_USER} \"\$${MINIO_ROOT_PASSWORD}\" &&
/usr/bin/mc mb --ignore-existing docs/docs-media-storage &&
/usr/bin/mc version enable docs/docs-media-storage &&
exit 0"
deploy:
mode: replicated
replicas: 0
restart_policy:
condition: none
secrets:
- minio_rp
- minio_ru
minio:
image: minio/minio:RELEASE.2025-05-24T17-08-30Z
@ -183,24 +228,34 @@ services:
interval: 1s
timeout: 20s
retries: 300
entrypoint: ""
networks:
- backend
command: minio server /data
entrypoint: ["/abra-entrypoint.sh", "/usr/bin/docker-entrypoint.sh"]
volumes:
- minio:/data
deploy:
labels:
backupbot.backup: "${ENABLE_BACKUPS:-true}"
entrypoint: /abra-entrypoint.sh
configs:
- source: abra_entrypoint
target: /abra-entrypoint.sh
mode: 0555
secrets:
- minio_rp
- minio_ru
web:
image: nginx:1.27
image: nginx:1.29
configs:
- source: nginx_conf
target: /etc/nginx/conf.d/default.conf
networks:
proxy:
backend:
environment:
- STACK_NAME
deploy:
labels:
- "traefik.enable=true"
@ -223,7 +278,37 @@ volumes:
configs:
nginx_conf:
name: ${STACK_NAME}_nginx_conf_${NGINX_CONF_VERSION}
file: nginx.conf
file: nginx.conf.tmpl
template_driver: golang
pg_backup:
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
file: pg_backup.sh
abra_entrypoint:
name: ${STACK_NAME}_entrypoint_${ABRA_ENTRYPOINT_VERSION}
file: abra-entrypoint.sh
secrets:
django_sk:
external: true
name: ${STACK_NAME}_django_sk_${SECRET_DJANGO_SK_VERSION}
oidc_rpcs:
external: true
name: ${STACK_NAME}_oidc_rpcs_${SECRET_OIDC_RPCS_VERSION}
django_sp:
external: true
name: ${STACK_NAME}_django_sp_${SECRET_DJANGO_SP_VERSION}
postgres_p:
external: true
name: ${STACK_NAME}_postgres_p_${SECRET_POSTGRES_P_VERSION}
collab_ss:
external: true
name: ${STACK_NAME}_collab_ss_${SECRET_COLLAB_SS_VERSION}
minio_rp:
external: true
name: ${STACK_NAME}_minio_rp_${SECRET_MINIO_RP_VERSION}
minio_ru:
external: true
name: ${STACK_NAME}_minio_ru_${SECRET_MINIO_RP_VERSION}
y_api_key:
external: true
name: ${STACK_NAME}_y_api_key_${SECRET_Y_API_KEY_VERSION}

View File

@ -1,9 +1,9 @@
upstream docs_backend {
server backend:8000 fail_timeout=0;
server {{ env "STACK_NAME" }}_backend:8000 fail_timeout=0;
}
upstream docs_frontend {
server app:8080 fail_timeout=0;
server {{ env "STACK_NAME" }}_app:8080 fail_timeout=0;
}
server {

View File

@ -5,8 +5,7 @@ set -e
BACKUP_FILE='/var/lib/postgresql/data/pgdata/backup.sql'
function backup {
# export PGPASSWORD=$(cat $POSTGRES_PASSWORD_FILE)
export PGPASSWORD="$POSTGRES_PASSWORD"
export PGPASSWORD=$(cat $POSTGRES_PASSWORD_FILE)
pg_dump -U ${POSTGRES_USER} ${POSTGRES_DB} > $BACKUP_FILE
}