Instantly share code, notes, and snippets.

@polidog /deploy.php
Last active Jan 22, 2018

Embed
What would you like to do?
Deployer with symfony4
<?php
namespace Deployer;
require 'recipe/symfony3.php';
// Project name
set('application', 'sf4-todo');
// Project repository
set('repository', 'git@github.com:polidog/sf4-todo.git');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
// Shared files/dirs between deploys
set('shared_files', []);
set('assets', ['public/pub', 'public/images', 'public/js']);
// Hosts
host('your server')
->stage('dev')
->user("deploy")
->set('symfony_env', 'prod')
->set('composer_options', 'install --verbose --prefer-dist --optimize-autoloader --no-progress --no-interaction --no-scripts')
->set('deploy_path', '/var/www/sf4-todo');
// Tasks
task('build', function () {
run('cd {{release_path}} && build');
});
task('deploy:assets:install', function () {
run('{{bin/php}} {{bin/console}} assets:install {{console_options}} {{release_path}}/public');
})->desc('Install bundle assets');
// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
// Migrate database before symlink new release.
before('deploy:symlink', 'database:migrate');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment