Provides the Liberty server on OpenShift.
To deploy applications using the IBM WebSphere Application Server Liberty Cartridge, you are required to accept the IBM Liberty license by following the instructions below:
- Read the current IBM Liberty-License.
- Extract the
D/N: <License code>
from the Liberty-License. - Set the IBM_LIBERTY_LICENSE environment variable to the extracted license code when you create your application.
File | Purpose |
---|---|
apps/ (optional) | Location for built applications with server configuartion |
dropins/ (optional) | Location for built applications without server configuration |
src/ | Example Maven source structure |
pom.xml | Example Maven build file |
.openshift/ (optional) | Location for OpenShift specific files |
config/ | Location for Liberty configuration files |
server.xml | Server configuration |
bootstrap.properties | Server bootstrap properties |
jvm.options | JVM options |
action_hooks/ | See the action hooks documentation |
markers/ | See the Markers section below |
There are two options for deploying applications on Liberty in OpenShift. They can be used together.
You can upload your content in a Maven src structure as is this sample project and on git push have the application built and deployed. For this to work you'll need your pom.xml at the root of your repository and a maven-war-plugin like in this sample to move the output from the build to the apps/ or dropins/ directories. By default the warName is ROOT within pom.xml, the WAR is moved to apps/, and the context-root is /.
A WAR in apps/ needs to be configured in server.xml (where the context-root is configurable), see sample pom.xml and server.xml. A WAR in dropins/ does not need any additional configuration and the context-root for a file app_name.war will be /app_name.
You can git push pre-built wars into apps/ or dropins/. To do this with the default repo you'll want to first run "git rm -r src/ pom.xml" from the root of your repo.
Basic workflows for deploying pre-built content (each operation will require associated git add/commit/push operations to take effect):
-
Add new zipped content and deploy it: cp target/example.war dropins/
-
Undeploy currently deployed content: git rm dropins/example.war
-
Add new zipped content and deploy it with specific configuration:
a. cp target/example.war apps/
b. edit server.xml
Adding marker files to .openshift/markers will have the following effects:
Marker | Effect |
---|---|
skip_maven_build | Maven build step will be skipped |
force_clean_build | Will start the build process by removing all non-essential Maven dependencies. Any current dependencies specified in your pom.xml file will then be re-downloaded. |
hot_deploy | Will prevent a Liberty container restart during build/deployment. |
Variable | Description |
---|---|
OPENSHIFT_LIBERTY_IP | The IP address used to bind Liberty |
OPENSHIFT_LIBERTY_HTTP_PORT | The Liberty listening port |
For more information about environment variables, consult the Users Guide.
Default app example using OpenShift Origin with cartridge installed:
rhc app-create <app name> ibm-liberty-8.5.5.2 IBM_LIBERTY_LICENSE=<liberty license code>
Example of creating an app (AcmeAir fork) with a downloadable cartridge at OpenShift Online:
rhc create-app <app name> http://cartreflect-claytondev.rhcloud.com/reflect?github=opiethehokie/openshift-liberty-cartridge postgresql-9.2 -e IBM_LIBERTY_LICENSE=<liberty license code> --from-code https://github.com/opiethehokie/openshift-acmeair.git