Example #1
0
// Start the build script
// *******************************
Config::enableLogging();
// ********************
// *** Initial output
//
Task::log("\n---------------------------------------\n");
Task::log("-------- Sync repository\n\n");
// Prompt for user password, if it's not hardcoded
CliTask::promptAccountPassword($cogecoAccount);
// ********************
// Prompt user input
//
// Prompt user to input a local folder to sync
$workingCopy = CliTask::promptRepo();
Task::log("You chose " . $workingCopy->getRepoUrl() . "\n\n");
// Prompt user to chose a remote folder to sync to
$selectedDir = CliTask::promptDir(array($devDir, $dev2Dir, $uatDir, $uat2Dir, $uat3Dir, $preprodDir));
Task::log("You chose " . $selectedDir->getPath() . "\n\n");
CliTask::promptQuit('Continue? [y/n]: ');
// ********************
// *** Checkout
//
SvnTask::checkoutClean($workingCopy);
SvnTask::createManifestFile($workingCopy, FALSE, TRUE);
// ********************
// Sync files and folders
//
$rsyncOptions = new RsyncOptions($workingCopy->dir, $selectedDir);
$rsyncOptions->chmod('Du=rwx,Dg=rwx,Do=rwx,Fu=rw,Fg=rw,Fo=r')->excludesAppend(array('/dev/', '/db/'));
FileSyncTask::sync($rsyncOptions);
Example #2
0
// Start the build script
// *******************************
Config::enableLogging();
// ********************
// *** Initial output
//
Task::log("\n---------------------------------------\n");
Task::log("-------- Sync repository\n\n");
// Prompt for user password, if it's not hardcoded
CliTask::promptAccountPassword($cogecoAccount);
// ********************
// Prompt user input
//
// Prompt user to input a local folder to sync
$workingCopy = CliTask::promptRepo();
Task::log("You chose " . $workingCopy->getRepoUrl() . "\n\n");
// Prompt user to chose a remote folder to sync to
$selectedDir = CliTask::promptDir(array($maoDev1Dir, $maoDev2Dir, $maoUat1Dir, $maoUat2Dir, $maoUat3Dir, $maoUat4Dir, $maoUat5Dir));
Task::log("You chose " . $selectedDir->getPath() . "\n\n");
CliTask::promptQuit('Continue? [y/n]: ');
// ********************
// *** Checkout
//
SvnTask::checkoutClean($workingCopy);
SvnTask::createManifestFile($workingCopy);
// ********************
// Sync files and folders
//
$rsyncOptions = new RsyncOptions($workingCopy->dir, $selectedDir);
$rsyncOptions->excludesAppend(array('/user_guide/', '/license.txt', '/vendor', 'application/logs/', '/dev/'));
FileSyncTask::sync($rsyncOptions);
Example #3
0
$build = 'prod';
// Use test for testing the script or prod for production use
// Common configs for test/prod
$workingCopy = $maoWcTrunk;
$revisionToCheckOut = 0;
$syncDestinationDir1 = $maoDevTempDir;
$syncDestinationDir2 = $maoDev1Dir;
if ($build === 'prod') {
    // Prod setup
    $syncDestinationDir1 = $maoProdTempDir;
    $syncDestinationDir2 = $maoProdDir;
    $maoReleaseEmail->to = $maoReleaseEmailRecipients;
}
$rsyncOptions1 = new RsyncOptions($maoWcTrunk->dir, $syncDestinationDir1);
$rsyncOptions1->excludesAppend(array('/user_guide/', '/license.txt', 'application/logs/', '/dev/'));
$rsyncOptions2 = new RsyncOptions($syncDestinationDir1, $syncDestinationDir2);
$rsyncOptions2->useSsh(FALSE)->excludesAppend(array('/user_guide/', '/license.txt', 'application/logs/', '/dev/', '/application/config/production/routes.php'));
// *******************************
// Start the build script
// *******************************
Config::enableLogging(TRUE, TRUE);
// ********************
// *** Initial output
//
Task::log("\n---------------------------------------\n");
Task::log("-------- Deploy Prod\n\n");
// Chicken quit
if ($build === 'prod') {
    CliTask::promptQuit('Deploying to production! Continue? [y/n]: ');
}
// Prompt for user password, if it's not hardcoded
$revisionToCheckOut = 0;
$sourceDb = $devDb;
$destinationDb = $prodDbPublic;
$syncDestinationDir1 = $preprodDir;
$syncDestinationDir2 = $prodDir;
$sourceDbSchema = 'cogecouat';
$destinationDbSchema = 'cogecouattest';
if ($build === 'prod') {
    // Prod setup
    $syncDestinationDir2 = $prodDir;
    $destinationDbSchema = 'cogeco';
    $cogecoCaReleaseEmail->to = array('*****@*****.**');
}
$rsyncOptions1 = new RsyncOptions($workingCopy->dir, $syncDestinationDir1);
$rsyncOptions1->excludesAppend(array('/dev/'));
$rsyncOptions2 = new RsyncOptions(new Dir($syncDestinationDir1->getPath()), new Dir($syncDestinationDir2->getPath()));
$rsyncOptions2->useSsh(FALSE)->excludesAppend(array('/dev/'));
// *******************************
// Start the build script
// *******************************
//
Config::enableLogging(TRUE, TRUE);
// ********************
// *** Initial output
//
Task::log("\n---------------------------------------\n");
Task::log("-------- Deploy Prod\n\n");
// Chicken quit
//if ($build === 'prod') {
//	CliTask::promptQuit('Deploying to production! Continue? [y/n]: ');
//}
Example #5
0
 /**
  *
  */
 public static function getRsyncCommand(RsyncOptions $rsync)
 {
     $cmd = Config::get('rsync.bin');
     if (!empty($rsync->flags)) {
         $cmd .= ' -' . $rsync->flags;
     }
     if ($rsync->deleteAfter) {
         $cmd .= ' --delete-after';
     }
     if ($rsync->deleteExcluded) {
         $cmd .= ' --delete-excluded';
     }
     if ($rsync->delete) {
         $cmd .= ' --delete';
     }
     if ($rsync->delayUpdates) {
         $cmd .= ' --delay-updates';
     }
     if ($rsync->dryRun) {
         $cmd .= ' --dry-run';
     }
     if ($rsync->noMotd) {
         $cmd .= ' --no-motd';
     }
     if ($rsync->stats) {
         $cmd .= ' --stats';
     }
     if ($rsync->progress) {
         $cmd .= ' --progress';
     }
     if ($rsync->safeLinks) {
         $cmd .= ' --safe-links';
     }
     if (!empty($rsync->chmod)) {
         $cmd .= ' --chmod=' . $rsync->chmod;
     }
     foreach ($rsync->includes as $include) {
         $cmd .= ' --include "' . $include . '"';
     }
     foreach ($rsync->excludes as $exclude) {
         $cmd .= ' --exclude "' . $exclude . '"';
     }
     $remoteHost = $rsync->getRemoteHost();
     if ($rsync->useSsh && !empty($remoteHost)) {
         $cmd .= ' -e "ssh -o ConnectTimeout=5';
         $identity = '';
         if ($rsync->useHostIdentity && !empty($remoteHost->privateKeyPath)) {
             // No CLI and no identity means one must be generated temporarily
             $cmd .= ' -i ' . Cygwin::cygPath($remoteHost->privateKeyPath);
         }
         if (!$rsync->sshStrictHostKeyChecking) {
             $cmd .= ' -o StrictHostKeyChecking=no';
         }
         $cmd .= '"';
     }
     // Continue building the command with the source arg
     $cmd .= ' ';
     if ($rsync->source->isRemote() && $rsync->useSsh) {
         $cmd .= "{$rsync->source->getHost()->account->username}@{$rsync->source->getHost()->hostname}:";
     }
     $cmd .= Cygwin::cygPath($rsync->source->getPath());
     // Continue building the command with the destination arg
     $cmd .= ' ';
     if ($rsync->destination->isRemote() && $rsync->useSsh) {
         $cmd .= "{$rsync->destination->getHost()->account->username}@{$rsync->destination->getHost()->hostname}:";
     }
     $cmd .= Cygwin::cygPath($rsync->destination->getPath());
     return $cmd;
 }
Example #6
0
$workingCopy = $cogecoCaWorkingCopy;
$revisionToCheckOut = 0;
$sourceDb = $localPublicDb;
$destinationDb = $prodPublicDb;
$syncDestinationDir1 = $preprodDir;
$syncDestinationDir2 = $prodDir;
$deployDatabase = TRUE;
if ($build !== 'prod') {
    // Non-prod testing
    $cogecoCaReleaseEmail->to = array('*****@*****.**');
}
$sourceDbSchema = $localPublicDb->getDbName();
$destinationDbSchema = $preprodPublicDb->getDbName();
$rsyncOptions1 = new RsyncOptions($workingCopy->dir, $syncDestinationDir1);
$rsyncOptions1->chmod('Du=rwx,Dg=rwx,Do=rwx,Fu=rw,Fg=rw,Fo=r')->excludesAppend(array('/dev/', '/db/', '/build.xml', '/build.properties'));
$rsyncOptions2 = new RsyncOptions(new Dir($syncDestinationDir1->getPath()), new Dir($syncDestinationDir2->getPath()));
$rsyncOptions2->chmod('Du=rwx,Dg=rwx,Do=rwx,Fu=rw,Fg=rw,Fo=r')->useSsh(FALSE)->excludesAppend(array('/dev/', '/db/', '/build.xml', '/build.properties'));
// *******************************
// Start the build script
// *******************************
//
Config::enableLogging(TRUE, TRUE);
// ********************
// *** Initial output
//
Task::log("\n---------------------------------------\n");
Task::log("-------- Deploy Prod\n\n");
// Chicken quit
if ($build === 'prod') {
    CliTask::promptQuit('Deploying to production! Continue? [y/n]: ');
}
Example #7
0
// Include the build script core
include_once __DIR__ . '/../../bootstrap.php';
// *******************************
// Script arguments
// *******************************
// *******************************
// Script configuration
// *******************************
// Common configs
$workingCopy = $cogecoCaWorkingCopy;
$revisionToCheckOut = 0;
$sourceDb = $localPublicDb;
$destinationDb = $preprodPublicDb;
$syncDestinationDir1 = $preprodDir;
$deployDatabase = true;
$rsyncOptions1 = new RsyncOptions($workingCopy->dir, $syncDestinationDir1);
$rsyncOptions1->chmod('Du=rwx,Dg=rwx,Do=rwx,Fu=rw,Fg=rw,Fo=r')->excludesAppend(array('/dev/', '/db/', '/build.xml', '/build.properties'));
$sourceDbSchema = $localPublicDb->getDbName();
$destinationDbSchema = $preprodPublicDb->getDbName();
if (isset($argv) && in_array('-no-db', $argv)) {
    $deployDatabase = false;
}
// *******************************
// Start the build script
// *******************************
//
Config::enableLogging(TRUE, TRUE);
// ********************
// *** Initial output
//
Task::log("\n---------------------------------------\n");
Example #8
0
// Prod setup
if ($build === 'prod') {
    $remoteFileOld = new File('/var/www/prod/logs/', 'orders.log', $prodHost);
    $sendOrdersEmail->to = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**');
} else {
    $remoteFileOld = new File('/var/www/prod/logs/', 'orders2.log', $prodHost);
}
// Common configs for test/prod
$destinationDirPath = '\\eBusiness_Cust_Data_Mngt\\Orders_Archives';
$destDirPathPrefix = '\\\\mtl-fs1\\dept';
$destDirPathPrefixCygwin = 'S:';
$sharedDestinationDir = $destDirPathPrefix . $destinationDirPath;
$localDestinationDir = $destDirPathPrefixCygwin . $destinationDirPath;
$remoteFileNew = new File($remoteFileOld->dir, 'orders_' . Config::get('datetime.slug') . '.log');
$destinationFile = new File($localDestinationDir, $remoteFileNew->name);
$rsyncOptions = new RsyncOptions($remoteFileNew, $destinationFile);
$rsyncOptions->chmod('u=rw,g=rw,o=');
// *******************************
// Start the build script
// *******************************
Config::enableLogging();
// ********************
// *** Initial output
//
Task::log("\n---------------------------------------\n");
Task::log("- Move cogeco.ca orders.log to secured shared drive\n\n");
// Prompt for user password, if it's not hardcoded
CliTask::promptAccountPassword($cogecoAccount);
// ********************
// *** Move the file to the shared drive
//