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
|
# Set any config versions here
|
||||||
# Docs: https://docs.coopcloud.tech/maintainers/handbook/#manage-configs
|
# 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 NGINX_CONF_VERSION=v2
|
||||||
export PG_BACKUP_VERSION=v3
|
export PG_BACKUP_VERSION=v3
|
||||||
|
|
||||||
|
|||||||
35
compose.yml
35
compose.yml
@ -115,10 +115,11 @@ services:
|
|||||||
retries: 20
|
retries: 20
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
command: ["gunicorn", "-c", "/usr/local/etc/gunicorn/impress.py", "impress.wsgi:application"]
|
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:
|
configs:
|
||||||
- source: abra_lasuite_entrypoint
|
- source: abra_entrypoint
|
||||||
target: /abra-lasuite-entrypoint.sh
|
target: /abra-entrypoint.sh
|
||||||
mode: 0555
|
mode: 0555
|
||||||
secrets:
|
secrets:
|
||||||
- django_secret_key
|
- django_secret_key
|
||||||
@ -136,10 +137,10 @@ services:
|
|||||||
command: ["celery", "-A", "impress.celery_app", "worker", "-l", "INFO"]
|
command: ["celery", "-A", "impress.celery_app", "worker", "-l", "INFO"]
|
||||||
environment:
|
environment:
|
||||||
<<: [*common-env, *postgres-env, *yprovider-env]
|
<<: [*common-env, *postgres-env, *yprovider-env]
|
||||||
entrypoint: /abra-lasuite-entrypoint.sh
|
entrypoint: ["/abra-entrypoint.sh", "/usr/local/bin/entrypoint"]
|
||||||
configs:
|
configs:
|
||||||
- source: abra_lasuite_entrypoint
|
- source: abra_entrypoint
|
||||||
target: /abra-lasuite-entrypoint.sh
|
target: /abra-entrypoint.sh
|
||||||
mode: 0555
|
mode: 0555
|
||||||
secrets:
|
secrets:
|
||||||
- django_secret_key
|
- django_secret_key
|
||||||
@ -156,6 +157,12 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- backend
|
- backend
|
||||||
environment: *yprovider-env
|
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
|
# NOTE: healthcheck - `wget` is available in the container, but `wget http://localhost:4444` gives a 403
|
||||||
|
|
||||||
db:
|
db:
|
||||||
@ -172,6 +179,8 @@ services:
|
|||||||
PGDATA: var/lib/postgresql/data/pgdata
|
PGDATA: var/lib/postgresql/data/pgdata
|
||||||
volumes:
|
volumes:
|
||||||
- postgres:/var/lib/postgresql/data/pgdata
|
- postgres:/var/lib/postgresql/data/pgdata
|
||||||
|
command: ["postgres"]
|
||||||
|
entrypoint: ["/abra-entrypoint.sh", "docker-entrypoint.sh"]
|
||||||
deploy:
|
deploy:
|
||||||
labels:
|
labels:
|
||||||
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
||||||
@ -182,6 +191,9 @@ services:
|
|||||||
- source: pg_backup
|
- source: pg_backup
|
||||||
target: /pg_backup.sh
|
target: /pg_backup.sh
|
||||||
mode: 0555
|
mode: 0555
|
||||||
|
- source: abra_entrypoint
|
||||||
|
target: /abra-entrypoint.sh
|
||||||
|
mode: 0555
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:8
|
image: redis:8
|
||||||
@ -219,15 +231,16 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- backend
|
- backend
|
||||||
command: minio server /data
|
command: minio server /data
|
||||||
|
entrypoint: ["/abra-entrypoint.sh", "/usr/bin/docker-entrypoint.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
- minio:/data
|
- minio:/data
|
||||||
deploy:
|
deploy:
|
||||||
labels:
|
labels:
|
||||||
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
||||||
entrypoint: /abra-lasuite-entrypoint.sh
|
entrypoint: /abra-entrypoint.sh
|
||||||
configs:
|
configs:
|
||||||
- source: abra_lasuite_entrypoint
|
- source: abra_entrypoint
|
||||||
target: /abra-lasuite-entrypoint.sh
|
target: /abra-entrypoint.sh
|
||||||
mode: 0555
|
mode: 0555
|
||||||
secrets:
|
secrets:
|
||||||
- django_secret_key
|
- django_secret_key
|
||||||
@ -273,8 +286,8 @@ configs:
|
|||||||
pg_backup:
|
pg_backup:
|
||||||
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
||||||
file: pg_backup.sh
|
file: pg_backup.sh
|
||||||
abra_lasuite_entrypoint:
|
abra_entrypoint:
|
||||||
name: ${STACK_NAME}_entrypoint_${ABRA_LASUITE_ENTRYPOINT_VERSION}
|
name: ${STACK_NAME}_entrypoint_${ABRA_ENTRYPOINT_VERSION}
|
||||||
file: entrypoint.sh
|
file: entrypoint.sh
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
|
|||||||
@ -1,20 +1,26 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
DJANGO_SECRET_KEY="$(cat /run/secrets/django_secret_key)"
|
echo "++ running new entrypoint"
|
||||||
OIDC_RP_CLIENT_SECRET="$(cat /run/secrets/oidc_rp_client_secret)"
|
ORIGINAL_ENTRYPOINT="$1"
|
||||||
DJANGO_SUPERUSER_PASSWORD="$(cat /run/secrets/django_superuser_password)"
|
shift
|
||||||
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)"
|
|
||||||
|
|
||||||
export DJANGO_SECRET_KEY
|
echo "++ original entrypoint: ${ORIGINAL_ENTRYPOINT}"
|
||||||
export OIDC_RP_CLIENT_SECRET
|
|
||||||
export DJANGO_SUPERUSER_PASSWORD
|
|
||||||
export COLLABORATION_SERVER_SECRET
|
|
||||||
export POSTGRES_PASSWORD
|
|
||||||
export DB_PASSWORD
|
|
||||||
export MINIO_ROOT_PASSWORD
|
|
||||||
|
|
||||||
# Execute the actual command (from command: in compose.yml)
|
# --- 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 "$@"
|
exec "$@"
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user