From 3b4af9fba99f816ee8e044435f881aed20922065 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 17 Oct 2023 16:31:44 -0500 Subject: [PATCH] Update cc-reinstall.sh --- cc-reinstall.sh | 127 ++++++++++++++++++++++++++++-------------------- 1 file changed, 74 insertions(+), 53 deletions(-) diff --git a/cc-reinstall.sh b/cc-reinstall.sh index ea141ec..a0f3d44 100755 --- a/cc-reinstall.sh +++ b/cc-reinstall.sh @@ -54,65 +54,86 @@ read -n 1 -p "Would you like to now re-install Cluster Control (Y/n)?" choice case "$choice" in [Nn]) echo ''; exit 0;; * ) + echo -e "Server 1: Pri MySQL & PostgreSQL\nServer 2: LAN & WAN MySQL" + read -n 1 -p "Select which server (1/2)? " serverchoice + case "${serverchoice}" in + [Nn]) echo ''; exit 0;; + * ) + ./install-cc -1 - ./install-cc -1 + /opt/copycerts.sh + # apt install -y mailutils xtrabackup + apt install -y mailutils - /opt/copycerts.sh - # apt install -y mailutils xtrabackup - apt install -y mailutils + echo + echo + read -p "Enter a password to set for the Admin account in MySQL: " pwd + echo + echo "Enter the root MySQL password:" + mysql -u root -p -e "CREATE USER 'admin'@'%' IDENTIFIED BY '${pwd}';GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;" - echo - echo - read -p "Enter a new password for the MySQL Admin account in MySQL: " pwd - echo - echo "Enter the root password for creating the admin account:" - mysql -u root -p -e "CREATE USER 'admin'@'%' IDENTIFIED BY '${pwd}';GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;" + read -n 1 -p "Login at https://mysql.scity.us and setup the admin user, verify it brings up the deploy prompt. Once complete then press ENTER" choice + echo + echo + echo "Importing Previous Database Clusters" + + if [ "${serverchoice}" == "1" ]; then + /usr/bin/s9s cluster --register \ + --cluster-type=galera \ + --nodes="10.10.1.51;10.10.1.52;10.2.1.51" \ + --vendor=mariadb \ + --provider-version=10.4 \ + --db-admin="root" \ + --db-admin-passwd='Dc$@54115' \ + --os-user=root \ + --os-key-file=/root/.ssh/id_rsa \ + --cluster-name="iDS-MySQL-Galera" \ + --wait + + /usr/bin/s9s cluster --register \ + --cluster-type=postgresql \ + --nodes="10.10.0.211;10.10.0.212" \ + --vendor=mariadb \ + --provider-version=13 \ + --db-admin="root" \ + --db-admin-passwd='Dc$@54115' \ + --os-user=root \ + --os-key-file=/root/.ssh/id_rsa \ + --cluster-name="IDS-Headscale-PostgreSQL" \ + --wait + + elif [ "${serverchoice}" == "2" ]; then + /usr/bin/s9s cluster --register \ + --cluster-type=galera \ + --nodes="100.100.55.2;100.100.55.3;100.100.55.4" \ + --vendor=mariadb \ + --provider-version=10.6 \ + --db-admin="root" \ + --db-admin-passwd='Dc$@54115' \ + --os-user=root \ + --os-key-file=/root/.ssh/id_rsa \ + --cluster-name="iDS-WAN-DNS-MySQL-Galera" \ + --wait - read -n 1 -p "Login at https://mysql.scity.us and setup the admin user, verify it brings up the deploy prompt. Once complete then press ENTER" choice - echo - echo - echo "Importing Previous Database Clusters" - - /usr/bin/s9s cluster --register \ - --cluster-type=galera \ - --nodes="10.10.1.51;10.10.1.52" \ - --vendor=mariadb \ - --provider-version=10.4 \ - --db-admin="root" \ - --db-admin-passwd='Dc$@54115' \ - --os-user=root \ - --os-key-file=/root/.ssh/id_rsa \ - --cluster-name="iDS-MySQL-Galera" \ - --wait - - /usr/bin/s9s cluster --register \ - --cluster-type=galera \ - --nodes="100.100.55.2;100.100.55.3;100.100.55.4" \ - --vendor=mariadb \ - --provider-version=10.6 \ - --db-admin="root" \ - --db-admin-passwd='Dc$@54115' \ - --os-user=root \ - --os-key-file=/root/.ssh/id_rsa \ - --cluster-name="iDS-WAN-DNS-MySQL-Galera" \ - --wait - - /usr/bin/s9s cluster --register \ - --cluster-type=galera \ - --nodes="100.100.10.1,100.100.10.2,100.100.10.3" \ - --vendor=mariadb \ - --provider-version=10.6 \ - --db-admin="root" \ - --db-admin-passwd='Dc$@54115' \ - --os-user=root \ - --os-key-file=/root/.ssh/id_rsa \ - --cluster-name="iDS-LAN-DNS-MySQL-Galera" \ - --wait + /usr/bin/s9s cluster --register \ + --cluster-type=galera \ + --nodes="100.100.10.1;100.100.10.2;100.100.10.3" \ + --vendor=mariadb \ + --provider-version=10.6 \ + --db-admin="root" \ + --db-admin-passwd='Dc$@54115' \ + --os-user=root \ + --os-key-file=/root/.ssh/id_rsa \ + --cluster-name="iDS-LAN-DNS-MySQL-Galera" \ + --wait + fi - # bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-postfix.sh) - echo - echo "Install Completed" + # bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-postfix.sh) + + echo + echo "Install Completed" + ;; ;; esac