Nodejs INstaller
The missing nodejs app deploy tool.
Created by LI, Yu
Usually only need to copy all files to deploy site.
cd deploy_site
cp /path/to/my/app/dev/* deploy_site/
Really done?
Oh, sorry, forget to generate some conf files ...
cd deploy_site
cat ./myexamples/my.conf.example | sed -e 's/foo/bar/g' > ./etc/my.conf
Sorry, and some dirs ...
mkdir -p ./var
mkdir -p ./log
Sor..., and some npm pkgs, I forgot I have cleaned there ...
npm install
Wait, ..., and which's the main js file?
sudo wall -n "somebody know which is my app's main js file?"
Can it solve my problem?
Try this ?
npm install /path/to/my/app
Or this ?
npm install /path/to/my/app -g
Admit it, usually some or part of the problems are solved.
And the 2nd one could mess up my global node_modules
.
npm install nin -g
mkdir -p ~/nintest
cd ~/nintest
nin install https://github.com/liyu1981/nin-example/archive/bash.tar.gz
nin start nin-example
After start, go to http://localhost:12345
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
setup <pkgname> Setup your app.
> <pkgname> is the pkg installed dir name, i.e., some name in <cwd>/node_modules/
start <pkgname> Start your app.
> <pkgname> is the pkg installed dir name, i.e., some name in <cwd>/node_modules/
> 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>/node_modules/
version Show version info.
Options:
-h, --help output usage information
-q, --quiet turn on quiet mode
For updated version, just nin↵
Just a nin.json file away.
{
"setup": [
{
"type": "bash",
"content": "op/setup.sh"
}
],
"start": [
{
"type": "bash",
"content": "op/start.sh"
}
],
"stop": [
{
"type": "bash",
"content": "op/stop.sh"
}
]
}
{ "type":..., "content": ... }
.
#op/setup.sh
node_modules/rask/bin/rask gen log.json >etc/log.json
#op/start.sh
node index.js &
echo $! >var/server.pid
#op/stop.sh
kill `cat var/server.pid`
In detail, they are
~/nintest $ tree -L 3
.
├── etc
│ └── nin-example -> /local/DevCamp/tmp/ne/node_modules/nin-example/etc
├── log
│ └── nin-example
├── node_modules
│ └── nin-example
│ ├── log -> /local/DevCamp/tmp/ne/log/nin-example
│ └── var -> /local/DevCamp/tmp/ne/var/nin-example
└── var
└── nin-example
and I need not to install grunt/forever by myself, nin covers them. :)