Skip to content

Instantly share code, notes, and snippets.

@polidog
Last active January 22, 2018 09:52
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 polidog/3f0fcfbbbd9f09ffda03c842559697a1 to your computer and use it in GitHub Desktop.
Save polidog/3f0fcfbbbd9f09ffda03c842559697a1 to your computer and use it in GitHub Desktop.
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