diff --git a/composer.json b/composer.json index 4c15a7e..52650fa 100644 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/composer.lock b/composer.lock index 7c177ba..58301ea 100644 --- a/composer.lock +++ b/composer.lock @@ -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" } diff --git a/deploy.php b/deploy.php new file mode 100644 index 0000000..30c46ac --- /dev/null +++ b/deploy.php @@ -0,0 +1,69 @@ +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');