Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example Script to deploy TYPO3 Neos with TYPO3 Surf on uberspace shared hosting
<?php
// TYPO3 Surf script to deploy and update TYPO3 Neos at your uberspace.de account
// before of after the initial deployment, you have to setup some things manually at your host (e.g. DB credentials in Settings.yaml)
// Note: replace placeholders such as [PLACEHOLDER] with the correct information
// Create a simple workflow based on the predefined 'SimpleWorkflow'.
$workflow = new \TYPO3\Surf\Domain\Model\SimpleWorkflow();
// Create and configure a simple shell task to add the FLOW_CONTEXT to your .htaccess file
// If you're using NEOS at your local machine to develop a NEOS site, you won't add this file and this setting to your Git repo...
$editHtaccessCommandOptions = array(
'command' => 'echo -e "\nSetEnv FLOW_CONTEXT Production \n" >> {releasePath}/Web/.htaccess'
);
$workflow->defineTask('[foobar]:editHtaccess', 'typo3.surf:shell', $editHtaccessCommandOptions);
$workflow->addTask('[foobar]:editHtaccess', 'finalize');
// Add the workflow to the deployment. The $deployment instance is created by Surf.
$deployment->setWorkflow($workflow);
// Create and configure your node / nodes (host / hosts).
$node = new \TYPO3\Surf\Domain\Model\Node('uberspace');
$node->setHostname('[username].[host].uberspace.de');
// If you don't use SSH-Keys to log into your remote host via SSH (as recommended),
// you have to to add the following line:
// $node->setOption('password', '[PASSWORD]');
// But you don't want to have any passwords as string in your deployment script ;-)
$node->setOption('username', '[username]');
// Define your application and add it to your node.
$application = new \TYPO3\Surf\Application\TYPO3\Flow('[sitename]');
// The deployment path is not the document root!
// The document root has to be: '[deploymentPath]/releases/current/Web'.
// At uberspace: create a symlink from '/var/www/virtual/[user]/html' to '[deploymentPath]/release/current/Web'
$application->setDeploymentPath('/var/www/virtual/[username]/[sitename]');
// Be sure, that your node has read-access to your git repository.
// In most cases, you can use the git- or https-protocol for public repositories or
// SSH to read from private repositories.
$application->setOption('repositoryUrl', '[urlToYourNeosDistributionGitRepository]');
// Be sure, that you have installed composer
$application->setOption('composerCommandPath', '/home/[username]/bin/composer');
$application->setOption('keepReleases', '5');
$application->addNode($node);
// remove unused task.
// you can't run a command with "sudo" at shared hosting environments
$deployment->onInitialize(function() use ($workflow, $application) {
$workflow->removeTask('typo3.surf:typo3:flow:setfilepermissions');
});
// Add the application to your deployment.
$deployment->addApplication($application);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.