This commit is contained in:
brooke 2025-03-04 02:29:13 -05:00
parent 5d85e975c5
commit 6a933fdeeb
6 changed files with 171 additions and 16 deletions

View File

@ -2,7 +2,44 @@ TYPE=liberaforms
DOMAIN=liberaforms.example.com
## Domain aliases
#EXTRA_DOMAINS=', `www.liberaforms.example.com`'
LETS_ENCRYPT_ENV=production
SECRET_SECRET_KEY_VERSION = v1
SECRET_DB_PASSWORD_VERSION = v1
SECRET_CRYPTO_KEY_VERSION= v1
ADMIN_USER = 'you@example.com'
DEFAULT_LANGUAGE = 'en' # Options: en, eu, es, ca, cs, de, fr, gl, ru, ta
E2EE_MODE=ENABLED_BY_DEFAULT # Options: AVAILABLE, DISABLED, REQUIRED, ENABLED_BY_DEFAULT
TOKEN_EXPIRATION = 604800 # Maximum valid age (in seconds) for password resets, invitations, etc.
DEFAULT_TIMEZONE="America/New_York"
ENABLE_RSS_FEED=True
ENABLE_PROMETHEUS_METRICS=False
#GUNICORN_WORKERS= # defaults to 6
#ALERT_MAILS = ["your_email_address", "another_email_address"] # Optional. Recieve Internal Server 500 errors. Good for debugging.
###############
### Uploads ###
###############
ENABLE_UPLOADS=True
ENABLE_REMOTE_STORAGE=False
TOTAL_UPLOADS_LIMIT="1 GB" # site-wide limit
DEFAULT_USER_UPLOADS_LIMIT="50 MB"
MAX_MEDIA_SIZE=512000 # In Bytes
MAX_ATTACHMENT_SIZE=1572864 # In Bytes
###############
#### LDAP #####
###############
#LDAP_SERVER: ldap://localhost
#LDAP_BIND_ACCOUNT="cn=nobody,dc=example,dc=com"
#LDAP_USER_DN_LIST=["uid=%uid,ou=users,o=company,dc=example,dc=com"]
#LDAP_SEARCH_BASE_DN="o=company,dc=example,dc=com"
#LDAP_FILTER="(&(objectclass=inetOrgPerson)(|(uid=%uid)(mail=%uid)))"
#LDAP_MAIL_ATTRIB=mail
#LDAP_RECOVER_PASSWD_URL=https://example.com/recover-your-ldap-password

View File

@ -7,11 +7,11 @@
* **Category**: Apps
* **Status**: 0
* **Image**: [`liberaforms`](https://hub.docker.com/r/liberaforms), 4, upstream
* **Healthcheck**: No
* **Healthcheck**: Yes
* **Backups**: No
* **Email**: No
* **Email**: 1
* **Tests**: No
* **SSO**: No
* **SSO**: 3
<!-- endmetadata -->

2
abra.sh Normal file
View File

@ -0,0 +1,2 @@
export ENTRYPOINT_VERSION=v2
export INIT_VERSION=v1

16
compose.ldap.yml Normal file
View File

@ -0,0 +1,16 @@
---
version: "3.8"
services:
app:
secrets:
- ldap_password
environment:
ENABLE_LDAP: "True"
LDAP_ANONYMOUS_BIND: "False"
LDAP_BIND_PASSWORD_FILE: /run/secrets/ldap_password
secrets:
ldap_password:
external: true
name: ${STACK_NAME}_ldap_password_${SECRET_DB_PASSWORD_VERSION}

View File

@ -3,30 +3,98 @@ version: "3.8"
services:
app:
image: nginx:1.20.0
image: fung.uy/mycosystems/liberaforms:v4.0.0
configs:
- source: entrypoint
mode: 0555
target: /custom-entrypoint.sh
- source: init
mode: 0555
target: /init.sh
entrypoint: /custom-entrypoint.sh
environment:
ENABLE_LDAP: "False"
FLASK_DEBUG: "False"
FLASK_CONFIG: production
DB_HOST: db
DB_USER: liberaforms
DB_PASSWORD_FILE: /run/secrets/db_password
DB_NAME: liberaforms
BASE_URL: https://${DOMAIN}
ROOT_USER: ${ADMIN_USER}
TMP_DIR: /tmp
SECRET_KEY_FILE: /run/secrets/secret_key
CRYPTO_KEY_FILE: /run/secrets/crypto_key
SESSION_TYPE: "filesystem"
LOG_LEVEL: INFO
LOG_DIR: /app/logs
GUNICORN_WORKERS: ${GUNICORN_WORKERS:-6}
volumes:
- uploads:/app/uploads
- log:/app/logs
secrets:
- db_password
- secret_key
- crypto_key
networks:
- proxy
- internal
deploy:
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=5000"
- "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}"
## Redirect from EXTRA_DOMAINS to DOMAIN
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
- "coop-cloud.${STACK_NAME}.version="
db:
image: postgres:17-alpine
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 30s
timeout: 10s
test: ["CMD", "pg_isready", "-q", "-d", "postgres", "-U", "${POSTGRES_ROOT_USER}"]
timeout: 45s
interval: 10s
retries: 10
start_period: 1m
environment:
POSTGRES_USER: liberaforms
POSTGRES_DB: liberaforms
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
volumes:
- db:/var/lib/postgresql/data
secrets:
- db_password
networks:
- internal
secrets:
db_password:
external: true
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
secret_key:
external: true
name: ${STACK_NAME}_secret_key_${SECRET_SECRET_KEY_VERSION}
crypto_key:
external: true
name: ${STACK_NAME}_crypto_key_${SECRET_CRYPTO_KEY_VERSION}
volumes:
uploads:
log:
db:
networks:
internal:
proxy:
external: true
configs:
entrypoint:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang
init:
name: ${STACK_NAME}_init_${INIT_VERSION}
file: init.sh.tmpl
template_driver: golang

32
entrypoint.sh.tmpl Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
set -e
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
file_env "DB_PASSWORD"
file_env "CRYPTO_KEY"
file_env "SECRET_KEY"
file_env "LDAP_BIND_PASSWORD"
/usr/bin/supervisord -n