Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • lupa/compose.libre.sh
  • libre.sh/compose.libre.sh
  • ecobytes/compose.libre.sh
  • jordan.mitchell/compose.libre.sh
  • timothee/compose.libre.sh
5 results
Show changes
...@@ -26,11 +26,13 @@ LOG_LEVEL="${LOG_LEVEL:-6}" # 7 = debug -> 0 = emergency ...@@ -26,11 +26,13 @@ LOG_LEVEL="${LOG_LEVEL:-6}" # 7 = debug -> 0 = emergency
# opts & defaults from. The parsing is unforgiving so be precise in your syntax # opts & defaults from. The parsing is unforgiving so be precise in your syntax
read -r -d '' usage <<-'EOF' read -r -d '' usage <<-'EOF'
-u [arg] URL to process. Required. -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)
-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. -s Start the application right away.
-b Buys the associated domain name. -b Buys the associated domain name.
-i Configure OpenDKIM. -i Configure OpenDKIM.
-c Configures DNS on Namecheap. -c Configures DNS if possible.
-d Enables debug mode -d Enables debug mode
-h This page -h This page
EOF EOF
...@@ -103,10 +105,34 @@ function buy_domain_name () { ...@@ -103,10 +105,34 @@ function buy_domain_name () {
} }
function application () { 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
#Define the tag/branch
git clone ${git_url} -b ${arg_t} /data/domains/${arg_u}
cd /data/domains/${arg_u} cd /data/domains/${arg_u}
if [ -f ./scripts/install ]; then 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 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 "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." warning "To stop having this warning, please configure your libre.sh to be abble to create email accounts."
...@@ -117,14 +143,16 @@ function application () { ...@@ -117,14 +143,16 @@ function application () {
export MAIL_HOST="mail.indie.host" export MAIL_HOST="mail.indie.host"
export MAIL_PORT="587" export MAIL_PORT="587"
else else
export MAIL_PASS=`tr -dc A-Za-z0-9_ < /dev/urandom | head -c 20 | xargs` echo "using MAIL_DOMAIN from server env"
export MAIL_USER="noreply.${arg_u}@${MAIL_DOMAIN}" #export MAIL_PASS=`tr -dc A-Za-z0-9_ < /dev/urandom | head -c 20 | xargs`
/opt/bin/add_mailbox ${MAIL_USER} ${MAIL_PASS} #export MAIL_USER="noreply.${arg_u}@${MAIL_DOMAIN}"
#/opt/bin/add_mailbox ${MAIL_USER} ${MAIL_PASS}
fi fi
./scripts/install ./scripts/install
fi fi
} }
function start () { function start () {
systemctl start u@${arg_u} systemctl start u@${arg_u}
systemctl enable u@${arg_u} systemctl enable u@${arg_u}
...@@ -200,6 +228,8 @@ fi ...@@ -200,6 +228,8 @@ fi
[ -z "${arg_u}" ] && help "URL is required." [ -z "${arg_u}" ] && help "URL is required."
[ -z "${LOG_LEVEL}" ] && emergency "Cannot continue without LOG_LEVEL." [ -z "${LOG_LEVEL}" ] && emergency "Cannot continue without LOG_LEVEL."
# tags/branch for modules
[ -z "${arg_t}" ] && arg_t=master
### Runtime ### Runtime
......
#!/bin/bash
cd /data/domains
my_ip=`curl http://ipv4.icanhazip.com/`
echo "My IP is $my_ip"
for domain in `ls .`; do
domain_ip=`host ${domain} | awk '/has address/ { print $4 }'`
if [[ "${domain_ip}" != "${my_ip}" ]]; then
echo "$domain has this IP: $domain_ip"
fi
done