feat(ess-pro/compose): deploy Element Server Suite Pro via Compose
initial commit of the converted role from helm charts for qubernetis to compose ansible role
This commit is contained in:
parent
c11f019aae
commit
32eca6b923
33 changed files with 1906 additions and 0 deletions
30
roles/ess_pro_compose/templates/postgres/configure-dbs.sh.j2
Normal file
30
roles/ess_pro_compose/templates/postgres/configure-dbs.sh.j2
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
# {{ ansible_managed }}
|
||||
# Postgres init script — chart-equivalent of configure-dbs.sh.
|
||||
# Reads password files from /secrets/ess-generated and creates two DBs.
|
||||
|
||||
set -e
|
||||
|
||||
create_or_ensure_db() {
|
||||
user="$1"
|
||||
db="$2"
|
||||
password="$3"
|
||||
admin_password="$4"
|
||||
|
||||
if echo -n "$admin_password" | psql -W -U postgres -tc "SELECT 1 FROM pg_catalog.pg_roles WHERE rolname = '$user'" | grep -q 1; then
|
||||
echo -n "$admin_password" | psql -W -U postgres -c "ALTER USER $user PASSWORD '$password'"
|
||||
else
|
||||
echo -n "$admin_password" | psql -W -U postgres -c "CREATE ROLE $user LOGIN PASSWORD '$password'"
|
||||
fi
|
||||
|
||||
if ! echo -n "$admin_password" | psql -W -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = '$db'" | grep -q 1; then
|
||||
echo -n "$admin_password" | createdb --encoding=UTF8 --locale=C --template=template0 --owner=$user $db -U postgres
|
||||
fi
|
||||
}
|
||||
|
||||
POSTGRES_PASSWORD="$(cat /secrets/ess-generated/POSTGRES_ADMIN_PASSWORD)"
|
||||
ESS_SYNAPSE_PW="$(cat /secrets/ess-generated/POSTGRES_SYNAPSE_PASSWORD)"
|
||||
ESS_MAS_PW="$(cat /secrets/ess-generated/POSTGRES_MATRIX_AUTHENTICATION_SERVICE_PASSWORD)"
|
||||
|
||||
create_or_ensure_db "matrixauthenticationservice_user" "matrixauthenticationservice" "$ESS_MAS_PW" "$POSTGRES_PASSWORD"
|
||||
create_or_ensure_db "synapse_user" "synapse" "$ESS_SYNAPSE_PW" "$POSTGRES_PASSWORD"
|
||||
Loading…
Add table
Add a link
Reference in a new issue