-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.php
47 lines (39 loc) · 1.25 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
<?php
require_once __DIR__ . '/bin/symfony.php';
require_once __DIR__ . '/vendor/autoload.php';
$yaml = new \Symfony\Component\Yaml\Yaml();
$parameters = $yaml->parse(__DIR__ . '/app/config/parameters.yml');
server('staging', $parameters['parameters']['prod_server_ip'])
->path('/var/www/' . $parameters['parameters']['domain'])
->user('root', $parameters['parameters']['prod_server_pass'])
;
set('repository', $parameters['parameters']['https_github_repository_url']);
set('env', 'dev');
task('deploy:staging:end', function () {
run('chmod 777 -R current/app/cache current/app/logs');
run('cp current/web/app.php current/web/app_dev.php');
run("sed -i -e 's,prod,dev,g' current/web/app_dev.php");
run("sed -i -e 's,app.php,app_dev.php,g' current/web/.htaccess");
});
/**
* Main task
*/
task('deploy:staging', [
'deploy:start',
'deploy:prepare',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'mongodb:fixtures:reload',
'deploy:symlink',
'deploy:staging:end',
'cleanup',
'deploy:end'
])->desc('Deploy your project');
/**
* Success message
*/
after('deploy:staging', function () {
$host = config()->getHost();
writeln("<info>Successfully deployed on</info> <fg=cyan>$host</fg=cyan>");
});