* things
This commit is contained in:
parent
d27ff7d574
commit
9e5f4c7f68
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "zendframework/zend-expressive-skeleton",
|
||||
"description": "Zend expressive skeleton. Begin developing PSR-15 middleware applications in seconds!",
|
||||
"name": "mtas/mtas-tv-backend",
|
||||
"description": "MTAS-TV backend api",
|
||||
"type": "project",
|
||||
"homepage": "https://github.com/zendframework/zend-expressive-skeleton",
|
||||
"homepage": "https://gogs.ragnarok.yvan.hu/MTAS/mtas-tv-backend",
|
||||
"license": "BSD-3-Clause",
|
||||
"keywords": [
|
||||
"skeleton",
|
||||
@ -63,7 +63,8 @@
|
||||
"zendframework/zend-json": "^3.1",
|
||||
"zendframework/zend-log": "^2.10",
|
||||
"zendframework/zend-servicemanager": "^3.3",
|
||||
"zendframework/zend-stdlib": "^3.1"
|
||||
"zendframework/zend-stdlib": "^3.1",
|
||||
"ext-posix": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.0.1",
|
||||
|
||||
79
deploy-local-build.php
Normal file
79
deploy-local-build.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
namespace Deployer;
|
||||
require 'recipe/common.php';
|
||||
|
||||
// Configuration
|
||||
set('ssh_type', 'native');
|
||||
set('ssh_multiplexing', true);
|
||||
|
||||
#set('repository', 'https://gogs.ragnarok.yvan.hu/MTAS/mtas-tv-backend.git');
|
||||
set('shared_files', [
|
||||
'config/autoload/local.php',
|
||||
'config/autoload/los-basepath.local.php',
|
||||
'config/autoload/doctrine.local.php',
|
||||
'data/production.db',
|
||||
]);
|
||||
/*
|
||||
set('shared_dirs', [
|
||||
'data/persistent',
|
||||
]);
|
||||
*/
|
||||
set('writable_dirs', [
|
||||
'data/cache',
|
||||
'data/logs',
|
||||
]);
|
||||
set('keep_releases', 3);
|
||||
set('default_stage', 'production');
|
||||
|
||||
|
||||
// Servers - mtas : esekivws5222a.rnd.ki.sw.ericsson.se
|
||||
host('mtas')
|
||||
->stage('production')
|
||||
->user('edvidan')
|
||||
->forwardAgent()
|
||||
->set('deploy_path', '/proj/webdocs/mtoolbox/root/mtastv-inst/backend');
|
||||
|
||||
|
||||
task('build', function() {
|
||||
run('composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader');
|
||||
run('composer archive --file=release-pkg');
|
||||
run('tar -czf vendor-pkg.tar.gz vendor');
|
||||
})->local();
|
||||
|
||||
task('upload', function() {
|
||||
upload('release-pkg.tar', '{{release_path}}');
|
||||
upload('vendor-pkg.tar.gz', '{{release_path}}');
|
||||
cd('{{release_path}}');
|
||||
run('tar -xf release-pkg.tar');
|
||||
run('tar -xzf vendor-pkg.tar.gz');
|
||||
});
|
||||
|
||||
task('clean-uploaded', function() {
|
||||
cd('{{release_path}}');
|
||||
run('rm -f release-pkg.tar vendor-pkg.tar.gz');
|
||||
});
|
||||
|
||||
task('restore-dev', function() {
|
||||
run('composer install --verbose --no-progress --no-interaction');
|
||||
})->local();
|
||||
|
||||
task('release', [
|
||||
'deploy:lock',
|
||||
'deploy:prepare',
|
||||
'deploy:release',
|
||||
'upload',
|
||||
'clean-uploaded',
|
||||
'deploy:shared',
|
||||
'deploy:writable',
|
||||
'deploy:symlink',
|
||||
'deploy:unlock',
|
||||
]);
|
||||
|
||||
desc('Deploy your project');
|
||||
task('deploy', [
|
||||
'build',
|
||||
'release',
|
||||
'cleanup',
|
||||
'restore-dev',
|
||||
'success',
|
||||
]);
|
||||
10
deploy.php
10
deploy.php
@ -23,14 +23,6 @@ set('keep_releases', 3);
|
||||
set('default_stage', 'production');
|
||||
|
||||
|
||||
// Servers - mtas : esekivws5222a.rnd.ki.sw.ericsson.se
|
||||
host('mtas')
|
||||
->stage('production')
|
||||
->user('edvidan')
|
||||
->forwardAgent()
|
||||
->set('php_service_name', 'php7.1-fpm')
|
||||
->set('deploy_path', '/proj/webdocs/mtoolbox/root/mtastv-api');
|
||||
|
||||
host('vasgyuro.tsp')
|
||||
->stage('staging')
|
||||
->user('edvidan')
|
||||
@ -45,7 +37,7 @@ task('php-fpm:reload', function () {
|
||||
// /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service
|
||||
run('sudo service {{php_service_name}} reload');
|
||||
});
|
||||
after('deploy:symlink', 'php-fpm:reload')->onlyOn('vasgyuro.tsp');
|
||||
after('deploy:symlink', 'php-fpm:reload');
|
||||
|
||||
|
||||
desc('Deploy your project');
|
||||
|
||||
@ -6,6 +6,7 @@ namespace App\Command;
|
||||
|
||||
use App\Service\JiraCollectorService;
|
||||
use App\Service\TeamService;
|
||||
use LosMiddleware\LosLog\StaticLogger;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@ -66,11 +67,10 @@ class UpdatePageCachesCommand extends Command
|
||||
|
||||
/**
|
||||
* Create the lock file
|
||||
* @return bool
|
||||
*/
|
||||
private function createLock(): bool
|
||||
private function createLock(): void
|
||||
{
|
||||
return touch(self::LOCK_FILE);
|
||||
file_put_contents(self::LOCK_FILE, posix_getpid());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,11 +83,26 @@ class UpdatePageCachesCommand extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if lock file exists
|
||||
* Check if lock file exists, also removes stale lock
|
||||
* @return bool
|
||||
* @throws \LosMiddleware\LosLog\Exception\InvalidArgumentException
|
||||
*/
|
||||
private function isLocked(): bool
|
||||
{
|
||||
return file_exists(self::LOCK_FILE);
|
||||
if (!file_exists(self::LOCK_FILE)) {
|
||||
return false;
|
||||
}
|
||||
StaticLogger::save("[1] LOCK file exists.");
|
||||
|
||||
$pid = (int)file_get_contents(self::LOCK_FILE);
|
||||
if (posix_getpgid($pid)) {
|
||||
StaticLogger::save("[2] PID is running");
|
||||
$binPath = readlink("/proc/${pid}/exe");
|
||||
$binName = basename($binPath);
|
||||
return substr($binName, 0, 3) === 'php';
|
||||
}
|
||||
|
||||
StaticLogger::save("[2] No process found.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user