Skip to content

Instantly share code, notes, and snippets.

@kitsunet
Created July 2, 2014 14:30
Show Gist options
  • Select an option

  • Save kitsunet/a069c2ea3fdf1ebd65d5 to your computer and use it in GitHub Desktop.

Select an option

Save kitsunet/a069c2ea3fdf1ebd65d5 to your computer and use it in GitHub Desktop.
example surf deployment script. Belongs into Build/Surf and then can be invoked by ./flow surf:deploy basic-deployment
<?php
$repository = getenv('REPO');
$branch = getenv('BRANCH');
use \TYPO3\Surf\Domain\Model\Node;
use \TYPO3\Surf\Domain\Model\SimpleWorkflow;
$application = new \TYPO3\Surf\Application\TYPO3\Neos();
$application->setOption('repositoryUrl', 'git://some.url.here/' . $repository);
/**
* given REPO=foo and BRANCH=bar
* deploy to /var/www/htdocs/foo-bar/
* in there you will have the following folder structure:
* releases
* 2134234234234 (some timestamp)
* current (the latest release you should symlink your htdocs to releases/current/Web)
* shared (in there should be files that are kept between releases, so shared/Data/Persistent and shared/Configuration/Settings.yaml)
*/
$application->setDeploymentPath('/var/www/htdocs/' . $repository . '-' . $branch);
// past releases to keep (important for emergency rollbacks)
$application->setOption('keepReleases', 2);
$application->setOption('transferMethod', 'git');
$application->setOption('typo3.surf:gitCheckout[branch]', $branch);
/**
* @var $deployment \TYPO3\Surf\Domain\Model\Deployment
*/
$deployment->addApplication($application);
$workflow = new SimpleWorkflow();
$workflow->setEnableRollback(FALSE);
$deployment->setWorkflow($workflow);
// your name here
$node = new Node('Dev Server');
// IP / hostname
$node->setHostname('localhost');
$application->addNode($node);
$deployment->addApplication($application);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment