|
|
@ -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!!!" |
|
|
|