From 18245f80dda97a10cf100ab5defe4c989446b3f9 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Fri, 26 Jun 2020 12:32:02 +0500 Subject: [PATCH] enable remote mysql in cyberpanel.sh --- cyberpanel.sh | 57 ++++++++++++++++++++++++++++++++++-- install/installCyberPanel.py | 2 +- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index ba395606c..c545710c1 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -8,6 +8,15 @@ DEV="OFF" POSTFIX_VARIABLE="ON" POWERDNS_VARIABLE="ON" PUREFTPD_VARIABLE="ON" + +### Remote MySQL Variables + +REMOTE_MYSQL='OFF' +MYSQL_HOST='' +MYSQL_USER='' +MYSQL_PASSWORD='' +MYSQL_PORT='' + PROVIDER="undefined" SERIAL_NO="" DIR=$(pwd) @@ -856,6 +865,42 @@ else fi fi +### Ask if you want to set up this CyberPanel with remote MySQL + +echo -e "\nDo you want to setup Remote MySQL? (This will skip installation of local MySQL)" +echo -e "" +printf "%s" "Remote MySQL [Y/n]: " +read TMP_YN +if [[ `expr "x$TMP_YN" : 'x[Yy]'` -gt 1 ]] || [[ $TMP_YN == "" ]] ; then + echo -e "\nRemote MySQL selected..." + REMOTE_MYSQL='ON' + + echo -e "" + printf "%s" "Remote MySQL Hostname: " + read MYSQL_HOST + + echo -e "" + printf "%s" "Remote MySQL Username: " + read MYSQL_USER + + echo -e "" + printf "%s" "Remote MySQL Password: " + read MYSQL_PASSWORD + + echo -e "" + printf "%s" "Remote MySQL Port: " + read MYSQL_PORT + +else + + echo -e "" + printf "%s" "Local MySQL selected.." + echo -e "" + +fi + +### + #above comment for future use #if [[ $DEV_ARG == "ON" ]] ; then @@ -1029,9 +1074,17 @@ if [[ $debug == "1" ]] ; then fi if [[ $REDIS_HOSTING == "Yes" ]] ; then - /usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE --redis enable + if [[ $REMOTE_MYSQL == "Yes" ]] ; then + /usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE --redis enable --remotemysql $REMOTE_MYSQL --mysqlhost $MYSQL_HOST --mysqluser $MYSQL_USER --mysqlpassword $MYSQL_PASSWORD --mysqlport $MYSQL_PORT + else + /usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE --redis enable + fi else - /usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE + if [[ $REMOTE_MYSQL == "Yes" ]] ; then + /usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE --remotemysql $REMOTE_MYSQL --mysqlhost $MYSQL_HOST --mysqluser $MYSQL_USER --mysqlpassword $MYSQL_PASSWORD --mysqlport $MYSQL_PORT + else + /usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE + fi fi if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index aa9546c5f..3b3c50991 100755 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -284,7 +284,6 @@ class InstallCyberPanel: install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - ############## Start mariadb ###################### self.startMariaDB() @@ -648,6 +647,7 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns installer.installMySQL(mysql) installer.changeMYSQLRootPassword() #installer.changeMYSQLRootPasswordCyberPanel(mysql) + installer.startMariaDB() if distro == ubuntu: installer.fixMariaDB()