set :application, "appname" set :domain, "hostname" set :user, "user" set :drupal_version, "6.14" set :site_name, 'hostname' set :repository, "user@hostname:~/path/to/project.git" set :scm, :git set :branch, 'master' set :git_shallow_clone, 1 set :scm_verbose, true set :deploy_to, "/home/#{user}/domain" set :deploy_via, :checkout set :use_sudo, false set :keep_releases, 4 default_run_options[:pty] = true ssh_options[:forward_agent] = true server domain, :app, :web role :db, domain, :primary => true namespace :deploy do task :set_permissions, :except => { :no_release => true } do # do nothing end task :restart do # do nothing end task :start do # do nothing end end after 'deploy:setup', 'drupal:setup' # Here we setup the shared files directory after 'deploy:symlink', 'drupal:symlink' # After symlinking the code we symlink the shared dirs # Before restarting the webserver we fix all the # permissions and then symlink it to production before 'deploy:restart', 'project:permissions:fix', 'project:symlink:application' namespace :drupal do # shared directories task :setup, :except => { :no_release => true } do "mkdir -p #{shared_path}/files" "chmod -R g+w #{shared_path}/files" "chown -R #{user} #{deploy_to}" "chown -R #{user} #{shared_path}/files" end # symlink shared directories task :symlink, :except => { :no_release => true } do # this assumes that you have put your shared files in the "shared/files" directory # it also assumes that you have setup the repositories as I described in the blog post. # This depends on where your 'files' directory is located (drupal 5 or drupal 6). #sudo "ln -s ../../../shared/files #{latest_release}/drupal" # assumes that 'files' is in the root directory (drupal 5) "ln -s ../../../../../shared/files #{latest_release}/drupal/sites/default/files" end end namespace :deploy do task :finalize_update, :except => { :no_release => true } do # I am currently not using this... end task :restart do # nothing to do here since we're on mod-php end end namespace :project do namespace :symlink do task :application, :except => { :no_release => true } do # I am currenlty not using this... end end # change ownership namespace :permissions do task :fix, :except => { :no_release => true } do "chmod -R 777 #{shared_path}/files" end end end