1. Go to this page and download the library: Download webtown/deployer-recipes library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
webtown / deployer-recipes example snippets
/**
* Created by IntelliJ IDEA.
* User: chris
* Date: 2017.02.17.
* Time: 16:37
*/
namespace Tests\Webtown\DeployerRecipesBundle\Template;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Component\Filesystem\Filesystem;
use Webtown\DeployerRecipesBundle\Template\AbstractDirectoryTwigTemplate;
class MySymfonyDeployerTemplate extends AbstractDirectoryTwigTemplate
{
// Vars for templates
protected $type;
protected $info;
protected $username;
protected $host;
public function getDirectory()
{
return implode(DIRECTORY_SEPARATOR, [
__DIR__,
'..',
'Resources',
'Template',
'mySymfonyDeployerTemplateStructure',
]);
}
public function build(InputInterface $input, OutputInterface $output, Command $command)
{
// Ask informations
$helper = $command->getHelper('question');
$typeQuestion = new Question('Please set type', false);
$this->type = $helper->ask($input, $output, $typeQuestion);
$infoQuestion = new Question('Please set info', false);
$this->info = $helper->ask($input, $output, $infoQuestion);
$usernameQuestion = new ChoiceQuestion(
'Please select username',
['root', 'admin', 'barfoo'],
0
);
$this->username = $helper->ask($input, $output, $usernameQuestion);
$hostQuestion = new Question('Please set host', 'company.com');
$this->host = $helper->ask($input, $output, $hostQuestion);
parent::build($input, $output, $command);
}
public function getTemplateParameters()
{
return [
'name' => 'Test',
'type' => $this->type,
'info' => $this->info,
'username' => $this->username,
'host' => $this->host,
];
}
public function getName()
{
return 'My Symfony Deployer Template';
}
}
namespace Deployer;
// include base
n/deployer-recipes/recipes/symfony.php';
const SERVER_CONFIGURATION_FILE_PATH = 'app/config/deploy/servers.yml';
if (!file_exists(SERVER_CONFIGURATION_FILE_PATH)) {
throw new \Exception(sprintf('Nem lett még létrehozva a szerver konfigurációs fájlod a `%s` helyen!', SERVER_CONFIGURATION_FILE_PATH));
}
serverList(SERVER_CONFIGURATION_FILE_PATH);
set('repository', '[email protected]:webtown-php/project.git');
set('enable_mysql_database_create', true);
namespace Deployer;
// include base
cipes/common.php';
// include extension (it contains WT symfony.php)
ILE_PATH)) {
throw new \Exception(sprintf('Nem lett még létrehozva a szerver konfigurációs fájlod a `%s` helyen!', SERVER_CONFIGURATION_FILE_PATH));
}
serverList(SERVER_CONFIGURATION_FILE_PATH);
set('repository', '[email protected]:webtown-php/project.git');
namespace Deployer;
// include base
n/deployer-recipes/recipes/common.php';
CONFIGURATION_FILE_PATH = 'app/config/deploy/servers.yml';
if (!file_exists(SERVER_CONFIGURATION_FILE_PATH)) {
throw new \Exception(sprintf('Nem lett még létrehozva a szerver konfigurációs fájlod a `%s` helyen!', SERVER_CONFIGURATION_FILE_PATH));
}
serverList(SERVER_CONFIGURATION_FILE_PATH);
set('repository', '[email protected]:webtown-php/project.git');
namespace Deployer;
// include base
n/deployer-recipes/recipes/common.php';
// ...
// !!!! Register tasks
before('database:migrate', 'maintenance:lock');
// You don't have to unlock after deploy, because there is a new, clean `web` path without maintenance.html!
after('rollback', 'maintenance:unlock');
yml
prod:
stage: prod
host: host.com
user: user
# if you are using key
forward_agent: true
# if you are using different php version
'bin/php': /usr/local/php/php5.6/bin/php
'bin/composer': /usr/local/php/php5.6/bin/php /usr/local/bin/composer
deploy_path: /var/www/project
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.