discourse OK

This commit is contained in:
pvincent
2024-10-09 17:08:08 +04:00
parent d98ae8e383
commit cc499784bb
3 changed files with 22 additions and 7 deletions
+21 -5
View File
@@ -1,14 +1,14 @@
#!/bin/bash
function check_service_running() {
lxc exec "$container" -- bash -c "docker ps --format {{.Names}} | grep $1"
lxc exec "$container" -- bash -c "docker ps --format '{{.Names}},{{.Ports}}' | grep $1 | grep $2"
}
function _read() {
disable_trace
check_db_postgres_exists "$longname"
check_container "$container"
check_service_running "$shortname"
check_service_running "$longname" "$port"
enable_trace
return 0
}
@@ -21,9 +21,25 @@ function _create() {
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"
#TODO:
1. copy template to container
1. rebuild container
echo "copying files to container <$container> ... "
lxc file push --uid 0 --gid 0 "$MIAOU_CONFIGDIR/apps/discourse/$longname.yml" "$container/var/discourse/containers/$longname.yml"
echo "copying files over container <$container> ... OK"
if ! (db-psql list | grep -q "$longname"); then
echo "create empty database <$longname> ... "
db-psql create "$longname"
echo "create empty database <$longname> ... OK"
else
echo "database already exists!"
fi
echo "build docker container $longname ..."
lxc exec "$container" -- bash <<EOF
set -Eeuo pipefail
cd /var/discourse
./launcher rebuild $longname
EOF
echo "initialize discourse $longname ... OK"
}
function _update() {
+1
View File
@@ -501,6 +501,7 @@ function build_services() {
[[ "$data" != "null" ]] && command+=" --data \"$data\""
if ! eval "$command -r" >/dev/null; then
echoinfo "CREATE RECIPE"
# echo "$command -c"
eval "$command -c"
echoinfo "CREATE RECIPE: OK"
-2
View File
@@ -20,8 +20,6 @@ env:
LANGUAGE: en_US.UTF-8
# DISCOURSE_DEFAULT_LOCALE: en
## Uncomment if you want the container to be started with the same
## hostname (-h option) as specified above (default "$hostname-$config")
DOCKER_USE_HOSTNAME: true
DISCOURSE_SMTP_ADDRESS: {{ services[env.APP_DOMAIN][env.APP_SUBDOMAIN].data.discourse.smtp.server }}