diff --git a/lib/images/bullseye-miaou.sh b/lib/images/bullseye-miaou.sh deleted file mode 100755 index 4af5c9a..0000000 --- a/lib/images/bullseye-miaou.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -MIAOU_DIR="$(dirname "$0")/../.." -readonly MIAOU_DIR - -function init_strict() { - set -Eeuo pipefail - # shellcheck source=/dev/null - source "$MIAOU_DIR/lib/functions.sh" - # shellcheck source=/dev/null - source "/opt/miaou-bash/lib/functions.sh" - trap 'trap_error $? $LINENO $BASH_LINENO "$BASH_COMMAND" $(printf "::%s" ${FUNCNAME[@]})' ERR -} - -## main -init_strict -sudo_required -build_miaou_image "bullseye" diff --git a/lib/images/buster-miaou.sh b/lib/images/buster-miaou.sh deleted file mode 100755 index 9fbb137..0000000 --- a/lib/images/buster-miaou.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -MIAOU_DIR="$(dirname "$0")/../.." -readonly MIAOU_DIR - -function init_strict() { - set -Eeuo pipefail - # shellcheck source=/dev/null - source "$MIAOU_DIR/lib/functions.sh" - # shellcheck source=/dev/null - source "/opt/miaou-bash/lib/functions.sh" - - trap 'trap_error $? $LINENO $BASH_LINENO "$BASH_COMMAND" $(printf "::%s" ${FUNCNAME[@]})' ERR -} - -## main -init_strict -sudo_required -build_miaou_image "buster" diff --git a/recipes/cagettepei/crud.sh b/recipes/cagettepei/crud.sh index b34692b..c6cb6d7 100755 --- a/recipes/cagettepei/crud.sh +++ b/recipes/cagettepei/crud.sh @@ -34,7 +34,7 @@ function _create() { echo "creating CagettePĂ©i instance for <$shortname> ... " mkdir -p "$MIAOU_CONFIGDIR/apps/cagettepei" - APP_PORT=$port APP_NAME=$shortname tera -e --env-key env -t "$MIAOU_DIR/templates/apps/cagettepei/cagettepei-host.j2" -o "$MIAOU_CONFIGDIR/apps/cagettepei/$longname.conf" "$MIAOU_CONFIGDIR/miaou.expanded.yaml" + APP_PORT=$port APP_NAME=$shortname tera -e --env-key env -t "$MIAOU_BASEDIR/templates/apps/cagettepei/cagettepei-host.j2" -o "$MIAOU_CONFIGDIR/apps/cagettepei/$longname.conf" "$MIAOU_CONFIGDIR/miaou.expanded.yaml" echo "creating templates ... OK" echo "copying files over container <$container> ... " diff --git a/recipes/dolibarr/crud.sh b/recipes/dolibarr/crud.sh index 4a6a217..f04325d 100755 --- a/recipes/dolibarr/crud.sh +++ b/recipes/dolibarr/crud.sh @@ -60,7 +60,7 @@ EOF echo "generating configuration files from templates... " mkdir -p "$MIAOU_CONFIGDIR/apps/dolibarr/$shortname" PHP_VERSION=$(lxc exec "$container" -- dpkg -l php-fpm | grep "^ii" | cut -d ':' -f2 | cut -d '+' -f1) - APP_PORT=$port APP_NAME=$longname PHP_VERSION=$PHP_VERSION tera -e -t "$MIAOU_DIR/templates/apps/dolibarr/host.j2" -o "$MIAOU_CONFIGDIR/apps/dolibarr/$shortname/host.conf" "$MIAOU_CONFIGDIR/miaou.expanded.yaml" >/dev/null + APP_PORT=$port APP_NAME=$longname PHP_VERSION=$PHP_VERSION tera -e -t "$MIAOU_BASEDIR/templates/apps/dolibarr/host.j2" -o "$MIAOU_CONFIGDIR/apps/dolibarr/$shortname/host.conf" "$MIAOU_CONFIGDIR/miaou.expanded.yaml" >/dev/null echo "copying configuration files onto container <$container>... " lxc file push --uid 0 --gid 0 "$MIAOU_CONFIGDIR/apps/dolibarr/$shortname/host.conf" "$container/etc/nginx/sites-available/$longname.conf" diff --git a/recipes/odoo12/crud.sh b/recipes/odoo12/crud.sh index 0309975..c03649c 100755 --- a/recipes/odoo12/crud.sh +++ b/recipes/odoo12/crud.sh @@ -30,8 +30,8 @@ function _create() { mkdir -p "$MIAOU_CONFIGDIR/apps/odoo12" longport=$((port + 1000)) - APP_PORT=$port LONG_PORT=$longport APP_NAME=$shortname tera -e -t "$MIAOU_DIR/templates/apps/odoo12/odoo.conf.j2" -o "$MIAOU_CONFIGDIR/apps/odoo12/$shortname.conf" "$MIAOU_CONFIGDIR/miaou.expanded.yaml" >/dev/null - APP_NAME=$shortname tera -t "$MIAOU_DIR/templates/apps/odoo12/odoo.service.j2" --env-only -o "$MIAOU_CONFIGDIR/apps/odoo12/$longname.service" >/dev/null + APP_PORT=$port LONG_PORT=$longport APP_NAME=$shortname tera -e -t "$MIAOU_BASEDIR/templates/apps/odoo12/odoo.conf.j2" -o "$MIAOU_CONFIGDIR/apps/odoo12/$shortname.conf" "$MIAOU_CONFIGDIR/miaou.expanded.yaml" >/dev/null + APP_NAME=$shortname tera -t "$MIAOU_BASEDIR/templates/apps/odoo12/odoo.service.j2" --env-only -o "$MIAOU_CONFIGDIR/apps/odoo12/$longname.service" >/dev/null echo "creating templates ... OK" echo "copying files over container <$container> ... " @@ -44,10 +44,11 @@ function _create() { db-psql create "$longname" echo "create empty database <$longname> ... OK" - #FIXME: load credential from data argument wth yq parsing!!! + admin_username=$(cat "$data" | yq '.admin.username') + [[ $admin_username == 'null ' ]] && echoerr "odoo12 recipe requires \`data:admin:username\` into miaou.yaml service definition of <$fqdn>" && exit 1 - credential_username=$(load_yaml_from_expanded credential.username) - credential_password=$(load_yaml_from_expanded credential.password) + admin_password=$(cat "$data" | yq '.admin.password') + [[ $admin_password == 'null ' ]] && echoerr "odoo12 recipe requires \`data:admin:password\` into miaou.yaml service definition of <$fqdn>" && exit 1 cat </dev/null - APP_NAME=$shortname tera -t "$MIAOU_DIR/templates/apps/odoo15/odoo.service.j2" --env-only -o "$MIAOU_CONFIGDIR/apps/odoo15/$longname.service" >/dev/null + APP_PORT=$port LONG_PORT=$longport APP_NAME=$shortname tera -e -t "$MIAOU_BASEDIR/templates/apps/odoo15/odoo.conf.j2" -o "$MIAOU_CONFIGDIR/apps/odoo15/$shortname.conf" "$MIAOU_CONFIGDIR/miaou.expanded.yaml" >/dev/null + APP_NAME=$shortname tera -t "$MIAOU_BASEDIR/templates/apps/odoo15/odoo.service.j2" --env-only -o "$MIAOU_CONFIGDIR/apps/odoo15/$longname.service" >/dev/null echo "creating templates ... OK" echo "copying files over container <$container> ... " @@ -54,8 +54,11 @@ EOF db-psql create "$longname" echo "create empty database <$longname> ... OK" - credential_username=$(load_yaml_from_expanded credential.username) - credential_password=$(load_yaml_from_expanded credential.password) + admin_username=$(cat "$data" | yq '.admin.username') + [[ $admin_username == 'null ' ]] && echoerr "odoo12 recipe requires \`data:admin:username\` into miaou.yaml service definition of <$fqdn>" && exit 1 + + admin_password=$(cat "$data" | yq '.admin.password') + [[ $admin_password == 'null ' ]] && echoerr "odoo12 recipe requires \`data:admin:password\` into miaou.yaml service definition of <$fqdn>" && exit 1 cat <" - if ! "$recipe" -r --port "$port" --container "$container" --name "$name" --fqdn "$fqdn"; then + command="env MIAOU_BASEDIR=$MIAOU_BASEDIR MIAOU_CONFIGDIR=$MIAOU_CONFIGDIR $recipe --port $port --container $container --name $name --fqdn $fqdn" + [[ "$data" != "null" ]] && command+=" --data \"$data\"" + if ! eval "$command -r" >/dev/null; then echoinfo "CREATE RECIPE" - "$recipe" -c --port "$port" --container "$container" --name "$name" --fqdn "$fqdn" + eval "$command -c" echoinfo "CREATE RECIPE: OK" fi else @@ -457,7 +456,7 @@ fi if containsElement options "config"; then editor /etc/miaou/miaou.yaml - if diff -q /etc/miaou/miaou.yaml $HOME/.config/miaou/archived/miaou.yaml/previous; then + if diff -q /etc/miaou/miaou.yaml "$HOME"/.config/miaou/archived/miaou.yaml/previous; then exit 0 fi fi