How to Create an OpenShift GitHub Quick Start Project

At OpenShift, we believe in an open PaaS solution.  A PaaS where developers are not locked-in to vendors that require proprietary API calls or data stores.  We want your code to run as is, without modifications.  To illustrate how easy this is, we have created a github space where we provide numerous quick start projects that make deploying common application to the cloud a painless process.  Some of the popular open source projects we provide a quick start for are:

Not finding what you are looking for?  Help us out by creating your own github OpenShift project. Okay, but how do I get my project into the github repo?  Follow the step-by-step directions below.

Note: These steps assume you that you are using Fedora 15.  However, the commands should be portable across any operating system with git and the OpenShift client tools installed.

Step 1: Decide on a project you want to create a quick start for
This is common sense, right?  The only thing to note is that you should focus on applications that are freely available under an open source license.  You must have the rights to redistribute the code in your own github repository.  For this guide, I have selected to deploy the popular web site analytic software Piwik.

Step 2: Download the code for Piwik
At the time of this writing, you can obtain the code directly from the Piwik website at:  Once downloaded, save the file to ~/code/piwikstage

Step 3: After you download the code, extract the contents

  • $ cd ~
  • $ mkdir code
  • $ mkdir piwikstage
  • $ unzip
  • This will create a piwik directory under the ~/code/piwikstage directory

Step 4: Create an OpenShift application to test the deployment

  • $ cd ~/code
  • $ rhc-create-app -a piwik -t php-5.3 -l yourlogin

Step 5: Create a mysql database if required by your application

  • $ rhc-ctl-app –a piwik –e add-mysql-5.1 –l yourlogin
  • Make a note of the username, password, host, and database name as you will need this later

Step 6: Remove the PHP template that is installed by default

  • rm –rf  ~/code/piwik/php/*

Step 7: Copy the Piwik sources from your staging area to your application directory

  • cp –av ~/code/piwikstage/piwik/* ~/code/piwik /php

Step 8: Add and commit your code to the local git repository

  • $ cd ~/code/piwik/php
  • $ git add .
  • $ git commit –a –m “Initial commit for Piwik”

Step 9: Deploy your application to the cloud and ensure it works

  • $ cd ~/code/piwik
  • $ git push
  • Assuming everything went as expected, you should be able to verify Piwik is running at piwik-$


Step 10: Create a github repository

Note: This step assumes that you already have a github account.  If you don’t, head on over to and sign up (It’s free).

Step 11: Add the new github repository to your piwik code base

  • On your newly created project space, grab the HTTP git url
  • $ cd ~/code/piwik
  • $ git remote add github $The HTTP git URL from above

Step 12: Create a README and with deployment instructions and add it to your repository


Step 13: Push your code up to github

  • $ git push –u github master


Step 14: Verify this quick start is repeatable

At this point, I normally delete my application (after making a backup) and run through the quick start from scratch to ensure that it works.

  • $ cd ~/code
  • $ rhc-ctl-app –a piwik –c destroy –l  yourlogin
  • $ mv piwik piwik.working
  • Follow the instructions you created in your README file to try and deploy the application from scratch

Step 15: Email us and let us know

Once you have created a quick start, send us an email at openshift AT redhat DOT com and we will add it to the main OpenShift space on github.

If your application requires an existing populated database, the way to accomplish this is by using the .openshift/action_hooks/build script located in your application directory.  Once you have your database created locally, do a mysqldump on the table and store the .sql file in the action_hooks directory.  You can then modify an existing build file to import the schema on application deployment.  For an example, please see our wordpess quickstart.

News, OpenShift Online
Comments are closed.