Help: How do YOU develop Rails apps on Dreamhost?

software development

#1

I am new to Ruby on Rails and just created my account here at Dreamhost. I’ve got my MySql subdomain working and created a couple subdomains for ROR apps that each show the ROR Welcome screen. So far, so good! I also have a complete ROR environment configured on my Powerbook and can create apps locally.

How to proceed from here is a bit perplexing.

I am reading through the Agile Web Development with Rails 2nd ed. and will be building the shopping cart software (the book’s main example app) as I go along. Should I do all of my development locally on my Powerbook, and then re-create the MySql table structures/data on my Dreamhost MySql databse and upload certain parts of the app’s dir structure to my Dreamhost subdomains after I get them working? Or should I edit a file and then upload it right away to see the results live on the site? I use TextMate on my mac and I’m not a fan of editing text files from the command line using something like Pico. I don’t have the public going to this site. It’s mainly for learning ROR and having it live so I can send other people there to check it out if I wanted to.

So how do the rest of you who do ROR development operate with dreamhost? Do you work on the live files or do you work locally and upload every so often??

-=Randy


#2

Yeah, the common way is to get the app working locally and upload it when its all done! Remeber that ruby runs in production mode on the server.


#3

Ah, good tip. I had noticed that in railsapp/config/environment.rb the production line is commented out. I wondered if that meant I could also use it in development/test modes. So this means I don’t need to create development or test versions of MySql databases, huh?

Ok, so develop on my laptop and then upload to check it out on dreamhost in productions mode. How do you upload? Manually, or do you use something like Capistrano? All the information seems to be online, albeit in many many different disconnected sources. After reading a bit about capistrano, I saw something about subversion. So now I have a svn.mydomain.com and am reading up on what that’s all about and how to use it with capistrano.


#4

I finally figured it out! I created my svn subdomain and imported a basic rails app into it. I can update and commit changes via svn easily now. (I found that capistrano won’t create the symlink without 1st having a rails app imported into svn!!) Next I spent some time tweaking the deploy.rb file from capistrano and successfully have it searching my svn for the latest version of my rails app and creating the symlink ‘/current/public’ to point to it whenever I execute ‘cap deploy’ from within my local rails app folder. Ended up installing both svn and capistrano locally (not sure I had to do that, but it works).

FOLLOW UP QUESTION:
How does one restart the processes/rails app on the Dreamhost server once uploading a new version of a rails app in production mode? I’ve tried including in the deploy.rb script ‘killall -USR1 dispatch.fcgi’ and it throws an error and doesn’t restart. If I try any sort of killall from the Dreamhost ssh command line, it simply say’s, “dispatch.fcgi: no process killed” I tried doing it as in a couple tutorials by adding ‘sudo’ to the beginning and got a warning from the Dreamhost server. The only way I can have my Dreamhost server restart and display the changes I’ve made is via the control panel. I go into Domains/Manage Domains, go into ‘edit’ my subdomain and click ‘Change fully hosted settings now’ without actually changing anything. There HAS to be a way to do this with a script, no?


#5

I usually use a 1-2 combo of:

killall -usr1 dispatch.fcgi # Until I get a no processes killed msg
killall -usr1 ruby1.8 # Dittoes

Your mileage may vary.