diff --git a/fstack/lib/checks.sh b/fstack/lib/checks.sh index dea561e..db52a4b 100644 --- a/fstack/lib/checks.sh +++ b/fstack/lib/checks.sh @@ -59,7 +59,6 @@ check_ports() { # Check if ss command exists if command -v ss &> /dev/null; then # Check every port we need if it's in use -# for i in 8000; do for i in 25 53 80 143 389 587 993 8000; do SS=`ss -tulwn | grep LISTEN | awk '{ print $5 }' | awk -F: '{ print $NF }' | grep "^$i$" | head -1` # If port 53 (dns) in use by system-resolvd (Ubuntu) then auto fix diff --git a/fstack/lib/collabora.sh b/fstack/lib/collabora.sh index 5c7a258..c93cb93 100644 --- a/fstack/lib/collabora.sh +++ b/fstack/lib/collabora.sh @@ -12,6 +12,7 @@ config_collabora() { if [ ! -d "fstack/collabora" ]; then mkdir -p fstack/collabora/data/root/certs &> /dev/null cp -rf fstack/dns/data/etc/letsencrypt/archive/$DOMAIN/*.pem fstack/collabora/data/root/certs/ + chown 104 fstack/collabora/data/root/certs/* fi DOMAIN_ARRAY=(${DOMAIN//./ }) diff --git a/fstack/lib/dns.sh b/fstack/lib/dns.sh index c49ddba..8d65244 100644 --- a/fstack/lib/dns.sh +++ b/fstack/lib/dns.sh @@ -97,6 +97,10 @@ if [ ! -e /etc/bind/.firstdone ]; then touch /etc/bind/.firstdone wait -n elif [ -e /etc/bind/.firstdone ] && [ -e /etc/bind/.failedcert ]; then + # Install bind and certbot packages + apk add --no-cache bind + apk add --no-cache certbot + DOMAIN=`ls /etc/bind/zones | head -1` named -f -g & crond & diff --git a/fstack/lib/network.sh b/fstack/lib/network.sh index c86fb51..0e61511 100644 --- a/fstack/lib/network.sh +++ b/fstack/lib/network.sh @@ -8,8 +8,8 @@ config_network() { echo -ne "\n* Configuring federated network.." spin & SPINPID=$! - - docker network create --subnet 172.99.0.0/16 fstack &> /dev/null + + [ ! `docker network ls -q --filter name=fstack` ] && docker network create --subnet 172.99.0.0/16 fstack &> /dev/null [ $? -ne 0 ] && fail "Couldn't run docker network create" echo -ne "done." diff --git a/fstack/lib/nextcloud.sh b/fstack/lib/nextcloud.sh index c186391..eda14fe 100644 --- a/fstack/lib/nextcloud.sh +++ b/fstack/lib/nextcloud.sh @@ -197,7 +197,6 @@ chmod +x fstack/nextcloud/data/root/*.sh cat > fstack/nextcloud/data/etc/apache2/sites-enabled/000-default.conf <<'EOF' LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so -Listen 443 ServerAdmin admin@localhost @@ -260,7 +259,7 @@ start_nextcloud() { [ $? -ne 0 ] && fail "Couldn't chown nextcloud.sh in fstack/nextcloud container" # Run nextcloud.sh - Setup LDAP, configuration for nextcloud - docker exec -it -u 33 nextcloud /var/www/html/nextcloud.sh + docker exec -it -u 33 nextcloud /var/www/html/nextcloud.sh &> /dev/null [ $? -ne 0 ] && fail "Couldn't run nextcloud.sh inside fstack/nextcloud container" # Enable SSL module in fstack/nextcloud diff --git a/install-federated.sh b/install-federated.sh index 892c0a8..97bde84 100755 --- a/install-federated.sh +++ b/install-federated.sh @@ -75,40 +75,18 @@ get_config echo -ne "\n\nStarting Federated install for $DOMAIN\n" # Check that we have docker installed. Check that -# we have all ports available and ont in use +# we have all ports available and not in use check_docker check_ports # Configure docker private network config_network -# Configure fstack/dns container and start it -config_dns -start_dns - -# Configure fstack/ldap container and start it -config_ldap -start_ldap - -# Configure fstack/mail container and start it -config_mail -start_mail - -# Configure fstack/collabora container and start it -config_collabora -start_collabora - -# Configure fstack/nextcloud container and start it -config_nextcloud -start_nextcloud - -# Configure fstack/panel container and start it -config_panel -start_panel - -# Configure fstack/proxy container and start it -config_proxy -start_proxy +# Configure and start each federated service +for i in dns ldap mail collabora nextcloud panel proxy; do + config_$i + start_$i +done # Print out fstack environment details echo -ne "\n\nInstall completed successfully.\n\n" diff --git a/start.sh b/start.sh index 2322145..cc45bc1 100755 --- a/start.sh +++ b/start.sh @@ -3,7 +3,7 @@ # Federated Start Script usage() { - echo "$0: all|dns|ldap|mail|nextcloud|panel|proxy" + echo "$0: all|dns|ldap|mail|collabora|nextcloud|panel|proxy" exit 2 } startservice() { @@ -11,7 +11,7 @@ startservice() { docker-compose -f fstack/$SERVICE/docker-compose.yml -p $SERVICE up -d } startservice_all() { - for i in dns ldap mail nextcloud panel proxy; do + for i in dns ldap mail collabora nextcloud panel proxy; do echo "* Starting $i.." docker-compose -f fstack/$i/docker-compose.yml -p $i up -d done @@ -22,6 +22,6 @@ SERVICE=$1 case "$SERVICE" in all) startservice_all;; - dns|ldap|mail|nextcloud|panel|proxy) startservice;; + dns|ldap|mail|collabora|nextcloud|panel|proxy) startservice;; *) usage;; esac diff --git a/stop.sh b/stop.sh index b9c9c52..77d7031 100755 --- a/stop.sh +++ b/stop.sh @@ -3,7 +3,7 @@ # Federated Stop Script usage() { - echo "$0: all|dns|ldap|mail|nextcloud|panel|proxy" + echo "$0: all|dns|ldap|mail|collabora|nextcloud|panel|proxy" exit 2 } stopservice() { @@ -11,7 +11,7 @@ stopservice() { docker-compose -f fstack/$SERVICE/docker-compose.yml -p $SERVICE down } stopservice_all() { - for i in dns ldap mail nextcloud panel proxy; do + for i in dns ldap mail collabora nextcloud panel proxy; do echo "* Stopping $i.." docker-compose -f fstack/$i/docker-compose.yml -p $i down done @@ -22,6 +22,6 @@ SERVICE=$1 case "$SERVICE" in all) stopservice_all;; - dns|ldap|mail|nextcloud|panel|proxy) stopservice;; + dns|ldap|mail|collabora|nextcloud|panel|proxy) stopservice;; *) usage;; esac