File: /var/www/vhosts/app.ett-dev.2amigos.us/cgi-bin/index.php
<?php
define('TOKEN', 'cUQHbqyOkXWi'); // Token to add as a GitHub or GitLab secret, or as https://www.example.com/?token=secret-token
define('REMOTE_REPOSITORY', 'git@gitlab.com:2amigos/emit.to-panel.git'); // The URL to your repository
define('BRANCH', 'development'); // Deploy only if push is made to branch
define('CLEAN', 'NO'); // Clean local before pull, YES/NO
define('DIR', '/var/www/vhosts/app.ett-dev.2amigos.us/docroot/'); // The path to local repository, this must be an absolute path, ending with slash (/)
define('LOGDIR', '/var/www/vhosts/app.ett-dev.2amigos.us/logs/'); // The path to logs folder, this must be an absolute path, ending with slash (/)
define('GIT', '/usr/bin/git'); // The path to the git executable
define('MAX_EXECUTION_TIME', 3600); // Override for PHP's max_execution_time (may need set in php.ini)
define('BEFORE_PULL', DIR . '.git/hooks/pre-deploy'); // A bash script to execute before pulling, with '/bin/bash -xe' shebang
define('AFTER_PULL', DIR . '.git/hooks/post-deploy'); // A bash script to execute after successfully pulling, with '/bin/bash -xe' shebang
define('ALLOWED_IP', array( // IPs allowed to access directly (still need to indicate token for deploy)
'107.20.185.102',
'138.201.82.136'
));
if (isset($_SERVER['REMOTE_ADDR']) && in_array($_SERVER['REMOTE_ADDR'], ALLOWED_IP) && isset($_GET['viewlog']) && strtolower($_GET['viewlog']) === 'yes') {
require_once('taillog.php');
// show log for ongoing deploy
$tail = new TailLog(readlink(LOGDIR . 'deploy-last.log'));
if(isset($_GET['ajax'])) {
echo $tail->getNewLines($_GET['lastsize'], $_GET['grep'], $_GET['invert']);
die();
}
$tail->generateGUI();
} else {
require_once('deployer.php');
}