Skip to content

Instantly share code, notes, and snippets.

@passionweb-manuel-schnabel
Last active January 26, 2024 11:44
Show Gist options
  • Save passionweb-manuel-schnabel/cc290452d03fd24764ec22cc70783c12 to your computer and use it in GitHub Desktop.
Save passionweb-manuel-schnabel/cc290452d03fd24764ec22cc70783c12 to your computer and use it in GitHub Desktop.
TYPO3 (v12) deployment with PHP Deployer (only deployer.php file)
<?php
namespace Deployer;
require 'recipe/common.php';
/**
* Configuration for TYPO3 deployment (v12)
* Based on a Hetzner server and a GitHub repository
* Deployer version: 7.3.3
* Default TYPO3 recipe: vendor/deployer/deployer/recipe/typo3.php
* More general details under https://deployer.org/docs/7.x/getting-started
*
* It is possible that the configurations need to be expanded in addition
* to the "placeholder" parameters or adapted to the existing server structure
*/
// One of:
// - chown
// - chgrp
// - chmod
// - acl
// - sticky
// - skip
set('writable_mode', 'chmod');
// set your repository which should be deployed
set('repository', 'git@github.com:organization-name/deploy-typo3.git');
// set your branch which shold be deployed
set('branch', 'deploy/typo3-v12');
// set releases to keep
set('keep_releases', 3);
// set your TYPO3 webroot
set('typo3_webroot', 'public');
// disable use of multiple interactive sessions or multiple tunneled connections
set('ssh_multiplexing', false);
// server/host configuration
host('deploy-typo3-v12')
->set('hostname', '123456.your-server.de') // hostname or IP address
->set('remote_user', 'your_remote_user') // default: RemoteUser from ~/.ssh/config file or current OS username
->set('deploy_path', '/path/to/typo3') // absolute path on the server
->set('identity_file', '~/.ssh/id_rsa') // private key for SSH authentication
->set('port', 222) // default: 22
->set('labels', ['stage' => 'staging']); // optional: host selector (useful if you have multiple hosts)
// shared TYPO3 directories
add('shared_dirs', [
'config',
'{{typo3_webroot}}/fileadmin',
'{{typo3_webroot}}/typo3temp'
]);
// shared TYPO3 files
add('shared_files', [
'{{typo3_webroot}}/.htaccess',
'{{typo3_webroot}}/.htpasswd'
]);
// writeable TYPO3 directories
add('writable_dirs', [
'config',
'var',
'{{typo3_webroot}}/_assets',
'{{typo3_webroot}}/fileadmin',
'{{typo3_webroot}}/typo3temp',
'{{typo3_webroot}}/typo3conf'
]);
// define specific TYPO3 setup tasks
task('deploy:setup_typo3', function () {
cd('{{release_path}}');
run('php composer install --no-dev 2>&1');
// add your required TYPO3 setup tasks here
});
// sample task (could be executed with "vendor/bin/dep test_task -v")
task('test_task', function () {
run('whoami');
});
// define main TYPO3 deployment task
// run with "vendor/bin/dep deploy"
desc('Deploys your project');
task('deploy', [
'deploy:prepare', // see vendor/deployer/deployer/recipe/common.php for single steps
'deploy:setup_typo3',
'deploy:publish', // see vendor/deployer/deployer/recipe/common.php for single steps
]);
// define tasks to run after specific task
// also possible to define task that run before other tasks
after('deploy:failed', 'deploy:unlock');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment