diff --git a/bin/.etc.federated b/bin/.etc.federated new file mode 100644 index 0000000..077b62f --- /dev/null +++ b/bin/.etc.federated @@ -0,0 +1,16 @@ +# Domain name +DOMAIN="f11391a1.federatedcomputer.cloud" +# Company name +COMPANY="f11391a1 Federated Core" +# Country Code (US, HK, GB, JP, etc) +COUNTRY="US" +# Where to send welcome e-mail +EMAIL="derek@federated.computer" +# Backblaze KeyID (Master Key) for backups +B2_APPLICATION_KEY_ID="3239c6765fdc" +# Backblaze Application Key for backups +B2_APPLICATION_KEY="0050ac8837466cbca0e0aa574b5f8332f706a5e26c" +# Email address for alerts on services that fail to start +ALERTS_EMAIL="alerts@federated.computer" +# What bundle to install (starter, team, ultimate) +BUNDLE=starter diff --git a/bin/.gpg.backblaze.old b/bin/.gpg.backblaze.old new file mode 100644 index 0000000..f9332e1 --- /dev/null +++ b/bin/.gpg.backblaze.old @@ -0,0 +1 @@ +BO9zorifWNgWmOTVuGaOFHhdUW9zHKDd diff --git a/bin/convertdomain b/bin/convertdomain index 590f12c..8052795 100755 --- a/bin/convertdomain +++ b/bin/convertdomain @@ -35,7 +35,7 @@ do_serviceprep() { docker exec pdns pdnsutil set-kind $DOMAIN_NEW native docker exec pdns pdnsutil set-meta $DOMAIN_NEW SOA-EDIT-API DEFAULT - for i in ns1 ns2 powerdns traefik mail www computer panel nextcloud collabora jitsi matrix element listmonk vaultwarden vpn wireguard baserow gitea blog documentation podcasts castopod caddy wordpress bookstack freescout msp espocrm; do + for i in ns1 ns2 powerdns traefik mail www computer panel nextcloud collabora jitsi matrix element listmonk vaultwarden vpn wireguard baserow gitea blog documentation podcasts castopod caddy wordpress bookstack freescout msp espocrm dashboard; do docker exec pdns pdnsutil add-record $DOMAIN_NEW $i A 86400 $EXTERNALIP done @@ -1013,6 +1013,21 @@ chmod 600 /federated/apps/espocrm/.env echo -ne "done." } +convert_dashboard() { + #### Convert Dashboard + echo -ne "\n* Converting dashboard.." + + sed -i "s#$DOMAIN#$DOMAIN_NEW#g" /federated/apps/dashboard/docker-compose.yml + sed -i "s#$DOMAIN#$DOMAIN_NEW#g" /federated/apps/dashboard/.env + + # Grab the container IP from docker-compose + SERVICE_IP=`grep ipv4_address /federated/apps/dashboard/docker-compose.yml | awk '{ print $2 }'` + + # Start service with command to make sure it's up before proceeding + start_service_convert "dashboard" "nc -z $SERVICE_IP 8080 &> /dev/null" + + echo -ne "done." +} usage() { echo "$0: " exit 2 diff --git a/bin/install-federated b/bin/install-federated index 6736875..000fe31 100755 --- a/bin/install-federated +++ b/bin/install-federated @@ -81,19 +81,19 @@ config_network # Setup arrays to what bundle if [ "$BUNDLE" = "starter" ]; then CORE_APPS=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap") - EXTRA_APPS=("mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden") + EXTRA_APPS=("mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden" "dashboard") elif [ "$BUNDLE" = "creator" ]; then CORE_APPS=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap") - EXTRA_APPS=("mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden" "matrix" "element" "coturn" "wordpress") + EXTRA_APPS=("mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden" "matrix" "element" "coturn" "wordpress" "dashboard") elif [ "$BUNDLE" = "team" ]; then CORE_APPS=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap") - EXTRA_APPS=("mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden" "matrix" "element" "coturn" "wordpress" "freescout" "espocrm") + EXTRA_APPS=("mail" "collabora" "nextcloud" "autodiscover" "panel" "vaultwarden" "matrix" "element" "coturn" "wordpress" "freescout" "espocrm" "dashboard") elif [ "$BUNDLE" = "enterprise" ]; then CORE_APPS=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap") - EXTRA_APPS=("mail" "collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover" "castopod" "wordpress" "coturn" "bookstack" "freescout" "msp" "espocrm") + EXTRA_APPS=("mail" "collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover" "castopod" "wordpress" "coturn" "bookstack" "freescout" "msp" "espocrm" "dashboard") else CORE_APPS=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap") - EXTRA_APPS=("mail" "collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover" "castopod" "wordpress" "coturn" "bookstack" "freescout" "msp" "espocrm") + EXTRA_APPS=("mail" "collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover" "castopod" "wordpress" "coturn" "bookstack" "freescout" "msp" "espocrm" "dashboard") fi # Get apps that need to be installed and create array for it @@ -123,15 +123,15 @@ add_cron # Print out federated environment details echo -ne "\n\n" if [ "$BUNDLE" = "starter" ]; then - print_details_starter + create_email_withoutvpn elif [ "$BUNDLE" = "team" ]; then - print_details_team + create_email_withoutvpn elif [ "$BUNDLE" = "creator" ]; then - print_details_creator + create_email_withoutvpn elif [ "$BUNDLE" = "enterprise" ]; then - print_details + create_email_withvpn else - print_details + create_email_withvpn fi echo -ne "\n\n" exit 0 diff --git a/bin/uninstallapp b/bin/uninstallapp index 27a8113..dc3c132 100755 --- a/bin/uninstallapp +++ b/bin/uninstallapp @@ -24,4 +24,5 @@ APP=$1 [ ! -f /federated/lib/$APP.sh ] && failcheck "/federated/lib/$APP.sh doesn't exist." [ ! -d /federated/apps/$APP ] && failcheck "/federated/apps/$APP doesn't exists. $APP is already uninstalled?" . /federated/lib/$APP.sh +. /federated/apps/$APP/.env uninstall_$APP diff --git a/lib/dashboard.sh b/lib/dashboard.sh new file mode 100644 index 0000000..6b17930 --- /dev/null +++ b/lib/dashboard.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# +# Dashboard Service + +PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +config_dashboard() { + echo -ne "\n* Configuring /federated/apps/dashboard container.." + + if [ ! -d "/federated/apps/dashboard" ]; then + mkdir -p /federated/apps/dashboard/data + fi + +cat > /federated/apps/dashboard/docker-compose.yml < /federated/apps/dashboard/.env < /root/.docker/config.json < /dev/null" "7" + + docker exec pdns pdnsutil add-record $DOMAIN dashboard A 86400 $EXTERNALIP &> /dev/null + [ $? -ne 0 ] && fail "Couldn't add dns record for dashboard" + + echo -ne "done." +} +uninstall_dashboard() { + echo -ne "* Uninstalling dashboard container.." + spin & + SPINPID=$! + + # First stop the service + cd /federated/apps/dashboard && docker-compose -f docker-compose.yml -p dashboard down &> /dev/null + + # Delete the app directory + rm -rf /federated/apps/dashboard + + # Delete the image + docker image rm federatedcomputer/dashboard:$IMAGE_VERSION &> /dev/null + + # Delete the DNS record + docker exec pdns pdnsutil delete-rrset $DOMAIN dashboard A + + kill -9 $SPINPID &> /dev/null + echo -ne "done.\n" +} diff --git a/lib/functions.sh b/lib/functions.sh index e46c1cf..6654b33 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -2,7 +2,7 @@ # Define all services CORE_APPS=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap") -EXTRA_APPS=("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") +EXTRA_APPS=("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" "dashboard") SERVICES=("${CORE_APPS[@]}" "${EXTRA_APPS[@]}") fail() { @@ -1509,3 +1509,191 @@ get_ldapdomain() { LDAP_DOMAIN_LAST=$(echo "${LDAP_DOMAIN_ARRAY[2]}" | awk -F= '{ print $2 }') fi } +create_email_withoutvpn() { +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 check https://www.federated.computer/support for videos on pointing your DNS correctly. +For further help please send us an email at support@federated.computer so that we can assist 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" +

+

Dashboard

+Visit https://dashboard.$DOMAIN to access all of your applications using the admin user and password above. +You can use dashboard as a launching pad for your applications. +
+

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 +} +create_email_withvpn() { +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 check https://www.federated.computer/support for videos on pointing your DNS correctly. +For further help please send us an email at support@federated.computer so that we can assist 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" +

+

Dashboard

+Visit https://dashboard.$DOMAIN to access all of your applications using the admin user and password above. +You can use dashboard as a launching pad for your applications. +
+

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 +} +create_email_migrated() { +cat > /federated/apps/mail/data/root/certs/mailfile < +
+

+

You are now migrated to $DOMAIN

+

+Credentials will be the same as the admin user in the original welcome e-mail.
+

+

Dashboard

+Visit https://dashboard.$DOMAIN to access all of your applications using the admin user and password. +You can use dashboard as a launching pad for your applications. +
+

+

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 +}