Setup Openshift Environment with XL Release
One of the important things when starting to work in an OpenShift environment is to setup Domains, Applications and Gears. OpenShift provides a set of REST services that can be used to setup domains, applications, gears, etc and also deploy, configure applications. A lot of companies are now moving ahead on the path of using software on the cloud solutions and OpenShift is a popular one among developers who want to quickly deploy applications in lower environments for testing /showcase and tear down after use. XL Release is used for an overall release management and automation of all those activities that can truly be a machine interaction. This article shows XL Release's Webhook capability to interact with OpenShift APIs to create a domain and setup gears. Here's how you can go about it
- Open a browser and login into you XL Release instance.
- Create a new template
- Create a new phase
- You can create the first task as JSON Webhook
- Task Name : Create Domain
- URL : Openshift API
- Method : POST
- HTTP Body : contains domain name as JSON string
- JSON Path Expression 1 : JSON Expression to parse the response from
- Result 1 : ${appcreate_url} to Capture the JSON Expression 1 Value from captured response
- Create the second step as another JSON Webhook
- Task Name : Create Application and Cartridges
- URL : ${appcreate_url} is the value captured for the domain created from previous step
- Method : POST
- HTTP Body : contains application name and cartridges as JSON string
- JSON Path Expression 1 : JSON Expression to parse the response from
- Result 1 : ${app_url} to Capture the JSON Expression 1 Value from captured response
- Create a final third step as Script Step
- Simple python code to print the captured value of ${app_url} pointing to the newly setup containers
- This is how it should look after all three have been created
- Now we can create a new Release from this Template and start the release
- This is how it looks after a successful run
- Looking into the output of each of the steps
- Step 1 - Create Domain - Output shows the new domain created under open shift rhcloud
- Step 2 - Create Application - Output shows the new application created under domain
- Step 3 - Print Information - Finally printing the URL