Friday, March 11, 2011

Ruby Formatter written in Python

I recently switched from TextMate to Aquamacs to MacVim and finally to Sublime Text 2. Sublime has some great features, but it was lacking ruby code formatting until now.

Get the source from

1) Place in ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/
2) Bind a key to pretty_ruby.  I changed "super+b" from "build" to "pretty_ruby"

{ "keys": ["super+b"], "command": "pretty_ruby" }

Migrating from Heroku Postgres to Amazon RDS MySQL

I recently moved from Heroku's built in postgres database to Amazon RDS to take advantage of Read Replica.

The following steps will get you there, too.

  1. Signup for Amazon RDS
  2. Download the Amazon RDS Command Line Toolkit
  3. Install the Toolkit
    • Unpack toolkit. I did this in /Users/phertler/Applications/RDSCli-1.3.003
    • export AWS_RDS_HOME=/Users/phertler/Applications/RDSCli-1.3.003
    • Make sure you JAVA_HOME is set. export JAVA_HOME=/Library/Java/Home
  4. Configure credentials
    • cp $AWS_RDS_HOME/credential-file-path.template $AWS_RDS_HOME/credential-file.txt
    • Update credential-file.txt with your Amazon Account credentials
  5. Create a security group for your database
    • rds-create-db-security-group --db-security-group-name mygroupname  --db-security-group-description 'my database security group'
  6. Launch a RDS instance with an instance named myinstance database named mytestdb. Be sure to remember your username and password. 
  7. Allow current local machine to connect to your new mysql database
    • rds-authorize-db-security-group-ingress --db-security-group-name mygroupname -i /32
  8. List your instances to be sure you can connect
    • rds-describe-db-instances
  9. Now you can connect to your database from you local machine. You will need to find your RDS instance's endpoint from the AWS console. It will look something like
    • mysql -h -u yourusername -p
Now you are ready to migrate your heroku database to RDS
  1. Allow heroku to connect to your RDS instance
    • rds-authorize-db-security-group-ingress default --ec2-security-group-name database --ec2-security-group-owner-id 098166147350
  2. Add the heroku rds addon
  3. Port your current Heroku Postgres database to your new Amazon RDS MySQL database
    • heroku db:pull mysql:// 
Finished!.....well, now you can also set up the Read Replica and then set up a Master/Slave database with


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]