Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 70 | All time: 10,286 This week: 673 |
Version | License | PHP version | Categories | |||
laravel-deploy 1.0 | Custom (specified... | 7.1 | Libraries, Project Management, PHP 7 |
Description | Author | |||||||||||||||||||||||
This package can deploy a Laravel project retrieved using GIT. Innovation Award
|
|
Laravel deploy package, used to automatically deploy project from GIT VCS that supports webhooks.
Just require this package with composer.
composer require kg-bot/laravel-deploy
Before you can use this package you have to export and run migrations and create clients for each VCS site or repository
php artisan vendor:publish --provider=KgBot\LaravelDeploy\LaravelDeployServiceProvider --tag=migrations
php artisan migrate
You can create new client with artisan command (Web panel should be in next release)
php artisan laravel-deploy:new-client {name} {token} {script_source} {source}
Because deploy is initiated from HTTP request user executing .sh script would be www-data and I find it cumbersome for non Linux or Server oriented developers to tweak with user permissions and server privileges.
This can be changed with some .env directives, you should create .sh script with your default server user and set rwx permissions for that user.
Next thing you need to do is add LARAVEL_DEPLOY_USERNAME
to .env file and set it to your default user (same user from your SSH/CLI).
Also you need to set LARAVEL_DEPLOY_PASSWORD
.env directive to match your default SSH/CLI login password.
If you login to your server with ssh forge@123.213.65.1
and you enter temp123
as your password then you would set LARAVEL_DEPLOY_USERNAME=forge
and LARAVEL_DEPLOY_PASSWORD=temp123
inside .env file.
Laravel Deploy is enabled by default, if you want to disable it add LARAVEL_DEPLOY_RUN=false
to your .env file.
Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php
KgBot\LaravelDeploy\LaravelDeployServiceProvider::class
You can export config by running
php artisan vendor:publish --provide=KgBot\LaravelDeploy\LaravelDeployServiceProvider --tag=config
We have already explained some of this package config directives but that's not all.
<?php
/
* Created by PhpStorm.
* User: kgbot
* Date: 6/4/18
* Time: 1:37 AM
*/
return [
'routes' => [
/
* Route prefix, example of route http://localhost/laravel-deploy/deploy?_token=#################
*
*/
'prefix' => env( 'LARAVEL_DEPLOY_PREFIX', 'laravel-deploy' ),
/
* Middleware used on webhook routes, default middleware is KgBot\LaravelDeploy\Http\Middleware\IsTokenValid
*
* You can add more middleware with .env directive, example LARAVEL_DEPLOY_MIDDLEWARE=webhook,auth:api, etc.
*
* Don't use space in .env directive after ,
*/
'middleware' => ( env( 'LARAVEL_DEPLOY_MIDDLEWARE' ) ) ? explode( ',', env( 'LARAVEL_DEPLOY_MIDDLEWARE' ) )
: [],
],
'events' => [
/
* This package emits some events before and after it run's deployment script
*
* Here you can change channel on which events will be broadcast
*/
'channel' => env( 'LARAVEL_DEPLOY_EVENTS_CHANNEL', '' ),
],
/
* This packages is doing all of it's work in a Job and here you change queue on which it will execute jobs
*/
'queue' => env( 'LARAVEL_DEPLOY_QUEUE', 'default' ),
/
* With this directive you can enable/disable this package
*/
'run_deploy' => env( 'LARAVEL_DEPLOY_RUN', true ),
/
* Detailed description is provided inside a README.md file
*
* Here you set your default server user and password which will be used to run deploy script
*/
'user' => [
'username' => env( 'LARAVEL_DEPLOY_USERNAME', 'www-data' ),
'password' => env( 'LARAVEL_DEPLOY_PASSWORD', '' ),
],
];
This package exposes some routes (only one for now but there will be more of them in next versions)
Let's say that your repository is located at [https://github.com/kg-bot/laravel-deploy], you would go to [https://github.com/kg-bot/laravel-deploy/settings/hooks/new].
There you will get screen like this
In the Payload URL you need to enter webhook URL which must be http://example.com/laravel-deploy/deploy+_token=#####################, where example.com
should be your domain and laravel-deploy
should be the prefix you set in configuration, also the token part needs to match hashed value you got when creating new client.
Other parts are not important for now, in next versions this will be probably need to be changed because there will be different code for each site (drivers).
Everything is same as GitHub except links and field names.
Link to create new webhook should be [https://bitbucket.org/:USERNAME:/:REPO:/admin/addon/admin/bitbucket-webhooks/bb-webhooks-repo-admin]
It looks like this , Title can be anything, URL should be same as in GitHub settings, you must check Active and you can check Skip certificate verification for now (until next versions)
Everything of this is highly welcome and appreciated
Anything else you can think of please leave me comments, mail me, create issue, whatever you prefer.
This project is licensed under the MIT License - see the LICENSE.md file for details
Files (17) |
File | Role | Description | ||
---|---|---|---|---|
src (1 file, 8 directories) | ||||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation | ||
routes.php | Class | Class source |
Files (17) | / | src |
File | Role | Description | ||
---|---|---|---|---|
config (1 file) | ||||
Console (1 directory) | ||||
database (1 directory) | ||||
Events (2 files) | ||||
Exceptions (2 files) | ||||
Http (2 directories) | ||||
Jobs (1 file) | ||||
Models (1 file) | ||||
LaravelDeployServiceProvider.php | Class | Class source |
Files (17) | / | src | / | database | / | migrations |
File | Role | Description |
---|---|---|
2018_06_04_000000_...y_sources_table.php | Class | Class source |
Files (17) | / | src | / | Events |
File | Role | Description |
---|---|---|
LaravelDeployFinished.php | Class | Class source |
LaravelDeployStarted.php | Class | Class source |
Files (17) | / | src | / | Exceptions |
File | Role | Description |
---|---|---|
InvalidClientException.php | Class | Class source |
UnableToReadScriptFile.php | Class | Class source |
Files (17) | / | src | / | Http | / | Controllers |
File | Role | Description |
---|---|---|
BaseController.php | Class | Class source |
DeployController.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.