deployer/recipe/symfony4.php
Nicolás González 62db938884 Update symfony4.php (#1907)
The .env and .env.<environment> files should be committed to the shared repository because they are the same for all developers and machines. However, the env files ending in .local (.env.local and .env.<environment>.local) should not be committed because only you will use them. In fact, the .gitignore file that comes with Symfony prevents them from being committed.

https://symfony.com/doc/current/configuration.html#managing-multiple-env-files
2019-08-16 13:58:53 +03:00

59 lines
1.4 KiB
PHP

<?php
/* (c) Anton Medvedev <anton@medv.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer;
require_once __DIR__ . '/common.php';
set('shared_dirs', ['var/log', 'var/sessions']);
set('shared_files', ['.env']);
set('writable_dirs', ['var']);
set('migrations_config', '');
set('bin/console', function () {
return parse('{{bin/php}} {{release_path}}/bin/console --no-interaction');
});
desc('Migrate database');
task('database:migrate', function () {
$options = '--allow-no-migration';
if (get('migrations_config') !== '') {
$options = sprintf('%s --configuration={{release_path}}/{{migrations_config}}', $options);
}
run(sprintf('{{bin/console}} doctrine:migrations:migrate %s', $options));
});
desc('Clear cache');
task('deploy:cache:clear', function () {
run('{{bin/console}} cache:clear --no-warmup');
});
desc('Warm up cache');
task('deploy:cache:warmup', function () {
run('{{bin/console}} cache:warmup');
});
desc('Deploy project');
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:writable',
'deploy:cache:clear',
'deploy:cache:warmup',
'deploy:symlink',
'deploy:unlock',
'cleanup',
]);
after('deploy', 'success');