#!/bin/bash # # Wordpress Service PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin get_appvars config_wordpress() { echo -ne "* Configuring wordpress container.." if [ ! -d "/federated/apps/wordpress" ]; then mkdir -p /federated/apps/wordpress/data/bitnami/wordpress chown -R 1001 /federated/apps/wordpress/data/bitnami/wordpress fi WORDPRESS_SECRET=$(create_password); cat > /federated/apps/wordpress/docker-compose.yml < /federated/apps/wordpress/.env < /dev/null docker exec pdnsmysql bash -c "mariadb -uroot -p$MYSQL_ROOTPASSWORD -e \"CREATE USER 'wordpress'@'%' IDENTIFIED BY '$WORDPRESS_SECRET';\"" &> /dev/null docker exec pdnsmysql bash -c "mariadb -uroot -p$MYSQL_ROOTPASSWORD -e \"grant all privileges on wordpress.* to 'wordpress'@'%';\"" &> /dev/null docker exec pdnsmysql bash -c "mariadb -uroot -p$MYSQL_ROOTPASSWORD -e 'flush privileges;'" &> /dev/null echo -ne "done.\n" } start_wordpress() { # Start service with command to make sure it's up before proceeding start_service "wordpress" "nc -z 192.168.0.34 8080 &> /dev/null" "7" chmod -R 755 /federated/apps/wordpress/data/bitnami/wordpress/wp-content chmod 740 /federated/apps/wordpress/data/bitnami/wordpress/wp-config.php sed -i s#http://#https://#g /federated/apps/wordpress/data/bitnami/wordpress/wp-config.php run_command "/federated/bin/stop wordpress" run_command "/federated/bin/start wordpress" run_command "docker exec pdns pdnsutil add-record $DOMAIN www A 86400 $EXTERNALIP" run_command "docker exec pdns pdnsutil add-record $DOMAIN wordpress A 86400 $EXTERNALIP" # Install cronjob (crontab -l 2>/dev/null; echo "30 * * * * /federated/bin/check-wordpressversion > /dev/null 2>&1") | sort -u | crontab - echo -ne "done.\n" } email_wordpress() { echo -ne "* Sending email to customer.." cat > /federated/apps/mail/data/root/certs/mailfile <

Wordpress is now installed on $DOMAIN

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

Applications

Service Link User / Pass Access Docs Description
Wordpress www.$DOMAIN/login admin@$DOMAIN
$ADMINPASS
User access is separate from panel Click here Wordpress 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 \"Application installed on $DOMAIN\" $EMAIL < /root/certs/mailfile" rm /federated/apps/mail/data/root/certs/mailfile echo -ne "done.\n" } uninstall_wordpress() { echo -ne "* Uninstalling wordpress container.." # First stop the service cd /federated/apps/wordpress && docker compose -f docker-compose.yml -p wordpress down &> /dev/null # Delete database and user docker exec pdnsmysql bash -c "mariadb -uroot -p$MYSQL_ROOTPASSWORD -e 'drop database wordpress;'" &> /dev/null docker exec pdnsmysql bash -c "mariadb -uroot -p$MYSQL_ROOTPASSWORD -e 'drop user wordpress;'" &> /dev/null # Delete the app directory rm -rf /federated/apps/wordpress # Delete the image docker image rm bitnami/wordpress:$IMAGE_VERSION &> /dev/null # Delete the DNS record docker exec pdns pdnsutil delete-rrset $DOMAIN wordpress A docker exec pdns pdnsutil delete-rrset $DOMAIN www A # Remove cronjob crontab -l | grep -v '/federated/bin/check-wordpressversion' | crontab - # Uninstall the SSO configuration if it exists in authelia (authelia must exist too) if [[ $(grep "### Wordpress" /federated/apps/authelia/data/config/idproviders.yml 2>/dev/null) ]]; then sed -i '/### Wordpress/,/### /{/### PowerDNS/!{/### /!d}}' /federated/apps/authelia/data/config/idproviders.yml sed -i '/### Wordpress/d' /federated/apps/authelia/data/config/idproviders.yml run_command "/federated/bin/stop authelia" run_command "/federated/bin/start authelia" fi echo -ne "done.\n" } configsso_wordpress() { echo -ne "* Configuring wordpress container with SSO.." [ ! -d "/federated/apps/authelia" ] && failcheck "Authelia is not installed. You need this first before continuing." [ ! -f "/federated/apps/authelia/data/config/idproviders.yml" ] && failcheck "Authelia idproviders.yml is missing." [[ $(grep "### Wordpress" /federated/apps/authelia/data/config/idproviders.yml 2>/dev/null) ]] && failcheck "Authelia already has a Wordpress configuration." WORDPRESS_CLIENT_SECRET=$(create_password); WORDPRESS_CLIENT_SECRET_HASH=$(docker run --rm authelia/authelia:latest authelia crypto hash generate pbkdf2 --password $WORDPRESS_CLIENT_SECRET | awk '{ print $2 }') cat >> /federated/apps/authelia/data/config/idproviders.yml <