OpenShift and Wercker Logos

OpenShift is Red Hat's auto-scaling PaaS for web applications. Similar to wercker, OpenShift allows developers to focus on their code and not on the management of their stack and infrastructure. You can sign up for OpenShift for free.

Wercker helps you streamline your continuous delivery pipeline to OpenShift, thus reducing risk and eliminating waste in your workflow and increasing developer velocity. Signing up for wercker is easy and free.
Alongside integrating with OpenShift, Wercker is now also a developer partner.

Getting started with wercker and OpenShift

In this post we're outlining how to get started with wercker and OpenShift. For your convenience, we've created a sample application in Ruby on GitHub that you can fork to get started with OpenShift and wercker. OpenShift offers several application quickstarts that you can view. Keep in mind that wercker currently supports Node.js, Ruby, and Python but more stacks are coming soon!

This guide is also available in short form on our dev center.

Prerequisites

Deploy target

Every successful build on wercker can be deployed to a so-called deploy target. This can be a custom deploy target, or one of the predefined targets like Heroku or OpenShift. You can read more at the deployment section.

In this article we will add one for OpenShift. Follow along with the steps below:

Navigate to your application

First we need to sign in at wercker and navigate to the application we would like to deploy to OpenShift.

Add OpenShift deploy target

To start the process to add an OpenShift deployment target, do the following:

  • Click on the Deployment tab to open it
  • Click the Add deploy target dropdown
  • Click OpenShift

Create OpenShift authentication token

note: you can skip this step if you already have an OpenShift authentication token.

OpenShift allows other services, like wercker, to access information via a secret token. OpenShift has three different scopes: session, read and userinfo. Wercker needs only read access. Although you can use an existing authentication token we strongly advise you to create one per service. You can create a read authorization key at the add authorization page at OpenShift. Give it a meaningful name like wercker.

Authorize wercker

Enter the OpenShift authorization token and click connect.

Enter OpenShift deploy target details

Enter a descriptive deploy target name, such as: staging or production.

Select the OpenShift domain and application that you want to deploy to. Wercker automatically selected the first available domain and application.

If there are no domains or applications listed, please make sure you've created them on OpenShift.

Click save to create the deploy target.

note: you can learn more about OpenShift domains and application in the Namespaces chapter of the OpenShift User Guide.

Add public key to OpenShift

Wercker generates a ssh key per deploy target which is used to securely encrypt the connection that is used to deploy to OpenShift. This key needs to be added to the public keys section at OpenShift.

Copy the full content of the public key from the second textbox.

Copy public key

Login to OpenShift and add the key to your public key list.

add public key to OpenShift

Deploy!

You are now ready to deploy to OpenShift. Wercker allows you to deploy all succesful builds. Navigate to your application and select the succesful build you would like to deploy.

select build to deploy

In the build via click the deploy this build button and choose the target that you have just created.

deploy this build

Congratulations! You have succesfully deployed your application to OpenShift.

Next steps

You can share the build status of your application via the wercker badge (for instance in the README.md of your application on GitHub) that you can add via the 'share button', just below the application header:

share build status

This is the build status of my application on wercker:

Wercker status

If you want to invite team members to your application, you can do so via the settings tab. Keep in mind that the team members you want to invite have to have a wercker account - they can register on our sign up page.

Thanks for following along and you can view the final application on wercker

Feel free to contact us with any feedback or questions via email or twitter, and please tell us about the applications that you develop with wercker and OpenShift!