diff --git a/docker/Dockerfile b/docker/Dockerfile index dc97d6a..526f43b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -98,7 +98,7 @@ RUN cp .env.example .env \ && sed -i "s/^DB_USERNAME=.*/DB_USERNAME=$PANEL_DB_USER/" .env \ && sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=$PANEL_DB_PASSWORD/" .env \ && sed -i "s/^DB_CONNECTION=.*/DB_CONNECTION=mysql/" .env \ - && sed -i "s/^MYSQl_ROOT_USERNAME=.*/MYSQl_ROOT_USERNAME=$MYSQL_ROOT_USERNAME/" .env \ + && sed -i "s/^MYSQL_ROOT_USERNAME=.*/MYSQL_ROOT_USERNAME=$MYSQL_ROOT_USERNAME/" .env \ && sed -i "s/^MYSQL_ROOT_PASSWORD=.*/MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD/" .env # Generate application key and migrate database diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 5f6b842..65f0b09 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -130,7 +130,7 @@ sed -i "s/^DB_USERNAME=.*/DB_USERNAME=$PANEL_DB_USER/" .env sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=$PANEL_DB_PASSWORD/" .env sed -i "s/^DB_CONNECTION=.*/DB_CONNECTION=mysql/" .env -sed -i "s/^MYSQl_ROOT_USERNAME=.*/MYSQl_ROOT_USERNAME=$MYSQL_ROOT_USERNAME/" .env +sed -i "s/^MYSQL_ROOT_USERNAME=.*/MYSQL_ROOT_USERNAME=$MYSQL_ROOT_USERNAME/" .env sed -i "s/^MYSQL_ROOT_PASSWORD=.*/MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD/" .env phyre-php artisan key:generate diff --git a/installers/ubuntu-20.04/install-partial/install_web.sh b/installers/ubuntu-20.04/install-partial/install_web.sh index bea7521..3764c46 100644 --- a/installers/ubuntu-20.04/install-partial/install_web.sh +++ b/installers/ubuntu-20.04/install-partial/install_web.sh @@ -54,7 +54,7 @@ sed -i "s/^DB_USERNAME=.*/DB_USERNAME=$PHYRE_PANEL_DB_USER/" .env sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=$PHYRE_PANEL_DB_PASSWORD/" .env sed -i "s/^DB_CONNECTION=.*/DB_CONNECTION=mysql/" .env -sed -i "s/^MYSQl_ROOT_USERNAME=.*/MYSQl_ROOT_USERNAME=$MYSQL_PHYRE_ROOT_USERNAME/" .env +sed -i "s/^MYSQL_ROOT_USERNAME=.*/MYSQL_ROOT_USERNAME=$MYSQL_PHYRE_ROOT_USERNAME/" .env sed -i "s/^MYSQL_ROOT_PASSWORD=.*/MYSQL_ROOT_PASSWORD=$MYSQL_PHYRE_ROOT_PASSWORD/" .env phyre-php artisan key:generate diff --git a/installers/ubuntu-20.04/install.sh b/installers/ubuntu-20.04/install.sh index 3cfb83a..acd6273 100644 --- a/installers/ubuntu-20.04/install.sh +++ b/installers/ubuntu-20.04/install.sh @@ -135,7 +135,7 @@ sed -i "s/^DB_USERNAME=.*/DB_USERNAME=$PHYRE_PANEL_DB_USER/" .env sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=$PHYRE_PANEL_DB_PASSWORD/" .env sed -i "s/^DB_CONNECTION=.*/DB_CONNECTION=mysql/" .env -sed -i "s/^MYSQl_ROOT_USERNAME=.*/MYSQl_ROOT_USERNAME=$MYSQL_PHYRE_ROOT_USERNAME/" .env +sed -i "s/^MYSQL_ROOT_USERNAME=.*/MYSQL_ROOT_USERNAME=$MYSQL_PHYRE_ROOT_USERNAME/" .env sed -i "s/^MYSQL_ROOT_PASSWORD=.*/MYSQL_ROOT_PASSWORD=$MYSQL_PHYRE_ROOT_PASSWORD/" .env phyre-php artisan key:generate diff --git a/installers/ubuntu-22.04/install-partial/install_web.sh b/installers/ubuntu-22.04/install-partial/install_web.sh index bea7521..3764c46 100644 --- a/installers/ubuntu-22.04/install-partial/install_web.sh +++ b/installers/ubuntu-22.04/install-partial/install_web.sh @@ -54,7 +54,7 @@ sed -i "s/^DB_USERNAME=.*/DB_USERNAME=$PHYRE_PANEL_DB_USER/" .env sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=$PHYRE_PANEL_DB_PASSWORD/" .env sed -i "s/^DB_CONNECTION=.*/DB_CONNECTION=mysql/" .env -sed -i "s/^MYSQl_ROOT_USERNAME=.*/MYSQl_ROOT_USERNAME=$MYSQL_PHYRE_ROOT_USERNAME/" .env +sed -i "s/^MYSQL_ROOT_USERNAME=.*/MYSQL_ROOT_USERNAME=$MYSQL_PHYRE_ROOT_USERNAME/" .env sed -i "s/^MYSQL_ROOT_PASSWORD=.*/MYSQL_ROOT_PASSWORD=$MYSQL_PHYRE_ROOT_PASSWORD/" .env phyre-php artisan key:generate diff --git a/installers/ubuntu-22.04/install.sh b/installers/ubuntu-22.04/install.sh index aa9895e..f3b141c 100644 --- a/installers/ubuntu-22.04/install.sh +++ b/installers/ubuntu-22.04/install.sh @@ -137,7 +137,7 @@ sed -i "s/^DB_USERNAME=.*/DB_USERNAME=$PHYRE_PANEL_DB_USER/" .env sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=$PHYRE_PANEL_DB_PASSWORD/" .env sed -i "s/^DB_CONNECTION=.*/DB_CONNECTION=mysql/" .env -sed -i "s/^MYSQl_ROOT_USERNAME=.*/MYSQl_ROOT_USERNAME=$MYSQL_PHYRE_ROOT_USERNAME/" .env +sed -i "s/^MYSQL_ROOT_USERNAME=.*/MYSQL_ROOT_USERNAME=$MYSQL_PHYRE_ROOT_USERNAME/" .env sed -i "s/^MYSQL_ROOT_PASSWORD=.*/MYSQL_ROOT_PASSWORD=$MYSQL_PHYRE_ROOT_PASSWORD/" .env phyre-php artisan key:generate diff --git a/web/.env.example b/web/.env.example index 10c4d52..7cb4251 100644 --- a/web/.env.example +++ b/web/.env.example @@ -17,7 +17,7 @@ DB_PASSWORD= MYSQL_HOST=127.0.0.1 MYSQL_PORT=3306 -MYSQl_ROOT_USERNAME=root +MYSQL_ROOT_USERNAME=root MYSQL_ROOT_PASSWORD=root BROADCAST_DRIVER=log diff --git a/web/app/Models/Backup.php b/web/app/Models/Backup.php index 9b13d4f..1e677f2 100644 --- a/web/app/Models/Backup.php +++ b/web/app/Models/Backup.php @@ -206,7 +206,13 @@ class Backup extends Model $shellFileContent .= 'echo "Backup Phyre Panel files"'. PHP_EOL; // Export Phyre Panel database - $shellFileContent .= 'mysqldump -u "'.env('MYSQl_ROOT_USERNAME').'" -p"'.env('MYSQL_ROOT_PASSWORD').'" "'.env('DB_DATABASE').'" > '.$databaseBackupPath . PHP_EOL; + $mysqlAuthConf = '/root/.phyre-mysql.cnf'; + $mysqlAuthContent = '[client]' . PHP_EOL; + $mysqlAuthContent .= 'user="' . env('MYSQL_ROOT_USERNAME') .'"'. PHP_EOL; + $mysqlAuthContent .= 'password="' . env('MYSQL_ROOT_PASSWORD') . '"' . PHP_EOL; + file_put_contents($mysqlAuthConf, $mysqlAuthContent); + + $shellFileContent .= 'mysqldump --defaults-extra-file='.$mysqlAuthConf.' "'.env('DB_DATABASE').'" > '.$databaseBackupPath . PHP_EOL; // Export Phyre Panel ENV $getEnv = Dotenv::createArrayBacked(base_path())->load(); @@ -244,7 +250,7 @@ class Backup extends Model $databaseName = $database->database_name_prefix . $database->database_name; $shellFileContent .= 'echo "Backup up database: ' . $databaseName . '" ' . PHP_EOL; $databaseBackupPath = $hostingSubscriptionPath . '/databases/' . $databaseName . '.sql'; - $shellFileContent .= 'mysqldump -u "' . env('MYSQl_ROOT_USERNAME') . '" -p"' . env('MYSQL_ROOT_PASSWORD') . '" "' . $databaseName . '" > ' . $databaseBackupPath . PHP_EOL; + $shellFileContent .= 'mysqldump --defaults-extra-file='.$mysqlAuthConf.' "' . $databaseName . '" > ' . $databaseBackupPath . PHP_EOL; } } diff --git a/web/app/Models/Database.php b/web/app/Models/Database.php index 84370c6..c32ae60 100644 --- a/web/app/Models/Database.php +++ b/web/app/Models/Database.php @@ -62,7 +62,7 @@ class Database extends Model $universalDatabaseExecutor = new UniversalDatabaseExecutor( env('MYSQL_HOST'), env('MYSQL_PORT'), - env('MYSQl_ROOT_USERNAME'), + env('MYSQL_ROOT_USERNAME'), env('MYSQL_ROOT_PASSWORD'), ); $createDatabase = $universalDatabaseExecutor->createDatabase($databaseName); diff --git a/web/app/Models/DatabaseUser.php b/web/app/Models/DatabaseUser.php index 96dd86a..89fc62c 100644 --- a/web/app/Models/DatabaseUser.php +++ b/web/app/Models/DatabaseUser.php @@ -58,7 +58,7 @@ class DatabaseUser extends Model $universalDatabaseExecutor = new UniversalDatabaseExecutor( env('MYSQL_HOST'), env('MYSQL_PORT'), - env('MYSQl_ROOT_USERNAME'), + env('MYSQL_ROOT_USERNAME'), env('MYSQL_ROOT_PASSWORD'), $findDatabase->database_name_prefix . $findDatabase->database_name ); diff --git a/web/app/Models/HostingSubscriptionBackup.php b/web/app/Models/HostingSubscriptionBackup.php index c3ac5c9..11d03dc 100644 --- a/web/app/Models/HostingSubscriptionBackup.php +++ b/web/app/Models/HostingSubscriptionBackup.php @@ -218,7 +218,7 @@ class HostingSubscriptionBackup extends Model $shellFileContent .= 'echo "Backup up database: ' . $databaseName .'" '. PHP_EOL; $shellFileContent .= 'mkdir -p '.$backupTempPath . '/databases' . PHP_EOL; $databaseBackupPath = $backupTempPath . '/databases/' . $databaseName . '.sql'; - $shellFileContent .= 'mysqldump -u "'.env('MYSQl_ROOT_USERNAME').'" -p"'.env('MYSQL_ROOT_PASSWORD').'" "'.$databaseName.'" > '.$databaseBackupPath . PHP_EOL; + $shellFileContent .= 'mysqldump -u "'.env('MYSQL_ROOT_USERNAME').'" -p"'.env('MYSQL_ROOT_PASSWORD').'" "'.$databaseName.'" > '.$databaseBackupPath . PHP_EOL; } }