deploy-handler v1.2.0
Deploy Handler
Deploy handler is a configurable command-line interface to let you upload your build files to a remote HTTP server with just one command.
Currently supported server programming languages for the remote server are Node.JS and PHP
Installation
npm install -g deploy-handler
Usage
deploy <Server Programming Language> [Options]
Where <Server Programming Language>
is one of
php, node (Express)
And [Options]
can be any of
Option | Alias | Description |
---|---|---|
--from | -f | Path to the local build folder that will be deployed to the remote server. |
--to | -t | Link to the remote deploy handler. |
--secret | -s | Private key that will be used to sign the package. |
Or just cd to your project directory and run deploy
and follow the instructions.
How it works
Deploy handler is configured by 4 main variables:
Var Name | Default | Description |
---|---|---|
lang | PHP | The programing language used in the server-side of the remote HTTP server. The deploy command will use this to generate a script that needs to be placed on the server-side in order to receive deployed packages. |
from | ./build | The relative path to the build directory where the content of this directory will be sent to the remote HTTP server |
to | https://example.com/deploy-handler.php | The link to which build files will be sent. This link should resolve to the deploy handler script generated by the deploy command |
secret | ** | The private key that will be used to sign the package in order to verify the identity of the sender. |
Once you enter these variables for the first time, they are saved in a json file deploy-config.json
and the private key secret
is saved under .deploy-temp/.secret.env.local
.
The .deploy-temp
folder must be added to .gitignore
as it contains the private key used to sign the package.
When you run deploy, the deploy-handler CLI compresses the build files into a zip archive, signs the zip archive, and sends it to a remote server to unzip it to its correct location on the server. But before sending the build files to the remote server, the CLI generates a template script that needs to be placed on the remote server in order to handle the sent package, verify the signature and extract files into the correct location.