From 46978df20572ba817d2f9da987fded192e5341e0 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 17 Jul 2024 14:37:10 +0000 Subject: [PATCH] Removed old files --- bin/install-federated.old | 116 --- bin/start.old | 123 ---- lib/baserow.sh.old | 104 --- lib/bookstack.old | 185 ----- lib/caddy.sh.old | 116 --- lib/collabora.sh.old | 78 -- lib/espocrm.sh.old | 207 ------ lib/freescout.sh.old | 188 ----- lib/functions.sh.old | 1429 ------------------------------------- lib/gitea.sh.old | 186 ----- lib/jitsi.sh.old | 622 ---------------- lib/listmonk.sh.old | 88 --- lib/msp.sh.old | 154 ---- lib/nextcloud.sh.old | 307 -------- lib/postgresql.sh.old | 114 --- lib/traefik.sh.old | 132 ---- lib/vaultwarden.sh.old | 72 -- lib/wireguard.sh.old | 99 --- 18 files changed, 4320 deletions(-) delete mode 100755 bin/install-federated.old delete mode 100755 bin/start.old delete mode 100644 lib/baserow.sh.old delete mode 100644 lib/bookstack.old delete mode 100644 lib/caddy.sh.old delete mode 100644 lib/collabora.sh.old delete mode 100644 lib/espocrm.sh.old delete mode 100644 lib/freescout.sh.old delete mode 100644 lib/functions.sh.old delete mode 100644 lib/gitea.sh.old delete mode 100644 lib/jitsi.sh.old delete mode 100644 lib/listmonk.sh.old delete mode 100644 lib/msp.sh.old delete mode 100644 lib/nextcloud.sh.old delete mode 100644 lib/postgresql.sh.old delete mode 100644 lib/traefik.sh.old delete mode 100644 lib/vaultwarden.sh.old delete mode 100644 lib/wireguard.sh.old diff --git a/bin/install-federated.old b/bin/install-federated.old deleted file mode 100755 index 6032127..0000000 --- a/bin/install-federated.old +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -x -# -# Federated installation script - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -. /federated/lib/functions.sh -. /federated/lib/network.sh -trap cleanup `seq 1 15` - -get_config() { -# FSTACKURL="http://137.184.95.3:8000" -# [ ! -d "/federated/lib" ] && mkdir -p /federated/lib - - # Download each library file -# for i in checks network dns ldap mail; do -# if [ ! -f "/federated/lib/$i.sh" ]; then -# curl $FSTACKURL/$i.sh -o /federated/lib/$i.sh -s -f &> /dev/null -# [ $? -ne 0 ] && failcheck "Couldn't download $i.sh" -# fi -# done - - COUNTRIES=("AF" "AL" "DZ" "AS" "AD" "AO" "AI" "AQ" "AG" "AR" "AM" "AW" "AU" "AT" "AZ" "BS" "BH" "BD" "BB" "BY" "BE" "BZ" "BJ" "BM" "BT" "BO" "BO" "BA" "BW" "BV" "BR" "IO" "BN" "BN" "BG" "BF" "BI" "KH" "CM" "CA" "CV" "KY" "CF" "TD" "CL" "CN" "CX" "CC" "CO" "KM" "CG" "CD" "CK" "CR" "CI" "CI" "HR" "CU" "CY" "CZ" "DK" "DJ" "DM" "DO" "EC" "EG" "SV" "GQ" "ER" "EE" "ET" "FK" "FO" "FJ" "FI" "FR" "GF" "PF" "TF" "GA" "GM" "GE" "DE" "GH" "GI" "GR" "GL" "GD" "GP" "GU" "GT" "GG" "GN" "GW" "GY" "HT" "HM" "VA" "HN" "HK" "HU" "IS" "IN" "ID" "IR" "IQ" "IE" "IM" "IL" "IT" "JM" "JP" "JE" "JO" "KZ" "KE" "KI" "KP" "KR" "KR" "KW" "KG" "LA" "LV" "LB" "LS" "LR" "LY" "LY" "LI" "LT" "LU" "MO" "MK" "MG" "MW" "MY" "MV" "ML" "MT" "MH" "MQ" "MR" "MU" "YT" "MX" "FM" "MD" "MC" "MN" "ME" "MS" "MA" "MZ" "MM" "MM" "NA" "NR" "NP" "NL" "AN" "NC" "NZ" "NI" "NE" "NG" "NU" "NF" "MP" "NO" "OM" "PK" "PW" "PS" "PA" "PG" "PY" "PE" "PH" "PN" "PL" "PT" "PR" "QA" "RE" "RO" "RU" "RU" "RW" "SH" "KN" "LC" "PM" "VC" "VC" "VC" "WS" "SM" "ST" "SA" "SN" "RS" "SC" "SL" "SG" "SK" "SI" "SB" "SO" "ZA" "GS" "SS" "ES" "LK" "SD" "SR" "SJ" "SZ" "SE" "CH" "SY" "TW" "TW" "TJ" "TZ" "TH" "TL" "TG" "TK" "TO" "TT" "TN" "TR" "TM" "TC" "TV" "UG" "UA" "AE" "GB" "US" "UM" "UY" "UZ" "VU" "VE" "VE" "VN" "VN" "VG" "VI" "WF" "EH" "YE" "ZM" "ZW") - - if [ -f "/etc/federated" ]; then - . /etc/federated - [ -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 - [ -z "$B2_APPLICATION_KEY_ID" ] && echo -ne "\nWarning: B2_APPLICATION_KEY_ID doesn't exist in /etc/federated\nBackups will be disabled" - [ -z "$B2_APPLICATION_KEY" ] && echo -ne "\nWarning: B2_APPLICATION_KEY doesn't exist in /etc/federated\nBackups will be disabled" - else - failcheck "/etc/federated doesn't exist" - fi - - # Setup DOMAIN variable for domain or subdomain - DOMAIN_ARRAY=(${DOMAIN//./ }) - if [ "${#DOMAIN_ARRAY[@]}" -eq "2" ]; then - DOMAIN_FIRST=${DOMAIN_ARRAY[0]} - DOMAIN_LAST=${DOMAIN_ARRAY[1]} - elif [ "${#DOMAIN_ARRAY[@]}" -eq "3" ]; then - DOMAIN_FIRST=${DOMAIN_ARRAY[0]} - DOMAIN_MIDDLE=${DOMAIN_ARRAY[1]} - DOMAIN_LAST=${DOMAIN_ARRAY[2]} - else - failcheck "$DOMAIN is not a valid domain.com or sub.domain.com" - fi -} - -while getopts d OPTION; do - case "$OPTION" in - d) DEBUG=ON;; - esac -done - -# Download lib scripts and take in setup variables -get_config - -echo -ne "\nStarting Federated install for $DOMAIN\n" - -# Check that we have docker installed. Check that -# we have all ports available and not in use -check_docker -check_os -#check_memory -check_ports - -# Configure docker private network -config_network - -# Setup SERVICES array to what bundle -if [ "$BUNDLE" = "starter" ]; then - SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden") -elif [ "$BUNDLE" = "team" ]; then - SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden" "matrix" "element" "coturn" "wordpress" "freescout" "espocrm") -elif [ "$BUNDLE" = "creator" ]; then - SERVICES=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden" "matrix" "element" "coturn" "wordpress") -elif [ "$BUNDLE" = "enterprise" ]; then - 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") -else - 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") -fi - -# 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 - start_$i -done - -# Add cron jobs for backup, upgrade, dumpcerts -add_cron - -# Print out federated environment details -echo -ne "\n\n" -if [ "$BUNDLE" = "starter" ]; then - print_details_starter -elif [ "$BUNDLE" = "team" ]; then - print_details_team -elif [ "$BUNDLE" = "creator" ]; then - print_details_creator -elif [ "$BUNDLE" = "enterprise" ]; then - print_details -else - print_details -fi -echo -ne "\n\n" -exit 0 diff --git a/bin/start.old b/bin/start.old deleted file mode 100755 index b987490..0000000 --- a/bin/start.old +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# -# Federated Start Script -. /federated/lib/functions.sh -. /etc/federated - -usage() { - printf -v SERVICES_JOINED '%s|' "${SERVICES[@]}" - echo "$0: ${SERVICES_JOINED%|}" - exit 2 -} -startservice_jitsi() { - if [ "$(docker container inspect -f '{{.State.Status}}' jitsi_web_1 2>/dev/null)" = "running" ]; then - echo -ne "* $SERVICE is already running.\n" - else - if [ -z "$ALERTS_EMAIL" ]; then - spin & - SPINPID=$! - - NC_COMMAND=`grep start_service /federated/lib/$SERVICE.sh | awk -F\" '{ print $4 }'` - RETRY=`grep start_service /federated/lib/jitsi.sh | awk -F\" '{ print $6 }'` - start_service_withalert "jitsi" "$NC_COMMAND" "$RETRY" "no" - - disown $SPINPID &> /dev/null - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" - else - spin & - SPINPID=$! - - NC_COMMAND=`grep start_service /federated/lib/$SERVICE.sh | awk -F\" '{ print $4 }'` - RETRY=`grep start_service /federated/lib/jitsi.sh | awk -F\" '{ print $6 }'` - start_service_withalert "$SERVICE" "$NC_COMMAND" "$RETRY" "yes" - - disown $SPINPID &> /dev/null - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" - fi - fi -} -startservice() { - if [ "$(docker container inspect -f '{{.State.Status}}' $SERVICE 2>/dev/null)" = "running" ]; then - echo -ne "* $SERVICE is already running.\n" - else - if [ -z "$ALERTS_EMAIL" ]; then - NC_COMMAND=`grep start_service /federated/lib/$SERVICE.sh | awk -F\" '{ print $4 }'` - RETRY=`grep start_service /federated/lib/$SERVICE.sh | awk -F\" '{ print $6 }'` - eval start_service_withalert "$SERVICE" "$NC_COMMAND" "$RETRY" "no" - - disown $SPINPID &> /dev/null - kill -9 $SPINPID &> /dev/null - echo -ne "done." - else - spin & - SPINPID=$! - - NC_COMMAND=`grep start_service /federated/lib/$SERVICE.sh | awk -F\" '{ print $4 }'` - RETRY=`grep start_service /federated/lib/$SERVICE.sh | awk -F\" '{ print $6 }'` - eval start_service_withalert "$SERVICE" "$NC_COMMAND" "$RETRY" "yes" - - disown $SPINPID &> /dev/null - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" - fi - fi -} -startservice_all() { - for SERVICE in "${SERVICES[@]}"; do - # If app isn't installed then skip - [ ! -d "/federated/apps/$SERVICE" ] && echo "* $SERVICE not installed, skipping." && continue - - FAILED="no" - if [ "$SERVICE" = "jitsi" ]; then - if [ "$(docker container inspect -f '{{.State.Status}}' jitsi_web_1 2>/dev/null)" = "running" ]; then - echo -ne "* $SERVICE is already running.\n" - else - startservice_jitsi - fi - else - if [ "$(docker container inspect -f '{{.State.Status}}' $SERVICE 2>/dev/null)" = "running" ]; then - echo -ne "* $SERVICE is already running.\n" - else - if [ -z "$ALERTS_EMAIL" ]; then - spin & - SPINPID=$! - - NC_COMMAND=`grep start_service /federated/lib/$SERVICE.sh | awk -F\" '{ print $4 }'` - RETRY=`grep start_service /federated/lib/$SERVICE.sh | awk -F\" '{ print $6 }'` - eval start_service_withalert "$SERVICE" "$NC_COMMAND" "$RETRY" "no" - - disown $SPINPID &> /dev/null - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" - else - spin & - SPINPID=$! - - NC_COMMAND=`grep start_service /federated/lib/$SERVICE.sh | awk -F\" '{ print $4 }'` - RETRY=`grep start_service /federated/lib/$SERVICE.sh | awk -F\" '{ print $6 }'` - eval start_service_withalert "$SERVICE" "$NC_COMMAND" "$RETRY" "yes" - - disown $SPINPID &> /dev/null - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" - fi - fi - fi - done -} - -#get_installedapps -[ $# != 1 ] && usage -SERVICE=$1 - -if [ "$SERVICE" = "jitsi" ]; then - startservice_jitsi -elif [ "$SERVICE" = "all" ]; then - startservice_all -elif printf '%s\0' "${SERVICES[@]}" | grep -Fxqz -- "$SERVICE"; then - startservice -else - usage -fi diff --git a/lib/baserow.sh.old b/lib/baserow.sh.old deleted file mode 100644 index a1ca44c..0000000 --- a/lib/baserow.sh.old +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash -# -# Baserow Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_baserow() { - echo -ne "\n* Configuring /federated/apps/baserow container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/baserow" ]; then - mkdir -p /federated/apps/baserow/data/baserow/data - fi - -cat > /federated/apps/baserow/docker-compose.yml < /federated/apps/baserow/.env < /federated/apps/baserow/data/baserow/data/.federated.postgresql.secret - -cat > /federated/apps/baserow/data/createuser.sh < /dev/null -EOF -chmod +x /federated/apps/baserow/data/createuser.sh - -kill -9 $SPINPID &> /dev/null -echo -ne "done." -} - -start_baserow() { - # Start service with command to make sure it's up before proceeding - start_service "baserow" "docker exec baserow curl http://localhost:8000 &> /dev/null" "20" - - # Move createuser.sh and set it executable - mv /federated/apps/baserow/data/createuser.sh /federated/apps/baserow/data/baserow/data/ - docker exec baserow chmod 755 /baserow/data/createuser.sh - [ $? -ne 0 ] && fail "Couldn't chown createuser.sh in /federated/apps/baserow container" - - # Run createuser.sh inside baserow container - docker exec baserow /baserow/data/createuser.sh - [ $? -ne 0 ] && fail "Couldn't run createuser.sh in /federated/apps/baserow container" - - # Disable new sign ups - docker exec postgresql psql -U baserow -c "update core_settings set allow_new_signups='f' where allow_new_signups='t';" - - # Remove baserow create user - rm /federated/apps/baserow/data/baserow/data/createuser.sh - - kill -9 $SPINPID &> /dev/null - echo -ne "done." -} diff --git a/lib/bookstack.old b/lib/bookstack.old deleted file mode 100644 index 7f2b817..0000000 --- a/lib/bookstack.old +++ /dev/null @@ -1,185 +0,0 @@ -#!/bin/bash -# -# Bookstack Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_bookstack() { - echo -ne "\n* Configuring bookstack container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/bookstack" ]; then - mkdir -p /federated/apps/bookstack/data/config - fi - -cat > /federated/apps/bookstack/docker-compose.yml < /federated/apps/bookstack/.env < /dev/null -docker exec pdnsmysql bash -c "mysql -uroot -p$MYSQL_ROOTPASSWORD -e \"CREATE USER 'bookstack'@'%' IDENTIFIED BY '$BOOKSTACK_SECRET';\"" &> /dev/null -docker exec pdnsmysql bash -c "mysql -uroot -p$MYSQL_ROOTPASSWORD -e \"grant all privileges on bookstack.* to 'bookstack'@'%';\"" &> /dev/null -docker exec pdnsmysql bash -c "mysql -uroot -p$MYSQL_ROOTPASSWORD -e 'flush privileges;'" &> /dev/null - -kill -9 $SPINPID &> /dev/null -echo -ne "done.\n" -} -start_bookstack() { - # Start service with command to make sure it's up before proceeding - start_service "bookstack" "nc -z 172.99.0.36 80 &> /dev/null" "7" - - docker exec pdns pdnsutil add-record $DOMAIN bookstack A 86400 $EXTERNALIP &> /dev/null - [ $? -ne 0 ] && fail "Couldn't add dns record for bookstack" - docker exec pdns pdnsutil add-record $DOMAIN documentation A 86400 $EXTERNALIP &> /dev/null - [ $? -ne 0 ] && fail "Couldn't add dns record for bookstack" - - PDNS_MYSQL_COMMAND="update users set password=\"$BOOKSTACK_ADMINPASSWORD\" where id = \"1\";" &> /dev/null - docker exec pdnsmysql bash -c "mysql -ubookstack -p$BOOKSTACK_SECRET bookstack -e '$PDNS_MYSQL_COMMAND;'" &> /dev/null - docker exec pdnsmysql bash -c "mysql -ubookstack -p$BOOKSTACK_SECRET bookstack -e \"update users set email='admin@$DOMAIN' where id = 1;\"" &> /dev/null - - # Set mail configuration - sed -i "s#MAIL_FROM=.*#MAIL_FROM=admin@$DOMAIN#g" /federated/apps/bookstack/data/config/www/.env - sed -i "s#MAIL_FROM_NAME=.*#MAIL_FROM_NAME=admin#g" /federated/apps/bookstack/data/config/www/.env - sed -i "s#MAIL_HOST=.*#MAIL_HOST=mail.$DOMAIN#g" /federated/apps/bookstack/data/config/www/.env - sed -i "s#MAIL_PORT=.*#MAIL_PORT=587#g" /federated/apps/bookstack/data/config/www/.env - sed -i "s#MAIL_USERNAME=.*#MAIL_USERNAME=admin#g" /federated/apps/bookstack/data/config/www/.env - sed -i "s#MAIL_PASSWORD=.*#MAIL_PASSWORD=$ADMINPASS#g" /federated/apps/bookstack/data/config/www/.env - sed -i "s#MAIL_ENCRYPTION=.*#MAIL_ENCRYPTION=TLS#g" /federated/apps/bookstack/data/config/www/.env - - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" -} -email_bookstack() { - echo -ne "* Sending email to customer.." - spin & - SPINPID=$! - -cat > /federated/apps/mail/data/root/certs/mailfile < -
-

-

Bookstack is now installed on $DOMAIN

-

-Here is your applications chart on how to access this service:
-

-

Applications

- - -------- - - - - - - - - - - - - - - - - - - - - -
ServiceLinkUser / PassAccessDocsDescription
Bookstackbookstack.$DOMAINadmin@$DOMAIN
$ADMINPASS
User access is separate from panelClick hereBookstack is a simple, open-source, self-hosted, easy-to-use platform (Wiki) for organising and storing information
-

Thanks for your support!

-

-Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful -time with Federated Core. -

-Again, if we can be of any assistance, please don't hesitate to get in touch. -

-Support: https://support.federated.computer
-Phone: (970) 722-8715
-Email: support@federated.computer
-

-It's your computer. Let's make it work for you! - -EOF - - # Send out e-mail from mail container with details - docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Application installed on $DOMAIN\" $EMAIL < /root/certs/mailfile" - rm /federated/apps/mail/data/root/certs/mailfile - - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" -} diff --git a/lib/caddy.sh.old b/lib/caddy.sh.old deleted file mode 100644 index ab7b951..0000000 --- a/lib/caddy.sh.old +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# -# Caddy Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_caddy() { - echo -ne "\n* Configuring /federated/apps/caddy container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/caddy" ]; then - mkdir -p /federated/apps/caddy/data/data - mkdir -p /federated/apps/caddy/data/srv - mkdir -p /federated/apps/caddy/data/etc/caddy - fi - -cat > /federated/apps/caddy/docker-compose.yml < /federated/apps/caddy/.env < /federated/apps/caddy/data/etc/caddy/Caddyfile < /dev/null -echo -ne "done." -} -start_caddy() { - # Start service with command and retry amount to make sure it's up before proceeding - start_service "caddy" "nc -z 172.99.0.31 80 &> /dev/null" "7" - - kill -9 $SPINPID &> /dev/null - echo -ne "done." -} diff --git a/lib/collabora.sh.old b/lib/collabora.sh.old deleted file mode 100644 index 5cf5d81..0000000 --- a/lib/collabora.sh.old +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# Collabora Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_collabora() { - echo -ne "\n* Configuring /federated/apps/collabora container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/collabora" ]; then - mkdir -p /federated/apps/collabora/data/root/certs &> /dev/null - mkdir -p /federated/apps/collabora/data/opt/collaboraoffice/share/fonts/truetype &> /dev/null - cp /federated/certs/certs/$DOMAIN.crt /federated/certs/private/$DOMAIN.key /federated/apps/collabora/data/root/certs/ - chown 104 /federated/apps/collabora/data/root/certs/* - fi - -cat > /federated/apps/collabora/docker-compose.yml < /federated/apps/collabora/.env < /dev/null -echo -ne "done." -} -start_collabora() { - # Start service with command to make sure it's up before proceeding - start_service "collabora" "nc -z 172.99.0.17 9980 &> /dev/null" "15" - - kill -9 $SPINPID &> /dev/null - echo -ne "done." -} diff --git a/lib/espocrm.sh.old b/lib/espocrm.sh.old deleted file mode 100644 index b08e1c9..0000000 --- a/lib/espocrm.sh.old +++ /dev/null @@ -1,207 +0,0 @@ -#!/bin/bash -# -# EspoCRM Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_espocrm() { - echo -ne "\n* Configuring espocrm container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/espocrm" ]; then - mkdir -p /federated/apps/espocrm/data/var/www/html - fi - -cat > /federated/apps/espocrm/docker-compose.yml < /federated/apps/espocrm/.env < /dev/null -echo -ne "done.\n" -} -start_espocrm() { - # Start service with command to make sure it's up before proceeding - start_service "espocrm" "nc -z 172.99.0.39 80 &> /dev/null" "7" - - docker exec pdns pdnsutil add-record $DOMAIN espocrm A 86400 $EXTERNALIP &> /dev/null - [ $? -ne 0 ] && fail "Couldn't add dns record for espocrm" - - # Install cronjob - (crontab -l 2>/dev/null; echo "* * * * * /usr/bin/docker exec espocrm /usr/local/bin/php -f /var/www/html/cron.php > /dev/null 2>&1") | sort -u | crontab - - - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" -} -email_espocrm() { - echo -ne "* Sending email to customer.." - spin & - SPINPID=$! - -cat > /federated/apps/mail/data/root/certs/mailfile < -
-

-

EspoCRM is now installed on $DOMAIN

-

-Here is your applications chart on how to access this service:
-

-

Applications

- - -------- - - - - - - - - - - - - - - - - - - - - -
ServiceLinkUser / PassAccessDocsDescription
EspoCRMespocrm.$DOMAINadmin@$DOMAIN
your admin password
All users in panel can access EspoCRM using user@$DOMAINClick hereEspoCRM is an Open Source CRM (Customer Relationship Management) software that allows you to see, enter and evaluate all your company relationships
-

Thanks for your support!

-

-Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful -time with Federated Core. -

-Again, if we can be of any assistance, please don't hesitate to get in touch. -

-Support: https://support.federated.computer
-Phone: (970) 722-8715
-Email: support@federated.computer
-

-It's your computer. Let's make it work for you! - -EOF - - # Send out e-mail from mail container with details - docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Application installed on $DOMAIN\" $EMAIL < /root/certs/mailfile" - rm /federated/apps/mail/data/root/certs/mailfile - - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" -} -uninstall_espocrm() { - echo -ne "* Uninstalling espocrm container.." - spin & - SPINPID=$! - - # First stop the service - cd /federated/apps/espocrm && docker-compose -f docker-compose.yml -p espocrm down &> /dev/null - - # Delete database and user - docker exec pdnsmysql bash -c "mysql -uroot -p$MYSQL_ROOTPASSWORD -e 'drop database espocrm;'" &> /dev/null - docker exec pdnsmysql bash -c "mysql -uroot -p$MYSQL_ROOTPASSWORD -e 'drop user espocrm;'" &> /dev/null - - # Delete the app directory - rm -rf /federated/apps/espocrm - - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" -} diff --git a/lib/freescout.sh.old b/lib/freescout.sh.old deleted file mode 100644 index d8c15de..0000000 --- a/lib/freescout.sh.old +++ /dev/null @@ -1,188 +0,0 @@ -#!/bin/bash -# -# Freescout Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_freescout() { - echo -ne "\n* Configuring freescout container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/freescout" ]; then - mkdir -p /federated/apps/freescout/data/data - mkdir -p /federated/apps/freescout/data/www/logs - fi - -cat > /federated/apps/freescout/docker-compose.yml < /federated/apps/freescout/.env < /dev/null -docker exec postgresql psql -U postgres -c "CREATE DATABASE freescout" &> /dev/null -docker exec postgresql psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE freescout TO freescout" &> /dev/null - -kill -9 $SPINPID &> /dev/null -echo -ne "done.\n" -} -start_freescout() { - # Start service with command to make sure it's up before proceeding - start_service "freescout" "nc -z 172.99.0.37 80 &> /dev/null" "7" - - docker exec pdns pdnsutil add-record $DOMAIN freescout A 86400 $EXTERNALIP &> /dev/null - [ $? -ne 0 ] && fail "Couldn't add dns record for freescout" - - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" -} -email_freescout() { - echo -ne "* Sending email to customer.." - spin & - SPINPID=$! - -cat > /federated/apps/mail/data/root/certs/mailfile < -
-

-

Freescout is now installed on $DOMAIN

-

-Here is your applications chart on how to access this service:
-

-

Applications

- - -------- - - - - - - - - - - - - - - - - - - - - -
ServiceLinkUser / PassAccessDocsDescription
Freescoutfreescout.$DOMAINadmin@$DOMAIN
$ADMINPASS
User access is separate from panelClick hereFreeScout is the super lightweight and powerful free open source help desk
-

Thanks for your support!

-

-Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful -time with Federated Core. -

-Again, if we can be of any assistance, please don't hesitate to get in touch. -

-Support: https://support.federated.computer
-Phone: (970) 722-8715
-Email: support@federated.computer
-

-It's your computer. Let's make it work for you! - -EOF - - # Send out e-mail from mail container with details - docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Application installed on $DOMAIN\" $EMAIL < /root/certs/mailfile" - rm /federated/apps/mail/data/root/certs/mailfile - - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" -} -uninstall_freescout() { - echo -ne "* Uninstalling freescout container.." - spin & - SPINPID=$! - - # First stop the service - cd /federated/apps/freescout && docker-compose -f docker-compose.yml -p freescout down &> /dev/null - - # Delete database and user in postgresql - docker exec postgresql psql -U postgres -c "DROP DATABASE freescout" &> /dev/null - docker exec postgresql psql -U postgres -c "DROP USER freescout" &> /dev/null - - # Delete the app directory - rm -rf /federated/apps/freescout - - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" -} diff --git a/lib/functions.sh.old b/lib/functions.sh.old deleted file mode 100644 index a43c2fa..0000000 --- a/lib/functions.sh.old +++ /dev/null @@ -1,1429 +0,0 @@ -# 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" "nginx" "matrixslack" "matrixsignal" "matrixwhatsapp") - -fail() { - echo -ne "FAILED\n\n$1\n\n" - kill -9 $SPINPID &> /dev/null - # [ -d "apps/dns" ] && rm -rf apps/dns - # docker network rm fstack &> /dev/null - exit 2; -} -failcheck() { - echo -ne "\n\nFAILED - $1\n\n" - exit 2; -} -cleanup() { - kill -9 $SPINPID &> /dev/null - exit 2; -} -spin() { - spinner="/|\\-/|\\-" - while : - do - for i in `seq 0 7` - do - echo -n "${spinner:$i:1}" - echo -en "\010" - sleep 1 - done - done -} -send_alert_backups() { - EXTERNALIP=`dig @resolver4.opendns.com myip.opendns.com +short 2> /dev/null` - echo "Generated by /federated/bin/backuptool" > /federated/apps/mail/data/root/certs/mailfile - docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"backuptool failed to run on $EXTERNALIP - low disk\" $ALERTS_EMAIL < /root/certs/mailfile" -} -add_cron() { -cat > /etc/logrotate.d/federated </dev/null; echo "30 22 * * * date >> /federated/logs/backup.log && /federated/bin/backuptool -b all >> /federated/logs/backup.log 2>&1") | sort -u | crontab - - (crontab -l 2>/dev/null; echo "0 2 * * * date >> /federated/logs/upgrade.log && /federated/bin/upgrade >> /federated/logs/upgrade.log 2>&1") | sort -u | crontab - - (crontab -l 2>/dev/null; echo "0 3 * * * date >> /federated/logs/dumpcerts.log && /federated/bin/dumpcerts >> /federated/logs/dumpcerts.log 2>&1") | sort -u | crontab - - (crontab -l 2>/dev/null; echo "*/5 * * * * /usr/bin/docker exec -u 33 nextcloud php -f /var/www/html/cron.php") | sort -u | crontab - -} -install_federated() { - # Check if Federated is already installed then install - [ -d "/federated" ] && fail "Directory /federated already exists. Already installed?" - API_TOKEN="6f3d11bee38b636e593aba295d661b9908b42134" - git clone https://installcore:$API_TOKEN@code.federated.company/federatedcomputer/Core /federated -} -upgrade_federated() { - echo -ne "\n* Updating federated install.." - [ ! -d "/federated" ] && fail "Directory /federated doesn't exist." - - echo -ne "\n* Grabbing the latest version from Gitea.." - - API_TOKEN="6f3d11bee38b636e593aba295d661b9908b42134" - cd /federated && git pull https://installcore:$API_TOKEN@code.federated.company/federatedcomputer/Core - [ $? -ne 0 ] && fail "Git pull not working on update of federated." - - echo -ne "\n* Checking installed app versions with the latest.." - - [ ! -f "/federated/lib/latest-versions" ] && fail "File /federated/lib/latest-version doesn't exist." - for i in `cat /federated/lib/latest-versions`; do - SERVICE=(${i//=/ }); - APP="${SERVICE[0]}" - VERSION="${SERVICE[1]}" - echo -ne "\n** Checking $APP.." - - if [ -f "/federated/apps/$APP/.env" ]; then - APP_VERSION_RAW=`grep IMAGE_VERSION /federated/apps/$APP/.env | awk -F= '{ print $2 }'` - APP_VERSION="${APP_VERSION_RAW//\"}" - - if [ "$APP_VERSION" = "$VERSION" ]; then - echo -ne "\n $APP is already at the latest version." - else - NC_COMMAND=`grep start_service /federated/lib/$APP.sh | awk -F\" '{ print $4 }'` - echo -ne "\n Upgrading $APP to $VERSION.." - echo -ne "\n Shutting Down $APP.." - cd /federated/apps/$APP && docker-compose -f docker-compose.yml -p $APP down - if [ "$APP" = "jitsi" ]; then - sed -i "s/#JITSI_IMAGE_VERSION=.*/JITSI_IMAGE_VERSION=$VERSION/g" /federated/apps/$APP/.env - sed -i "s/JITSI_IMAGE_VERSION=.*/JITSI_IMAGE_VERSION=$VERSION/g" /federated/apps/$APP/.env - else - sed -i "s#VERSION=.*#VERSION=$VERSION#g" /federated/apps/$APP/.env - fi - echo -ne "\n Starting Up $APP.." - /federated/bin/start $APP - echo -ne "\n Done Updating $APP to $VERSION." - fi - else - echo -ne "not found." - fi - done - echo -ne "\n" - - echo -ne "\n* Getting upgrade script from Upgrades repo.." - curl -s -f https://$API_TOKEN@code.federated.company/federatedcomputer/Upgrades/raw/branch/master/upgrade.sh > /tmp/upgrade.sh - if [ $? -ne 0 ]; then - echo "not found." - else - echo -ne "\n* Found. Running /tmp/upgrade.sh..\n\n" - chmod +x /tmp/upgrade.sh - bash -c /tmp/upgrade.sh - if [ $? -ne 0 ]; then - rm /tmp/upgrade.sh - fail "There was an error running /tmp/upgrade.sh" - else - echo -ne "\nDone.\n" - fi - fi -} -create_password() { -# eval $1_var=$1 -# echo "$postgres_var" - SECRET=`tr -cd '[:alnum:]' < /dev/urandom | fold -w32 | head -n1` - echo "$SECRET"; -} -get_externalip() { - EXTERNALIP=`dig @resolver4.opendns.com myip.opendns.com +short 2> /dev/null` - echo "$EXTERNALIP"; -} -start_service_convert() { - SERVICE="$1" - COMMAND="$2" - - # Start /federated/apps/SERVICE with output to /dev/null - echo -ne "\n* Starting /federated/apps/$SERVICE service.." - - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up -d &> /dev/null - - # Keep trying service port to make sure it's up before - # we proceed - RETRY="40" - while [ $RETRY -gt 0 ]; do - bash -c "$COMMAND" &> /dev/null - if [ $? -eq 0 ]; then - break - else - if [ "$RETRY" == 1 ]; then - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE down &> /dev/null - fail "There was a problem starting service /federated/apps/$SERVICE\nCheck the output of 'docker logs $SERVICE' or turn on\ndebug with -d" - fi - ((RETRY--)) - sleep 7 - fi - done -} -start_service_upgrade() { - SERVICE="$1" - COMMAND="$2" - - # Start /federated/apps/SERVICE with output to /dev/null - echo -ne "\n* Starting /federated/apps/$SERVICE service.." - - if [ $DEBUG ]; then - # Start /federated/apps/SERVICE with output to console for debug - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up - [ $? -eq 0 ] && echo -ne "done.\n" || fail "There was a problem starting service /federated/apps/$SERVICE" - else - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up -d &> /dev/null - - # Keep trying service port to make sure it's up before - # we proceed - RETRY="30" - while [ $RETRY -gt 0 ]; do - bash -c "$COMMAND" &> /dev/null - if [ $? -eq 0 ]; then - break - else - if [ "$RETRY" == 1 ]; then - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE down &> /dev/null - fail "There was a problem starting service /federated/apps/$SERVICE\nCheck the output of 'docker logs $SERVICE' or turn on\ndebug with -d" - fi - ((RETRY--)) - sleep 7 - fi - done - fi -} -start_service_withalert() { - SERVICE="$1" - COMMAND="$2" - RETRY="$3" - ALERT="$4" - - echo -ne "* Starting $SERVICE.." - - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up -d &> /dev/null - - # Keep trying service port to make sure it's up before - # we proceed - while [ $RETRY -gt 0 ]; do - bash -c "eval $COMMAND" &> /dev/null - if [ $? -eq 0 ]; then - break - else - if [ "$RETRY" == 1 ]; then - disown $SPINPID &> /dev/null - kill -9 $SPINPID &> /dev/null - FAILED="yes" - - if [ "$ALERT" = "yes" ]; then - EXTERNALIP=`dig @resolver4.opendns.com myip.opendns.com +short 2> /dev/null` - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE down &> /dev/null - echo "Generated by /federated/bin/start" > /federated/apps/mail/data/root/certs/mailfile - docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"$SERVICE failed to start on $EXTERNALIP\" $ALERTS_EMAIL < /root/certs/mailfile" - echo -ne "\n\nThere was a problem starting service /federated/apps/$SERVICE\nCheck the output of 'docker logs $SERVICE' or turn on\ndebug with set -x\n\n" - else - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE down &> /dev/null - echo -ne "\n\nThere was a problem starting service /federated/apps/$SERVICE\nCheck the output of 'docker logs $SERVICE' or turn on\ndebug with set -x\n\n" - fi - fi - ((RETRY--)) - sleep 7 - fi - done -} -start_service() { - SERVICE="$1" - COMMAND="$2" - RETRY="$3" - - # Start /federated/apps/SERVICE with output to /dev/null - echo -ne "* Starting $SERVICE.." - spin & - SPINPID=$! - - if [ $DEBUG ]; then - # Start /federated/apps/SERVICE with output to console for debug - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up - [ $? -eq 0 ] && echo -ne "done.\n" || fail "There was a problem starting service /federated/apps/$SERVICE" - else - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up -d &> /dev/null - - # Keep trying service port to make sure it's up before - # we proceed - while [ $RETRY -gt 0 ]; do - bash -c "$COMMAND" &> /dev/null - if [ $? -eq 0 ]; then - break - else - if [ "$RETRY" == 1 ]; then - docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE down &> /dev/null - kill -9 $SPINPID &> /dev/null - fail "There was a problem starting service /federated/apps/$SERVICE\nCheck the output of 'docker logs $SERVICE' or turn on\ndebug with set -x" - fi - ((RETRY--)) - sleep 7 - fi - done - fi -} -print_details_migrated() { -cat > /federated/apps/mail/data/root/certs/mailfile < -
-

-

You are now migrated to $DOMAIN

-

-Credentials will be the same as the admin user and listmonk user in the original welcome e-mail.
-Here is your applications reference chart with $DOMAIN: -

-

Applications

- - -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ServiceLinkUser / PassAccessDocsDescription
Panelpanel.$DOMAINadmin@$DOMAIN
admin password above
All users added in panel can access panel with their own user@$DOMAINClick hereUse panel to create user accounts for your team and change passwords
Emailnextcloud.$DOMAIN
WebMail application
admin@$DOMAIN
admin password above
All users added in panel can access their own mail accounts through Nextcloud or mail client using user@$DOMAINClick hereThis is your own private e-mail service accessed through Nextcloud webmail or configure a mail client with SMTP mail.$DOMAIN (port 465), and IMAP mail.$DOMAIN (port 993)
Nextcloudnextcloud.$DOMAINadmin@$DOMAIN
admin password above
All users added in panel can access Nextcloud / Email with their own user@$DOMAIN accountClick hereThe Nextcloud Suite replaces google workspace which provides mail, calendar, contacts, notes, tasks, files, word processing, spreadsheets, project management, slides, and pictures
Jitsijitsi.$DOMAINadmin
admin password above
All users added in panel can access Jitsi with their own user account using 'username'Click hereJitsi is a zoom replacement video conferencing solution
Elementelement.$DOMAINadmin@$DOMAIN
admin password above
All users added in panel can access element / matrix with their own user@$DOMAIN accountClick hereElement (a Slack replacement) provides you the ability to chat with those on your team and outside of your team
Listmonklistmonk.$DOMAINlistmonk
listmonk password above
User access is separate from panel. There is only the listmonk userClick hereListmonk is (a replacement for Mailchimp) is used to create e-mail subscription lists
Baserowbaserow.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panel. Use the admin account to login and then invite other usersClick hereBaserow (Air table replacement) allows you to create and customize databases without writing any code
Vaultwardenvaultwarden.$DOMAINCreate your own userUser access is separate from panel. Create your own initial userClick hereVaultwarden is a password manager
Giteagitea.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereGitea is a code repository system similar to GitHub
PowerDNSpowerdns.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick herePowerDNS is a powerful tool for managing DNS of your domain
Castopodcastopod.$DOMAIN/cp-auth/loginadmin@$DOMAIN
admin password above
User access is separate from panelClick hereCastopod is a full platform for hosting and delivering podcasts to your audience
Wordpresswww.$DOMAIN/loginadmin@$DOMAIN
admin password above
User access is separate from panelClick hereWordpress is a dynamic content management solution used by 10s of millions of websites around the globe
Autodiscoveryautodiscover.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereAuto discovery is a service to provide automatic mail configurations for mail clients
Bookstackbookstack.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereBookstack is a simple, open-source, self-hosted, easy-to-use platform (Wiki) for organising and storing information
Freescoutfreescout.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereFreeScout is the super lightweight and powerful free open source help desk
Music Side Projectmsp.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereMusic Side Project Studio enables you to harness the potential of RSS feeds and the Lightning Network, allowing you to self-host your music and receive direct payment from your fans
EspoCRMespocrm.$DOMAINadmin@$DOMAIN
admin password above
All users in panel can access EspoCRM using user@domain.comClick hereEspoCRM is an Open Source CRM (Customer Relationship Management) software that allows you to see, enter and evaluate all your company relationships
-

Thanks for your support!

-

-Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful -time with Federated Core. -

-Again, if we can be of any assistance, please don't hesitate to get in touch. -

-Support: https://support.federated.computer
-Phone: (970) 722-8715
-Email: support@federated.computer
-

-It's your computer. Let's make it work for you! - -EOF - -# Send out e-mail from mail container with details -#docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Migrated To $DOMAIN\" admin@$DOMAIN < /root/certs/mailfile" -#docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Migrated To $DOMAIN\" $EMAIL < /root/certs/mailfile" -#cat /federated/apps/mail/data/root/certs/mailfile -#rm /federated/apps/mail/data/root/certs/mailfile -} -print_details_creator() { -cat > /federated/apps/mail/data/root/certs/mailfile < -
-Dear Federated Customer, -

-Please read this note in its entirety since it has some important information for you to get the best use -out of your Federated Core. If you ever get stuck for whatever reason, please reach out to us for support: -

-Website: https://support.federated.computer
-Phone: 970-722-8715
-Email: support@federated.computer
-

-We are here to help you, the Customer, get the most out of your Federated Core. -

-All documentation for your Federated Core can be found at https://documentation.federated.computer. -There you'll find tips for how to use your Core and the various open source applications bundled with -your Core. -

-

Domain Information

-This is your domain: $DOMAIN -

-If you just signed up for Federated Core, your domain is a temporary domain (example: starts with F...). Please do not change the admin password (see below) until you switch to your own domain name (example: mustache.com). We use the admin account and password for your temporary domain to re-configure all the software for your new/permanent domain. If you have a question about this, send us an email to support@federated.computer. -

-When you are ready to switch over to your own yourdomain.com send us an e-mail at support@federated.computer and let us know you are done migrating your data, have pointed DNS correctly, and ready for us to switch. We also need to know the yourdomain.com you will be using. -

-For setting DNS records you will need to set your glue records for your own yourdomain.com to be: -

-ns1.yourdomain.com - $EXTERNALIP
-ns2.yourdomain.com - $EXTERNALIP
-

-And your authoritative: -

-ns1.yourdomain.com
-ns2.yourdomain.com
-

-If you have questions about DNS records, please send us an email at support@federated.computer so that we can help you. -

-

Admin User

-

-There is an "admin" or administrative use that has access to everything on your Federated Core. -Here are the credentials for that user. -

-Username = "admin@$DOMAIN"
-Password = "$ADMINPASS" -

-

Applications

- - -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ServiceLinkUser / PassAccessDocsDescription
Panelpanel.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereUse panel to create user accounts for your team and change passwords
Emailnextcloud.$DOMAIN
WebMail application
admin@$DOMAIN
admin password above
All users in panel can access their own mail accounts through Nextcloud or mail client using user@$DOMAINClick hereThis is your own private e-mail service accessed through Nextcloud webmail or configure a mail client with SMTP mail.$DOMAIN (port 465), and IMAP mail.$DOMAIN (port 993)
Nextcloudnextcloud.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereThe Nextcloud Suite replaces google workspace which provides mail, calendar, contacts, notes, tasks, files, word processing, spreadsheets, project management, slides, and pictures
Autodiscoveryautodiscover.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereAuto discovery is a service to provide automatic mail configurations for mail clients
Vaultwardenvaultwarden.$DOMAINCreate your own userUser access is separate from panel. Create your own initial userClick hereVaultwarden is a password manager
PowerDNSpowerdns.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick herePowerDNS is a powerful tool for managing DNS of your domain
Elementelement.$DOMAINadmin@$DOMAIN
admin password above
All users added in panel can access element / matrix with their own user@$DOMAIN accountClick hereElement (a Slack replacement) provides you the ability to chat with those on your team and outside of your team
Wordpresswww.$DOMAIN/loginadmin@$DOMAIN
admin password above
User access is separate from panelClick hereWordpress is a dynamic content management solution used by 10s of millions of websites around the globe
-
-

Thanks for your support!

-

-Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful -time with Federated Core. -

-Again, if we can be of any assistance, please don't hesitate to get in touch. -

-Support: https://support.federated.computer
-Phone: (970) 722-8715
-Email: support@federated.computer
-

-It's your computer. Let's make it work for you! - -EOF - -# Send out e-mail from mail container with details -#docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Welcome to Federated\" admin@$DOMAIN < /root/certs/mailfile" -#docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Welcome to Federated\" $EMAIL < /root/certs/mailfile" -#cat /federated/apps/mail/data/root/certs/mailfile -#rm /federated/apps/mail/data/root/certs/mailfile -} -print_details_team() { -cat > /federated/apps/mail/data/root/certs/mailfile < -
-Dear Federated Customer, -

-Please read this note in its entirety since it has some important information for you to get the best use -out of your Federated Core. If you ever get stuck for whatever reason, please reach out to us for support: -

-Website: https://support.federated.computer
-Phone: 970-722-8715
-Email: support@federated.computer
-

-We are here to help you, the Customer, get the most out of your Federated Core. -

-All documentation for your Federated Core can be found at https://documentation.federated.computer. -There you'll find tips for how to use your Core and the various open source applications bundled with -your Core. -

-

Domain Information

-This is your domain: $DOMAIN -

-If you just signed up for Federated Core, your domain is a temporary domain (example: starts with F...). Please do not change the admin password (see below) until you switch to your own domain name (example: mustache.com). We use the admin account and password for your temporary domain to re-configure all the software for your new/permanent domain. If you have a question about this, send us an email to support@federated.computer. -

-When you are ready to switch over to your own yourdomain.com send us an e-mail at support@federated.computer and let us know you are done migrating your data, have pointed DNS correctly, and ready for us to switch. We also need to know the yourdomain.com you will be using. -

-For setting DNS records you will need to set your glue records for your own yourdomain.com to be: -

-ns1.yourdomain.com - $EXTERNALIP
-ns2.yourdomain.com - $EXTERNALIP
-

-And your authoritative: -

-ns1.yourdomain.com
-ns2.yourdomain.com
-

-If you have questions about DNS records, please send us an email at support@federated.computer so that we can help you. -

-

Admin User

-

-There is an "admin" or administrative use that has access to everything on your Federated Core. -Here are the credentials for that user. -

-Username = "admin@$DOMAIN"
-Password = "$ADMINPASS" -

-

Applications

- - -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ServiceLinkUser / PassAccessDocsDescription
Panelpanel.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereUse panel to create user accounts for your team and change passwords
Emailnextcloud.$DOMAIN
WebMail application
admin@$DOMAIN
admin password above
All users in panel can access their own mail accounts through Nextcloud or mail client using user@$DOMAINClick hereThis is your own private e-mail service accessed through Nextcloud webmail or configure a mail client with SMTP mail.$DOMAIN (port 465), and IMAP mail.$DOMAIN (port 993)
Nextcloudnextcloud.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereThe Nextcloud Suite replaces google workspace which provides mail, calendar, contacts, notes, tasks, files, word processing, spreadsheets, project management, slides, and pictures
Autodiscoveryautodiscover.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereAuto discovery is a service to provide automatic mail configurations for mail clients
Vaultwardenvaultwarden.$DOMAINCreate your own userUser access is separate from panel. Create your own initial userClick hereVaultwarden is a password manager
PowerDNSpowerdns.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick herePowerDNS is a powerful tool for managing DNS of your domain
Elementelement.$DOMAINadmin@$DOMAIN
admin password above
All users added in panel can access element / matrix with their own user@$DOMAIN accountClick hereElement (a Slack replacement) provides you the ability to chat with those on your team and outside of your team
Wordpresswww.$DOMAIN/loginadmin@$DOMAIN
admin password above
User access is separate from panelClick hereWordpress is a dynamic content management solution used by 10s of millions of websites around the globe
Freescoutfreescout.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereFreeScout is the super lightweight and powerful free open source help desk
EspoCRMespocrm.$DOMAINadmin@$DOMAIN
admin password above
All users in panel can access EspoCRM using user@$DOMAINClick hereEspoCRM is an Open Source CRM (Customer Relationship Management) software that allows you to see, enter and evaluate all your company relationships
-
-

Thanks for your support!

-

-Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful -time with Federated Core. -

-Again, if we can be of any assistance, please don't hesitate to get in touch. -

-Support: https://support.federated.computer
-Phone: (970) 722-8715
-Email: support@federated.computer
-

-It's your computer. Let's make it work for you! - -EOF - -# Send out e-mail from mail container with details -#docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Welcome to Federated\" admin@$DOMAIN < /root/certs/mailfile" -#docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Welcome to Federated\" $EMAIL < /root/certs/mailfile" -#cat /federated/apps/mail/data/root/certs/mailfile -#rm /federated/apps/mail/data/root/certs/mailfile -} -print_details_starter() { -cat > /federated/apps/mail/data/root/certs/mailfile < -
-Dear Federated Customer, -

-Please read this note in its entirety since it has some important information for you to get the best use -out of your Federated Core. If you ever get stuck for whatever reason, please reach out to us for support: -

-Website: https://support.federated.computer
-Phone: 970-722-8715
-Email: support@federated.computer
-

-We are here to help you, the Customer, get the most out of your Federated Core. -

-All documentation for your Federated Core can be found at https://documentation.federated.computer. -There you'll find tips for how to use your Core and the various open source applications bundled with -your Core. -

-

Domain Information

-This is your domain: $DOMAIN -

-If you just signed up for Federated Core, your domain is a temporary domain (example: starts with F...). Please do not change the admin password (see below) until you switch to your own domain name (example: mustache.com). We use the admin account and password for your temporary domain to re-configure all the software for your new/permanent domain. If you have a question about this, send us an email to support@federated.computer. -

-When you are ready to switch over to your own yourdomain.com send us an e-mail at support@federated.computer and let us know you are done migrating your data, have pointed DNS correctly, and ready for us to switch. We also need to know the yourdomain.com you will be using. -

-For setting DNS records you will need to set your glue records for your own yourdomain.com to be: -

-ns1.yourdomain.com - $EXTERNALIP
-ns2.yourdomain.com - $EXTERNALIP
-

-And your authoritative: -

-ns1.yourdomain.com
-ns2.yourdomain.com
-

-If you have questions about DNS records, please send us an email at support@federated.computer so that we can help you. -

-

Admin User

-

-There is an "admin" or administrative use that has access to everything on your Federated Core. -Here are the credentials for that user. -

-Username = "admin@$DOMAIN"
-Password = "$ADMINPASS" -

-

Applications

- - -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ServiceLinkUser / PassAccessDocsDescription
Panelpanel.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereUse panel to create user accounts for your team and change passwords
Emailnextcloud.$DOMAIN
WebMail application
admin@$DOMAIN
admin password above
All users in panel can access their own mail accounts through Nextcloud or mail client using user@$DOMAINClick hereThis is your own private e-mail service accessed through Nextcloud webmail or configure a mail client with SMTP mail.$DOMAIN (port 465), and IMAP mail.$DOMAIN (port 993)
Nextcloudnextcloud.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereThe Nextcloud Suite replaces google workspace which provides mail, calendar, contacts, notes, tasks, files, word processing, spreadsheets, project management, slides, and pictures
Autodiscoveryautodiscover.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereAuto discovery is a service to provide automatic mail configurations for mail clients
Vaultwardenvaultwarden.$DOMAINCreate your own userUser access is separate from panel. Create your own initial userClick hereVaultwarden is a password manager
PowerDNSpowerdns.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick herePowerDNS is a powerful tool for managing DNS of your domain
-
-

Thanks for your support!

-

-Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful -time with Federated Core. -

-Again, if we can be of any assistance, please don't hesitate to get in touch. -

-Support: https://support.federated.computer
-Phone: (970) 722-8715
-Email: support@federated.computer
-

-It's your computer. Let's make it work for you! - -EOF - -# Send out e-mail from mail container with details -#docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Welcome to Federated\" admin@$DOMAIN < /root/certs/mailfile" -#docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Welcome to Federated\" $EMAIL < /root/certs/mailfile" -#cat /federated/apps/mail/data/root/certs/mailfile -#rm /federated/apps/mail/data/root/certs/mailfile -} -print_details() { -cat > /federated/apps/mail/data/root/certs/mailfile < -
-Dear Federated Customer, -

-Please read this note in its entirety since it has some important information for you to get the best use -out of your Federated Core. If you ever get stuck for whatever reason, please reach out to us for support: -

-Website: https://support.federated.computer
-Phone: 970-722-8715
-Email: support@federated.computer
-

-We are here to help you, the Customer, get the most out of your Federated Core. -

-All documentation for your Federated Core can be found at https://documentation.federated.computer. -There you'll find tips for how to use your Core and the various open source applications bundled with -your Core. -

-

Domain Information

-This is your domain: $DOMAIN -

-If you just signed up for Federated Core, your domain is a temporary domain (example: starts with F...). Please do not change the admin password (see below) until you switch to your own domain name (example: mustache.com). We use the admin account and password for your temporary domain to re-configure all the software for your new/permanent domain. If you have a question about this, send us an email to support@federated.computer. -

-When you are ready to switch over to your own yourdomain.com send us an e-mail at support@federated.computer and let us know you are done migrating your data, have pointed DNS correctly, and ready for us to switch. We also need to know the yourdomain.com you will be using. -

-For setting DNS records you will need to set your glue records for your own yourdomain.com to be: -

-ns1.yourdomain.com - $EXTERNALIP
-ns2.yourdomain.com - $EXTERNALIP
-

-And your authoritative: -

-ns1.yourdomain.com
-ns2.yourdomain.com
-

-If you have questions about DNS records, please send us an email at support@federated.computer so that we can help you. -

-

Admin User

-

-There is an "admin" or administrative use that has access to everything on your Federated Core. -Here are the credentials for that user. -

-Username = "admin@$DOMAIN"
-Password = "$ADMINPASS" -

-

Applications

- - -------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ServiceLinkUser / PassAccessDocsDescription
Panelpanel.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereUse panel to create user accounts for your team and change passwords
Emailnextcloud.$DOMAIN
WebMail application
admin@$DOMAIN
admin password above
All users in panel can access their own mail accounts through Nextcloud or mail client using user@$DOMAINClick hereThis is your own private e-mail service accessed through Nextcloud webmail or configure a mail client with SMTP mail.$DOMAIN (port 465), and IMAP mail.$DOMAIN (port 993)
Nextcloudnextcloud.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereThe Nextcloud Suite replaces google workspace which provides mail, calendar, contacts, notes, tasks, files, word processing, spreadsheets, project management, slides, and pictures
Jitsijitsi.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereJitsi is a zoom replacement video conferencing solution
Elementelement.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereElement (a Slack replacement) provides you the ability to chat with those on your team and outside of your team
Listmonklistmonk.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panel.Click hereListmonk is (a replacement for Mailchimp) is used to create e-mail subscription lists
Baserowbaserow.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panel. Use the admin account to login and then invite other usersClick hereBaserow (Air table replacement) allows you to create and customize databases without writing any code
Vaultwardenvaultwarden.$DOMAINCreate your own userUser access is separate from panel. Create your own initial userClick hereVaultwarden is a password manager
Giteagitea.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereGitea is a code repository system similar to GitHub
PowerDNSpowerdns.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick herePowerDNS is a powerful tool for managing DNS of your domain
Castopodcastopod.$DOMAIN/cp-auth/loginadmin@$DOMAIN
admin password above
User access is separate from panelClick hereCastopod is a full platform for hosting and delivering podcasts to your audience
Wordpresswww.$DOMAIN/loginadmin@$DOMAIN
admin password above
User access is separate from panelClick hereWordpress is a dynamic content management solution used by 10s of millions of websites around the globe
Autodiscoveryautodiscover.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereAuto discovery is a service to provide automatic mail configurations for mail clients
Bookstackbookstack.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereBookstack is a simple, open-source, self-hosted, easy-to-use platform (Wiki) for organising and storing information
Freescoutfreescout.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereFreeScout is the super lightweight and powerful free open source help desk
Music Side Projectmsp.$DOMAINadmin@$DOMAIN
admin password above
User access is separate from panelClick hereMusic Side Project Studio enables you to harness the potential of RSS feeds and the Lightning Network, allowing you to self-host your music and receive direct payment from your fans
EspoCRMespocrm.$DOMAINadmin@$DOMAIN
admin password above
All users in panel have access using user@$DOMAINClick hereEspoCRM is an Open Source CRM (Customer Relationship Management) software that allows you to see, enter and evaluate all your company relationships
-
-

VPN

-

-Your core comes with a very powerful VPN solution built using Wireguard. The following information is -needed by your users so that they can use the VPN. Please treat this information as a very important -secret. There are two important parts of the VPN: -

-Here is your VPN configuration:
- - -EOF -sed "s/$/
/" /federated/apps/wireguard/data/config/peer1/peer1.conf >> /federated/apps/mail/data/root/certs/mailfile - -cat >> /federated/apps/mail/data/root/certs/mailfile < -

Thanks for your support!

-

-Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful -time with Federated Core. -

-Again, if we can be of any assistance, please don't hesitate to get in touch. -

-Support: https://support.federated.computer
-Phone: (970) 722-8715
-Email: support@federated.computer
-

-It's your computer. Let's make it work for you! - -EOF - -# Send out e-mail from mail container with details -#docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Welcome to Federated\" admin@$DOMAIN < /root/certs/mailfile" -#docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Welcome to Federated\" $EMAIL < /root/certs/mailfile" -#cat /federated/apps/mail/data/root/certs/mailfile -#rm /federated/apps/mail/data/root/certs/mailfile -} -check_docker() { - OSRELEASE=`lsb_release -a 2>/dev/null | grep ID | awk -F: '{ print $2 }' | xargs` - - echo -ne "\n* Updating OS with the latest patches.." - spin & - SPINPID=$! - - # Update OS with latest patches - sudo apt-get update -y &> /dev/null - [ $? -ne 0 ] && failcheck "Couldn't run sudo apt-get update" - - NEEDRESTART_MODE=a apt-get upgrade -y &> /dev/null - [ $? -ne 0 ] && failcheck "Couldn't run sudo apt-get upgrade" - - kill -9 $SPINPID &> /dev/null - echo -ne "done." - - # Install docker if not found - if ! command -v docker &> /dev/null; then - echo -ne "\n* Couldn't find docker, installing.." - spin & - SPINPID=$! - - # Install Docker on Ubuntu - if [ $OSRELEASE == "Ubuntu" ]; then - # Update list of packages - sudo apt-get update -y &> /dev/null - [ $? -ne 0 ] && failcheck "Couldn't run sudo apt-get update" - - # Install packages which let apt use packages over HTTPS - sudo apt install apt-transport-https ca-certificates curl software-properties-common -y &> /dev/null - [ $? -ne 0 ] && failcheck "Couldn't run sudo apt install for https packages" - - # Add GPG key for the official Docker repository to this system - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - &> /dev/null - [ $? -ne 0 ] && failcheck "Couldn't run curl to add Docker GPG key" - - # Add the docker repository to our APT sources list - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable" -y &> /dev/null - [ $? -ne 0 ] && failcheck "Couldn't run sudo add-apt-repository" - - # Install docker packages - sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-compose -y &> /dev/null - [ $? -ne 0 ] && failcheck "Couldn't run sudo apt install docker packages" - - # Install extra packages - sudo apt-get install duplicity python3-b2sdk uuid apache2-utils -y &> /dev/null - [ $? -ne 0 ] && failcheck "Couldn't run sudo apt install extra packages" - - # Install Traefik certs dumper - curl -sfL https://raw.githubusercontent.com/ldez/traefik-certs-dumper/master/godownloader.sh | bash -s -- -b $(go env GOPATH 2>/dev/null)/bin v2.8.1 &> /dev/null - [ $? -ne 0 ] && failcheck "Couldn't install traefik certs dumper" - fi - kill -9 $SPINPID &> /dev/null - echo -ne "done." - fi - - if ! command -v docker-compose &> /dev/null; then - echo -ne "\n* Couldn't find docker-compose, installing.." - spin & - SPINPID=$! - - # Install Docker compose on Ubuntu - if [ $OSRELEASE == "Ubuntu" ]; then - sudo apt-get install docker-compose -y &> /dev/null - fi - - kill -9 $SPINPID &> /dev/null - echo -ne "done." - fi -} -check_ports() { - EXTERNALIP=`dig @resolver4.opendns.com myip.opendns.com +short 2> /dev/null` - [ $? -ne 0 ] && failcheck "Couldn't run dig, dns is not working" - - # Check if ss command exists - if command -v ss &> /dev/null; then - # Check every port we need if it's in use (only if we have never run before) - if [ $(ls /federated/apps | wc -l) -eq "0" ]; then - 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 - if [ "$SS" == 53 ]; then - if [ $OSRELEASE == "Ubuntu" ]; then - if [ `pgrep -x systemd-resolve` ]; then - echo -ne "\n* Port 53 in use by systemd-resolved, fixing.." - spin & - SPINPID=$! - - # Install resolvconf to fix - sudo apt install resolvconf -y &> /dev/null - [ $? -eq 0 ] && echo -ne "." || failcheck "Failed running sudo apt install resolvconf" - - # Shut down systemd-resolved - systemctl stop systemd-resolved &> /dev/null - [ $? -ne 0 ] && failcheck "Failed running systemctl stop systemd-resolved" - systemctl disable systemd-resolved &> /dev/null - [ $? -ne 0 ] && failcheck "Failed running systemctl stop systemd-resolved" - - # Put nameserver entries so will exist on reboot - rm /etc/resolv.conf - echo "nameserver 1.1.1.1" >> /etc/resolv.conf - echo "nameserver 1.0.0.1" >> /etc/resolv.conf - - kill -9 $SPINPID &> /dev/null - echo -ne "done." - else - echo -ne "\nFAILED - Port 53 (dns) is already in use\n\n" && exit 2 - fi - fi - elif [ "$SS" == "$i" ]; then - failcheck "FAILED - Port $i is already in use" - fi - done - fi - fi -} -check_os() { - VERSIONID=`grep "VERSION_ID=" /etc/os-release | awk -F\" '{ print $2 }'` - if [ "$VERSIONID" != "22.04" ]; then - echo -ne "\nFederated requires a minimum of 4G of RAM and 25G of storage\n \ - running Ubuntu 22.04 LTS. Your system is not supported. Please contact\n \ - Federated @ support@federated.computer for assistance or choose our\n \ - cloud offerings at https://cloud.federated.computer.\n\n" - exit 2; - fi -} -check_memory() { - MEMTOTAL=`awk '/MemTotal/ { printf "%.3d \n", $2/1024 }' /proc/meminfo` - if [ "$MEMTOTAL" -lt "3700" ]; then - echo -ne "\nFederated requires a minimum of 4G of RAM and 25G of storage\n \ - running Ubuntu 22.04 LTS. Your system is not supported. Please contact\n \ - Federated @ support@federated.computer for assistance or choose our\n \ - cloud offerings at https://cloud.federated.computer.\n\n" - exit 2; - fi -} -get_installedapps() { - SERVICES=( $(ls -d /federated/apps/* | awk -F/ '{ print $4 }') ) -} -get_appvars() { - LDAP_SECRET=`cat /federated/apps/ldap/.ldap.secret` - EXTERNALIP=$(get_externalip); - MYSQL_ROOTPASSWORD=`cat /federated/apps/pdnsmysql/.env | grep MYSQL_ROOT_PASSWORD | awk -F= '{ print $2 }'` - - # If ADMINPASS doesn't exist in /etc/federated then use nextcloud to get it. Otherwise get it from /etc/federated - [[ ! $(grep ADMINPASS /etc/federated | awk -F\" '{ print $2 }') ]] && ADMINPASS=$(cat /federated/apps/nextcloud/.nextcloud.secret) || ADMINPASS=$(grep ADMINPASS /etc/federated | awk -F\" '{ print $2 }') - - # If COTURN_MATRIX_SECRET exists in turnserver.conf then use it, otherwise create the password - [[ $(grep static-auth-secret /federated/apps/coturn/data/etc/turnserver.conf 2>/dev/null | awk -F= '{ print $2 }') ]] && COTURN_MATRIX_SECRET=$(grep static-auth-secret /federated/apps/coturn/data/etc/turnserver.conf 2>/dev/null | awk -F= '{ print $2 }') || COTURN_MATRIX_SECRET=$(create_password); - - # If LISTMONKPASS doesn't exist in /etc/federated then create it. Otherwise get it from /etc/federated - [[ ! $(grep LISTMONKPASS /etc/federated | awk -F\" '{ print $2 }') ]] && LISTMONKPASS=$(create_password) || LISTMONKPASS=$(grep LISTMONKPASS /etc/federated | awk -F\" '{ print $2 }') - - # If gitea token file exists then set it as the variable. Otherwise create it. Used for caddy / gitea webhook - [[ -f "/federated/apps/gitea/.gitea.token.1" ]] && GITEA_TOKEN_1=$(cat /federated/apps/gitea/.gitea.token.1) || GITEA_TOKEN_1=$(create_password) - - # If webhook file exists then set it as the variable. Otherwise create it. Used for caddy / gitea webhook - if [[ -f "/federated/apps/gitea/.webhook.secret" ]]; then - WEBHOOK_SECRET=$(cat /federated/apps/gitea/.webhook.secret) - else - WEBHOOK_SECRET=$(create_password) - echo "$WEBHOOK_SECRET" > /federated/apps/gitea/.webhook.secret - fi - - # Get LDAP DOMAIN from ldap its self and setup variables for each part - LDAP_DOMAIN=$(docker exec ldap slapcat | grep "dn:" | head -1 | awk -F: '{ print $2 }') - - # Setup LDAP_DOMAIN variable for domain or subdomain - LDAP_DOMAIN_ARRAY=(${LDAP_DOMAIN//,/ }) - if [ "${#LDAP_DOMAIN_ARRAY[@]}" -eq "2" ]; then - LDAP_DOMAIN_FIRST=$(echo "${LDAP_DOMAIN_ARRAY[0]}" | awk -F= '{ print $2 }') - LDAP_DOMAIN_LAST=$(echo "${LDAP_DOMAIN_ARRAY[1]}" | awk -F= '{ print $2 }') - elif [ "${#LDAP_DOMAIN_ARRAY[@]}" -eq "3" ]; then - LDAP_DOMAIN_FIRST=$(echo "${LDAP_DOMAIN_ARRAY[0]}" | awk -F= '{ print $2 }') - LDAP_DOMAIN_MIDDLE=$(echo "${LDAP_DOMAIN_ARRAY[1]}" | awk -F= '{ print $2 }') - LDAP_DOMAIN_LAST=$(echo "${LDAP_DOMAIN_ARRAY[2]}" | awk -F= '{ print $2 }') - fi - - # Set SMTP user based on if fcore exists - [[ $(docker exec ldap slapcat | grep fcore) ]] && SMTPUSER="fcore" || SMTPUSER="admin" -} -get_appvars_old() { - LDAP_SECRET=`cat /federated/apps/ldap/.ldap.secret` - EXTERNALIP=$(get_externalip); - MYSQL_ROOTPASSWORD=`cat /federated/apps/pdnsmysql/.env | grep MYSQL_ROOT_PASSWORD | awk -F= '{ print $2 }'` - - # If ADMINPASS doesn't exist in /etc/federated then use nextcloud to get it. Otherwise get it from /etc/federated - [[ ! $(grep ADMINPASS /etc/federated | awk -F\" '{ print $2 }') ]] && ADMINPASS=$(cat /federated/apps/nextcloud/.nextcloud.secret) || ADMINPASS=$(grep ADMINPASS /etc/federated | awk -F\" '{ print $2 }') - - # If COTURN_MATRIX_SECRET exists in turnserver.conf then use it, otherwise create the password - [[ $(grep static-auth-secret /federated/apps/coturn/data/etc/turnserver.conf 2>/dev/null | awk -F= '{ print $2 }') ]] && COTURN_MATRIX_SECRET=$(grep static-auth-secret /federated/apps/coturn/data/etc/turnserver.conf 2>/dev/null | awk -F= '{ print $2 }') || COTURN_MATRIX_SECRET=$(create_password); - - # Set SMTP user based on if fcore exists - [[ $(docker exec ldap slapcat | grep fcore) ]] && SMTPUSER="fcore" || SMTPUSER="admin" -} -get_ldapdomain() { - # Get LDAP DOMAIN from ldap its self and setup variables for each part - LDAP_DOMAIN=$(docker exec ldap slapcat | grep "dn:" | head -1 | awk -F: '{ print $2 }') - - # Setup LDAP_DOMAIN variable for domain or subdomain - LDAP_DOMAIN_ARRAY=(${LDAP_DOMAIN//,/ }) - if [ "${#LDAP_DOMAIN_ARRAY[@]}" -eq "2" ]; then - LDAP_DOMAIN_FIRST=$(echo "${LDAP_DOMAIN_ARRAY[0]}" | awk -F= '{ print $2 }') - LDAP_DOMAIN_LAST=$(echo "${LDAP_DOMAIN_ARRAY[1]}" | awk -F= '{ print $2 }') - elif [ "${#LDAP_DOMAIN_ARRAY[@]}" -eq "3" ]; then - LDAP_DOMAIN_FIRST=$(echo "${LDAP_DOMAIN_ARRAY[0]}" | awk -F= '{ print $2 }') - LDAP_DOMAIN_MIDDLE=$(echo "${LDAP_DOMAIN_ARRAY[1]}" | awk -F= '{ print $2 }') - LDAP_DOMAIN_LAST=$(echo "${LDAP_DOMAIN_ARRAY[2]}" | awk -F= '{ print $2 }') - fi -} diff --git a/lib/gitea.sh.old b/lib/gitea.sh.old deleted file mode 100644 index 721fa32..0000000 --- a/lib/gitea.sh.old +++ /dev/null @@ -1,186 +0,0 @@ -#!/bin/bash -# -# Gitea Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_gitea() { - echo -ne "\n* Configuring /federated/apps/gitea container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/gitea" ]; then - mkdir -p /federated/apps/gitea/data/data - mkdir -p /federated/apps/gitea/data/data/git/.ssh - touch /federated/apps/gitea/data/data/git/.ssh/authorized_keys - chmod 600 /federated/apps/gitea/data/data/git/.ssh/authorized_keys - fi - -cat > /federated/apps/gitea/docker-compose.yml < /federated/apps/gitea/.env < /federated/apps/gitea/data/creategitea.sh </dev/null | awk -F: '{ print \$4 }' | awk -F\" '{ print \$2 }'\` - -# Create the repository website, blog, and documentation -curl -k -X POST http://gitea.$DOMAIN:3000/api/v1/user/repos -H "content-type: application/json" -H "Authorization: token \$GITEA_TOKEN_2" --data '{"name":"www","auto_init":true,"default_branch":"master","private":true}' -curl -k -X POST http://gitea.$DOMAIN:3000/api/v1/user/repos -H "content-type: application/json" -H "Authorization: token \$GITEA_TOKEN_2" --data '{"name":"blog","auto_init":true,"default_branch":"master","private":true}' -curl -k -X POST http://gitea.$DOMAIN:3000/api/v1/user/repos -H "content-type: application/json" -H "Authorization: token \$GITEA_TOKEN_2" --data '{"name":"documentation","auto_init":true,"default_branch":"master","private":true}' - -# Create the webhook inside the www repository -curl -X 'POST' \ - 'http://gitea.$DOMAIN:3000/api/v1/repos/gitea/www/hooks' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -H "Authorization: token \$GITEA_TOKEN_2" \ - -d '{ - "active": true, - "config": { - "content_type": "json", - "url": "https://caddy.$DOMAIN/webhook", - "secret": "$WEBHOOK_SECRET" - }, - "events": [ - "push" - ], - "type": "gitea" -}' - -# Create the webhook inside the blog repository -curl -X 'POST' \ - 'http://gitea.$DOMAIN:3000/api/v1/repos/gitea/blog/hooks' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -H "Authorization: token \$GITEA_TOKEN_2" \ - -d '{ - "active": true, - "config": { - "content_type": "json", - "url": "https://blog.$DOMAIN/webhook", - "secret": "$WEBHOOK_SECRET" - }, - "events": [ - "push" - ], - "type": "gitea" -}' - -# Create the webhook inside the documentation repository -curl -X 'POST' \ - 'http://gitea.$DOMAIN:3000/api/v1/repos/gitea/documentation/hooks' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -H "Authorization: token \$GITEA_TOKEN_2" \ - -d '{ - "active": true, - "config": { - "content_type": "json", - "url": "https://documentation.$DOMAIN/webhook", - "secret": "$WEBHOOK_SECRET" - }, - "events": [ - "push" - ], - "type": "gitea" -}' -EOF - -chmod +x /federated/apps/gitea/data/creategitea.sh - -kill -9 $SPINPID &> /dev/null -echo -ne "done." -} -start_gitea() { - # Start service with command to make sure it's up before proceeding - start_service "gitea" "nc -z 172.99.0.30 3000 &> /dev/null" "7" - - # Copy creategitea.sh inside gitea container - mv /federated/apps/gitea/data/creategitea.sh /federated/apps/gitea/data/data/creategitea.sh - [ $? -ne 0 ] && fail "Couldn't mv creategitea.sh inside /federated/apps/gitea container" - - # Create admin user gitea - docker exec --user 1000 gitea gitea admin user create --admin --username gitea --password $ADMINPASS --email admin@$DOMAIN &> /dev/null - [ $? -ne 0 ] && fail "Couldn't run gitea user create inside /federated/apps/gitea container" - - # Run creategitea.sh inside gitea container - docker exec gitea /data/creategitea.sh &> /dev/null - [ $? -ne 0 ] && fail "Couldn't run creategitea.sh inside /federated/apps/gitea container" - - # Create token to use for Caddy starting up next - GITEA_TOKEN_1=`docker exec gitea curl -H "Content-Type: application/json" -d '{"name":"gitea1","scopes":["all"]}' -u gitea:$ADMINPASS http://gitea.$DOMAIN:3000/api/v1/users/gitea/tokens 2>/dev/null | awk -F: '{ print $4 }' | awk -F\" '{ print $2 }'` &> /dev/null - [ $? -ne 0 ] && fail "Couldn't run gitea curl to get token inside /federated/apps/gitea container" - - # Remove creategitea.sh - rm /federated/apps/gitea/data/data/creategitea.sh - - kill -9 $SPINPID &> /dev/null - echo -ne "done." -} diff --git a/lib/jitsi.sh.old b/lib/jitsi.sh.old deleted file mode 100644 index a66fb57..0000000 --- a/lib/jitsi.sh.old +++ /dev/null @@ -1,622 +0,0 @@ -#!/bin/bash -# -# Jitsi Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_jitsi() { - echo -ne "\n* Configuring /federated/apps/jitsi container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/jitsi" ]; then - mkdir -p /federated/apps/jitsi -# mkdir -p /federated/apps/jitsi/data/config/keys &> /dev/null -# cp -rf /federated/apps/dns/data/etc/letsencrypt/archive/$DOMAIN/*.pem apps/jitsi/data/config/keys -# mv /federated/apps/jitsi/data/config/keys/fullchain1.pem apps/jitsi/data/config/keys/cert.crt -# mv /federated/apps/jitsi/data/config/keys/privkey1.pem apps/jitsi/data/config/keys/cert.key -# chmod 644 /federated/apps/jitsi/data/config/keys/*.pem - fi - -# Extract Jitsi into /federated/apps/jitsi -tar zxvf /federated/lib/files/jitsi/stable-* --strip-components 1 -C /federated/apps/jitsi &> /dev/null -[ $? -ne 0 ] && fail "Couldn't extract files/jitsi/stable* into /federated/apps/jitsi" - -# Create docker compose file -cat > /federated/apps/jitsi/docker-compose.yml < /federated/apps/jitsi/.env < /dev/null -echo -ne "done." -} - -start_jitsi() { - # Start service with command to make sure it's up before proceeding - start_service "jitsi" "nc -z 172.99.0.25 443 &> /dev/null" "8" - - kill -9 $SPINPID &> /dev/null - echo -ne "done." -} diff --git a/lib/listmonk.sh.old b/lib/listmonk.sh.old deleted file mode 100644 index a3f277e..0000000 --- a/lib/listmonk.sh.old +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -# -# Listmonk Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_listmonk() { - echo -ne "\n* Configuring /federated/apps/listmonk container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/listmonk" ]; then - mkdir -p /federated/apps/listmonk/data/listmonk/static /federated/apps/listmonk/data/listmonk/uploads - fi - -cat > /federated/apps/listmonk/docker-compose.yml < /federated/apps/listmonk/.env < /federated/apps/listmonk/data/listmonk/config.toml < /dev/null -echo -ne "done." -} -start_listmonk() { - # Install the database scheme first - docker-compose -f /federated/apps/listmonk/docker-compose.yml run --rm listmonk ./listmonk --install --yes &> /dev/null - - # Change app.root_url and other settings to our domain - docker exec postgresql psql -U listmonk -c "update settings set value='\"http://listmonk.$DOMAIN\"' where key='app.root_url'" &> /dev/null - docker exec postgresql psql -U listmonk -c "update settings set value='\"listmonk \"' where key='app.from_email'" &> /dev/null - docker exec postgresql psql -U listmonk -c "update settings set value='[{\"host\": \"mail.$DOMAIN\", \"port\": 587, \"enabled\": true, \"password\": \"$ADMINPASS\", \"tls_type\": \"STARTTLS\", \"username\": \"fcore\", \"max_conns\": 10, \"idle_timeout\": \"15s\", \"wait_timeout\": \"5s\", \"auth_protocol\": \"login\", \"email_headers\": [], \"hello_hostname\": \"\", \"max_msg_retries\": 2, \"tls_skip_verify\": false}, {\"host\": \"smtp.gmail.com\", \"port\": 465, \"enabled\": false, \"password\": \"password\", \"tls_type\": \"TLS\", \"username\": \"username@gmail.com\", \"max_conns\": 10, \"idle_timeout\": \"15s\", \"wait_timeout\": \"5s\", \"auth_protocol\": \"login\", \"email_headers\": [], \"hello_hostname\": \"\", \"max_msg_retries\": 2, \"tls_skip_verify\": false}]' where key='smtp';" &> /dev/null - - # Start service with command to make sure it's up before proceeding - start_service "listmonk" "nc -z 172.99.0.21 9000 &> /dev/null" "8" - - kill -9 $SPINPID &> /dev/null - echo -ne "done." -} diff --git a/lib/msp.sh.old b/lib/msp.sh.old deleted file mode 100644 index a9a2ef8..0000000 --- a/lib/msp.sh.old +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/bash -# -# MSP Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_msp() { - echo -ne "\n* Configuring msp container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/msp" ]; then - mkdir -p /federated/apps/msp/data - fi - -EXTERNALIP=$(get_externalip); -ADMINPASS=`cat /federated/apps/panel/.env | grep SMTP_PASSWORD | awk -F= '{ print $2 }'` -TRAEFIK_HTTPAUTH_STRING_MSP=$(echo `htpasswd -nb admin@$DOMAIN $ADMINPASS` | sed -e s/\\$/\\$\\$/g) - -cat > /federated/apps/msp/docker-compose.yml < /federated/apps/msp/.env < /dev/null -echo -ne "done.\n" -} -start_msp() { - # Start service with command to make sure it's up before proceeding - start_service "msp" "nc -z 172.99.0.38 3000 &> /dev/null" "7" - - docker exec pdns pdnsutil add-record $DOMAIN msp A 86400 $EXTERNALIP &> /dev/null - [ $? -ne 0 ] && fail "Couldn't add dns record for msp" - - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" -} -email_msp() { - echo -ne "* Sending email to customer.." - spin & - SPINPID=$! - -cat > /federated/apps/mail/data/root/certs/mailfile < -
-

-

MSP (Music Side Project) is now installed on $DOMAIN

-

-Here is your applications chart on how to access this service:
-

-

Applications

- - -------- - - - - - - - - - - - - - - - - - - - - -
ServiceLinkUser / PassAccessDocsDescription
Music Side Projectmsp.$DOMAINadmin@$DOMAIN
$ADMINPASS
User access is separate from panelClick hereMusic Side Project Studio enables you to harness the potential of RSS feeds and the Lightning Network, allowing you to self-host your music and receive direct payment from your fans
-

Thanks for your support!

-

-Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful -time with Federated Core. -

-Again, if we can be of any assistance, please don't hesitate to get in touch. -

-Support: https://support.federated.computer
-Phone: (970) 722-8715
-Email: support@federated.computer
-

-It's your computer. Let's make it work for you! - -EOF - - # Send out e-mail from mail container with details - docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Application installed on $DOMAIN\" $EMAIL < /root/certs/mailfile" - rm /federated/apps/mail/data/root/certs/mailfile - - kill -9 $SPINPID &> /dev/null - echo -ne "done.\n" -} diff --git a/lib/nextcloud.sh.old b/lib/nextcloud.sh.old deleted file mode 100644 index 02c4829..0000000 --- a/lib/nextcloud.sh.old +++ /dev/null @@ -1,307 +0,0 @@ -#!/bin/bash -x -# -# NextCloud Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_nextcloud() { - echo -ne "\n* Configuring /federated/apps/nextcloud container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/nextcloud" ]; then - mkdir -p /federated/apps/nextcloud/data/root &> /dev/null - mkdir -p /federated/apps/nextcloud/data/home &> /dev/null - mkdir -p /federated/apps/nextcloud/data/var/www/html &> /dev/null - mkdir -p /federated/apps/nextcloud/data/var/www/html/custom_apps &> /dev/null - mkdir -p /federated/apps/nextcloud/data/var/www/config &> /dev/null - mkdir -p /federated/apps/nextcloud/data/var/www/data &> /dev/null - mkdir -p /federated/apps/nextcloud/data/usr/local/etc/php/conf.d &> /dev/null - fi - -cat > /federated/apps/nextcloud/docker-compose.yml < /federated/apps/nextcloud/.postgresql.secret -echo "$ADMINPASS" > /federated/apps/nextcloud/.nextcloud.secret -chmod 600 /federated/apps/nextcloud/.postgresql.secret /federated/apps/nextcloud/.nextcloud.secret - -cat > /federated/apps/nextcloud/.env < /federated/apps/nextcloud/data/usr/local/etc/php/conf.d/opcache-recommended.ini < /federated/apps/nextcloud/data/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini < /federated/apps/nextcloud/data/configs.json < /federated/apps/nextcloud/data/config.sh < /dev/null - echo -ne "done." -} - -start_nextcloud() { - # Start service with command to make sure it's up before proceeding - start_service "nextcloud" "nc -z 172.99.0.18 80 &> /dev/null" "35" - - # Move config.sh and sidemenu config, set config.sh executable - mv /federated/apps/nextcloud/data/config.sh /federated/apps/nextcloud/data/configs.json /federated/apps/nextcloud/data/var/www/html/ - docker exec nextcloud chown www-data:root /var/www/html/config.sh /var/www/html/configs.json - docker exec nextcloud chmod 755 /var/www/html/config.sh - [ $? -ne 0 ] && fail "Couldn't chown config.sh in /federated/apps/nextcloud container" - - # Run config.sh - Setup LDAP, configuration for nextcloud - docker exec -u 33 nextcloud /var/www/html/config.sh &> /dev/null - [ $? -ne 0 ] && fail "Couldn't run config.sh inside /federated/apps/nextcloud container" - - # Add admin user to group - # Have to do it this many times so it will query LDAP and populate admin user first - docker exec -u 33 nextcloud /var/www/html/occ ldap:search admin - docker exec -u 33 nextcloud /var/www/html/occ group:list - docker exec -u 33 nextcloud /var/www/html/occ group:adduser admin admin - docker exec -u 33 nextcloud /var/www/html/occ group:adduser admin admin - docker exec -u 33 nextcloud /var/www/html/occ group:list - - # Setup admin email account - docker exec -u 33 nextcloud bash -c "/var/www/html/occ mail:account:create admin admin admin@$DOMAIN mail.$DOMAIN 993 ssl admin@$DOMAIN $ADMINPASS mail.$DOMAIN 465 ssl admin@$DOMAIN $ADMINPASS password" &> /dev/null - - # Add missing indexes and disable activity app - docker exec -u 33 nextcloud /var/www/html/occ db:add-missing-indices - docker exec -u 33 nextcloud /var/www/html/occ app:disable activity - - # Remove configs - rm /federated/apps/nextcloud/data/var/www/html/config.sh /federated/apps/nextcloud/data/var/www/html/configs.json - - kill -9 $SPINPID &> /dev/null - echo -ne "done." -} diff --git a/lib/postgresql.sh.old b/lib/postgresql.sh.old deleted file mode 100644 index 8c20ebf..0000000 --- a/lib/postgresql.sh.old +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# -# Postgresql Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_postgresql() { - echo -ne "\n* Configuring /federated/apps/postgresql container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/postgresql" ]; then - mkdir -p /federated/apps/postgresql/data/var/lib/postgresql /federated/apps/postgresql/data/docker-entrypoint-initdb.d - cp /federated/certs/certs/$DOMAIN.crt /federated/apps/postgresql/data/var/lib/postgresql/server.crt - cp /federated/certs/private/$DOMAIN.key /federated/apps/postgresql/data/var/lib/postgresql/server.key - chown 999 /federated/apps/postgresql/data/var/lib/postgresql/server.crt /federated/apps/postgresql/data/var/lib/postgresql/server.key - chmod 600 /federated/apps/postgresql/data/var/lib/postgresql/server.crt /federated/apps/postgresql/data/var/lib/postgresql/server.key - fi - -cat > /federated/apps/postgresql/docker-compose.yml < - -c ssl=on - -c ssl_cert_file=/var/lib/postgresql/server.crt - -c ssl_key_file=/var/lib/postgresql/server.key - healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres"] - interval: 10s - timeout: 5s - retries: 5 - -secrets: - federated_psql_password: - file: ./.postgresql.secret -networks: - federated: - external: true -EOF - -cat > /federated/apps/postgresql/.env < /federated/apps/postgresql/.postgresql.secret -chmod 600 /federated/apps/postgresql/.postgresql.secret -NEXTCLOUD_SECRET=$(create_password); -VAULTWARDEN_SECRET=$(create_password); - -# cat postgresql/data/docker-entrypoint-initdb.d/init.sql -cat > /federated/apps/postgresql/data/docker-entrypoint-initdb.d/init.sql < /dev/null -echo -ne "done." -} -start_postgresql() { - # Start service with command to make sure it's up before proceeding - start_service "postgresql" "nc -z 172.99.0.14 5432 &> /dev/null" "18" - - # Tune PostgreSQL -# if [[ "$BUNDLE" = "starter" ]]; then -# sed -i "s#shared_buffers =.*#shared_buffers = 50MB#g" /federated/apps/postgresql/data/var/lib/postgresql/data/postgresql.conf -# sed -i "s#max_connections =.*#max_connections = 400#g" /federated/apps/postgresql/data/var/lib/postgresql/data/postgresql.conf -# sed -i "s/#work_mem =.*/work_mem = 4MB/g" /federated/apps/postgresql/data/var/lib/postgresql/data/postgresql.conf -# sed -i "s/#maintenance_work_mem =.*/maintenance_work_mem = 50MB/g" /federated/apps/postgresql/data/var/lib/postgresql/data/postgresql.conf -# else - sed -i "s#shared_buffers =.*#shared_buffers = 800MB#g" /federated/apps/postgresql/data/var/lib/postgresql/data/postgresql.conf - sed -i "s#max_connections =.*#max_connections = 400#g" /federated/apps/postgresql/data/var/lib/postgresql/data/postgresql.conf - sed -i "s/#work_mem =.*/work_mem = 16MB/g" /federated/apps/postgresql/data/var/lib/postgresql/data/postgresql.conf - sed -i "s/#maintenance_work_mem =.*/maintenance_work_mem = 128MB/g" /federated/apps/postgresql/data/var/lib/postgresql/data/postgresql.conf -# fi - - # Restart PostgreSQL - /federated/bin/stop postgresql &> /dev/null - /federated/bin/start postgresql &> /dev/null - - # Remove init.sql -# rm /federated/apps/postgresql/data/docker-entrypoint-initdb.d/init.sql - - kill -9 $SPINPID &> /dev/null - echo -ne "done." -} diff --git a/lib/traefik.sh.old b/lib/traefik.sh.old deleted file mode 100644 index 0ab75e6..0000000 --- a/lib/traefik.sh.old +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash -# -# Traefik Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_traefik() { - echo -ne "\n* Configuring /federated/apps/traefik container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/traefik" ]; then - mkdir -p /federated/apps/traefik/data/letsencrypt - fi - -TRAEFIK_HTTPAUTH_STRING=$(echo `htpasswd -nb admin $ADMINPASS` | sed -e s/\\$/\\$\\$/g) - -cat > /federated/apps/traefik/docker-compose.yml < /federated/apps/traefik/.env < /dev/null -echo -ne "done." -} - -start_traefik() { - echo -ne "\n* Starting /federated/apps/traefik service.." - - spin & - SPINPID=$! - - if [ $DEBUG ]; then - # Start /federated/apps/traefik with output to console for debug - docker-compose -f /federated/apps/traefik/docker-compose.yml -p traefik up - [ $? -eq 0 ] && echo -ne "done.\n" || fail "There was a problem starting service /federated/apps/traefik" - else - # Start /federated/apps/traefik with output to /dev/null - docker-compose -f /federated/apps/traefik/docker-compose.yml -p traefik up -d &> /dev/null - - # Keep trying to see that certificates are generated - RETRY="20" - while [ $RETRY -gt 0 ]; do - traefik-certs-dumper file --version v2 --source /federated/apps/traefik/data/letsencrypt/acme.json --dest /federated/certs &> /dev/null - - # Check if certs are generated - ls /federated/certs/private/$DOMAIN.key /federated/certs/certs/$DOMAIN.crt &> /dev/null - if [ $? -eq 0 ]; then - kill -9 $SPINPID &> /dev/null - echo -ne "done." - break - else - if [ "$RETRY" == 1 ]; then - docker-compose -f /federated/apps/traefik/docker-compose.yml -p traefik down &> /dev/null - fail "There was a problem starting service /federated/apps/traefik\nCheck the output of 'docker logs traefik' or turn on\ndebug with -d" - fi - ((RETRY--)) - sleep 9 - fi - done - fi -} diff --git a/lib/vaultwarden.sh.old b/lib/vaultwarden.sh.old deleted file mode 100644 index 1f4a967..0000000 --- a/lib/vaultwarden.sh.old +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# -# Vaultwarden Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_vaultwarden() { - echo -ne "\n* Configuring /federated/apps/vaultwarden container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/vaultwarden" ]; then - mkdir -p /federated/apps/vaultwarden/data/data - fi - -cat > /federated/apps/vaultwarden/docker-compose.yml < /federated/apps/vaultwarden/.env < /dev/null -echo -ne "done." -} -start_vaultwarden() { - # Start service with command to make sure it's up before proceeding - start_service "vaultwarden" "nc -z 172.99.0.22 80 &> /dev/null" "8" - - kill -9 $SPINPID &> /dev/null - echo -ne "done." -} diff --git a/lib/wireguard.sh.old b/lib/wireguard.sh.old deleted file mode 100644 index 27f88ff..0000000 --- a/lib/wireguard.sh.old +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -# -# Wireguard / VPN Service - -PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -config_wireguard() { - echo -ne "\n* Configuring /federated/apps/wireguard container.." - spin & - SPINPID=$! - - if [ ! -d "/federated/apps/wireguard" ]; then - mkdir -p /federated/apps/wireguard/data/config/coredns - fi - -cat > /federated/apps/wireguard/docker-compose.yml < /federated/apps/wireguard/.env < /federated/apps/wireguard/data/config/coredns/Corefile < /dev/null -echo -ne "done." -} - -start_wireguard() { - # Start service with command to make sure it's up before proceeding - start_service "wireguard" "nc -uvz 172.99.0.24 51820 &> /dev/null" "8" - - kill -9 $SPINPID &> /dev/null - echo -ne "done." -}