credential.redis

This commit is contained in:
pvincent
2024-10-10 01:18:16 +04:00
parent cc499784bb
commit 8a65146071
5 changed files with 76 additions and 6 deletions
+10 -1
View File
@@ -17,8 +17,13 @@ function _create() {
echo "creating discourse instance for <$shortname> ... "
echo "initialize discourse $shortname $longname ... OK"
admin_username=$(load_yaml_from_expanded services[\""$domain"\"][\""$subdomain"\"].data.discourse.admin.username)
admin_email=$(load_yaml_from_expanded services[\""$domain"\"][\""$subdomain"\"].data.discourse.admin.email)
admin_password=$(load_yaml_from_expanded services[\""$domain"\"][\""$subdomain"\"].data.discourse.admin.password)
redis_password=$(load_yaml_from_expanded credential.redis)
mkdir -p "$MIAOU_CONFIGDIR/apps/discourse"
APP_DOMAIN=$domain APP_SUBDOMAIN=$subdomain APP_FQDN=$fqdn APP_PORT=$port APP_NAME=$longname tera -e --env-key env -t "$MIAOU_BASEDIR/templates/apps/discourse/forum.yml.j2" -o "$MIAOU_CONFIGDIR/apps/discourse/$longname.yml" "$MIAOU_CONFIGDIR/miaou.expanded.yaml"
APP_REDIS_PASSWORD=$redis_password APP_DOMAIN=$domain APP_SUBDOMAIN=$subdomain APP_FQDN=$fqdn APP_PORT=$port APP_NAME=$longname tera -e --env-key env -t "$MIAOU_BASEDIR/templates/apps/discourse/forum.yml.j2" -o "$MIAOU_CONFIGDIR/apps/discourse/$longname.yml" "$MIAOU_CONFIGDIR/miaou.expanded.yaml"
echo "creating templates ... OK"
echo "copying files to container <$container> ... "
@@ -28,6 +33,8 @@ function _create() {
if ! (db-psql list | grep -q "$longname"); then
echo "create empty database <$longname> ... "
db-psql create "$longname"
db-psql use "$longname" "CREATE EXTENSION IF NOT EXISTS hstore"
db-psql use "$longname" "CREATE EXTENSION IF NOT EXISTS pg_trgm"
echo "create empty database <$longname> ... OK"
else
echo "database already exists!"
@@ -38,6 +45,8 @@ function _create() {
set -Eeuo pipefail
cd /var/discourse
./launcher rebuild $longname
command='u=User.create_with(email: "$admin_email", password: "$admin_password").find_or_initialize_by(username: "$admin_username"); u.save; u.activate'
./launcher run $longname "rails runner '\$command'"
EOF
echo "initialize discourse $longname ... OK"
}