Wallogit.com
2017 © Pedro Peláez
Bitbucket webhook auto deployer
Process Bitbucket webhook 2.0, please be advise that this is a work in progress., (*1)
Using composer, (*2)
$ composer require tiorafa/autodeploy
Create a PHP similar to this:, (*3)
<?php
require_once 'composer/autoload.php'; // autoloader
use AutoDeploy\Handler;
$Handler = new Handler();
$Handler->add('team/repo_name', [
'branch' => 'master',
'folder' => 'folder_name',
'destination' => '/var/www/test/repos'
]);
$Handler->register();
Point Bitbucket's webhook to that file., (*4)
The user running php must be configured correctly. Please make sure to check any of the following steps., (*5)
To figure out who is running run whoami in a php script, create a file with the following code:, (*6)
<?php
exec('whoami');
Common values are:, (*7)
The following steps will use www-data but please change it to what ever user your php is running from., (*8)
Make your sure destination is writable for www-data, (*9)
$ sudo chown www-data {destination_path}
$ sudo -u www-data ssh-keygen -t rsa
You may need to create a .ssh directory somewhere in the file system with access for www-data., (*10)