remove init script in favor of an abra.sh function, add liberaforms container to proxy and update readme.

This commit is contained in:
brooke 2025-06-18 17:10:12 -04:00
parent 32d4553b74
commit 3f99bbabcc
5 changed files with 48 additions and 52 deletions

View File

@ -17,7 +17,7 @@ DEFAULT_TIMEZONE="America/New_York"
ENABLE_RSS_FEED=True ENABLE_RSS_FEED=True
ENABLE_PROMETHEUS_METRICS=False ENABLE_PROMETHEUS_METRICS=False
#GUNICORN_WORKERS= # Advanced option based on the specs of your server, defaults to 6 #GUNICORN_WORKERS= # Advanced option based on the specs of your server, defaults to 3
#ALERT_MAILS = ["your_email_address", "another_email_address"] # Optional. Recieve Internal Server 500 errors. Good for debugging. #ALERT_MAILS = ["your_email_address", "another_email_address"] # Optional. Recieve Internal Server 500 errors. Good for debugging.

View File

@ -6,7 +6,7 @@
* **Category**: Apps * **Category**: Apps
* **Status**: wip * **Status**: wip
* **Image**: [`liberaforms`](https://hub.docker.com/r/liberaforms), 4, upstream * **Image**: [`liberaforms`](https://fung.uy/mycosystems/-/packages/container/liberaforms/), 1
* **Healthcheck**: Yes * **Healthcheck**: Yes
* **Backups**: No * **Backups**: No
* **Email**: 1 * **Email**: 1
@ -20,6 +20,6 @@
* `abra app new liberaforms --secrets` * `abra app new liberaforms --secrets`
* `abra app config <app-name>` * `abra app config <app-name>`
* `abra app deploy <app-name>` * `abra app deploy <app-name>`
* `abra app run <app-name> app /init.sh` [Create tables](https://gitlab.com/liberaforms/liberaforms/-/blob/main/docs/docker.md?ref_type=heads#create-the-database) in pgsql database * `abra app cmd forms.fung.uy app create_database` [Create tables](https://gitlab.com/liberaforms/liberaforms/-/blob/main/docs/docker.md?ref_type=heads#create-the-database)
For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech). For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech).

40
abra.sh
View File

@ -1,2 +1,42 @@
#!/bin/bash
export ENTRYPOINT_VERSION=v2 export ENTRYPOINT_VERSION=v2
export INIT_VERSION=v1 export INIT_VERSION=v1
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"
}
setup_db() {
file_env "DB_PASSWORD"
file_env "CRYPTO_KEY"
file_env "SECRET_KEY"
file_env "LDAP_BIND_PASSWORD"
echo "Creating tables..."
flask database create-tables && flask db stamp
if [ $? -ne 0 ]; then
echo -e "\033[0;31m\nDatabase failed to initialize please open an issue at https://git.coopcloud.tech/coop-cloud/liberaforms/issues\n"
return 1
fi
echo "Database setup complete. <3"
}

View File

@ -9,10 +9,8 @@ services:
- source: entrypoint - source: entrypoint
mode: 0555 mode: 0555
target: /custom-entrypoint.sh target: /custom-entrypoint.sh
- source: init
mode: 0555
target: /init.sh
entrypoint: /custom-entrypoint.sh entrypoint: /custom-entrypoint.sh
command: "/usr/bin/supervisord -n"
environment: environment:
ENABLE_LDAP: "False" ENABLE_LDAP: "False"
FLASK_DEBUG: "False" FLASK_DEBUG: "False"
@ -29,9 +27,8 @@ services:
SESSION_TYPE: "filesystem" SESSION_TYPE: "filesystem"
LOG_LEVEL: INFO LOG_LEVEL: INFO
LOG_DIR: /app/logs LOG_DIR: /app/logs
GUNICORN_WORKERS: ${GUNICORN_WORKERS:-6} GUNICORN_WORKERS: ${GUNICORN_WORKERS:-3}
volumes: volumes:
- app
- uploads:/app/uploads - uploads:/app/uploads
- log:/app/logs - log:/app/logs
secrets: secrets:
@ -40,12 +37,13 @@ services:
- crypto_key - crypto_key
networks: networks:
- internal - internal
- proxy
deploy: deploy:
labels: labels:
- "coop-cloud.${STACK_NAME}.version=" - "coop-cloud.${STACK_NAME}.version=wip"
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=5000" - "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=5000"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})" - "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure" - "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}" - "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
@ -93,11 +91,3 @@ configs:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION} name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
file: entrypoint.sh.tmpl file: entrypoint.sh.tmpl
template_driver: golang template_driver: golang
init:
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

View File

@ -1,34 +0,0 @@
#!/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