Deployment tool for services of ssh
$ npm install pm2 -g
$ deploy init --host my-ssh-hostThis will create a default .deploy.yml file.
The deployment file is used to configure the deployment scripts.
$ deploy deployThis will deploy the application with the .deploy.yml configuration.
The configuration is kept in the .deploy.yml.
A deployment is splitted into multiple steps and every step can be individually changes through the configuration.
The default steps are [INITIALIZE, ENSURE, INITIALIZED, APP_UPLOAD, BEFORE_START, START_APP, AFTER_START, BLUEGREEN, BEFORE_STOP, STOP_APP, AFTER_STOP, APP_READY]
Each step can be customized with any commands. An plugin interface to add more commands is planned for the next release. Currently there are just 3 commands: ssh, scp, ensure
This will copy all deployment scripts from nx-deploy onto the server.
It will check if the log & config directory for nginx exists.
This step will ensure that nodejs is installed, :nodeVersion is v7.10.0 by default. Afterwards it will install pm2 globally to use it as the process manager. Then it will run npm install for the nx-deploy scripts.
This will strip the extensions of the scripts in the scripts folder. This is just as an example to show how scripts can be transferred to the host and be used to enhance the service and/or deployment process.
This step ensures that a versioned Capistrano-like structure will be created. It will first ensure that a directory exists. Then will find an empty port and get a timestamp, using the ssh-save feature to save it to the env. Afterwards using the timestamp to copy the application into the versioned directory.
Currently not in use...
Telling pm2 to start the application on the free port.
Currently not in use...
Using the standard nginx configuration, replace the port with the found free port. Stop nginx... This will cause a short downtime... and start it with the newly created configuration.
Currently not in use...
Use an nodejs script to kill all other processes
Currently not in use...
And we are done with the basic deployment