# Dreamhost/Capistrano confusion

**URL:** <https://www.ruby-forum.com/t/dreamhost-capistrano-confusion/70933>\
**Category:** Rails\
**Created:** [October 4, 2006, 1:02am UTC](https://www.ruby-forum.com/t/dreamhost-capistrano-confusion/70933 "2006-10-04T01:02:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [October 4, 2006, 1:02am UTC](https://www.ruby-forum.com/t/dreamhost-capistrano-confusion/70933/1 "2006-10-04T01:02:18Z")

</div>

Hi,

I am having trouble getting a Rails app deployed on Dreamhost via  
Capistrano. I am using the information from the Dreamhost wiki at  
[http://wiki.dreamhost.com/index.php/Ruby\_on\_Rails](http://wiki.dreamhost.com/index.php/Ruby_on_Rails), and the ‘shovel  
dreamhost’ script from [nubyonrails.com/pages/shovel\_dreamhost](http://nubyonrails.com/pages/shovel_dreamhost). One of my  
problems is that the wiki seems to suggest to create the app on the  
production server, do the dreamhost-specific configuration and then just  
copy over the ‘app’ folder (and a couple more) from development. However  
the capistrano script seems to export the entire folder from subversion.  
(BTW I froze the app to edge rails - does this make a difference?).

I was wondering whether any of the list members has found a workflow for  
developing apps locally and deploying them on Dreamhost that actually  
works.

Thanks!  
Ingo

---

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [October 4, 2006, 9:11pm UTC](https://www.ruby-forum.com/t/dreamhost-capistrano-confusion/70933/2 "2006-10-04T21:11:09Z")

</div>

Ingo W. wrote:

> I was wondering whether any of the list members has found a workflow for  
> developing apps locally and deploying them on Dreamhost that actually  
> works.

Hi Ingo,

This should cover everything you need to set up. I use separate live  
and staging environments, so I’ve included those settings in case you  
find it helpful.

1. Make your deploy.rb and other files on your local development  
machine and commit them to Svn.

2. Use DH panel to set your hosted directory to app\_name/current/public

3. Empty out the “app\_name” directory where you will be deploying to.  
then run cap setup so it creates the current/shared/releases  
directories and symlinks in there.

4. Run cap deploy.

Here’s what I have in my config files:

## config/deploy.rb

set :application, “your\_app”  
set :user, ‘your\_user’  
set :svn\_username, “your\_svn\_username”  
set(:svn\_password) { Capistrano::CLI.password\_prompt } # (don’t know  
if CLI.password is necessary)  
set :repository, “http://svn.your\_domain.com/trunk”  
set :use\_sudo, false  
set :checkout, “export”

# for ssh key-based passwordless connection (optional)

ssh\_options[:keys] =  
%w(’/Users/your\_local\_dev\_machine\_user/.ssh/id\_dsa’)

# for separate staging / live environments (optional)

case ENV[‘TO’]  
when ‘production’ :  
set :deploy\_to, “/home/#{user}/#{application}”  
set :rails\_env, :production  
else  
set :deploy\_to, “/home/#{user}/stage.#{application}”  
set :rails\_env, :staging  
end

# roles

role :app, application  
role :web, application, :no\_release =\> true  
role :db, application, :primary =\> true, :no\_release =\> true

# tasks

desc “Restart the FCGI processes on the app server as a regular user.”  
task :restart, :roles =\> :app do  
run “#{current\_path}/script/process/reaper -d dispatch.fcgi”  
end

# for this you should symlink whatever directories you want kept in

current between deployments which aren’t stored in SVN.

desc “Link shared files to carry them forward to current deployment”  
task :before\_symlink do  
run “rmdir #{current\_release}/public/uploads”  
run “ln -nfs #{deploy\_to}/#{shared\_dir}/uploads”   
" #{current\_release}/public/"  
end

## config/environment.rb

# Set environment based on deployment directory name (optional)

# (I use a directory name without .com for local development)

case File.expand\_path(’…/…/…’,Dir.pwd).gsub(/.\*//,’’)  
when ‘your\_app.com’ : ENV[‘RAILS\_ENV’] = ‘production’  
when ‘stage.your\_app.com’ : ENV[‘RAILS\_ENV’] = ‘staging’  
end

## config/environments/staging.rb

# create this file as needed for logging/error reporting settings for

your staging environment. (optional)
