Showing posts with label rails ubuntu centos migration postgresql. Show all posts
Showing posts with label rails ubuntu centos migration postgresql. Show all posts

Thursday, March 12, 2009

Migrating an RoR app from Ubuntu Feisty to CentOS 5.2 Part 2: Database Migration

Part 2 in a series of 4

In Part 1, I got Phusion Passenger up and running. Now I needed to migrate my database schema across. I use Postgres 8.3, which was not installed on the centos box.

Installing Postgres
I need to make sure postgres is (a) installed and (b) configured.

(a) installing postgres: following steps outlined here.
(b) configuring my database and user: my database settings from database.yml are:

development:
adapter: postgresql
host: localhost
database: deploy_monitor_development
username: deploy_monitor
password: deploy_monitor

test:
adapter: postgresql
host: localhost
database: deploy_monitor_test
username: deploy_monitor
password: deploy_monitor


production:
adapter: postgresql
host: localhost
database: deploy_monitor
username: deploy_monitor
password: deploy_monitor


Because this is a production box, I only need to configure the production database, meaning I only need to add the production user deploy_monitor and the database deploy_monitor.

I followed the instructions from the postgresql site to add a user and create a database.
I also needed to install the following gems:
  • postgres (0.7.9.2008.01.28)
  • postgres-pr (0.5.1)
to enable Rails to connect to Postgres.

Console Access
A lot of times I need to log into the box and check something via script/console, i.e. to run an ActiveRecord query.
In order to run console, I need to build readline:

(1) Install readline and readline-devel

yum install readline
yum install readline-devel

(2) build/install ruby readline bindings

cd {ruby src}/ext/readline
ruby extconf.rb
make
sudo make install

Continued: Part 3, Installing RRD