add deployer dependency and its configuration

This commit is contained in:
Rev 2021-10-11 09:43:03 +09:00
parent f2d685ad48
commit b8591bd50b
3 changed files with 110 additions and 5 deletions

View File

@ -9,6 +9,7 @@
"laravel/lumen-framework": "^8.0"
},
"require-dev": {
"deployer/dist": "^6.8",
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^9.3"

45
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e8bc64e95c46d5057ad773282c0bbd78",
"content-hash": "1ebb9c18e0dba807db35d97dec0b4a87",
"packages": [
{
"name": "asm89/stack-cors",
@ -5080,6 +5080,43 @@
}
],
"packages-dev": [
{
"name": "deployer/dist",
"version": "v6.8.0",
"source": {
"type": "git",
"url": "https://github.com/deployphp/distribution.git",
"reference": "857158fa5466d5135ce87f07fe67779b6b6a13d2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/deployphp/distribution/zipball/857158fa5466d5135ce87f07fe67779b6b6a13d2",
"reference": "857158fa5466d5135ce87f07fe67779b6b6a13d2",
"shasum": ""
},
"bin": [
"dep"
],
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anton Medvedev",
"email": "anton@medv.io"
}
],
"description": "Deployer Phar Distribution",
"homepage": "https://deployer.org",
"support": {
"docs": "https://deployer.org/docs",
"issues": "https://github.com/deployphp/deployer/issues",
"source": "https://github.com/deployphp/deployer"
},
"time": "2020-04-25T18:48:50+00:00"
},
{
"name": "doctrine/instantiator",
"version": "1.4.0",
@ -7229,9 +7266,7 @@
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^7.3|^8.0"
},
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.0.0"
}

69
deploy.php Normal file
View File

@ -0,0 +1,69 @@
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Project name
set('application', 'SPT-Items-API');
// Project repository
set('repository', 'https://dev.sp-tarkov.com/Rev/spt-items-api.git');
set('shared_dirs', [
'storage/app',
'storage/framework/cache',
'storage/framework/sessions',
'storage/framework/views',
'storage/logs',
]);
// Writable dirs by web server
add('writable_dirs', []);
set('writable_use_sudo', false);
// Hosts
host('spt-server')
->multiplexing(false)
->become('apache')
->set('deploy_path', '/var/www/html');
task('artisan:cache:clear', function () {
run('{{bin/php}} {{release_path}}/artisan cache:clear');
})->desc('Execute artisan cache:clear');
task('deploy:vendors', function () {
run('cd {{release_path}} && /usr/local/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader --no-suggest');
})->desc('installing composer packages');
task('artisan:config:cache', function() {})->setPrivate();
task('artisan:down', function() {})->setPrivate();
task('artisan:event:cache', function() {})->setPrivate();
task('artisan:event:clear', function() {})->setPrivate();
task('artisan:horizon:terminate', function() {})->setPrivate();
task('artisan:optimize', function() {})->setPrivate();
task('artisan:optimize:clear', function() {})->setPrivate();
task('artisan:route:cache', function() {})->setPrivate();
task('artisan:storage:link', function() {})->setPrivate();
task('artisan:up', function() {})->setPrivate();
task('artisan:view:cache', function() {})->setPrivate();
task('artisan:view:clear', function() {})->setPrivate();
// Tasks
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:writable',
'artisan:cache:clear',
'deploy:symlink',
'deploy:unlock',
'cleanup',
]);
// [Optional] If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');