Hey Tim,
I've just read the comment you posted a couple of hours ago on my blog post
at
http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/#comments

As you probably noticed reading the post, my tutorial is focused exactly on
the same problem.

The second code snippet is a ready to use recipe based on capistrano
multi-environment plugin.
Did you run into any problem using that script?

-- Simone


On Thu, Apr 9, 2009 at 9:52 PM, E. Johnson <[email protected]> wrote:

> Have you tried moving your 'after' call outside of the :uploads namespace?
>
> -Erik
>
>
>
> On Thu, Apr 9, 2009 at 3:35 PM, TimBooher <[email protected]> wrote:
>
>>
>> I share a common database for my staging and production site. I would
>> like to share image uploads as well in
>>
>> /var/www/my_site/staging/current/public/system
>>
>> from var/www/my_site:
>>
>> |-- current -> /var/www/my_site/releases/20090409190216
>> |-- releases
>> . . .
>> |-- shared
>> |   |-- log
>> |   |-- pids
>> |   `-- system
>> `-- staging
>>    |-- current -> /var/www/my_site/staging/releases/20090409185152
>>    |-- releases
>>    `-- shared
>>
>> I want, paperclip to store images from both distributions in /var/www/
>> my_site/staging.
>>
>> Since capistrano already creates a link to #{shared_path}/system, I
>> just need to map:
>> /var/www/my_site/staging/shared/system  to --> /var/www/my_site/shared/
>> system
>>
>> (http://github.com/jamis/capistrano/blob/
>> 2ce539d87c928f41d82f7bfda84e228d3948d82b/lib/capistrano/recipes/
>> deploy.rb#L229<http://github.com/jamis/capistrano/blob/%0A2ce539d87c928f41d82f7bfda84e228d3948d82b/lib/capistrano/recipes/%0Adeploy.rb#L229>
>> )
>>
>> So I have the following deploy.rb:
>>
>> --------------------------------------
>> set :stages, %w(staging production)
>> set :default_stage, "staging"
>> require 'capistrano/ext/multistage'
>>
>> set :application, "my_site"
>> set :repository,  "http://svn.my_site.com/";
>> set :deploy_to, "/var/www/#{application}"
>> set :user, "passenger"
>> set :keep_releases, 3 # (doesn't seem to work)
>>
>> role :app, "my_server"
>> role :web, "my_server"
>> role :db,  "my_server", :primary => true
>>
>> namespace :deploy do
>>  desc "Restarting mod_rails with restart.txt"
>>  task :restart, :roles => :app, :except => { :no_release => true } do
>>    run "touch #{current_path}/tmp/restart.txt"
>>  end
>>
>>  [:start, :stop].each do |t|
>>    desc "#{t} task is a no-op with mod_rails"
>>    task t, :roles => :app do ; end
>>  end
>> end
>>
>> # ==============================
>> # Uploads
>> # ==============================
>>
>> namespace :uploads do
>>
>>  desc <<-EOD
>>    [internal] Creates the symlink to uploads shared folder
>>    for the most recently deployed version.
>>  EOD
>>  task :symlink, :except => { :no_release => true } do
>>    run "rm -rf #{current_path}/public/system"
>>    run "ln -nfs /var/www/my_site/shared/system #{current_path}/public/
>> system"
>>  end
>>
>>  after       "deploy:finalize_update", "uploads:symlink"
>>
>> end
>>
>> --------------------------------------
>>
>> I am having trouble getting that callback to work, but am wondering if
>> there is not a much easier way to do this (or more robust, am I
>> missing something). I thought I could fix things by moving that after
>> "deploy:" command to the front of the script, and out of the
>> namespace. I also what _nothing_ to happen when I type:
>>
>> cap production deploy.
>>
>> Thanks in advance,
>>
>> Tim
>>
>>
>>
>>
>
> >
>


-- 
Simone Carletti

Site & Blog: http://www.simonecarletti.com
Email: [email protected]
LinkedIn: http://linkedin.com/in/weppos
Nick: weppos | Skype: weppos

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to