Running on OpenShift
OpenShift is a free auto-scaling “Platform as a Service” cloud based hosting platform from RedHat. Because it supports Ruby, you can install Nesta on it easily.
Before you can deploy your site you need to get it running properly on your own computer. You’ll also need to check it into a Git repository.
When you generate a new Nesta site you can tell Nesta that you want to manage it with Git by adding the
$ nesta new mysite.com --git
--git switch just creates a new repository for you, and commits the freshly created site. If you’re deploying a site that has been created without a git repository, create a git repository as follows:
$ cd mysite.com $ git init $ git add . $ git commit -m "Initial commit"
See the quick start docs for more details on the above.
If you haven’t already done so, install the Ruby gem that contains the client tools for the OpenShift platform, and run the setup command:
$ gem install rhc $ rhc setup
Deploying to OpenShift
If you don’t already have an app setup for your site on OpenShift, create a remote ruby-1.9 application with
$ rhc app create -a mysite -t ruby-1.9
rhc app create command will print out the URL of your application’s Git repository on OpenShift (it will start with
We need to add that remote repository to our site:
$ cd mysite.com $ git remote add origin \ ssh://email@example.com/~/git/mysite.git
Make sure you change the random key, “mysite” and “namespace” in the remote URL to match the name of your app and OpenShift namespace.
Now we just need to merge your app’s OpenShift template files (that RedHat have set up for us) into our Git repository. This will do the job for you:
$ git pull -s recursive -X ours origin master
To deploy, just push your Nesta code back up to OpenShift. The first time you push I’d recommend the
-u option, which will setup your local Git branch to track the remote Git branch; in future you can just type
$ git push -u origin master
That’s it. You should now be able to view your app running at http://app-namespace.rhcloud.com.
To make more changes to your site, edit your files, commit them to your repository and then deploy the changes with:
$ git push origin master