Categories
General

Host Tracks v2.2.2 for free with OpenShift

Update: Fixed the command to create the application.
A few days ago I discovered Red Hat’s OpenShift service for hosting web applications in the cloud. Currently, you can host up to three applications for free which is nice, and performance is quite acceptable as well.
In order to host tracks on OpenShift, you can use the repository I created at https://bitbucket.org/matt/tracks-openshift-quickdeploy/src which includes Tracks v2.2.2.
Here’s instructions on how to deploy Tracks on OpenShift. In the future, when Red Hat resolves some issues with deploying from a git repository, it will be much simpler.

Assumptions

I’m going to assume that you have created an account at openshift.com and that you have installed the OpenShift client tools, including git.

Installation

First, we’ll create the application:

$ rhc app create tracks ruby-1.9 mysql-5.1

After creating the application, rhc will create a git repository in the current directory with the name of the app. We need to replace all the code with the code from https://bitbucket.org/matt/tracks-openshift-quickdeploy/src.

$ cd tracks
$ rm -rf *
$ git rm --cached *
$ git commit -m "Removing initial files"
$ git remote add upstream -m master https://bitbucket.org/matt/tracks-openshift-quickdeploy.git
$ git pull -s recursive -X theirs upstream master

Note, if you’re on Windows, you might want to double check to make sure that the hook scripts are still executable. You can do this on Windows with the following:

$ git update-index --chmod=+x .openshiftaction_hooksbuild
$ git update-index --chmod=+x .openshiftaction_hooksdeploy
$ git update-index --chmod=+x .openshiftaction_hookspost_deploy
$ git update-index --chmod=+x .openshiftaction_hookspost_start_ruby-1.9
$ git update-index --chmod=+x .openshiftaction_hookspost_stop_ruby-1.9
$ git update-index --chmod=+x .openshiftaction_hookspre_build
$ git update-index --chmod=+x .openshiftaction_hookspre_start_ruby-1.9
$ git update-index --chmod=+x .openshiftaction_hookspre_stop_ruby-1.9
$ git commit

Now, you will want to edit the config/site.yml file and replace the salt: and secret_token: values with your own values. I used GRC’s password generator to generate some random values. Also, while you’re at it, modify any other options in site.yml that you want. Be sure to commit the changes when you’re done.
Finally, we can do a push and after a while, you should be able to access your application at https://APPLICATION-NAMESPACE.rhcloud.com where you’ll be prompted to create the admin account and etc.
Once Red Hat resolves issues with the --from-code, this will become much simpler.

Credit

Thanks to @disconn3ct for boiling down the necessary instructions to avoid Red Hat’s issues.

Categories
General

my-eye-reflection
taken by someone special