Download the PHP package brunocfalcao/larapush without Composer
On this page you can find all versions of the php package brunocfalcao/larapush. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download brunocfalcao/larapush
More information about brunocfalcao/larapush
Files in brunocfalcao/larapush
Package larapush
Short Description php artisan push - Deploy your codebase into your web server with a single Artisan command
License MIT
Homepage https://github.com/brunocfalcao/larapush
Informations about the package larapush
Deploy your codebase to your web server using a new Laravel Artisan command
php artisan push
Features
- Client <-> Server communications using HTTP. No need to have SSH access!
- Choose what codebase you want to upload (files, folders).
- Run pre-scripts and post-scripts that you define (artisan commands, invokable classes, or custom methods).
- You can choose to upload only modified files, or all files inside your codebase.
- Blacklist files so they can never be uploaded to your web server (e.g. .env).
- Keeps all of your uploaded codebase versions backup on your storage path.
- Get prompted in case you are uploading to production environments.
- Works on both UNIX and Windows web servers.
Requirements
Database is only needed in your web server (Laravel Passport will be installed)
PHP 7.2+
Laravel 5.8+
Installation
:exclamation: In order to generate your OAuth client and token, you need to first install Larapush on your web server!
Log in into your web server and run the following commands:
At the end, it will generate your command line that you will need to use to install it on your local computer. As example:
:exclamation: Now copy+paste the one generated on your web server so you can use it later on your local installation.
On your local development computer, run the following commands:
Now paste the line from your previous web server installation to your local computer prompt. Here is an example:
The installer will prompt to insert your web server URL. Just add it in the FQDN format (e.g.: https://www.johnsmith.com).
The installation completes you should see:
Usage
Henceforth all you have to do is to run the command:
It will upload your codebase that you define on your larapush.php configuration file (larapush.codebase) and the scripts that you also specified (larapush.scripts).
Configuration
A new larapush.php configuration file is created. Let's explore it.
larapush.type
No need to change this, it is automatically configured by the installers using .env keys that will be registered.
larapush.environment
If your web server environment name matches one of the ones specified here, then Larapush will ask you to confirm the upload each time you push your code. This will avoid you to upload your codebase to environments that you might not want to (like a production).
larapush.remote
No need to change these keys by default, unless you want to change the main root URL path, or force a web server URL.
larapush.scripts (pre_scripts and post_scripts)
You can specify actions to run before and after the code is deployed on your web server. For each, you can:
- Run an Artisan command. E.g.: ['cache:clear', ScriptType::ARTISAN]
- Execute an invokable method. E.g.: [MyClass::class, ScriptType::CLASSMETHOD]
- Execute a specific object method: E.g.: ['MyClass@myMethod', ScriptType::CLASSMETHOD]
- Execute a system shell commands: E.g.:"['composer dumpautoload', ScriptType::SHELLCMD]
You can add as much as you want. All outputs are stored inside your transaction folder (later to be explained).
larapush.codebase
Important part, where you can specify your codebase folders and files. Just add them as array values, E.g.:
larapush.storage
This is the path where all of your codebase push transactions are stored. See it like a versioning way of storing all of your codebase along time.
larapush.oauth
These are security tokens generated by Laravel Passport. Don't change them, they are recorded on your .env file.
larapush.token
This is an extra security layer, of a token that needs to be the same in both web server and your local dev computer. Registered via your installation process.
Codebase transaction repository
Each time you upload your codebase, Larapush stores that codebase plus your configured "pre" and "post" scripts both in your local computer and in your web server. This is called a transaction. By default these transaction folders are on your storage_path("app/larapush"). You can change this path on your larapush.php configuration file.
As example, you are pushing your codebase and you see this line on your artisan command info:
That code between parenthesis is the transaction code. If you navigate to your storage-path/app/larapush you will see all the transaction folders listed there. Each of those correspond to a push you have made to your web server.
Here is an example of the folders location:
In your web server it works exactly the same way. Additionally on each of the folder you might see also 2 files:
Those are the console exports of the scripts that ran on each of your codebase push. So, in case you are running scripts you will see your console output there. Nice, heim? :)
Security above all
Larapush was developed taking security very seriously. At the end, anyone that knows your endpoint would be able to upload a malicious codebase to your web server. That's why Larapush uses OAuth client grant access tokens for each of the HTTP transactions that are handshaken between your web server and your local computer. At the end of the HTTP transaction, the client access token is marked as used, so it cannot be used again.
When you install Larapush on your web server, it installs Laravel Passport and generates a specific client token that will be unique between your web server and your local computer. Henceforth any transaction between your local computer and your web server needs to first request a new client grant token and then use that token on the respective HTTP call. Additionally there is also a token that is passed on each request that needs to be the same between your local computer and the web server. If not, the transaction aborts in error.
All of this is done automatically each time you push your codebase. Nice and smooth!
Security
If you find any security related issue please send me a direct email.
License
The MIT License (MIT). Please see License File for more information.
All versions of larapush with dependencies
illuminate/support Version ^5.8.15|^6.0|^7.0
kitetail/zttp Version ^0.6
sixlive/dotenv-editor Version ^1.2
laravel/helpers Version ^1.0
brunocfalcao/helpers Version ^1.0
nelexa/zip Version ^3.1