Hi guys,
So I finally got around to setting up a staging server (ubuntu + apache
- passenger) and after some headaches got Capistrano (using git as the
scm) to deploy the app to my staging server using a basic deploy.rb
file. Everything seems to be working well, any changes I commit and
deploy take effect.
HOWEVER, I am storing user pictures using the paperclip plugin to the
staging server filesystem (rails_root/public/images/users/). After
creating some users and uploading their pictures (on the staging
server), I decided to deploy some changes I made to the app only to find
out that my user pictures we’re overwritten with my local (development)
user image folder.
I rolled back the deployment and all the pictures were displayed like
they were previously (on the staging server)
So I added the following line to the .gitignore file to my local
(development) machine:
public/images/users/*
I committed the change and deployed but again, the local development
machine’s user image folder replaces the staging server user image
folder contents.
Below is my deploy.rb file contents (edited):
set :application, "staging.domain.com"
set :repository, "."
set :rails_env, "staging"
set :user, "user"
set :deploy_to, "/home/#{user}/public/#{application}"
set :use_sudo, true
set :scm, :git
set :deploy_via, :copy
set :copy_remote_dir, "/home/#{user}"
role :app, application
role :web, application
role :db, application, :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
I’m pretty much stumped on this. Also, I realize doing a full copy every
time to the server isn’t the best thing to do, but it’s the only way I
can (currently) get it to work. I’m still pretty new at this
rails/scm/terminal world.
Let me know if you need any more info or code from my end that may help.
Thanks for any advice or suggestions!
-Tony