From 491587eee258f28858a01ba8980212015b838234 Mon Sep 17 00:00:00 2001 From: ekimia Date: Thu, 26 Dec 2019 01:02:44 +0100 Subject: [PATCH 01/10] add -t param to provision clone + param check --- utils/provision | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/provision b/utils/provision index eb9d772..ca5d01d 100755 --- a/utils/provision +++ b/utils/provision @@ -32,6 +32,7 @@ read -r -d '' usage <<-'EOF' -i Configure OpenDKIM. -c Configures DNS on Namecheap. -d Enables debug mode + -t Checkout a specific tag or branch -h This page EOF @@ -103,7 +104,7 @@ function buy_domain_name () { } function application () { - git clone https://${arg_a}.git /data/domains/${arg_u} + git clone https://${arg_a}.git /data/domains/${arg_u} -t ${arg_t} cd /data/domains/${arg_u} if [ -f ./scripts/install ]; then export URL=${arg_u} @@ -201,6 +202,8 @@ fi [ -z "${arg_u}" ] && help "URL is required." [ -z "${LOG_LEVEL}" ] && emergency "Cannot continue without LOG_LEVEL." +# tags/branch for modules +[ -z "${arg_t}" ] && arg_t=master ### Runtime From b275794ca694d861d77c4a1710374ed695a17a04 Mon Sep 17 00:00:00 2001 From: Michel Memeteau Date: Sun, 22 Mar 2020 17:56:16 +0100 Subject: [PATCH 02/10] Update utils/provision, install.linux.sh files --- install.linux.sh | 4 ++-- utils/provision | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/install.linux.sh b/install.linux.sh index 24cce8a..21fb324 100755 --- a/install.linux.sh +++ b/install.linux.sh @@ -6,9 +6,9 @@ LIBRE_VERSION=1.1 ## domain handling -### TODO : Specify you template repo ROOT +### TODO : Specify you template repo ROOT without training slash -TEMPLATES_ROOT=lab.libreho.st/libre.sh/compose/ +APP_REPO_URL=lab.libreho.st/libre.sh/compose ### TODO : change to your domain vendor ( ovh , online, ) DOMAIN_SERVER=namecheap diff --git a/utils/provision b/utils/provision index eb9d772..deee495 100755 --- a/utils/provision +++ b/utils/provision @@ -103,7 +103,17 @@ function buy_domain_name () { } function application () { - git clone https://${arg_a}.git /data/domains/${arg_u} + #We check if a APP_REPO_URL was specified + + if[ -z ${APP_REPO_URL:-} ]; then + warning "NO repo URL specified, using argument as full URL" + git_url=https://${arg_a}.git + else + warning "REPO specified, using argument as app name" + git_url=https://${APP_REPO_URL}/${arg_a}.git + fi + + git clone ${git_url} /data/domains/${arg_u} cd /data/domains/${arg_u} if [ -f ./scripts/install ]; then export URL=${arg_u} From 8aea5b59146b6285a01f79549850a0a02f569cb6 Mon Sep 17 00:00:00 2001 From: Michel Memeteau Date: Sun, 22 Mar 2020 18:10:38 +0100 Subject: [PATCH 03/10] Set up variables --- install.linux.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/install.linux.sh b/install.linux.sh index 21fb324..07c8cd2 100755 --- a/install.linux.sh +++ b/install.linux.sh @@ -1,7 +1,7 @@ #!/bin/bash #Current version of libre.sh to be installed -LIBRE_VERSION=1.1 +LIBRE_VERSION=187-repo-mode-to-retrieve-application-recipe # System env vars ## domain handling @@ -23,7 +23,7 @@ OVH_URL="eu.api.ovh.com" OVH_API_USER="" OVH_API_KEY= - +### TODO : change your settings IP="curl -s http://icanhazip.com/" FirstName="Pierre" LastName="Ozoux" @@ -36,13 +36,15 @@ City="Lisbon" CountryCode="PT" ## Backup BACKUP_DESTINATION=root@xxxxx:port + +### TODO : Change your mail settings. ## SMTP MAIL_USER= MAIL_PASS= MAIL_HOST=mail.indie.host MAIL_PORT=587 - +### TODO : source a setting file is present to override defaults echo "-------- Welcome to libre.sh $LIBRE_VERSION installer" @@ -53,6 +55,18 @@ echo "-------- Welcome to libre.sh $LIBRE_VERSION installer" echo "-------- setting up system variables" +echo "APP_REPO_URL=${APP_REPO_URL}" >> /etc/environnement + +echo "LIBRE_VERSION=${LIBRE_VERSION}" >> /etc/environnement + +echo "MAIL_USER=${MAIL_USER}" >> /etc/environnement + +echo "MAIL_PASS=${MAIL_PASS}" >> /etc/environnement + +echo "MAIL_HOST=${MAIL_HOST}" >> /etc/environnement + +echo "MAIL_PORT=${MAIL_PORT}" >> /etc/environnement + # STEP Install Docker From ba58e277dd091e872d06a679a274ea7e0e25f3e2 Mon Sep 17 00:00:00 2001 From: Michel Memeteau Date: Sun, 22 Mar 2020 18:35:44 +0100 Subject: [PATCH 04/10] Fix variables --- install.linux.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/install.linux.sh b/install.linux.sh index 07c8cd2..f2ba021 100755 --- a/install.linux.sh +++ b/install.linux.sh @@ -8,7 +8,7 @@ LIBRE_VERSION=187-repo-mode-to-retrieve-application-recipe ### TODO : Specify you template repo ROOT without training slash -APP_REPO_URL=lab.libreho.st/libre.sh/compose +APP_REPO_URL="lab.libreho.st/libre.sh/compose" ### TODO : change to your domain vendor ( ovh , online, ) DOMAIN_SERVER=namecheap @@ -55,17 +55,17 @@ echo "-------- Welcome to libre.sh $LIBRE_VERSION installer" echo "-------- setting up system variables" -echo "APP_REPO_URL=${APP_REPO_URL}" >> /etc/environnement +echo "APP_REPO_URL=${APP_REPO_URL}" >> /etc/environment -echo "LIBRE_VERSION=${LIBRE_VERSION}" >> /etc/environnement +echo "LIBRE_VERSION=${LIBRE_VERSION}" >> /etc/environment -echo "MAIL_USER=${MAIL_USER}" >> /etc/environnement +echo "MAIL_USER=${MAIL_USER}" >> /etc/environment -echo "MAIL_PASS=${MAIL_PASS}" >> /etc/environnement +echo "MAIL_PASS=${MAIL_PASS}" >> /etc/environment -echo "MAIL_HOST=${MAIL_HOST}" >> /etc/environnement +echo "MAIL_HOST=${MAIL_HOST}" >> /etc/environment -echo "MAIL_PORT=${MAIL_PORT}" >> /etc/environnement +echo "MAIL_PORT=${MAIL_PORT}" >> /etc/environment # STEP Install Docker @@ -112,3 +112,5 @@ cat > /etc/profile.d/libre.sh < Date: Wed, 25 Mar 2020 17:03:00 +0100 Subject: [PATCH 05/10] Fix typo , repo mode works now --- utils/provision | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/provision b/utils/provision index deee495..29293f9 100755 --- a/utils/provision +++ b/utils/provision @@ -103,9 +103,10 @@ function buy_domain_name () { } function application () { + #We check if a APP_REPO_URL was specified - if[ -z ${APP_REPO_URL:-} ]; then + if [ -z ${APP_REPO_URL:-} ]; then warning "NO repo URL specified, using argument as full URL" git_url=https://${arg_a}.git else From 41d64fb51339089b3f2ab15b16fc9f7a6e696bf0 Mon Sep 17 00:00:00 2001 From: Michel Memeteau Date: Wed, 25 Mar 2020 17:10:53 +0100 Subject: [PATCH 06/10] sourcing values.env file --- install.linux.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/install.linux.sh b/install.linux.sh index f2ba021..8b5051d 100755 --- a/install.linux.sh +++ b/install.linux.sh @@ -2,15 +2,16 @@ #Current version of libre.sh to be installed LIBRE_VERSION=187-repo-mode-to-retrieve-application-recipe -# System env vars +# System env vars : can be overrided by a values.env file next to this install file -## domain handling -### TODO : Specify you template repo ROOT without training slash +### CONFIG : Specify you template repo ROOT without training slash (Optional) or comment if you want to supply full url for apps APP_REPO_URL="lab.libreho.st/libre.sh/compose" -### TODO : change to your domain vendor ( ovh , online, ) +## domain handling + +### CONFIG : change to your domain vendor ( namecheap, ovh , scaleway, ) DOMAIN_SERVER=namecheap ### Namecheap specific @@ -18,11 +19,18 @@ NAMECHEAP_URL="namecheap.com" NAMECHEAP_API_USER="pierreo" NAMECHEAP_API_KEY= -### ovh specific +### ovh specific (WIP) OVH_URL="eu.api.ovh.com" OVH_API_USER="" OVH_API_KEY= + +### Scaleway specific (WIP) +SCALEWAY_URL="" +SCALEWAY_API_USER="" +SCALEWAY_API_KEY= + + ### TODO : change your settings IP="curl -s http://icanhazip.com/" FirstName="Pierre" @@ -37,7 +45,7 @@ CountryCode="PT" ## Backup BACKUP_DESTINATION=root@xxxxx:port -### TODO : Change your mail settings. +### CONFIG : Change your mail settings. ## SMTP MAIL_USER= MAIL_PASS= @@ -48,6 +56,10 @@ MAIL_PORT=587 echo "-------- Welcome to libre.sh $LIBRE_VERSION installer" +echo "---- sourcing local values.env file if present" + +source values.env + # STEP add kernel parameter From 633bab6358c9f0628f8b071670716f14362388f8 Mon Sep 17 00:00:00 2001 From: Michel Memeteau Date: Fri, 27 Mar 2020 15:48:11 +0100 Subject: [PATCH 07/10] comments --- utils/provision | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/provision b/utils/provision index ca5d01d..2f6a4ad 100755 --- a/utils/provision +++ b/utils/provision @@ -26,11 +26,11 @@ LOG_LEVEL="${LOG_LEVEL:-6}" # 7 = debug -> 0 = emergency # opts & defaults from. The parsing is unforgiving so be precise in your syntax read -r -d '' usage <<-'EOF' -u [arg] URL to process. Required. - -a [arg] Application to install. (in the form github.com/indiehosters/wordpress) + -a [arg] Application to install. (in the form github.com/indiehosters/wordpress or wordpress in REPO_MODE) -s Start the application right away. -b Buys the associated domain name. -i Configure OpenDKIM. - -c Configures DNS on Namecheap. + -c Configures DNS if possible. -d Enables debug mode -t Checkout a specific tag or branch -h This page From a1587b03f080934f2b2a49f99176c67193f11323 Mon Sep 17 00:00:00 2001 From: Michel Memeteau Date: Thu, 2 Apr 2020 18:24:37 +0200 Subject: [PATCH 08/10] final : add the -t param in the usage --- utils/provision | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/provision b/utils/provision index d8dfac6..af27200 100755 --- a/utils/provision +++ b/utils/provision @@ -27,12 +27,12 @@ LOG_LEVEL="${LOG_LEVEL:-6}" # 7 = debug -> 0 = emergency read -r -d '' usage <<-'EOF' -u [arg] URL to process. Required. -a [arg] Application to install. (in the form github.com/indiehosters/wordpress or wordpress in REPO_MODE) + -t [arg] Checkout a specific tag or branch from the application repo. default to master -s Start the application right away. -b Buys the associated domain name. -i Configure OpenDKIM. -c Configures DNS if possible. -d Enables debug mode - -t Checkout a specific tag or branch -h This page EOF @@ -117,7 +117,7 @@ function application () { #Define the tag/branch - if [ -z ${arg_t:-} ]; then + if [ "${arg_t}" = "1" ]; then warning "No tag/branch specified, Using master " git_tag=master else From 61b28985bb7002e6187a9e7419e4dc19a438e6e7 Mon Sep 17 00:00:00 2001 From: Michel Memeteau Date: Fri, 3 Apr 2020 13:38:53 +0200 Subject: [PATCH 09/10] export admin email ( default in etc env ) --- install.linux.sh | 8 +++++++- utils/provision | 19 ++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/install.linux.sh b/install.linux.sh index 8b5051d..381fcc2 100755 --- a/install.linux.sh +++ b/install.linux.sh @@ -1,7 +1,7 @@ #!/bin/bash #Current version of libre.sh to be installed -LIBRE_VERSION=187-repo-mode-to-retrieve-application-recipe +LIBRE_VERSION=develop # System env vars : can be overrided by a values.env file next to this install file @@ -52,6 +52,10 @@ MAIL_PASS= MAIL_HOST=mail.indie.host MAIL_PORT=587 +# Default admin emails for apps + +ADMIN_EMAIL=support@ekimia.fr + ### TODO : source a setting file is present to override defaults echo "-------- Welcome to libre.sh $LIBRE_VERSION installer" @@ -79,6 +83,8 @@ echo "MAIL_HOST=${MAIL_HOST}" >> /etc/environment echo "MAIL_PORT=${MAIL_PORT}" >> /etc/environment +echo "ADMIN_EMAIL=${ADMIN_EMAIL}" >> /etc/environment + # STEP Install Docker diff --git a/utils/provision b/utils/provision index af27200..b54d766 100755 --- a/utils/provision +++ b/utils/provision @@ -28,6 +28,7 @@ read -r -d '' usage <<-'EOF' -u [arg] URL to process. Required. -a [arg] Application to install. (in the form github.com/indiehosters/wordpress or wordpress in REPO_MODE) -t [arg] Checkout a specific tag or branch from the application repo. default to master + -e [arg] Specify the email of the application admin -s Start the application right away. -b Buys the associated domain name. -i Configure OpenDKIM. @@ -117,18 +118,21 @@ function application () { #Define the tag/branch - if [ "${arg_t}" = "1" ]; then - warning "No tag/branch specified, Using master " - git_tag=master - else - git_tag=${arg_t} - fi git clone ${git_url} -b ${arg_t} /data/domains/${arg_u} cd /data/domains/${arg_u} if [ -f ./scripts/install ]; then - export URL=${arg_u} + #domain + export URL=${arg_u} + #admin email + if [ -z "${arg_e}" ]; then + warning "No admin_email specified with -e , using default hoster email" + else + export ADMIN_EMAIL=${arg_e} + debug " admin email is ${ADMIN_EMAIL} " + fi + if [ -z ${MAIL_DOMAIN:-} ]; then warning "you have no email server setup, we'll print a random configuration in your application. Make sure to check the parameters for your app to send proper emails." warning "To stop having this warning, please configure your libre.sh to be abble to create email accounts." @@ -148,6 +152,7 @@ function application () { fi } + function start () { systemctl start u@${arg_u} systemctl enable u@${arg_u} From 2d7ff88023e16580e9390e80d725ba5876567d6d Mon Sep 17 00:00:00 2001 From: freechelmi Date: Fri, 3 Apr 2020 16:27:02 +0200 Subject: [PATCH 10/10] Bump version release/1.2 --- install.linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.linux.sh b/install.linux.sh index 381fcc2..d48d8d3 100755 --- a/install.linux.sh +++ b/install.linux.sh @@ -1,7 +1,7 @@ #!/bin/bash #Current version of libre.sh to be installed -LIBRE_VERSION=develop +LIBRE_VERSION=release/1.2 # System env vars : can be overrided by a values.env file next to this install file