|
|
@ -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() { |
|
|
|