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

2 comments:

  1. Configuring software and installation of some programs can be a hard thing to do. Sometimes the program simply refuses to work properly, as if it was human. bestdissertations. Some programs can really mess with your head and cause you to have headache, even. I quite remember I had to install a new program on my system and there wasn’t enough space on the local disk so I had to delete other programs to make room for the new one.

    ReplyDelete