Modificato script backup (mongodump con auth)
Signed-off-by: Riccardo Di Dato <r.didato@asdynamics.it>
This commit is contained in:
@@ -12,7 +12,9 @@ Creation Date: 07/gen/2016
|
|||||||
// $dbconn->password = "root";
|
// $dbconn->password = "root";
|
||||||
$database = new stdClass();
|
$database = new stdClass();
|
||||||
$database->dbName = "fdn2";
|
$database->dbName = "fdn2";
|
||||||
// $database->connectionString = "mongodb://10.0.0.2:27017";
|
$database->user = "test";
|
||||||
|
$database->pass = "test";
|
||||||
|
$database->useAuth = false;
|
||||||
$database->connectionString = "mongodb://127.0.0.1:27017";
|
$database->connectionString = "mongodb://127.0.0.1:27017";
|
||||||
|
|
||||||
$currentSystem = new stdClass();
|
$currentSystem = new stdClass();
|
||||||
|
|||||||
@@ -100,6 +100,6 @@ $config->cbs2 = new stdClass();
|
|||||||
$config->cbs2->keyFile = $config->paths->common . "/" . $cbs2->keyfile;
|
$config->cbs2->keyFile = $config->paths->common . "/" . $cbs2->keyfile;
|
||||||
$config->cbs2->serverPort = $cbs2->serverPort;
|
$config->cbs2->serverPort = $cbs2->serverPort;
|
||||||
|
|
||||||
|
$config->database = $database;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ Creation Date: 19/nov/2013
|
|||||||
// Password mongo produzione: p14n3ll1FDN2
|
// Password mongo produzione: p14n3ll1FDN2
|
||||||
$database = new stdClass();
|
$database = new stdClass();
|
||||||
$database->dbName = "fdn2";
|
$database->dbName = "fdn2";
|
||||||
$database->connectionString = "mongodb://fdn2:p14n3ll1FDN2@db.ifattidinapoli.it/fdn2";
|
$database->user = "fdn2";
|
||||||
|
$database->pass = "p14n3ll1FDN2";
|
||||||
|
$database->useAuth = true;
|
||||||
|
$database->connectionString = "mongodb://".$database->user.":".$database->pass."@localhost/".$database->dbname;
|
||||||
|
|
||||||
$currentSystem = new stdClass();
|
$currentSystem = new stdClass();
|
||||||
$currentSystem->storageBaseDir = "/home/asdynamics/storage"; // Il path con storage ecc in cui mettere immagini, file temporanei ecc
|
$currentSystem->storageBaseDir = "/home/asdynamics/storage"; // Il path con storage ecc in cui mettere immagini, file temporanei ecc
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ Creation Date: 14/nov/2013
|
|||||||
// $dbconn->password = "root";
|
// $dbconn->password = "root";
|
||||||
$database = new stdClass();
|
$database = new stdClass();
|
||||||
$database->dbName = "fdn2";
|
$database->dbName = "fdn2";
|
||||||
$database->connectionString = "mongodb://fdn2:p14n3ll1FDN2@localhost/fdn2";
|
$database->user = "test";
|
||||||
|
$database->pass = "test";
|
||||||
|
$database->useAuth = false;
|
||||||
|
$database->connectionString = "mongodb://".$database->user.":".$database->pass."@localhost/".$database->dbname;
|
||||||
|
|
||||||
$currentSystem = new stdClass();
|
$currentSystem = new stdClass();
|
||||||
$currentSystem->storageBaseDir = "/home"; // Il path con storage ecc in cui mettere immagini, file temporanei ecc
|
$currentSystem->storageBaseDir = "/home"; // Il path con storage ecc in cui mettere immagini, file temporanei ecc
|
||||||
|
|||||||
@@ -16,9 +16,14 @@ class SendBackupTask extends Task {
|
|||||||
public static function execute(){
|
public static function execute(){
|
||||||
$config = GlobalVariables::get("config");
|
$config = GlobalVariables::get("config");
|
||||||
|
|
||||||
$dbName = GlobalVariables::get("dao")->getDbName();
|
$dbName = $config->database->dbName;
|
||||||
$backDir = $config->paths->backup."/mongoDump";
|
$backDir = $config->paths->backup."/mongoDump";
|
||||||
SystemController::shellExec("mongodump","-d $dbName -o $backDir");
|
|
||||||
|
$mongoDumpOpts = "-d $dbName -o $backDir";
|
||||||
|
if ($config->database->useAuth){
|
||||||
|
$mongoDumpOpts = "-d $dbName -o $backDir -u ".$config->database->user." -p ".$config->database->pass;
|
||||||
|
}
|
||||||
|
SystemController::shellExec("mongodump",$mongoDumpOpts);
|
||||||
|
|
||||||
$backupKeyFile = $config->cbs2->keyFile;
|
$backupKeyFile = $config->cbs2->keyFile;
|
||||||
$backupServerPort = $config->cbs2->serverPort;
|
$backupServerPort = $config->cbs2->serverPort;
|
||||||
|
|||||||
Reference in New Issue
Block a user