For LINUX platformsFor Windows platforms

apiconnect-collective-member wlpn-server and wlpn-collective commands

Run wlpn-server commands to start or stop unpacked Node.js applications and pack or unpack applications. Run wlpn-collective commands to join a Node.js application as a member of a Liberty collective or to remove a Node.js collective member from a collective. Run apiconnect-collective-member commands from the ${wlpn.usr.dir} directory, which defaults to /home/user_name/wlpn.

Although you run wlpn-server commands to start and stop an unpacked Node.js application and run a wlpn-collective command to make it a Node.js collective member, a Node.js application is not a server. It is an application. However, a Node.js application unpacked to a wlpn user directory that is known by a collective controller can be managed by the controller as a collective member server. A Node.js collective member is sometimes called a Node.js server in this documentation.

wlpn-server commands syntax

The command syntax for wlpn-server commands is as follows:

wlpn-server action variable | variable
where action can take the following values and variables:
help
Display information about wlpn-server commands.
wlpn-server help
start
Start an unpacked Node.js application. For server_name, specify the name of the unpacked Node.js application to start in the command.
wlpn-server start server_name

The command starts the server process and writes a PID file in the server directory, which defaults to /home/user_name/wlpn/server_name.

stop
Stop an unpacked Node.js application. For server_name, specify the name of the unpacked Node.js application to stop in the command.
wlpn-server stop server_name

The command stops the server process and removes the PID file from the server directory.

pack
Create a compressed TAR archive with the .tgz extension for deployment of an application on the file system. Specify the directory to compress in the command.
wlpn-server pack directory_to_pack

The command compresses the specified directory and creates a .tgz file in the current directory.

The following procedure describes how to prepare and pack a directory:

  1. Create a Node.js application.
  2. Optionally, create a server.json file and put it in the same directory as the package.json file. The server.json file content resembles the following example:
    { 
      "clusterName": "cluster name",
      "contextRoot": "context root",
      "appPort":"integer",
      "adminPort":"integer"
    }
    • cluster name defaults to server name.
    • context root is optional and defaults to server name.
    • For appPort, integer is the port for application traffic and defaults to 9080.
    • For adminPort, integer is the port for administrative traffic and defaults to 9443.
  3. To include dependencies, run the npm install command in the application directory.
  4. To compress the directory, run the wlpn-server pack command.
unpack
Unpack an application onto disk, creating a server directory. Specify the name of the server to create and the name of the TAR file to unpack in the command.
wlpn-server unpack server_name tgz_file_name

The command expands the .tgz file at ${wlpn.usr.dir}/server_name, which defaults to the /home/user_name/wlpn directory. If the wlpn directory does not exist, the command creates the wlpn directory.

wlpn-server commands usage

The following examples demonstrate correct syntax:

wlpn-server help
wlpn-server start myServer
wlpn-server stop myServer
wlpn-server pack example-app
wlpn-server unpack myServer example-app.tgz

wlpn-collective commands syntax

The command syntax for wlpn-collective commands is as follows:

wlpn-collective action server_name [options]
where action can take the following values and variables:
help
Display information about wlpn-collective commands.
wlpn-collective help
join
Join an unpacked Node.js application as a member to a Liberty collective. Specify the name of the unpacked Node.js application, the collective controller host, port, user, and password, and a keystore password in the command.
wlpn-collective join server_name --host=collectiveControllerHost --port=collectiveControllerHTTPSPort 
--user=collectiveControllerAdminUserID --password=collectiveControllerAdminUserPassword --keystorePassword=generatedKeystorePassword
Also, specify one or more of the following optional parameters, as needed:
--autoAcceptCertificates
Automatically trust any SSL certificates.
--sshPrivateKey
The wlpn-collective join command generates a unique SSH key pair for authenticating to the SSH server of a specified host computer. If you are registering a remote host for which an SSH key pair is already generated, you can specify the path of the SSH private key file. The following command assumes that the SSH private key is stored on the local controller computer at /home/user1/.ssh/id_rsa. The other file in the SSH key pair is the /home/user1/.ssh/authorized_keys public key file on the remote target host.
wlpn-collective join myServer --host=controllerHost --port=controllerHTTPSPort 
--user=controllerAdmin --password=controllerAdminPassword --sshPrivateKey=/home/user1/.ssh/id_rsa
--genDeployVariables
Allocate deployment variables (ports) when you join an unpacked Node.js application as a member to a Liberty collective. The genDeployVariables option registers deployment variables to the collective repository and generates deployment variables to the member. For an example of deployVariable statements that define deployment variables in a controller server.xml file, see step 3 in Deploying Node.js servers using deployment REST APIs.
The command joins the Node.js application to the collective and creates SSL configuration files on the file system from which the command was run. The command also creates the join.json file on the file system in the ${wlpn.usr.dir}/server_name directory. The join.json file is separate from server.json and is used for collectives. The join.json file contains the controller host name, port number, and heartbeat interval.
Note: If you want to modify the heartbeat interval in a nodeJS member, you need to add the following to the member's join.json file:
{
 "hostName": "HOST_NAME",
 "userDir": "USER_DIR",
 "serverName": "SERVER_NAME",
 "keystorePassword": "PASSWORD",
 "controllerList": [ "https//controller_host:controller_https_port" ],
 "clusterName": "CLUSTER_NAME",
 "appPort": "9090",
 "adminPort": "9453",
 <b> "heartBeatInterval": "15"</b>
 }
By default, the heartBeatInterval value defaults to 30 seconds (and is implicitly configured). After you have made the adjustment shown in the preceding example to the heartBeatInterval, restart the nodeJS member.
remove
Remove a Node.js collective member server from a Liberty collective. Specify the name of the Node.js server, the collective controller host, port, user, and password, and the --autoAcceptCertificates parameter in the command.
wlpn-collective remove server_name --host=collectiveControllerHost --port=collectiveControllerHTTPSPort 
--user=collectiveControllerAdminUserID --password=collectiveControllerAdminUserPassword --autoAcceptCertificates

The command removes the Node.js server from the collective and deletes the SSL configuration and join.json files.

registerHost
Register the host on which you want to install a Node.js server with the collective controller. Specify the name of the target host, the collective controller host, port, user, and password, and the --autoAcceptCertificates parameter in the command.
wlpn-collective registerHost targetHost --host=controllerHost --port=controllerHTTPSPort 
--user=controllerAdmin --password=controllerAdminPassword --rpcUser=osUser --rpcPassword=osUserPassword --autoAcceptCertificates

The command enables the collective controller to access files, commands, and other resources on the host.

updateHost
Change the host registration parameter values of a host on which a Node.js server resides. Specify the name of the target host, the collective controller host, port, user, and password, and the --autoAcceptCertificates parameter in the command.
wlpn-collective updateHost targetHost --host=controllerHost --port=controllerHTTPSPort 
--user=controllerAdmin --password=controllerAdminPassword --rpcUser=osUser --rpcPassword=osUserPassword --autoAcceptCertificates

The command updates the host registration.

wlpn-collective commands usage

The following examples demonstrate correct syntax:

wlpn-collective help 

wlpn-collective join myServer --host=controllerHost --port=controllerHTTPSPort --user=controllerAdmin --password=controllerAdminPassword --autoAcceptCertificates

wlpn-collective remove myServer --host=controllerHost --port=controllerHTTPSPort --user=controllerAdmin --password=controllerAdminPassword --autoAcceptCertificates