Rails + oauth-plugin + mongodb – Part 2: Consumer

In previous post, we went through the process to create a Provider with Oauth-plugin that works with Mongodb using mongid as the driver. Here we will build the Consumer using mongoid too.

This Consumer app will run on port 4000 (rails s -p 4000) and connect with the Provider app which will be running on port 3000.

Step 1 – step 3

Exactly the same as in previous post for Provider

Read More »

Rails + oauth-plugin + mongodb – Part 1: Provider

Recently I had a chance to work with Oauth and Rails using oauth-plugin and mongodb. Although oauth-plugin itself has a documentation but actually doesn’t cover the mongoid part detailed enough. Also I found this very good tutorial but it’s for SQLite3 only: Oauth Provider, Oauth Consumer

Base on the above posts, to get Rails and oauth-plugin working with mongodb, you need to do some changes.

Firstly, create a oauth-sample directory, you’ll put provider and consumer apps in there.

Read More »

BrowserCMS: from development to production

There’re some Rails CMS such as Radiant, Refinery, BrowserCMS… and I find BrowserCMS the best one to build simple websites for my customers, we can easily create dynamic content for you websites with Portlet, create new object to manage by with Content type, and easily create template for each page (homepage, subpages…).

In this post we won’t talk about how to use BrowserCMS, please go to the BrowserCMS Wiki if you’re finding that information. This post just concentrates on things you need to do to get BrowserCMS work properly on server in production mode.

Read More »

Deploy Rails app from Github to Heroku

Recently I found deploying your Rails code which already on Github to Heroku is very useful. You can use this to show your work to your customers, friends …. Let’s start

= GITHUB

== Generate a keypair

cd ~/.ssh
ssh-keygen -t rsa -C “your@mail.com”
(enter at first prompt)

Then go to your github account then add that key in id_rsa.pub. Should use a text editor then ctrl-A to select all.

Read More »

how to setup tr.im on Bluehost

Ok, some days ago a friend of mine asked me to write a tutorial on how to install a Tr.im application. Actually, I had successfully installed it on Bluehost (failed on Justhost, I think there’re some problems with dispatch.cgi/fcgi/rb on Justhsot)

Tr.im application is a combination of 3 applications: trim, trim_api and trim_redirect. We have to modify the configuration files in trim/config/ only (no need on that 2 remaining apps)

Read More »

Install and use your custom gems on Bluehost

It’s very normal your Rails app has to run under a Rails version different from the one on Bluehost (or any other hosts). If so, we have to find a way to install our own Rails gem and let the application knows about it.

Install a new gem on Bluehost (or any other hosts) is easy, just run

gem install gem_name -v=gem_version

Next, we’ll let our app where our own gems are located. In your ~/.bashrc, added these:

Read More »

Easily setup Rails app on Bluehost

Hi guys, below is the steps to setup a Rails application on Bluehost. Really easy

– create new sub domain (a folder named /public_html/sub_domain_name will be created automatically)
– delete the above folder
– “rails app_name”
– create soft link: “ln -s /path/to/your/app_name /public_html/sub_domain_name”
– create database (by cPanel)
– create mysql user (by cPanel)

– add user to database (and grant *ALL* privileges)

– modify /config/database.yml file to match the username/password, database name of mysql
– “rake rails:update:generate_dispatchers” to create 3 dispatchers.rb/cgi/fcgi (will use fcgi, chmod 755)
– create .htaccess with content:

Read More »