From 2b537ae6bcb97953d3a4af37fb8f304b80f7c203 Mon Sep 17 00:00:00 2001 From: brooke Date: Fri, 18 Apr 2025 13:37:31 -0400 Subject: [PATCH] update --- .env.sample | 2 +- README.md | 3 ++- abra.sh | 2 +- compose.yml | 13 ++++++++----- init.sh.tmpl | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 init.sh.tmpl diff --git a/.env.sample b/.env.sample index 9bea43e..7d3805b 100644 --- a/.env.sample +++ b/.env.sample @@ -17,7 +17,7 @@ DEFAULT_TIMEZONE="America/New_York" ENABLE_RSS_FEED=True ENABLE_PROMETHEUS_METRICS=False -#GUNICORN_WORKERS= # defaults to 6 +#GUNICORN_WORKERS= # Advanced option based on the specs of your server, defaults to 6 #ALERT_MAILS = ["your_email_address", "another_email_address"] # Optional. Recieve Internal Server 500 errors. Good for debugging. diff --git a/README.md b/README.md index 0b716c5..3730386 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ * **Category**: Apps -* **Status**: 0 +* **Status**: wip * **Image**: [`liberaforms`](https://hub.docker.com/r/liberaforms), 4, upstream * **Healthcheck**: Yes * **Backups**: No @@ -20,5 +20,6 @@ * `abra app new liberaforms --secrets` * `abra app config ` * `abra app deploy ` +* `abra app run app /init.sh` [Create tables](https://gitlab.com/liberaforms/liberaforms/-/blob/main/docs/docker.md?ref_type=heads#create-the-database) in pgsql database For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech). diff --git a/abra.sh b/abra.sh index 48a3187..fc4a203 100644 --- a/abra.sh +++ b/abra.sh @@ -1,2 +1,2 @@ export ENTRYPOINT_VERSION=v2 -export INIT_VERSION=v1 \ No newline at end of file +export INIT_VERSION=v1 diff --git a/compose.yml b/compose.yml index 225b48a..d2f5425 100644 --- a/compose.yml +++ b/compose.yml @@ -2,6 +2,7 @@ version: "3.8" services: + app: image: fung.uy/mycosystems/liberaforms:v4.0.0 configs: @@ -30,6 +31,7 @@ services: LOG_DIR: /app/logs GUNICORN_WORKERS: ${GUNICORN_WORKERS:-6} volumes: + - app - uploads:/app/uploads - log:/app/logs secrets: @@ -37,21 +39,18 @@ services: - secret_key - crypto_key networks: - - proxy - internal deploy: - restart_policy: - condition: on-failure labels: + - "coop-cloud.${STACK_NAME}.version=" - "traefik.enable=true" - "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}" - - "coop-cloud.${STACK_NAME}.version=" db: - image: postgres:17-alpine + image: postgres:17 healthcheck: test: ["CMD", "pg_isready", "-q", "-d", "postgres", "-U", "${POSTGRES_ROOT_USER}"] timeout: 45s @@ -98,3 +97,7 @@ configs: name: ${STACK_NAME}_init_${INIT_VERSION} file: init.sh.tmpl template_driver: golang + nginx_conf: + name: ${STACK_NAME}_nginx_conf_${NGINX_CONF_VERSION} + file: nginx.conf.tmpl + template_driver: golang diff --git a/init.sh.tmpl b/init.sh.tmpl new file mode 100644 index 0000000..a347a16 --- /dev/null +++ b/init.sh.tmpl @@ -0,0 +1,34 @@ +#!/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" + +flask database create --docker-container db + +flask database create-tables