Setting up GlitterGallery

I’ll try my best to explain the process I went through to set up GlitterGallery. Covered, are instructions for setting things up on a fresh install of Fedora 18. I’m not sure how far these instructions will accurately apply to other GNU/Linux distributions, but I’d love it if you could give me your feedback!

We’ll begin with first installing Ruby Version Manager (RVM). RVM is a tool that helps you manage multiple Ruby versions simultaneously on your computer. It’s necessary because many a time Ruby developers need to look through and run old Ruby code, and there isn’t an easy way to manage different environment configurations on the same computer. You could of course get away by simply installing the Ruby version you most commonly use, but using RVM simply gives you more power.

I would recommend reading the official detailed RVM guide for installation instructions, although if you just want a quick bunch of steps, here’s what you’d normally do.

$ sudo yum update
$ sudo yum install curl git-core make bzip2 gcc-c++ \
patch readline readline-devel zlib zlib-devel \
libyaml-devel libffi-devel libxslt-devel sqlite \
sqlite-devel openssl openssl-devel
$ \curl -L https://get.rvm.io | bash -s stable --auto 
$ rvm get head

Now that you have installed RVM, close the current terminal and reopen a new one. Install Ruby and set v1.9.3 as default.

$ rvm install 1.9.3 
$ rvm use 1.9.3 --default

You’ll  now need to install Rails. So go ahead and do:

$ gem install rails -v 3.2.13

At this point, you have RVM, Git, Ruby 1.9.3 and Rails installed, besides other packages that these depend on. So now we’ll obtain the source code and deploy GlitterGallery. Start by signing up for an OpenShift account. You will now have to create a new Ruby 1.9 application, and add a MySQL cartridge. You can do this on the browser as well, but if you’d like to use the terminal, you’d do this:

$ gem install rhc
$ rhc setup
$ rhc create-app glittery ruby-1.9 
$ # Note the OpenShift Git URL you get
$ rhc add-cartridge mysql-5.1 -a glittery

Since we’re using the mysql2 gem in the application, we’ll additionally have to install the MySQL  and ruby development packages for Fedora.

$ sudo yum install mysql-devel ruby-devel rubygems

Now you can go back to syncing your OpenShift Git repo with the current source code:

$ git clone <OpenShift git URL>
$ cd glittery
$ git remote add glitter -m master http://bit.ly/12k3LVE
$ git pull -s recursive -X theirs glitter master
$ git push

Aaaand, you’re set! 😀 Go to your application’s URL and see if it is deployed properly. For reference, you can compare it with my instance. If you see a Passenger page, you have more work to do. The most general solution I can think of is to change to your app directory and do:

$ bundle install

If this gets interrupted in between, you’d most likely be instructed to do something, such as “Make sure gem install rake succeeds before bundling.” If this happens, do as instructed and try bundle install again.

Please add any problems you face in the comments!

Advertisements

One thought on “Setting up GlitterGallery

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s