Deploying Liberty servers using deployment REST APIs
You can deploy Liberty servers as members of a collective using the DeployService REST APIs.
Before you begin
- If you do not have an existing server to package, run the create command to
create a new server.
./server create member1
- If you have an existing server to package, ensure the server that you want to package is stopped.
- Run the package command to create the server
package.
./server package member1
The command creates a server package named, for example, member1.zip. The zip file should include a Liberty runtime, which a
"collective join"
operation needs and an expected path in the package for a deploying the Liberty server, like/wlp/usr/servers
.
Ensure the target host is set up for Remote Execution Agent (RXA). See Setting up RXA for Liberty collective operations.
Also ensure the target host has the cURL utility, an
unzip utility, and Java support for the jar utility in the
environment (path) of a user that has operating system rights to the target deployment location.
This user must be the same user specified for --rpcUser
, a Remote Procedure Call
(RPC) user, during registration of the host. You register a host in step 3.
Procedure
What to do next
Request and review the deployment status and results.
- Get a list of deployment tokens for requested deployment
operations.
GET https://controller_host:controller_port/ibm/api/collective/v1/deployment/deploy
- Get a short status of the deployment operations. Use the token from step 6 for
{token}
. Thus, for a{"id":3}
return token from step 6, use3
for{token}
.
During deployment, the API returns IN_PROGRESS:GET https://controller_host:controller_port/ibm/api/collective/v1/deployment/{token}/status
After deployment, the API returns FINISHED:{"status":{"target_host":"IN_PROGRESS"}}
{"status":{"target_host":"FINISHED"}}
You can also get a final status of ERROR if the deployment has problems. Use the following information to get the complete results. The
stdout
andstderr
information that is returned can help you diagnose the problems. - Get the complete results of a deployment operation. Use the token from step 6 for
{token}
. Thus, for a{"id":3}
return token from step 6, use3
for{token}
.
After deployment completes, the results contain information about the operation. The following example shows results for FINISHED:GET https://controller_host:controller_port/ibm/api/collective/v1/deployment/{token}/results
{"results":[{"host_name":"target_host","status":"FINISHED","result":0,"stdout":"deployment_stdout", "stderr":"deployment_stderr", "deployedArtifactName":"serverName_from_inputVars", "deployedUserDir":"target_host_directory_for_deployed_server"}]}
- Undeploy a Liberty
server.
POST https://controller_host:controller_port/ibm/api/collective/v1/deployment/undeploy { "host": "myHostName", "userDir":"myUserDir", "serverName":"myServerName" }
- Get a list of tokens for undeployment
operations.
To get status and results, follow steps similar to deployments.GET https://controller_host:controller_port/ibm/api/collective/v1/deployment/undeploy