* deploy script added

* los basepath middleware added
This commit is contained in:
Dávid Danyi 2018-04-20 10:39:53 +02:00
parent 83f6c50af2
commit 8b28a73ed8
6 changed files with 123 additions and 1 deletions

View File

@ -41,6 +41,7 @@
"dasprid/container-interop-doctrine": "^1.1",
"doctrine/orm": "^2.6",
"gedmo/doctrine-extensions": "^2.4",
"los/basepath": "^2.0",
"roave/security-advisories": "dev-master",
"symfony/console": "^4.0",
"tuupola/cors-middleware": "^0.7.0",

50
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "f30cef69b43fa78cf3e1a64684b41ca4",
"content-hash": "dbd785ba02ce109f4eb930114fe2c75a",
"packages": [
{
"name": "behat/transliterator",
@ -914,6 +914,54 @@
],
"time": "2017-03-24T14:48:51+00:00"
},
{
"name": "los/basepath",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/Lansoweb/basepath.git",
"reference": "877187636f157f7f9d336c7808cfb6aeabc1c686"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Lansoweb/basepath/zipball/877187636f157f7f9d336c7808cfb6aeabc1c686",
"reference": "877187636f157f7f9d336c7808cfb6aeabc1c686",
"shasum": ""
},
"require": {
"php": "^7.1",
"psr/container": "^1.0",
"psr/http-message": "~1.0",
"psr/http-server-middleware": "^1.0"
},
"require-dev": {
"phpstan/phpstan": "^0.9.2",
"phpunit/phpunit": "^7.0",
"squizlabs/php_codesniffer": "^2.7",
"zendframework/zend-coding-standard": "^1.0",
"zendframework/zend-diactoros": "^1.0",
"zendframework/zend-expressive-helpers": "^5.0"
},
"type": "library",
"autoload": {
"psr-4": {
"LosMiddleware\\BasePath\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Leandro Silva",
"homepage": "http://leandrosilva.info/"
}
],
"description": "PHP middleware to remove a path prefix from request uri",
"homepage": "https://github.com/lansoweb/basepath",
"time": "2018-03-27T11:46:22+00:00"
},
{
"name": "neomerx/cors-psr7",
"version": "v1.0.12",

View File

@ -0,0 +1,9 @@
<?php
return [
'dependencies' => [
'factories' => [
LosMiddleware\BasePath\BasePath::class => LosMiddleware\BasePath\BasePathFactory::class,
],
],
];

View File

@ -0,0 +1,5 @@
<?php
return [
'los_basepath' => '',
];

View File

@ -23,6 +23,7 @@ return function (Application $app, MiddlewareFactory $factory, ContainerInterfac
// The error handler should be the first (most outer) middleware to catch
// all Exceptions.
$app->pipe(ErrorHandler::class);
$app->pipe(LosMiddleware\BasePath\BasePath::class);
$app->pipe(ServerUrlMiddleware::class);
// Pipe more middleware here that you want to execute on every request:

58
deploy.php Normal file
View File

@ -0,0 +1,58 @@
<?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',
]);
/*
set('shared_dirs', [
'data/persistent',
]);
*/
set('writable_dirs', []);
set('keep_releases', 3);
set('default_stage', 'production');
// Servers
host('vasgyuro.tsp')
->stage('production')
->user('edvidan')
->forwardAgent()
->set('php_service_name', 'php7.1-fpm')
->set('deploy_path', '/home/edvidan/applications/mtastv-api');
desc('Reload PHP-FPM service');
task('php-fpm:reload', function () {
// The user must have rights for restart service
// /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service
run('sudo service {{php_service_name}} reload');
}); //->onlyOn('alfheim');
after('deploy:symlink', 'php-fpm:reload');
desc('Deploy your project');
task('deploy', [
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:writable',
'deploy:vendors',
'deploy:clear_paths',
'deploy:symlink',
'deploy:unlock',
'cleanup',
]);
after('deploy', 'success');