From a30904a1cbbace8a2a45414970f0395259eea6dc Mon Sep 17 00:00:00 2001 From: root Date: Mon, 8 Jan 2024 19:13:42 +0000 Subject: [PATCH] First round of bundles install --- bin/backuptool | 1 + bin/convertdomain | 1 + bin/install-federated | 15 ++++++++++++++- bin/start | 1 + bin/stop | 1 + lib/functions.sh | 6 ++++-- 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/bin/backuptool b/bin/backuptool index e3357ed..61ec41c 100755 --- a/bin/backuptool +++ b/bin/backuptool @@ -192,6 +192,7 @@ else failcheck "Could not find an /etc/federated file." fi +get_installedapps [ -f "/federated/bin/.b2init" ] && UUID=`cat /federated/bin/.b2init` [ $LIST_BACKUP ] && listbackup [ $RUN_DELETE ] && deletebackup diff --git a/bin/convertdomain b/bin/convertdomain index 8c94bab..652dd3b 100755 --- a/bin/convertdomain +++ b/bin/convertdomain @@ -1040,6 +1040,7 @@ LDAP_SECRET=`cat /federated/apps/ldap/.ldap.secret` echo -ne "\n\nConverting Federated Core $DOMAIN to $DOMAIN_NEW.\n\n" check_gluerecords +get_installedapps do_serviceprep # Stop all services diff --git a/bin/install-federated b/bin/install-federated index f8ac9bf..b200645 100755 --- a/bin/install-federated +++ b/bin/install-federated @@ -26,6 +26,7 @@ get_config() { [ -z "$DOMAIN" ] && failcheck "/etc/federated doesn't include DOMAIN" [ -z "$COMPANY" ] && failcheck "/etc/federated doesn't include COMPANY" [ -z "$COUNTRY" ] && failcheck "/etc/federated doesn't include COUNTRY" + [ -z "$BUNDLE" ] && failcheck "/etc/federated doesn't include BUNDLE" if ! printf '%s\0' "${COUNTRIES[@]}" | grep -Fxqz -- "$COUNTRY"; then failcheck "$COUNTRY is not a valid country code. Use US, GB, HK, etc" fi @@ -70,7 +71,19 @@ check_ports # Configure docker private network config_network -# Configure and start each federated service +case "$BUNDLE" in + starter) SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden") + team) SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden" "matrix" "element" "coturn" "wordpress" "freescout" "espocrm") + ultimate) SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover" "castopod" "wordpress" "coturn" "bookstack" "freescout" "msp" "espocrm") + *) SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover" "castopod" "wordpress" "coturn" "bookstack" "freescout" "msp" "espocrm") +esac + +# Get apps that need to be installed and create array for it +#IFS=$'\n' read -r -d '' -a CORE_APPS_LIST < <(awk -F',' '{ for( i=1; i<=NF; i++ ) print $i }' <<<"$CORE_APPS") +#IFS=$'\n' read -r -d '' -a EXTRA_APPS_LIST < <(awk -F',' '{ for( i=1; i<=NF; i++ ) print $i }' <<<"$EXTRA_APPS") +#SERVICES=("${CORE_APPS_LIST[@]}" "${EXTRA_APPS_LIST[@]}") + +# Configure and start each federated app for i in "${SERVICES[@]}"; do . /federated/lib/$i.sh config_$i diff --git a/bin/start b/bin/start index 57816f3..7330931 100755 --- a/bin/start +++ b/bin/start @@ -105,6 +105,7 @@ startservice_all() { done } +get_installedapps [ $# != 1 ] && usage SERVICE=$1 diff --git a/bin/stop b/bin/stop index 6eae973..ede8a9f 100755 --- a/bin/stop +++ b/bin/stop @@ -19,6 +19,7 @@ stopservice_all() { done } +get_installedapps [ $# != 1 ] && usage SERVICE=$1 diff --git a/lib/functions.sh b/lib/functions.sh index 7820cf0..5c53e13 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -1,8 +1,7 @@ # Federated Computer functions -# # Define all services -SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover" "castopod" "wordpress" "coturn" "bookstack" "freescout" "msp" "espocrm") +#SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover" "castopod" "wordpress" "coturn" "bookstack" "freescout" "msp" "espocrm") fail() { echo -ne "FAILED\n\n$1\n\n" @@ -848,3 +847,6 @@ check_memory() { exit 2; fi } +get_installedapps() { + SERVICES=( $(ls -d /federated/apps/* | awk -F/ '{ print $4 }') ) +}