diff --git a/lib/bookstack.old b/lib/bookstack.old new file mode 100644 index 0000000..7f2b817 --- /dev/null +++ b/lib/bookstack.old @@ -0,0 +1,185 @@ +#!/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/bookstack.sh b/lib/bookstack.sh index 7f2b817..5c1920f 100644 --- a/lib/bookstack.sh +++ b/lib/bookstack.sh @@ -3,6 +3,7 @@ # Bookstack Service PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +get_appvars config_bookstack() { echo -ne "\n* Configuring bookstack container.." @@ -40,13 +41,8 @@ networks: external: true EOF -EXTERNALIP=$(get_externalip); -ADMINPASS=`cat /federated/apps/panel/.env | grep SMTP_PASSWORD | awk -F= '{ print $2 }'` BOOKSTACK_ADMINPASSWORD=`htpasswd -bnBC 10 "" $ADMINPASS | tr -d ':\n' | sed 's/$2y/$2b/'` BOOKSTACK_SECRET=$(create_password); -MYSQL_ROOTPASSWORD=`cat /federated/apps/pdnsmysql/.env | grep MYSQL_ROOT_PASSWORD | awk -F= '{ print $2 }'` -# Set SMTP user based on if fcore exists -[[ $(docker exec ldap slapcat | grep fcore) ]] && SMTPUSER="fcore" || SMTPUSER="admin" cat > /federated/apps/bookstack/.env < /dev/null echo -ne "done.\n" } +uninstall_bookstack() { + echo -ne "* Uninstalling bookstack container.." + spin & + SPINPID=$! + + # First stop the service + cd /federated/apps/bookstack && docker-compose -f docker-compose.yml -p bookstack down &> /dev/null + + # Delete database and user + docker exec pdnsmysql bash -c "mysql -uroot -p$MYSQL_ROOTPASSWORD -e 'drop database bookstack;'" &> /dev/null + docker exec pdnsmysql bash -c "mysql -uroot -p$MYSQL_ROOTPASSWORD -e 'drop user bookstack;'" &> /dev/null + + # Delete the app directory + rm -rf /federated/apps/bookstack + + kill -9 $SPINPID &> /dev/null + echo -ne "done.\n" +} diff --git a/lib/espocrm.sh b/lib/espocrm.sh index b08e1c9..3d44426 100644 --- a/lib/espocrm.sh +++ b/lib/espocrm.sh @@ -3,6 +3,7 @@ # EspoCRM Service PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +get_appvars config_espocrm() { echo -ne "\n* Configuring espocrm container.." @@ -41,13 +42,7 @@ networks: external: true EOF -ADMINPASS=`cat /federated/apps/panel/.env | grep SMTP_PASSWORD | awk -F= '{ print $2 }'` -EXTERNALIP=$(get_externalip); ESPOCRM_SECRET=$(create_password); -MYSQL_ROOTPASSWORD=`cat /federated/apps/pdnsmysql/.env | grep MYSQL_ROOT_PASSWORD | awk -F= '{ print $2 }'` -LDAP_SECRET=`cat /federated/apps/ldap/.ldap.secret` -# Set SMTP user based on if fcore exists -[[ $(docker exec ldap slapcat | grep fcore) ]] && SMTPUSER="fcore" || SMTPUSER="admin" cat > /federated/apps/espocrm/.env < /dev/null docker exec pdnsmysql bash -c "mysql -uroot -p$MYSQL_ROOTPASSWORD -e 'drop user espocrm;'" &> /dev/null + # Remove cronjob + crontab -l | grep -v 'espocrm /usr/local/bin/php -f /var/www/html/cron.php' | crontab - + # Delete the app directory rm -rf /federated/apps/espocrm diff --git a/lib/espocrm.sh.old b/lib/espocrm.sh.old new file mode 100644 index 0000000..b08e1c9 --- /dev/null +++ b/lib/espocrm.sh.old @@ -0,0 +1,207 @@ +#!/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 b/lib/freescout.sh index d8c15de..afc9f04 100644 --- a/lib/freescout.sh +++ b/lib/freescout.sh @@ -3,6 +3,7 @@ # Freescout Service PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +get_appvars config_freescout() { echo -ne "\n* Configuring freescout container.." @@ -42,11 +43,7 @@ networks: external: true EOF -ADMINPASS=`cat /federated/apps/panel/.env | grep SMTP_PASSWORD | awk -F= '{ print $2 }'` -EXTERNALIP=$(get_externalip); FREESCOUT_SECRET=$(create_password); -# Set SMTP user based on if fcore exists -[[ $(docker exec ldap slapcat | grep fcore) ]] && SMTPUSER="fcore" || SMTPUSER="admin" cat > /federated/apps/freescout/.env < /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/msp.sh b/lib/msp.sh index a9a2ef8..d9d0121 100644 --- a/lib/msp.sh +++ b/lib/msp.sh @@ -3,6 +3,7 @@ # MSP Service PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +get_appvars config_msp() { echo -ne "\n* Configuring msp container.." @@ -13,8 +14,6 @@ config_msp() { 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 < /dev/null echo -ne "done.\n" } +uninstall_msp() { + echo -ne "* Uninstalling msp container.." + spin & + SPINPID=$! + + # First stop the service + cd /federated/apps/msp && docker-compose -f docker-compose.yml -p msp down &> /dev/null + + # Delete the app directory + rm -rf /federated/apps/msp + + kill -9 $SPINPID &> /dev/null + echo -ne "done.\n" +} diff --git a/lib/msp.sh.old b/lib/msp.sh.old new file mode 100644 index 0000000..a9a2ef8 --- /dev/null +++ b/lib/msp.sh.old @@ -0,0 +1,154 @@ +#!/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" +}