

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.
Syntax wlpn-server commands
The command syntax for wlpn-server commands is as follows:
wlpn-server action variable | variable
- 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:
- Create a Node.js application.
- 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.
- To include dependencies, run the npm install command in the application directory.
- 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.
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
Syntax wlpn-collective commands
The command syntax for wlpn-collective commands is as follows:
wlpn-collective action server_name [options]
- 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.
- 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.
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