JV was interested in how I got
Heroku to talk to
Xeround... here's how I did it:
Note: This is how I did it with a separate Xeround account, rather than using the Heroku add-on method. I did this because my db is currently fairly small so the 500mb option from Heroku was a bit bigger/more expensive than I needed.
On the Xeround side:
1) Signup and setup your new db instance at
http://www.xeround.com
2) Add a user to the xeround db with the right permissions and note down the username/password
3) Import your db into your xeround db - I used a phpmyadmin backup from my existing mysql server, then a rake db:migrate to bring it up to the latest version on my local dev laptop, followed by an import via navicat using the credentials from step 2) above
4) Note down one of the urls for your db, e.g. ec2-999-202-xxxxx
So you should end up with:
a) A db instance on the Xeround cloud (
your_instance_name)
b) A user with access to the instance (
your_db_username/
your_db_user_password)
c) A DNS Name and port for the instance (
your_xeround_instance_DNSName:portnum)
And on the Heroku side:
1) Hook up your Heroku app as their docs detail -
http://devcenter.heroku.com/ I got my app running using Postgresql with the rake create, migrate, seed commands just to test out a blank db install.
2) Now you need to repoint your std Heroku app using Postgresql to the external production Xeround db instance using mysql...
3) View your current app config using:
heroku config --app your-herokuapp-123
... where your-herokuapp-123 is the name of your Heroku app. This shows you the app config values that Heroku is using, and the key one we are looking to overload is the DATABASE_URL
4) Set your DATABASE_URL config value as follows:
heroku config:add DATABASE_URL="mysql://your_db_username:your_db_user_password@your_xeround_instance_DNSName:portnum/your_instance_name" --app your-herokuapp-123
5) Check the config values again:
heroku config --app your-herokuapp-123
... and you should see your new DATABASE_URL
6) Restart your Heroku app:
heroku restart --app your-herokuapp-123
... and hopefully you're in business.
Once I'd worked out the key was to override the default DATABASE_URL it was plain sailing, all I had to do was shift the db instance from Ireland to the ec2 data centre in the US to improve performance ;-)