Skip to content

Instantly share code, notes, and snippets.

@exts
Last active January 3, 2018 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exts/1b8ff00e4e158e4eb24f887fc05c2dff to your computer and use it in GitHub Desktop.
Save exts/1b8ff00e4e158e4eb24f887fc05c2dff to your computer and use it in GitHub Desktop.
Deployer 6.0 - Symfony Flex (4.0) Basic Deploy script
<?php
namespace Deployer;
require 'recipe/common.php';
//Project Name
set('application', 'app_name');
// Project repository
set('repository', 'git@bitbucket.org:USER/REPO.git');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
//composer options
set('composer_action', 'update');
set('composer_options', '{{composer_action}} --optimize-autoloader --no-suggest --no-progress');
// Shared files/dirs between deploys
set('shared_files', [
'.env',
]);
set('shared_dirs', [
'var/log'
]);
// Writable dirs by web server
set('writable_dirs', []);
set('allow_anonymous_stats', false);
// Hosts
host('website.net')
->set('deploy_path', '/var/www/website.net');
// Tasks
task('symlink:public', function() {
$output = run('if [ ! -d {{deploy_path}}/www ]; then ln -s {{deploy_path}}/current/public {{deploy_path}}/www; fi;');
});
task('doctrine:update', function() {
$output = run('if [ -f {{deploy_path}}/current/bin/console ]; then php {{deploy_path}}/current/bin/console doctrine:schema:update --force; fi');
writeln('<info>' . $output . '</info>');
});
desc('Deploy project');
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:writable',
'deploy:vendors',
'deploy:clear_paths',
'deploy:symlink',
'deploy:unlock',
'symlink:public',
'cleanup',
'success'
]);
// [Optional] If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
@exts
Copy link
Author

exts commented Jan 3, 2018

Nothing special, but if you want to get a basic app up you can use this as a base. Since almost all your configuration is in the .env file you can share just that file and maybe the logs folder and you're good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment