$application->setDeploymentPath(getenv('DEPLOYMENT_PATH'));
} else {
    throw new \Exception('Deployment path must be set in the DEPLOYMENT_PATH env variable.');
}
$application->setOption('repositoryUrl', 'git://git.typo3.org/Sites/NeosTypo3Org.git');
$application->setOption('sitePackageKey', 'TYPO3.NeosTypo3Org');
$application->setOption('keepReleases', 50);
$application->setOption('composerCommandPath', 'php /var/www/vhosts/neos.typo3.org/home/composer.phar');
$deployment->addApplication($application);
$workflow = new SimpleWorkflow();
# $workflow->setEnableRollback(FALSE);
$deployment->setWorkflow($workflow);
$deployment->onInitialize(function () use($workflow, $application) {
    $workflow->removeTask('typo3.surf:flow3:setfilepermissions');
    $workflow->removeTask('typo3.surf:flow3:copyconfiguration');
    $workflow->removeTask('typo3.surf:typo3:importsite');
});
#$workflow->afterTask('typo3.surf:symlinkrelease', array('typo3.surf:varnishpurge'), $application);
if (getenv('DEPLOYMENT_HOST')) {
    $hostName = getenv('DEPLOYMENT_HOST');
} else {
    throw new \Exception('Deployment host name must be set in the DEPLOYMENT_HOST env variable.');
}
$node = new Node($hostName);
$node->setHostname($hostName);
if (getenv('DEPLOYMENT_USERNAME')) {
    $node->setOption('username', getenv('DEPLOYMENT_USERNAME'));
} else {
    throw new \Exception('Username must be set in the DEPLOYMENT_USERNAME env variable.');
}
$application->addNode($node);
<?php

use TYPO3\Surf\Domain\Model\Workflow;
use TYPO3\Surf\Domain\Model\Node;
use TYPO3\Surf\Domain\Model\SimpleWorkflow;
$application = new \Famelo\Surf\SharedHosting\Application\Flow();
$application->setOption('repositoryUrl', '{repositoryUrl}');
$application->setDeploymentPath('{directory}');
$application->setOption('keepReleases', 3);
$application->setOption('defaultContext', 'Production');
$application->setOption('composerCommandPath', '/html/composer.phar');
$application->setHosting('Mittwald');
$application->setOption('transferMethod', 'rsync');
$application->setOption('packageMethod', 'git');
$application->setOption('updateMethod', NULL);
$deployment->addApplication($application);
$workflow = new SimpleWorkflow();
$workflow->setEnableRollback(FALSE);
$workflow->afterTask('typo3.surf:typo3:flow:copyconfiguration', array('famelo.surf.sharedhosting:downloadbeard', 'famelo.surf.sharedhosting:beardpatch'), $application);
$deployment->setWorkflow($workflow);
$node = new Node('{host}');
$node->setHostname('{host}');
$node->setOption('username', '{user}');
$application->addNode($node);
$deployment->addApplication($application);
$application->setOption('packageMethod', 'git');
$application->setOption('updateMethod', NULL);
$application->setContext('Production');
$application->setDeploymentPath('/home/hostroot/sites/langeland/iotdemo');
$application->setOption('keepReleases', 2);
$deployment->addApplication($application);
$workflow = new SimpleWorkflow();
$workflow->setEnableRollback(TRUE);
// Prevent local Settings.yaml from being transferred
$workflow->defineTask('typo3.surf:shell:removeLocalConfiguration', 'typo3.surf:shell', array('command' => 'cd "{releasePath}" && rm -f Configuration/Settings.yaml'));
$workflow->beforeStage('migrate', array('typo3.surf:shell:removeLocalConfiguration'), $application);
// Remove resource links since they're absolute symlinks to previous releases (will be generated again automatically)
$workflow->defineTask('typo3.surf:shell:unsetResourceLinks', 'typo3.surf:shell', array('command' => 'cd {releasePath} && rm -rf Web/_Resources/Persistent/*(N)'));
$workflow->beforeStage('switch', array('typo3.surf:shell:unsetResourceLinks'), $application);
$workflow->afterStage('switch', 'typo3.surf:typo3:flow:publishresources', $application);
// Clear PHP 5.5+ OpCache (required for php-fpm)
//$resetScriptFilename = 'surf-opcache-reset-' . uniqid() . '.php';
//$workflow->defineTask('fn:clearopcache',
//	'typo3.surf:shell',
//	array('command' => 'cd {currentPath}/Web && echo "<?php if (function_exists(\"opcache_reset\")) { opcache_reset(); } @unlink(__FILE__); echo \"cache cleared\";" > ' . $resetScriptFilename . ' && curl -s "http://kmcpr-live.lombard.pil.dk/' . $resetScriptFilename . '" && rm -rf ' . $resetScriptFilename)
//);
//$workflow->afterStage('switch', array('fn:clearopcache'), $application);
$deployment->setWorkflow($workflow);
$deployment->onInitialize(function () use($workflow, $application) {
    $workflow->setTaskOptions('typo3.surf:generic:createDirectories', array('directories' => array('shared/Data/Web/_Resources', 'shared/Data/Session')));
    $workflow->setTaskOptions('typo3.surf:generic:createSymlinks', array('symlinks' => array('Web/_Resources' => '../../../shared/Data/Web/_Resources/', 'Data/Session' => '../../../shared/Data/Session/')));
});
$node = new Node('Flab');
$node->setHostname('ny.flab.dk');
$node->setOption('username', 'langeland');
$application->addNode($node);