Topic: Understanding the basics of how Rails/Capistrano/RadRails work

I use a Mac that I'd like to develop locally on and then run my sites on Dreamhost, I have some PHP experience but am new to Ruby, Rails, etc.  This is primarily a learning experiment for me to see how these larger web app systems work.  My questions are:

1- The most effective way to set up my Mac as a development environment?  I understand dragging Locomotive over to run Rails apps, and I understand installing Eclipse with RadRails, RDE, etc.  Not really sure how to link them together?

2- How to upload my site to Dreamhost?  I've been able to SSH into my account and generate a rails project there, and on another machine I've been able to generate a local rails project.  When I've tried to FTP the local system to the remote, however, it breaks.  I'm sure this is because some files must remain local, but I'm not sure what should or shouldn't be uploaded.  Which brings me to my next question... Capistrano

3- Someone told me that I need to use Capistrano to upload my project to Dreamhost, rather than the Eclipse FTP.  I have no idea how to use subversion or capistrano, much less how to configure that on Dreamhost.  Sadly most of the documentation I've found thus far assumes more knowledge about how servers and Unix/Linux command line than I have.

Can someone link me to a resource or provide a quick and dirty "for dummies" overview of my particular situation?  I'm excited about the actual Rails for Dummies book coming out in January, it actually does seem to have a focus on using RadRails.

Thanks in advance for any feedback.

Re: Understanding the basics of how Rails/Capistrano/RadRails work

kenneth@pardue.com wrote:

1- The most effective way to set up my Mac as a development environment?  I understand dragging Locomotive over to run Rails apps, and I understand installing Eclipse with RadRails, RDE, etc.  Not really sure how to link them together?

Rails is just a bunch of text files (mostly Ruby) so you can us any text editor to create a Rails app. On the Mac, my favorite is TextMate. Highly recommended!

kenneth@pardue.com wrote:

2- How to upload my site to Dreamhost?  I've been able to SSH into my account and generate a rails project there, and on another machine I've been able to generate a local rails project.  When I've tried to FTP the local system to the remote, however, it breaks.  I'm sure this is because some files must remain local, but I'm not sure what should or shouldn't be uploaded.  Which brings me to my next question... Capistrano

3- Someone told me that I need to use Capistrano to upload my project to Dreamhost, rather than the Eclipse FTP.  I have no idea how to use subversion or capistrano, much less how to configure that on Dreamhost.  Sadly most of the documentation I've found thus far assumes more knowledge about how servers and Unix/Linux command line than I have.

Yep, Capistrano is the way to go. Unfortunately there doesn't seem much documentation for it. The book is probably the best resource. After that you'll need specific instructions on setting it up for Dreamhost. There's quite a bit out there. One or the best spots to look for that is Dreamhost's wiki.


kenneth@pardue.com wrote:

Can someone link me to a resource or provide a quick and dirty "for dummies" overview of my particular situation?  I'm excited about the actual Rails for Dummies book coming out in January, it actually does seem to have a focus on using RadRails.

All the resources I know of dealing specifically with Capistrano/deployment require some knowledge of the command line and subversion. I suggest you set up Subversion on your dreamhost account and read the subversion book. Take a couple weeks and set up a Rails project on your local computer using subversion. A good OS X/Unix book can help you to learn some basic command line stuff too.

Railscasts - Free Ruby on Rails Screencasts

Re: Understanding the basics of how Rails/Capistrano/RadRails work

Okay, I've been playing around with this.
- I've finally got my local setup working properly (Ruby, RadRails, Subclipse).
- I've got a local project skeleton on my local machine.
- I've got a rails project skeleton created on Dreamhost as a subdomain.  I've forwarded the web directory to the "public" folder.
- I've "capistranized" my project, and edited my deploy.rb file based on the deployment receipe listed here: http://nubyonrails.com/pages/shovel_dreamhost.
- I've created a Subversion directory on Dreamhost, and using the Team/Share Project in Eclipse have uploaded my files to the directory.

NOW, what do I do?  From RadRails' Rake Tasks dialog, i've run "remote:exec ACTION=setup".  I get a message saying that Capistrano/Rake integration is deprecated, but it still seems to run.  I get 'executing command' and 'command finished'.  I don't know what that did or where it did it.

I've tried running 'deploy' from Rake Tasks and I get a message that says rake aborted! Could not determine latest revision.

What's next for me?

Re: Understanding the basics of how Rails/Capistrano/RadRails work

Not sure how much it will help but Geoffrey Grosenbach from Peepcode has a new video tutorial all about capistrano for deployment. http://www.peepcode.com/products/capistrano-concepts

Forgot to mention it costs $9.

Last edited by sydneyfx (2007-01-15 01:53:02)

Re: Understanding the basics of how Rails/Capistrano/RadRails work

kenneth@pardue.com wrote:

Okay, I've been playing around with this.
- I've finally got my local setup working properly (Ruby, RadRails, Subclipse).
- I've got a local project skeleton on my local machine.
- I've got a rails project skeleton created on Dreamhost as a subdomain.  I've forwarded the web directory to the "public" folder.
- I've "capistranized" my project, and edited my deploy.rb file based on the deployment receipe listed here: http://nubyonrails.com/pages/shovel_dreamhost.
- I've created a Subversion directory on Dreamhost, and using the Team/Share Project in Eclipse have uploaded my files to the directory.

NOW, what do I do?  From RadRails' Rake Tasks dialog, i've run "remote:exec ACTION=setup".  I get a message saying that Capistrano/Rake integration is deprecated, but it still seems to run.  I get 'executing command' and 'command finished'.  I don't know what that did or where it did it.

I've tried running 'deploy' from Rake Tasks and I get a message that says rake aborted! Could not determine latest revision.

What's next for me?

Bump.  It's been some time now and I still havent' found a solution for this issue.  It tells me "rake aborted! Could not determine latest revision."

Re: Understanding the basics of how Rails/Capistrano/RadRails work

kenneth@pardue.com wrote:
kenneth@pardue.com wrote:

Okay, I've been playing around with this.
- I've finally got my local setup working properly (Ruby, RadRails, Subclipse).
- I've got a local project skeleton on my local machine.
- I've got a rails project skeleton created on Dreamhost as a subdomain.  I've forwarded the web directory to the "public" folder.
- I've "capistranized" my project, and edited my deploy.rb file based on the deployment receipe listed here: http://nubyonrails.com/pages/shovel_dreamhost.
- I've created a Subversion directory on Dreamhost, and using the Team/Share Project in Eclipse have uploaded my files to the directory.

NOW, what do I do?  From RadRails' Rake Tasks dialog, i've run "remote:exec ACTION=setup".  I get a message saying that Capistrano/Rake integration is deprecated, but it still seems to run.  I get 'executing command' and 'command finished'.  I don't know what that did or where it did it.

I've tried running 'deploy' from Rake Tasks and I get a message that says rake aborted! Could not determine latest revision.

What's next for me?

Bump.  It's been some time now and I still havent' found a solution for this issue.  It tells me "rake aborted! Could not determine latest revision."

capistrano doesn't work,
http://railsforum.com/viewtopic.php?id=3903
you should just export your head revision and sftp it up to your server

Re: Understanding the basics of how Rails/Capistrano/RadRails work

Fantastic, wish I had realized Capistrano doesn't work before.  If I may ask, since I don't yet fully understand how Rails apps work, which files should I avoid uploading to Dreamhost (to keep from breaking it), and which should be uploaded?

Thanks

Re: Understanding the basics of how Rails/Capistrano/RadRails work

kenneth@pardue.com wrote:

Fantastic, wish I had realized Capistrano doesn't work before.  If I may ask, since I don't yet fully understand how Rails apps work, which files should I avoid uploading to Dreamhost (to keep from breaking it), and which should be uploaded?

Thanks

i only upload my /config directory once, and have a working copy for development and one for production, edited as necessary.

then i don't upload /test /log and /tmp

i even ignore them from subversion.

and of course if you have any /.metadata directories, i ignore those also (some IDEs generate this)

Re: Understanding the basics of how Rails/Capistrano/RadRails work

Capistrano works fine, you just need to have it configured properly.

Railscasts - Free Ruby on Rails Screencasts

Re: Understanding the basics of how Rails/Capistrano/RadRails work

ryanb wrote:

Capistrano works fine, you just need to have it configured properly.

If that's the case, here's my deploy file (username omitted, of course).  I'd like to do it the 'correct' way, if possible.  I did notice that several directories were created in my rails.kenpardue.com directory, just not, apparently my application.

# Introductory SwitchTower config for Dreamhost.
#
# ORIGINAL BY: Jamis Buck
#
# Docs: http://manuals.rubyonrails.com/read/chapter/98
#
# HIGHLY MODIFIED BY: Geoffrey Grosenbach boss@topfunky.com
#
# Docs: http://nubyonrails.com/pages/shovel_dreamhost
#
# USE AT YOUR OWN RISK! THIS SCRIPT MODIFIES FILES, MAKES DIRECTORIES, AND STARTS
# PROCESSES. FOR ADVANCED OR DARING USERS ONLY!
#
# DESCRIPTION
#
# This is a customized recipe for easily deploying web apps to a shared host.
#
# You also need to modify Apache's document root using Dreamhost's web control panel.
#
# For full details, see http://nubyonrails.com/pages/shovel_dreamhost
#
# To setup lighty, first edit this file for your primary Dreamhost account.
#
# Then run:
#   rake remote:exec ACTION=setup
#
# This will create all the necessary directories for running Switchtower.
#
# From then, you can deploy your application with Switchtower's standard
#   rake deploy
#
# Or rollback with
#   rake rollback
#
# This defines a deployment "recipe" that you can feed to switchtower
# (http://manuals.rubyonrails.com/read/book/17). It allows you to automate
# (among other things) the deployment of your application.
#
# NOTE: When editing on Windows, be sure to save with Unix line endings (LF).

set :user, '*********'
set :application, "rails_kenpardue_com"
set :repository, "svn+ssh://home/#{user}/svn/rails_kenpardue_com/"
# NOTE: If file:/// doesn't work for you, try this:
#set :repository, "svn+ssh://home/#{user}/svn/#{application}"


# =============================================================================
# You shouldn't have to modify the rest of these
# =============================================================================

role :web, application
role :app, application
role :db,  application, :primary => true

set :deploy_to, "/home/#{user}/rails.kenpardue.com"
# set :svn, "/path/to/svn"       # defaults to searching the PATH
set :use_sudo, false

desc "Restart the FCGI processes on the app server as a regular user."
task :restart, :roles => :app do
  run "#{current_path}/script/process/reaper --dispatcher=dispatch.fcgi"
end

Re: Understanding the basics of how Rails/Capistrano/RadRails work

Based on the error you got above, it sounds like capistrano can't access your SVN repository. Are you certain the settings are correct? I forgot, does DH support svn+ssh access to the repository? You might just want to use http:

set :repository, "http://#{user}@svn.domain.com/myapp/trunk"

I know it's not as secure, but at least you can see if it works.

Railscasts - Free Ruby on Rails Screencasts