This repository has been archived by the owner on Apr 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.php
70 lines (54 loc) · 1.99 KB
/
deploy.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace Deployer;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Dotenv\Dotenv;
require_once __DIR__.'/vendor/autoload.php';
require 'recipe/symfony.php';
$dotenv = new Dotenv();
$dotenv->loadEnv(__DIR__.'/.env.local');
// Le nom de votre projet
set('application', 'api-caencamp');
// Hosts
host('caencamp')
->forwardAgent()
/* ->port($_ENV['DEPLOYER_REPO_PORT']) */
/* ->hostname($_ENV['DEPLOYER_REPO_HOSTNAME']) */
->set('deploy_path', '/home/php-app/{{application}}')
;
// Nombre de déploiements à conserver avant de les supprimer.
set('keep_releases', 4);
// Votre repo
set('repository', 'git@github.com:CaenCamp/api-caencamp.git');
set('bin_dir', 'bin');
set('clear_paths', ['var/cache']);
add('shared_files', ['.env.local']); // vous pouvez ajouter des fichiers partagés et surcharger la recette de base
add('shared_dirs', []); // vous pouvez ajouter des dossiers partagés et surcharger la recette de base
// vous pouvez surcharger la recette de base en réécrivant la fonction
task('deploy:vendors', function () {
if (!commandExist('unzip')) {
writeln('To speed up composer installation setup "unzip" command with PHP zip extension https://goo.gl/sxzFcD');
}
run('cd {{release_path}} && {{bin/composer}} install --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader');
});
task('deploy:assets:install', function () {
run('{{bin/php}} {{bin/console}} assets:install {{console_options}} --symlink');
})->desc('Install bundle assets');
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:clear_paths',
'deploy:shared',
'deploy:vendors',
'deploy:cache:clear',
'deploy:cache:warmup',
'deploy:writable',
'deploy:assets:install',
'deploy:symlink',
'deploy:unlock',
'cleanup',
])->desc('Deploy your project');
after('deploy:failed', 'deploy:unlock');