Fill in entrypoint, add abra.sh, fix environment

This commit is contained in:
Cassowary 2024-03-26 12:22:50 -07:00
parent 1ffd4e7736
commit 53d3046e01
4 changed files with 48 additions and 3 deletions

View File

@ -7,7 +7,6 @@ DOMAIN=grist.example.com
LETS_ENCRYPT_ENV=production
GRIST_SUPPORT_ANON=false
SECRET_GRIST_SESSION_SECRET_VERSION=v1
#GRIST_SANDBOX_FLAVOR=
GRIST_SINGLE_ORG="yourorg"
GRIST_ORG_IN_PATH=true
@ -15,3 +14,6 @@ COOKIE_MAX_AGE=7776000000
GRIST_FORCE_LOGIN=true
GRIST_HIDE_UI_ELEMENTS=billing,sendToDrive
GRIST_DEFAULT_EMAIL=grist@example.com
SECRET_GRIST_SESSION_SECRET_VERSION=v1
SECRET_DB_PASSWORD_VERSION=v1

1
abra.sh Normal file
View File

@ -0,0 +1 @@
export ENTRYPOINT_CONF_VERSION=v1

View File

@ -5,14 +5,14 @@ services:
- proxy
- internal
environment:
- GRIST_DATABASE_URL=postgresql://${STACK_NAME}_db:5432/grist
- TYPEORM_DATABASE=grist
- TYPEORM_TYPE=postgres
- TYPEORM_USERNAME=grist
- TYPEORM_PASSWORD_FILE=/run/secrets/db_password
- REDIS_URL=redis://${STACK_NAME}_redis:6379
- GRIST_DATA_DIR=/var/grist-data
- GRIST_SUPPORT_ANON
- SESSION_SECRET_FILE=/run/secrets/
- SESSION_SECRET_FILE=/run/secrets/session_secret
- GRIST_SANDBOX_FLAVOR=unsandboxed
- APP_HOME_URL=https://${DOMAIN}
- APP_DOC_URL=https://${DOMAIN}
@ -24,6 +24,12 @@ services:
- GRIST_DEFAULT_EMAIL
secrets:
- session_secret
- db_password
configs:
- source: entrypoint_conf
target: /docker-entrypoint.sh
mode: 0555
entrypoint: /docker-entrypoint.sh
volumes:
- grist_data:/persist
depends_on:
@ -78,3 +84,9 @@ networks:
proxy:
external: true
internal:
configs:
entrypoint_conf:
name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang

30
entrypoint.sh.tmpl Executable file
View File

@ -0,0 +1,30 @@
#!/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 TYPEORM_PASSWORD
file_env SESSION_SECRET
exec ./sandbox/run.sh $@