Browse Source

redis multiple databases

main
pvincent 1 month ago
parent
commit
7a6a94f10a
  1. 14
      recipes/discourse/crud.sh
  2. 1
      templates/apps/discourse/forum.yml.j2

14
recipes/discourse/crud.sh

@ -31,8 +31,20 @@ function _create() {
admin_password=$(load_yaml_from_expanded services[\""$domain"\"][\""$subdomain"\"].data.admin.password)
redis_password=$(load_yaml_from_expanded credential.redis)
redis_host=$(lxc list ct1 -c4 -f csv | cut -d' ' -f1)
echo -n "count redis databases..."
redis_database=$(lxc exec ct1 -- bash -c "redis-cli -h $redis_host -a $redis_password INFO keyspace | tail -n1 | grep db | cut -d: -f1")
redis_database=${redis_database#db}
if [[ "$redis_database" =~ ^[0-9]+$ ]]; then
redis_database=$((redis_database + 1))
else
redis_database=0
fi
PREFIX='' echo $redis_database
mkdir -p "$MIAOU_CONFIGDIR/apps/discourse"
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" >/dev/null
APP_REDIS_DB=$redis_database 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" >/dev/null
echo "creating templates ... OK"
echo "copying files to container <$container> ... "

1
templates/apps/discourse/forum.yml.j2

@ -37,6 +37,7 @@ env:
DISCOURSE_REDIS_HOST: ct1.lxd
DISCOURSE_REDIS_PASSWORD: {{ env.APP_REDIS_PASSWORD }}
DISCOURSE_REDIS_DB: {{ env.APP_REDIS_DB }}
volumes:
- volume:

Loading…
Cancel
Save