PHP code example of m-adamski / symfony-deployer-bundle
1. Go to this page and download the library: Download m-adamski/symfony-deployer-bundle 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/ */
m-adamski / symfony-deployer-bundle example snippets
namespace Deployer;
/**
* Global Configuration
*/
set("application", "example-application");
set("repository", "[email protected] :m-adamski/example-application.git");
set("ssh_multiplexing", false);
set("git_tty", false);
set("shared_dirs", ["var/log"]);
set("shared_files", [".env.local"]);
set("writable_dirs", ["var"]);
set("sudo_password", function () {
return askHiddenResponse("[sudo] password: ");
});
set("allow_anonymous_stats", false);
namespace Deployer;
nfig.php";
/**
* Additional workflow events
*/
before("deploy:writable", "deploy:writable:prepare");
after("deploy:cache:warmup", "deploy:restart:php");
after("deploy:failed", "deploy:unlock");
namespace Deployer;
/**
* Hosts
*/
host("example.com")
->stage("production")
->user("deployer")
->identityFile(__DIR__ . "/.ssh/production/deployer_rsa")
->addSshOption("UserKnownHostsFile", "/dev/null")
->addSshOption("StrictHostKeyChecking", "no")
->set("php_version", "php7.2-fpm")
->set("deploy_path", "/var/www/vhosts/example.com")
->set("branch", "master");
namespace Deployer;
task("deploy:restart:php", function () {
run("echo '{{ sudo_password }}' | sudo -S service {{ php_version }} restart");
})->desc("Restart PHP");
task("deploy:writable:prepare", function () {
$dirs = join(" ", get("writable_dirs"));
cd("{{ release_path }}");
run("echo '{{ sudo_password }}' | sudo -S setfacl -RL -m mask:rwX $dirs");
})->desc("Prepare writable");