-
Notifications
You must be signed in to change notification settings - Fork 2
Configuration
name : The name of the application. Defaults to the basedir of the application. Also used for defaulting some other params.
name: "NodeToolbox"
hosts : An array of hosts on which to deploy. eg.
hosts: [{host: "192.168.2.44", user: "v", location:"~/apps/nodetoolbox"}]
Each host definition can have
- host : Mandatory, ip/alias for the machine
- user : name of the user to connect as to the machine
- password: password of the user to connect to the machine (in general this may be a bad idea)
- location: Location on this host to deploy.
A general thumbrule is if you can connect via ssh then you can connect to host then the same params can be used to connect via deploy.
eg. ssh toolbox-new works (because your .ssh/config has rest of the info) then you just need to specify host:'toolbox-new' only.
repository : Information about the repository.
repository: { type: "git", url: "git@github.com:sreeix/nodetoolbox2.git", branch: "master"}
Typical configuration will follow a type and a repositiry specific set of options. Like in git
Following params are allowed
- type : type of the repository
- url : url of the repository
- branch : (Optional) Branch from which to deploy from. Defaults to master.
deploy: The deployment type to use. Currently only option is npm, unless you want to roll out your own.
deploymentType: { type: "npm" , env:{ NODE_ENV: "development"}, outputFile: "hat.js.log"}
Following params are allowed
- type : Type of deployment.
- env : (Optional) Any environment parameters that need to be passed to npm
- outputFile : (Optional) The location of the output log file. Defaults to application name
In addition to the options, you can also implement pre and post methods to the standard methods in the deploy file. eg.
postdeploy: function cleanup(done){ this.cleanup(done); }
Would run cleanup after each deploy is completed. As you can see, most the deploy methods are available to the hook methods. Also some of the internal functions as _hosts and _ssh are available for use in these methods. Thus providing an easy way of extending the scripts. Also note the hooks are applied for every public method. eg. if postcleanup function is implemented, then that also will be called in the correct sequence.
Note: Because this stuff runs asynchronously, it is important to return control asynchronously. Each hook method has to have done as the only argument and on completion of the work done should be invoked