nin v0.1.6
nin
nin is Node INstaller, the missing nodejs app deploy tool.
nin tries to solve a trival-but-bother problem: how to deploy your nodejs app ?
The manual method
When I manually deploy a nodejs app, I do
- Copy the project pkg and extract all files to deployment site
dir. - Change to that
dir,npm installall my dependencies. - After that, manually do some setup things, such as
bash sth.shorgrunt. - Finally start the app with
node index.jsor evenforever index.js. (In this step I usually save my app'spidin some file for future.) - And when there is a need, I stop the app with
pidsaved before.
So why not to make some tool to automate that process?
That is what nin do.
The nin method
Suppose you have your project in /path/to/yourapp or git://github.com/yourname/yourapp.git, with your nin.json conf file well prepared,
mkdir yourapp_deploy; cd yourapp_deploynin install /path/to/yourappornin install git://github.com/yourname/yourapp.git
Done. You app is installed and configured by nin.
Then you can nin start yourapp to start it or nin stop yourapp to stop it.
Installation
npm install -g ninor locally
curl https://raw.githubusercontent.com/liyu1981/nin/master/install.sh | shDependencies
- nodejs
>0.10.0 - npm
>1.4.0
Command Line Summary
Usage: nin [options] [command]
Commands:
deploy <pkg> Install your app.
> <pkg> can be any llegal npm pkg names.
> Ref https://www.npmjs.org/doc/cli/npm-install.html
install <pkg> Install your app.
> This equals deploy then setup.
> <pkg> can be any llegal npm pkg names.
> Ref https://www.npmjs.org/doc/cli/npm-install.html
remove [options] <pkgname> Remove your app.
> <pkgname> is the pkg installed dir name, i.e., some name in <cwd>/apps/
restart <pkgname> restart your app.
> This equals stop then start your app.
> <pkgname> is the pkg installed dir name, i.e., some name in <cwd>/apps/
setup <pkgname> Setup your app.
> <pkgname> is the pkg installed dir name, i.e., some name in <cwd>/apps/
start <pkgname> Start your app.
> <pkgname> is the pkg installed dir name, i.e., some name in <cwd>/apps/
> pid file will write to var/<pkgname>
stop <pkgname> Stop your app.
> <pkgname> is the pkg installed dir name, i.e., some name in <cwd>/apps/
update <pkgname> Update your app.
> <pkgname> is the pkg installed dir name, i.e., some name in <cwd>/apps/
version [options] Show version info.
Options:
-h, --help output usage information
-q, --quiet turn on quiet modenin.json
nin.json is the configuration file of your app, which contains the intructions on how to setup/start/stop your app. It should be placed in the root dir (like package.json). The format is
{
"setup": [
{ "type": "...", "content": "..." },
...
],
"start": [
{ "type": "...", "content": "..." },
...
],
"stop": [
{ "type": "...", "content": "..." },
...
]
}setup
typecan bebash|gruntcontentis the relative path to your script/file.
start/stop
typecan bebash|forevercontentis the relative path to your script/file.
Project Example
Nothing can compared to an example. Check nin-example for different settings(in different git branch) of nin.
