Skip to content
Snippets Groups Projects
Commit baf90e41 authored by hahn's avatar hahn
Browse files

- config: Hostname nicht mehr aus $SERVER nehmen (wg. CLI)

- Deployment-Cronjob: Check, ob es etwas in der Queue ist
- Sync-Cronjo - sollte nach Anpassung der Config nun gehen
parent 024e0e4f
No related branches found
No related tags found
No related merge requests found
......@@ -35,28 +35,26 @@ $aConfig=array(
// override for local development
// ----------------------------------------------------------------------
if ($_SERVER && array_key_exists("SERVER_NAME", $_SERVER)){
switch ($_SERVER["SERVER_NAME"]) {
case "localhost":
case "dev.ci.iml.unibe.ch":
$aConfig['workDir']="D:\imldeployment";
$aProjects["scrudu"]["phases"]["preview"]["url"]="http://localhost/deployment/";
break;
case "ci.iml.unibe.ch":
// synch der Pakete nur auf dem Livesystem
$aConfig['mirrorPackages']=array(
'puppet'=>array(
'type'=>'rsync',
'runas'=>'www-data', // nur fuer commandline
'target'=>'ladmin@calcium.iml.unibe.ch:/share/imldeployment',
));
break;
default:
break;
}
switch (php_uname("n")) {
case "USER":
case "dev.ci.iml.unibe.ch":
$aConfig['workDir']="D:\imldeployment";
break;
case "ci.iml.unibe.ch":
// synch der Pakete nur auf dem Livesystem
$aConfig['mirrorPackages']=array(
'puppet'=>array(
'type'=>'rsync',
'runas'=>'www-data', // nur fuer commandline
'target'=>'ladmin@calcium.iml.unibe.ch:/share/imldeployment',
));
break;
default:
break;
}
$aConfig=array_merge($aConfig, array(
......
<?php
echo '<h1>' . $_SERVER["SERVER_NAME"] . '</h1><hr>';
echo '<h1>' . php_uname("n") . '</h1><hr>';
?>
<a href="http://www.iml.unibe.ch/">IML Startseite</a> |
......
<?php
/**
*
* CRONJOB
* deploy all queued packages
*
*/
// http://iml:deployment@ci.iml.unibe.ch/deployment/?prj=ci&action=deploy&par3=preview&confirm=1
......@@ -11,8 +17,15 @@ echo "<h1>===== IMLDEPLOYMENT - deploy all projects =====</h1>\n";
foreach ($oPrj1->getProjects() as $sPrj) {
$oPrj = new project($sPrj);
echo "----- $sPrj:\n";
foreach ($oPrj->getActivePhases() as $sPhase) {
echo $oPrj->deploy($sPhase);
$aTmp=$oPrj->getPhaseInfos($sPhase);
echo "$sPhase: ";
if (array_key_exists("version", $aTmp)){
echo $oPrj->deploy($sPhase);
} else {
echo "SKIP - es ist nichts in der Queue<br>\n";
}
}
echo "<br>\n";
}
......
<?php
/**
*
* FOR CRONJOB
* sync archive files
*
*/
require_once(dirname(__DIR__)."/public_html/deployment/config/inc_projects_config.php");
echo "\n========= SYNC archive files ==========\n";
if (array_key_exists('mirrorPackages', $aConfig) && count($aConfig['mirrorPackages']) ){
foreach (array_keys($aConfig["phases"]) as $sPhase){
echo "\n\n===== phase $sPhase \n";
foreach($aConfig['mirrorPackages'] as $sLabel=>$aTarget){
echo "--- $sLabel\n";
if (array_key_exists('type', $aTarget)){
$sCmd=false;
$sSource=$aConfig["packageDir"]."/$sPhase/*";
$sTarget=$aTarget['target']."/$sPhase";
switch ($aTarget['type']) {
case 'rsync':
$sCmd="ls -l $sSource 2>/dev/null && /usr/bin/rsync --delete -rLv $sSource $sTarget";
break;
default:
echo "ERROR: type ".$aTarget['type']." ist not supported (yet) - skipping.";
break;
} // switch
if ($sCmd) {
if ($aTarget['runas']) {
$sCmd="su - " . $aTarget['runas'] . " -c \"" . $sCmd . "\"";
}
echo "\$ $sCmd\n";
$sOut=shell_exec($sCmd);
echo $sOut;
}
}
} // foreach
} // foreach
}
echo "\n\ndone.\n";
<?php
/**
*
* CRONJOB
* sync archive files
*
*/
require_once(dirname(__DIR__)."/public_html/deployment/config/inc_projects_config.php");
echo "\n========= SYNC archive files ==========\n";
if (array_key_exists('mirrorPackages', $aConfig) && count($aConfig['mirrorPackages']) ){
foreach (array_keys($aConfig["phases"]) as $sPhase){
echo "\n\n===== phase $sPhase \n";
foreach($aConfig['mirrorPackages'] as $sLabel=>$aTarget){
echo "--- $sLabel\n";
if (array_key_exists('type', $aTarget)){
$sCmd=false;
$sSource=$aConfig["packageDir"]."/$sPhase/*";
$sTarget=$aTarget['target']."/$sPhase";
switch ($aTarget['type']) {
case 'rsync':
$sCmd="ls -l $sSource 2>/dev/null && /usr/bin/rsync --delete -rLv $sSource $sTarget";
break;
default:
echo "ERROR: type ".$aTarget['type']." ist not supported (yet) - skipping.";
break;
} // switch
if ($sCmd) {
if ($aTarget['runas']) {
$sCmd="su - " . $aTarget['runas'] . " -c \"" . $sCmd . "\"";
}
echo "\$ $sCmd\n";
$sOut=shell_exec($sCmd);
echo $sOut;
}
}
} // foreach
} // foreach
}
echo "\n\ndone.\n";
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment