An interesting platform I came across recently for developing and deploying cloud applications is OpenShift by RedHat. OpenShift is a next generation application hosting platform. The software running this service is open-sourced under the name OpenShift Origin, and is available on GitHub. Developers use Gitto deploy web applications in different languages to the platform. OpenShift supports any web applications that run on Red Hat Enterprise Linux. This allows a wide range of languages and frameworks. OpenShift takes care of maintaining the services underlying the application and scaling the application as needed. This makes it an excellent platform for Drupal. Getting your first application up and running can be done very rapidly through a couple of simple steps.
Create an Application
OpenShift runs as a platform-as-a-service. You can either use the web console, Eclipse, or if you are a command line warriror, RedHat provides a "gem" to manage your applications from a console. You can use the command
rhc-create-app from a console to create your first application and OpenShift will spin up a container with a set of resources that allow you to run your application. These resources are called Gears and OpenShift runs many Gears on each virtual machine and dynamically distributes Gears across them. To install the gem, you must have ruby installed, you then install the command line with; "
gem install rhc" followed by
rhc setupto complete the setup.
- Signup for OpenShift online and use their cloud service to get started, it's free to join and an easy way to get your first application running. A free account OpenShift gives you three small gears. You can either run an app on a single gear or have it scale to multiple gears with load balancing.
- Once your account is created, choose a domain name for your applications, all your apps will show up as a subdomain.
- Next choose a
cartridge. For Drupal I chose "PHP 5.3 with Zend Server 5.6".
- Once you have chosen a cartridge, you are prompted for a domain for all your applications to live under.
- Next you are prompted for the name of your application and the optional git repository name, for example: for my domain name I chose "Bohemian" and for my application I chose "Drupal" so my final domain would be http://drupal-bohemian.rhcloud.com
- Choose additional cartridges to get your application up and running, MySQL 5.5, CRON and Jenkins (for continuous integration.)
Login to your account and you can create your application, you can select your choice of programming language, database, or other services via OpenShift cartridges. These cartridges can include, PHP, MySQL, Postgress etc.
OpenShift uses git for managing code inside your application. You can clone the new repo from the URL on your application console. Update your code and then simply perform a "git push" to deploy your code to your application. You will need to add a secure SSH key to your account before you can deploy any code. Openshift provides a directory framework allowing you to modify your application and exposes elements of your setup through environment variables eg.
$_ENV['OPENSHIFT_DATA_DIR']for the location of persistent storage between pushes or others for your database connection information. You can use these inside your settings.php to define your database connection settings:
- $_ENV['OPENSHIFT_MYSQL_DB_HOST'] - DB host
- $_ENV['OPENSHIFT_MYSQL_DB_PORT'] - DB Port
- $_ENV['OPENSHIFT_MYSQL_DB_USERNAME'] - DB Username
- $_ENV['OPENSHIFT_MYSQL_DB_PASSWORD'] - DB Password
There are more variables available for your use and OpenShift lists them on their website To get up and running quickly, openshift maintains a quickstart version of Drupalwhich can be installed with all the common cartridges to get you up and running. When you run a 'git push' from your computer - your changes are sent to your OpenShift application and the following actions occur.
- The application is shut down
- Your changes are copied on the server into the correct location
- OpenShift invokes your build hooks - script files you've placed in your Git repository
- Your application is restarted.
OpenShift is a scalable affordable platform for Drupal hosting on a managed platform backed by Red Hat support and a community of Drupal developers. The Drupal cartridge is maintained by Red Hat and has everything you need to get up and running. The platform is open to more than just Drupal, if it runs on RHEL, it will run on OpenShift. With a full shell and vim and preconfigued Drush, this is definitely a platform worth exploring.
- Overview of OpenShift as a developer
- How it works
- Application Gallery
- Drupal Quickstart on OpenShift
- Iinstalling Drupal under OpenShift express,demo from RedHat