limesurvey data provided by configuration
This commit is contained in:
@@ -28,6 +28,16 @@ function _create() {
|
|||||||
|
|
||||||
echo "creating limesurvey instance for <$shortname> ..."
|
echo "creating limesurvey instance for <$shortname> ..."
|
||||||
|
|
||||||
|
admin_username=$(echo -e "$data" | yq '.admin.username')
|
||||||
|
[[ $admin_username = 'null' ]] && echoerr "limesurver recipe requires \`data:admin:username\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
||||||
|
|
||||||
|
admin_email=$(echo -e "$data" | yq '.admin.email')
|
||||||
|
[[ $admin_email = 'null' ]] && echoerr "limesurver recipe requires \`data:admin:email\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
||||||
|
echo "admin_email = [$admin_email]"
|
||||||
|
|
||||||
|
admin_password=$(echo -e "$data" | yq '.admin.password')
|
||||||
|
[[ $admin_password = 'null' ]] && echoerr "limesurver recipe requires \`data:admin:password\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
||||||
|
|
||||||
mkdir -p "$MIAOU_CONFIGDIR/apps/limesurvey"
|
mkdir -p "$MIAOU_CONFIGDIR/apps/limesurvey"
|
||||||
APP_PORT=$port APP_NAME=$shortname tera -e --env-key env -t "$MIAOU_BASEDIR/templates/apps/limesurvey/limesurvey-host.j2" -o "$MIAOU_CONFIGDIR/apps/limesurvey/$shortname.conf" "$MIAOU_CONFIGDIR/miaou.expanded.yaml"
|
APP_PORT=$port APP_NAME=$shortname tera -e --env-key env -t "$MIAOU_BASEDIR/templates/apps/limesurvey/limesurvey-host.j2" -o "$MIAOU_CONFIGDIR/apps/limesurvey/$shortname.conf" "$MIAOU_CONFIGDIR/miaou.expanded.yaml"
|
||||||
echo "creating templates ... OK"
|
echo "creating templates ... OK"
|
||||||
@@ -85,14 +95,15 @@ return array(
|
|||||||
'config'=>array(
|
'config'=>array(
|
||||||
'debug'=>0,
|
'debug'=>0,
|
||||||
'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2
|
'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2
|
||||||
'mysqlEngine' => 'MYISAM',
|
'mysqlEngine' => 'MYISAM',
|
||||||
|
'force_ssl'=> true,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
EOT2
|
EOT2
|
||||||
echo 'initializing admin...'
|
echo 'initializing admin...'
|
||||||
cd /var/www/limesurvey/$shortname/application/commands
|
cd /var/www/limesurvey/$shortname/application/commands
|
||||||
set +e
|
set +e
|
||||||
php console.php install pvincent reunion pvincent pvincent@arcode.re
|
php console.php install $admin_username $admin_password $admin_username $admin_email
|
||||||
[[ \$? -ne 0 ]] && echo 'already initialized!'
|
[[ \$? -ne 0 ]] && echo 'already initialized!'
|
||||||
set -e
|
set -e
|
||||||
echo OK
|
echo OK
|
||||||
@@ -134,16 +145,18 @@ COMMAND_NAME=$(basename "$0")
|
|||||||
|
|
||||||
# read the options
|
# read the options
|
||||||
|
|
||||||
TEMP=$(getopt -n "$COMMAND_NAME" -o crud --long port:,container:,name:,fqdn:,domain:,subdomain: -- "$@")
|
TEMP=$(getopt -n "$COMMAND_NAME" -o crud --long port:,container:,name:,fqdn:,domain:,subdomain:,data: -- "$@")
|
||||||
# shellcheck disable=SC2181
|
# shellcheck disable=SC2181
|
||||||
[[ "$?" -eq 0 ]] || usage
|
[[ "$?" -eq 0 ]] || usage
|
||||||
eval set -- "$TEMP"
|
eval set -- "$TEMP"
|
||||||
|
|
||||||
action="unset"
|
action="unset"
|
||||||
port="unset"
|
port="unset"
|
||||||
|
fqdn="unset"
|
||||||
container="unset"
|
container="unset"
|
||||||
shortname="unset"
|
shortname="unset"
|
||||||
longname="unset"
|
longname="unset"
|
||||||
|
data="unset"
|
||||||
|
|
||||||
# extract options and their arguments into variables.
|
# extract options and their arguments into variables.
|
||||||
while true; do
|
while true; do
|
||||||
@@ -153,6 +166,7 @@ while true; do
|
|||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--fqdn)
|
--fqdn)
|
||||||
|
fqdn=$2
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--container)
|
--container)
|
||||||
@@ -170,6 +184,10 @@ while true; do
|
|||||||
--subdomain)
|
--subdomain)
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
--data)
|
||||||
|
data=$2
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
-c)
|
-c)
|
||||||
[[ "$action" == "unset" ]] || usage
|
[[ "$action" == "unset" ]] || usage
|
||||||
action="_create"
|
action="_create"
|
||||||
@@ -206,5 +224,8 @@ done
|
|||||||
"$action" != unset &&
|
"$action" != unset &&
|
||||||
"$port" != unset &&
|
"$port" != unset &&
|
||||||
"$container" != unset &&
|
"$container" != unset &&
|
||||||
|
"$data" != unset &&
|
||||||
|
"$fqdn" != unset &&
|
||||||
"$shortname" != unset ]] || usage
|
"$shortname" != unset ]] || usage
|
||||||
|
|
||||||
$action
|
$action
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ function _create() {
|
|||||||
echo "create empty database <$longname> ... OK"
|
echo "create empty database <$longname> ... OK"
|
||||||
|
|
||||||
admin_username=$(echo -e "$data" | yq '.admin.username')
|
admin_username=$(echo -e "$data" | yq '.admin.username')
|
||||||
[[ $admin_username == 'null ' ]] && echoerr "odoo12 recipe requires \`data:admin:username\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
[[ $admin_username = 'null' ]] && echoerr "odoo12 recipe requires \`data:admin:username\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
||||||
|
|
||||||
admin_password=$(echo -e "$data" | yq '.admin.password')
|
admin_password=$(echo -e "$data" | yq '.admin.password')
|
||||||
[[ $admin_password == 'null ' ]] && echoerr "odoo12 recipe requires \`data:admin:password\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
[[ $admin_password = 'null' ]] && echoerr "odoo12 recipe requires \`data:admin:password\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
||||||
|
|
||||||
cat <<EOF | lxc_exec "$container"
|
cat <<EOF | lxc_exec "$container"
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|||||||
@@ -55,10 +55,10 @@ EOF
|
|||||||
echo "create empty database <$longname> ... OK"
|
echo "create empty database <$longname> ... OK"
|
||||||
|
|
||||||
admin_username=$(echo -e "$data" | yq '.admin.username')
|
admin_username=$(echo -e "$data" | yq '.admin.username')
|
||||||
[[ $admin_username == 'null ' ]] && echoerr "odoo12 recipe requires \`data:admin:username\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
[[ $admin_username = 'null' ]] && echoerr "odoo12 recipe requires \`data:admin:username\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
||||||
|
|
||||||
admin_password=$(echo -e "$data" | yq '.admin.password')
|
admin_password=$(echo -e "$data" | yq '.admin.password')
|
||||||
[[ $admin_password == 'null ' ]] && echoerr "odoo12 recipe requires \`data:admin:password\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
[[ $admin_password = 'null' ]] && echoerr "odoo12 recipe requires \`data:admin:password\` into miaou.yaml service definition of <$fqdn>" && exit 1
|
||||||
|
|
||||||
cat <<EOF | lxc_exec "$container"
|
cat <<EOF | lxc_exec "$container"
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|||||||
@@ -503,6 +503,9 @@ function build_services() {
|
|||||||
echo "read [$app:$name] provided by container <$container>"
|
echo "read [$app:$name] provided by container <$container>"
|
||||||
command="env MIAOU_BASEDIR=$MIAOU_BASEDIR MIAOU_CONFIGDIR=$MIAOU_CONFIGDIR $recipe --port $port --container $container --name $name --fqdn $fqdn --domain $domain --subdomain $subdomain"
|
command="env MIAOU_BASEDIR=$MIAOU_BASEDIR MIAOU_CONFIGDIR=$MIAOU_CONFIGDIR $recipe --port $port --container $container --name $name --fqdn $fqdn --domain $domain --subdomain $subdomain"
|
||||||
[[ "$data" != "null" ]] && command+=" --data \"$data\""
|
[[ "$data" != "null" ]] && command+=" --data \"$data\""
|
||||||
|
|
||||||
|
# eval "$command -r" # USEFUL for debugging when read fails!!!
|
||||||
|
|
||||||
if ! eval "$command -r" >/dev/null; then
|
if ! eval "$command -r" >/dev/null; then
|
||||||
echoinfo "CREATE RECIPE"
|
echoinfo "CREATE RECIPE"
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
server {
|
server {
|
||||||
listen {{ env.APP_PORT }};
|
listen {{ env.APP_PORT }} default_server;
|
||||||
server_name localhost;
|
|
||||||
root /var/www/limesurvey/{{ env.APP_NAME }};
|
root /var/www/limesurvey/{{ env.APP_NAME }};
|
||||||
|
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
|||||||
Reference in New Issue
Block a user