Heads Up for This New PaaS of RedHat

Once again , we have a new PaaS service to deploy and test our web apps. It is not so new to talk about this much but I just want to share my exciting experiences in this PaaS rather than the One, Heroku. By the way , heroku is too mainstream !

Opensift is a PaaS service by RedHat and supports most of the popular application resources from PHP,python to nodejs,Ruby[RoR] . You can create a free account here and you have 3 Gears free for life time [ I think so ].

Let’s use the service as testing purpose. In this case , I would like to deploy a simple RoR application which is already tuned by OpenShift itselft. Repo can be found at https://github.com/openshift/rails-example. You can learn yourself at their official get-started page or follow me.

Install the RHC [ OpenShift Service Client Tool ] as a gem.

$ gem install rhc

Exit your bash session and then open a new one. In the other words, “Restart” your current bash session. And make this command.

$ rhc

You will see a lot of options coming down and each has an explaination aside. Observe well for future use. And then you can list down the supported resources and languages by this command.

$ rhc cartridges

Here is how it will show up !

Setup the RHC integrated with your OpenShift account.

$ rhc setup

It would prompt you to enter your OpenShift email and password and automatically generate a token. And all done. You are now linked with your Open Shift account and not necessarily need to use their website to create some apps. Do it right within your bash.

Let’s create an empty project which would be called as myapp. We will use sqlite in local development and PostgreSql for deployment.

As we are going to deploy a RoR application which is made with Ruby programming language and the command should be …

$ rhc app create ruby-1.9 -a myapp
$ rhc cartridge add postgresql-9.2 -a myapp

This would create an application with a quick start ruby app within it.Wow it is not a really empty project after all. Now time to pull the quick-start app from github. For more information for this step , you can follow the instruction here in README.

$ cd myapp
$ git remote add upstream -m master git://github.com/openshift/rails-example.git
$ git pull -s recursive -X theirs upstream master

Ok , you are set to go and deploy the app. Env_Variables were already configured in the quick-start app. But for your own app , you need to customize the database.yml and put the production env_variables yourself. This is for a rails app with Postgresql.

adapter: postgresql
encoding: unicode
pool: 5
database: <%=ENV['OPENSHIFT_APP_NAME']%>

Time to push.

$ git push

You will see the log messages of deploying your app and then you can test it via the public url that OpenShift provided. You can get the url by signing into the web dashboard or use this command.

$ rhc show-app myapp

You can use ssh to access your gear’s workspace just by the following command.

$ rhc ssh myapp

Try to know the platform by yourself for further usage.
Have Fun

Copyright © 2016 - Tin Aung Linn. Powered by Octopress