Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Question: SQL Database with App on Heroku

Please I wish to understand that I have existing SQL Database on SQL and I wish to use it on my application on Heroku.

It gives error on posting :: Regards

3 Answers

Rails default database is SQL Lite, unless you have changed database.yml this is the database you are using.

Regardless of any configuration changes you make Heroku only runs on Postgres database. You cannot run any other database on Heroku.

The migrations you have written work the same on SQL Lite as they do on Postgresql. The important thing is, as before, to create the database and run the migration on Heorku or it will crash.

If you've migrated the database on Heroku and you're still getting the error you'll have give more details. Heroku is a complicated system and there can be many different issues.

Rich

Dear Mr. Richard. Many Thanks. Just let me know as I am working on Ruby on Rails but my hosting server donot support Ruby on Rails and Heroku is free hosting I wish to use free hosting service for RoR and get it linked to my regular coding.

Do you have suggestions and I also wish to keep my Database same.

Help required .

Best regards Nandini

What does it take to support Rails?

To support rails all you need is root access to a Linux box. You then install a webserver and an application server - typically NGINX and Unicorn but there are many other combinations. If your hosting provider can supply you a VPS or a dedicated box you can get Rails. I followed an episode of Railscasts that showed you how to do it - requires $9 a month to read it and there's a similar article from Smashing Magazine - this is free

I followed the Railscasts way of doing it and I can support many applications for a fixed charge of around $7 per month.

Heroku

What Heroku and the other application service providers is that they install this software (NGINX, Ruby etc) and maintain it. In the case of Heroku they have spent time to make getting onto the web as easy as possible. You have to decide if that them supporting the application servers is cost effective vs you supporting the server.

Heroku is a great way for a beginner to see a web application on the Internet. However, when the application stops being requested they backup the app and save it to a disk. Later on when you make a request for the application it has to find it on the disk, load it up and then respond to the request. This will take a few seconds - fine for development but not acceptable for production. The only, none hack, way around this is paying them per application per month - I wouldn't be suprised if this was $30 per application per month.

The other issue with Heroku is that their datacenter is in the US great if your customers are in that continent but if your users are in Asia or Europe then it isn't very quick.

I have only had small sites so I've kept the webserver and database on the same box (not recommend for bigger sites). So, I don't want to comment on having a separate database server though it is a common practice.

Rich

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

You can use heroku db:push to push from SQLite or MySQL from one box to Heroku's postgres instance.