First add of new welcome email and dashboard

This commit is contained in:
root 2024-07-12 15:26:42 +00:00
parent 4a3204b075
commit d8522730ef
7 changed files with 324 additions and 12 deletions

16
bin/.etc.federated Normal file
View File

@ -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

1
bin/.gpg.backblaze.old Normal file
View File

@ -0,0 +1 @@
BO9zorifWNgWmOTVuGaOFHhdUW9zHKDd

View File

@ -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: <domain.com> <organization name>"
exit 2

View File

@ -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

View File

@ -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

91
lib/dashboard.sh Normal file
View File

@ -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 <<EOF
version: '3.7'
services:
dashboard:
image: federatedcomputer/dashboard:\${IMAGE_VERSION}
container_name: dashboard
hostname: dashboard.$DOMAIN
domainname: $DOMAIN
restart: always
networks:
federated:
ipv4_address: 172.99.0.41
env_file:
- ./.env
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(\`dashboard.$DOMAIN\`)"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.tls.certresolver=letsencrypt"
networks:
federated:
external: true
EOF
cat > /federated/apps/dashboard/.env <<EOF
IMAGE_VERSION="latest"
DOMAIN="$DOMAIN"
TIER="$BUNDLE"
EOF
chmod 600 /federated/apps/dashboard/.env
if [[ ! -f "/root/.docker/config.json" ]]; then
[[ ! -d "/root/.docker" ]] && mkdir /root/.docker
cat > /root/.docker/config.json <<EOF
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "ZGF2aWRwYXVseW91bmc6VkdBN2F6ajR5ZXQ1bW5oQGV0eA=="
}
}
}
EOF
chmod 600 /root/.docker/config.json
fi
echo -ne "done."
}
start_dashboard() {
# Start service with command to make sure it's up before proceeding
start_service "dashboard" "nc -z 172.99.0.41 8080 &> /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"
}

View File

@ -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 <<EOF
<html>
<img src="https://www.federated.computer/images/logo.png" alt="" /><br>
Dear Federated Customer,
<p>
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:
<p>
Website: https://support.federated.computer<br>
Phone: 970-722-8715<br>
Email: support@federated.computer<br>
<p>
We are here to help you, the Customer, get the most out of your Federated Core.
<p>
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.
<p>
<h4>Domain Information</h4>
This is your domain: <b>$DOMAIN</b>
<p>
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.
<p>
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.
<p>
For setting DNS records you will need to set your glue records for your own yourdomain.com to be:
<p>
ns1.yourdomain.com - $EXTERNALIP<br>
ns2.yourdomain.com - $EXTERNALIP<br>
<p>
And your authoritative:
<p>
ns1.yourdomain.com<br>
ns2.yourdomain.com<br>
<p>
If you have questions about DNS records, please check <a href="https://www.federated.computer/support">https://www.federated.computer/support</a> 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.
<p>
<h4>Admin User</h4>
<p>
There is an "admin" or administrative use that has access to everything on your Federated Core.
Here are the credentials for that user.
<p>
Username = "admin@$DOMAIN"<br>
Password = "$ADMINPASS"
<p>
<h4>Dashboard</h4>
Visit <a href="https://dashboard.$DOMAIN">https://dashboard.$DOMAIN</a> to access all of your applications using the admin user and password above.
You can use dashboard as a launching pad for your applications.
<br>
<h4>Thanks for your support!</h4>
<p>
Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful
time with Federated Core.
<p>
Again, if we can be of any assistance, please don't hesitate to get in touch.
<p>
Support: https://support.federated.computer<br>
Phone: (970) 722-8715<br>
Email: support@federated.computer<br>
<p>
It's <b>your</b> computer. Let's make it work for you!
</html>
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 <<EOF
<html>
<img src="https://www.federated.computer/images/logo.png" alt="" /><br>
Dear Federated Customer,
<p>
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:
<p>
Website: https://support.federated.computer<br>
Phone: 970-722-8715<br>
Email: support@federated.computer<br>
<p>
We are here to help you, the Customer, get the most out of your Federated Core.
<p>
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.
<p>
<h4>Domain Information</h4>
This is your domain: <b>$DOMAIN</b>
<p>
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.
<p>
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.
<p>
For setting DNS records you will need to set your glue records for your own yourdomain.com to be:
<p>
ns1.yourdomain.com - $EXTERNALIP<br>
ns2.yourdomain.com - $EXTERNALIP<br>
<p>
And your authoritative:
<p>
ns1.yourdomain.com<br>
ns2.yourdomain.com<br>
<p>
If you have questions about DNS records, please check <a href="https://www.federated.computer/support">https://www.federated.computer/support</a> 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.
<p>
<h4>Admin User</h4>
<p>
There is an "admin" or administrative use that has access to everything on your Federated Core.
Here are the credentials for that user.
<p>
Username = "admin@$DOMAIN"<br>
Password = "$ADMINPASS"
<p>
<h4>Dashboard</h4>
Visit <a href="https://dashboard.$DOMAIN">https://dashboard.$DOMAIN</a> to access all of your applications using the admin user and password above.
You can use dashboard as a launching pad for your applications.
<br>
<h4>VPN</h4>
<p>
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:
<p>
Here is your VPN configuration:<br>
<code>
EOF
sed "s/$/<br>/" /federated/apps/wireguard/data/config/peer1/peer1.conf >> /federated/apps/mail/data/root/certs/mailfile
cat >> /federated/apps/mail/data/root/certs/mailfile <<EOF
</code>
<h4>Thanks for your support!</h4>
<p>
Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful
time with Federated Core.
<p>
Again, if we can be of any assistance, please don't hesitate to get in touch.
<p>
Support: https://support.federated.computer<br>
Phone: (970) 722-8715<br>
Email: support@federated.computer<br>
<p>
It's <b>your</b> computer. Let's make it work for you!
</html>
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 <<EOF
<html>
<img src="https://www.federated.computer/images/logo.png" alt="" /><br>
<p>
<h4>You are now migrated to $DOMAIN</h4>
<p>
Credentials will be the same as the admin user in the original welcome e-mail.<br>
<p>
<h4>Dashboard</h4>
Visit <a href="https://dashboard.$DOMAIN">https://dashboard.$DOMAIN</a> to access all of your applications using the admin user and password.
You can use dashboard as a launching pad for your applications.
<br>
<p>
<h4>Thanks for your support!</h4>
<p>
Thank you for your support of Federated Computer. We really appreciate it and hope you have a very successful
time with Federated Core.
<p>
Again, if we can be of any assistance, please don't hesitate to get in touch.
<p>
Support: https://support.federated.computer<br>
Phone: (970) 722-8715<br>
Email: support@federated.computer<br>
<p>
It's <b>your</b> computer. Let's make it work for you!
</html>
EOF
}