diff --git a/composer.json b/composer.json index 5572f63..17f5212 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ }, "require": { "php": "^7.1", + "los/basepath": "^1.0", "roave/security-advisories": "dev-master", "zendframework/zend-component-installer": "^1.0", "zendframework/zend-config": "^3.1", diff --git a/composer.lock b/composer.lock index cdc6349..619e74e 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "50100ee3d1e0aedcc8bc64b5a81c8b44", + "content-hash": "14eac04b4180a20ff231172a7ad1c5ac", "packages": [ { "name": "container-interop/container-interop", @@ -194,6 +194,49 @@ ], "time": "2016-12-28T00:14:17+00:00" }, + { + "name": "los/basepath", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Lansoweb/basepath.git", + "reference": "8a40de843a4c7cf1fdac51d7e33c7dfbcfb08d29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Lansoweb/basepath/zipball/8a40de843a4c7cf1fdac51d7e33c7dfbcfb08d29", + "reference": "8a40de843a4c7cf1fdac51d7e33c7dfbcfb08d29", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "~1.1", + "php": "^7.0", + "psr/http-message": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0", + "zendframework/zend-diactoros": "^1.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": "2016-08-27T20:56:32+00:00" + }, { "name": "nikic/fast-route", "version": "v1.2.0", @@ -3202,7 +3245,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^5.6 || ^7.0" + "php": "^7.1" }, "platform-dev": [] } diff --git a/config/autoload/los-basepath.global.php.dist b/config/autoload/los-basepath.global.php.dist new file mode 100644 index 0000000..2667a1e --- /dev/null +++ b/config/autoload/los-basepath.global.php.dist @@ -0,0 +1,10 @@ + '', + 'dependencies' => [ + 'factories' => [ + LosMiddleware\BasePath\BasePath::class => LosMiddleware\BasePath\BasePathFactory::class, + ], + ], +]; diff --git a/config/pipeline.php b/config/pipeline.php index c551918..8ebfd96 100644 --- a/config/pipeline.php +++ b/config/pipeline.php @@ -14,6 +14,7 @@ use Zend\Stratigility\Middleware\ErrorHandler; // 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: diff --git a/deploy.php b/deploy.php new file mode 100644 index 0000000..3242118 --- /dev/null +++ b/deploy.php @@ -0,0 +1,58 @@ +stage('production') + ->user('edvidan') + ->forwardAgent() + ->set('php_service_name', 'php7.1-fpm') + ->set('deploy_path', '/home/edvidan/applications/support-jira-graph'); + + +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');