Attempt at universal abra wrapper
This commit is contained in:
2
abra.sh
2
abra.sh
@ -1,6 +1,6 @@
|
||||
# Set any config versions here
|
||||
# Docs: https://docs.coopcloud.tech/maintainers/handbook/#manage-configs
|
||||
export ABRA_LASUITE_ENTRYPOINT_VERSION=v2
|
||||
export ABRA_ENTRYPOINT_VERSION=v3
|
||||
export NGINX_CONF_VERSION=v2
|
||||
export PG_BACKUP_VERSION=v3
|
||||
|
||||
|
||||
35
compose.yml
35
compose.yml
@ -115,10 +115,11 @@ services:
|
||||
retries: 20
|
||||
start_period: 10s
|
||||
command: ["gunicorn", "-c", "/usr/local/etc/gunicorn/impress.py", "impress.wsgi:application"]
|
||||
entrypoint: /abra-lasuite-entrypoint.sh
|
||||
# entrypoint: "/abra-entrypoint.sh"
|
||||
entrypoint: ["/abra-entrypoint.sh", "/usr/local/bin/entrypoint"]
|
||||
configs:
|
||||
- source: abra_lasuite_entrypoint
|
||||
target: /abra-lasuite-entrypoint.sh
|
||||
- source: abra_entrypoint
|
||||
target: /abra-entrypoint.sh
|
||||
mode: 0555
|
||||
secrets:
|
||||
- django_secret_key
|
||||
@ -136,10 +137,10 @@ services:
|
||||
command: ["celery", "-A", "impress.celery_app", "worker", "-l", "INFO"]
|
||||
environment:
|
||||
<<: [*common-env, *postgres-env, *yprovider-env]
|
||||
entrypoint: /abra-lasuite-entrypoint.sh
|
||||
entrypoint: ["/abra-entrypoint.sh", "/usr/local/bin/entrypoint"]
|
||||
configs:
|
||||
- source: abra_lasuite_entrypoint
|
||||
target: /abra-lasuite-entrypoint.sh
|
||||
- source: abra_entrypoint
|
||||
target: /abra-entrypoint.sh
|
||||
mode: 0555
|
||||
secrets:
|
||||
- django_secret_key
|
||||
@ -156,6 +157,12 @@ services:
|
||||
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
|
||||
|
||||
db:
|
||||
@ -172,6 +179,8 @@ services:
|
||||
PGDATA: var/lib/postgresql/data/pgdata
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data/pgdata
|
||||
command: ["postgres"]
|
||||
entrypoint: ["/abra-entrypoint.sh", "docker-entrypoint.sh"]
|
||||
deploy:
|
||||
labels:
|
||||
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
||||
@ -182,6 +191,9 @@ services:
|
||||
- source: pg_backup
|
||||
target: /pg_backup.sh
|
||||
mode: 0555
|
||||
- source: abra_entrypoint
|
||||
target: /abra-entrypoint.sh
|
||||
mode: 0555
|
||||
|
||||
redis:
|
||||
image: redis:8
|
||||
@ -219,15 +231,16 @@ services:
|
||||
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-lasuite-entrypoint.sh
|
||||
entrypoint: /abra-entrypoint.sh
|
||||
configs:
|
||||
- source: abra_lasuite_entrypoint
|
||||
target: /abra-lasuite-entrypoint.sh
|
||||
- source: abra_entrypoint
|
||||
target: /abra-entrypoint.sh
|
||||
mode: 0555
|
||||
secrets:
|
||||
- django_secret_key
|
||||
@ -273,8 +286,8 @@ configs:
|
||||
pg_backup:
|
||||
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
||||
file: pg_backup.sh
|
||||
abra_lasuite_entrypoint:
|
||||
name: ${STACK_NAME}_entrypoint_${ABRA_LASUITE_ENTRYPOINT_VERSION}
|
||||
abra_entrypoint:
|
||||
name: ${STACK_NAME}_entrypoint_${ABRA_ENTRYPOINT_VERSION}
|
||||
file: entrypoint.sh
|
||||
|
||||
secrets:
|
||||
|
||||
@ -1,20 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
DJANGO_SECRET_KEY="$(cat /run/secrets/django_secret_key)"
|
||||
OIDC_RP_CLIENT_SECRET="$(cat /run/secrets/oidc_rp_client_secret)"
|
||||
DJANGO_SUPERUSER_PASSWORD="$(cat /run/secrets/django_superuser_password)"
|
||||
COLLABORATION_SERVER_SECRET="$(cat /run/secrets/collaboration_server_secret)"
|
||||
POSTGRES_PASSWORD="$(cat /run/secrets/postgres_password)"
|
||||
DB_PASSWORD="$(cat /run/secrets/db_password)"
|
||||
MINIO_ROOT_PASSWORD="$(cat /run/secrets/minio_root_password)"
|
||||
echo "++ running new entrypoint"
|
||||
ORIGINAL_ENTRYPOINT="$1"
|
||||
shift
|
||||
|
||||
export DJANGO_SECRET_KEY
|
||||
export OIDC_RP_CLIENT_SECRET
|
||||
export DJANGO_SUPERUSER_PASSWORD
|
||||
export COLLABORATION_SERVER_SECRET
|
||||
export POSTGRES_PASSWORD
|
||||
export DB_PASSWORD
|
||||
export MINIO_ROOT_PASSWORD
|
||||
echo "++ original entrypoint: ${ORIGINAL_ENTRYPOINT}"
|
||||
|
||||
# Execute the actual command (from command: in compose.yml)
|
||||
exec "$@"
|
||||
# --- Load secrets into environment variables ---
|
||||
if [ -d /run/secrets ]; then
|
||||
for secret_file in /run/secrets/*; do
|
||||
echo "++ loading secret: ${secret_file}"
|
||||
var_name=$(basename "$secret_file" | tr '[:lower:]' '[:upper:]')
|
||||
export "$var_name"="$(cat "$secret_file")"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "++ command: ${@}"
|
||||
|
||||
# --- Execute the original entrypoint and command ---
|
||||
if [ -n "$ORIGINAL_ENTRYPOINT" ] && [ "$ORIGINAL_ENTRYPOINT" != "null" ]; then
|
||||
exec "$ORIGINAL_ENTRYPOINT" "$@"
|
||||
else
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user