fix cagettepei
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
function check_db_maria_exists() {
|
||||
db-maria list | grep -q "$1"
|
||||
db-maria list | grep -q "^$1$"
|
||||
}
|
||||
|
||||
function check_db_postgres_exists() {
|
||||
|
||||
@@ -27,20 +27,20 @@ function _read() {
|
||||
}
|
||||
|
||||
function _create() {
|
||||
echo "creating CagettePéi instance for <$shortname> ... "
|
||||
echo "creating cagettepei instance for <$shortname> ... "
|
||||
|
||||
mkdir -p "$MIAOU_CONFIGDIR/apps/cagettepei"
|
||||
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 "template $longname.conf... OK"
|
||||
|
||||
echo "copying files to container <$container> ... "
|
||||
lxc file push --uid 0 --gid 0 "$MIAOU_CONFIGDIR/apps/cagettepei/$longname.conf" "$container/etc/apache2/sites-available/$longname.conf"
|
||||
echo "copying files to container <$container> ... OK"
|
||||
|
||||
if ! (db-maria list | grep -q "$longname"); then
|
||||
echo "create empty database <$longname> ... "
|
||||
if ! check_db_maria_exists "$longname"; then
|
||||
echo -n "create empty database <$longname> ... "
|
||||
db-maria create "$longname"
|
||||
echo "create empty database <$longname> ... OK"
|
||||
PREFIX="" echoinfo "DONE"
|
||||
DB_INIT=true
|
||||
else
|
||||
echo "database already exists!"
|
||||
@@ -106,10 +106,11 @@ EOT2
|
||||
a2ensite $longname.conf
|
||||
mkdir -p /var/log/apache2/cagettepei/$shortname
|
||||
systemctl restart apache2
|
||||
curl localhost:$port
|
||||
sleep 5
|
||||
|
||||
if [[ $DB_INIT == true ]]; then
|
||||
echo "Force TABLES initialization"
|
||||
curl localhost:$port
|
||||
echo "Set administrator password..."
|
||||
echo "insert into User values (1,'fr','c3513c793b13471f3a49bdb22acb66de',1,'$credential_username','Admin', '$credential_email', null, null, null, null, null, null, null, null, null, now(), now(),6,null, null);" | mariadb cagettepei-$shortname -u cagettepei-$shortname -pcagettepei-$shortname -h ct1.lxd
|
||||
echo "TODO: password \`cagette\` should be changed soon!!!"
|
||||
|
||||
@@ -468,7 +468,9 @@ function prepare_containers() {
|
||||
service="${item[$j]}"
|
||||
recipe_install="$MIAOU_BASEDIR/recipes/$service/install.sh"
|
||||
if [[ -f "$recipe_install" ]]; then
|
||||
echowarn "container <$container> installing new recipe [$service]..."
|
||||
"$recipe_install" "$container"
|
||||
echoinfo DONE
|
||||
else
|
||||
echoerr "FAILURE, for container <$container>, install recipe [$service] not found!"
|
||||
echoerr "please review configuration, mismatch recipe name maybe?"
|
||||
|
||||
Reference in New Issue
Block a user