Commands
The pandora.js provides some useful CLI commands, show in below:
- init
- start
- stop
- restart
- list
- log
- ps
- exit
- dev
init - Initiate a Pandora.js project
pandora init <filePath> --name customName
Quick generate procfile.js
.
<filePath>
required, the path of the entry file.--name
optional, the process name for the fork mode.
Example:
$ pandora init ./app.js
? Which type do you like to generate ? (Use arrow keys)
❯ fork
cluster
** The procfile.js was auto generated to location /xx/xx/procfile.js **
start - Start an application at the background
pandora start [path] --name urAppName --env="NODE_ENV=production" --node-args="--expose-gc"
The often used command, to start an application at the background.
[path]
Required, project directory, by default as the working directory.--name=urAppName
Optional, for specify the name of the application, by default as the name in package.json or last part of the working directory path.--env="NODE_ENV=production"
Optional, for specify the environmental variables, it can got by process.env.--node-args="--expose-gc"
Optional, for specify the Node.js execArgv.--args="--a=b"
Optional, for specify the args of the Node.js application.
Example:
# Working dir is /home/admin/mytaobao/target/mytaobao ( suppose there is no name in package.json )
pandora start # Start application mytaobao, such as --name=mytaobao
pandora start . --name mytaobao # Same as above
pandora start `pwd` # Same as above
stop - stop an application
Notice: Only the application that start by start command can stop by this command
pandora stop [appName]
stop an application.
[appName]
Optional, for specify the name of the application, by default as the name in package.json or last part of the working directory path.
Example:
pandora stop mytaobao # mytaobao is the name that was previously started, and if you did't specified a name, that will automatically get name as well as start.
restart - Restart an application
pandora restart [appName]
Equivalent to pandora stop
and then pandora start
.
[appName]
Optional, for specify the name of the application, by default as the name in package.json or last part of the working directory path.
Example:
pandora restart mytaobao # mytaobao is the name that was previously started, and if you did't specified a name, that will automatically get name as well as start.
list - List all running applications
Notice: The dev command will not start the daemon process, this command cannot get the information of it.
pandora list
List all applications, example as below:
log - View logs
pandora log [appName] --follow --lines --full --daemon
[appName]
Optional, for specify the name of the application, by default as the name in package.json or last part of the working directory path.--follow
Optional, alias as-f
, just liketail -f
.--lines
Optional, alias as-l
, output the last few lines, by default as 50.--full
Optional, output all logs.--daemon
Optional, output logs of the daemon process.
ps - View processes tree
pandora ps <appName>
<appName>
Required, the name of the application.
exit - Quit the Pandora.js
Complete exit of the Pandora.js process, and stop all running applications.
pandora exit
dev - Start an application at front
Notice: this command will not start the daemon process, the list command cannot get the information of it.
pandora dev [path] --name urAppName --env="NODE_ENV=production" --node-args="--expose-gc"
Start an application at front without the daemon process, logs output to stdout directly. It is mostly used for local debugging, the parameters similar with the start command.
[path]
Required, project directory, by default as the working directory.--name=urAppName
Optional, for specify the name of the application, by default as the name in package.json or last part of the working directory path.--env="NODE_ENV=production"
Optional, for specify the environmental variables, can got by process.env.--node-args="--expose-gc"
Optional, for specify the Node.js execArgv.--args="--a=b"
Optional, for specify the args of the Node.js application.