Skip to content

Instantly share code, notes, and snippets.

@igancev
Created December 21, 2017 09:34
Show Gist options
  • Save igancev/2a70cce653eacd575940c9a4bd08db6b to your computer and use it in GitHub Desktop.
Save igancev/2a70cce653eacd575940c9a4bd08db6b to your computer and use it in GitHub Desktop.
deployer-yii2-advanced
<?php
namespace Deployer;
require 'recipe/yii2-app-advanced.php';
/*
* Configuration
*/
set('bin/php', '/opt/php70/bin/php');
set('repository', 'https://***@bitbucket.org/***/***.git');
set('git_tty', true); // [Optional] Allocate tty for git on first deployment
set('shared_dirs', [
'frontend/runtime',
'backend/runtime',
'console/runtime',
'common/runtime',
'frontend/web/upload', // это опционально
]);
set('copy_dirs', ['frontend/web/upload']); // это опционально
/*
* Hosts
*/
// production
host('92.53.**.**')
->stage('production')
->user('***')
->set('deploy_path', '/home/c/***/app')
->forwardAgent();
/*
* Tasks
*/
// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
// ниже опционально, если надо бэкенд с фронтом на одном домене держать
/*
* ставим симлинк на таймвебе
*/
task('deploy:simlinkFrontToBack', function () {
run('ln -s /home/c/***/app/current/backend/web /home/c/**/app/current/frontend/web/backend');
})->desc('Simlink frontend/backend to backend');
// перед успешным деплоем ставим симлинк
after('cleanup', 'deploy:simlinkFrontToBack');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment