Skip to content

Command Line Document

py edited this page Jul 17, 2013 · 16 revisions

Command Line Document

Pomelo includes various shell-like commands that help developers build applications more convenient and more efficient. These commands support most of the normal application operations such as creating project, starting application, debugging application, stopping application, killing application, etc.

Command Installation

Use npm(node package manage tool) install pomelo and command line tool in the global.

npm install pomelo -g

Command Introduction

  • init: creates a new project that contains basic files with which can build pomelo-based applications.

  • start: launches the application and servers and it allows appending various parameters like –debug, --trace, --profile, --daemon to start the application in different mode.

  • list: lists information of all servers that the application is running on, including server id, server type, pid, heapUsed, and uptime.

  • stop: stops the application in all servers.

  • kill: kills the application immediately.

  • --version: lists the current version of pomelo.

  • --help: lists all the commands currently supported by Pomelo.

Command Usage

pomelo init

Create a new project under the path you give. If the path is not provided, the default path is current path, the default project name is current directory name; relative path is also supported.

pomelo start [development|production] [--daemon]

Users can launch the application in two modes, if not appointed, the default option is development. Users can add '--daemon' to run application in background, and you can find logs in directory game-server/logs/; application runs in front side by default. And users can add different start parameters in file /nameofproject/game-server/config/servers.json. For example:

{"connector":[{"id":"connector-server-1", "host":"127.0.0.1", "port":4050, "wsPort":3050, "args":"--debug=[port] --trace"}]}

If need to debug in a certain server, just add the parameter '--debug=[port]'.For example, if you need to debug at 8080, --debug=8080. The supported parameters can refer to the command line parameters of node.js and v8. The command must be used in 'game-server' directory of the application.

notice: application run in daemon need to install forever, install command: npm install forever

pomelo add host=[host] port=[port] id=[id] serverType=[serverType]

Developers can add server dynamically. The parameters include server ip(host), server port(port),server identity (id),server type(serverType). The command must be used in master server.

pomelo list

List all servers' information after the application started. The command must be used in root directory of the application.

pomelo stop

Close all servers and stop the application gracefully. Unlike the kill command, it will first close the connection between clients and the server, and then terminal all servers. The command must be used in root directory of the application.

pomelo kill [--force]

Close the application forcefully.If happens that there left application processes after killing when you develop in local, you can use the command pomelo kill --force to kill all application processes. It may lead to bad influences like data loss, so we do not recommend using this command in production mode. The command must be used in root directory of the application.

pomelo --version

List the current version of pomelo. The command can be used in the global.

pomelo --help

List all the commands currently supported by pomelo. The command can be used in the global.

Clone this wiki locally