Skip to content

Instantly share code, notes, and snippets.

@andyh
Created March 8, 2009 19:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andyh/75871 to your computer and use it in GitHub Desktop.
Save andyh/75871 to your computer and use it in GitHub Desktop.
set :typo3_local_folders, %W(fileadmin typo3temp uploads)
set :typo3_source, %W(index.php t3lib typo3)
namespace :deploy do
desc "Set up the expected application directory structure on all boxes"
task :setup, :except => { :no_release => true } do
sudo <<-CMD
mkdir -p #{deploy_to} #{releases_path} #{shared_path}
CMD
typo3_local_folders.each do |asset|
sudo "mkdir #{shared_path}/#{asset}"
end
sudo "chown -R www-data #{deploy_to}"
sudo "chown -R www-data #{releases_path}"
sudo "chown -R www-data #{shared_path}"
sudo "chgrp -R admin #{deploy_to}"
sudo "chgrp -R admin #{releases_path}"
sudo "chgrp -R admin #{shared_path}"
sudo "chmod -R 770 #{deploy_to}"
sudo "chmod -R 770 #{releases_path}"
sudo "chmod -R 770 #{shared_path}"
# create log directory for Apache
sudo "mkdir #{shared_path}/log"
sudo "chgrp -R www-data #{shared_path}/log"
sudo "chmod -R 775 #{shared_path}/log"
end
desc "Link the local typo3 folders from the shared folder into the site"
task :finalize_update, :except => { :no_release => true } do
logger.info 'finalizing update with custom method'
typo3_local_folders.each do |asset|
run "rm -rf #{release_path}/src/#{asset}"
run "ln -nfs #{shared_path}/#{asset} #{release_path}/src/#{asset}"
end
typo3_source.each do |source|
run "rm -rf #{release_path}/src/#{source}"
run "ln -nfs #{release_path}/src/typo3_src/#{source} #{release_path}/src/#{source}"
end
# link up the main source to the latest TYPO3 install
run "rm -rf #{release_path}/src/typo3_src"
run "ln -nfs /usr/local/typo3/latest #{release_path}/src/typo3_src"
# copy in localconf for production
run "cp #{release_path}/config/localconf.production.php #{release_path}/src/typo3conf/localconf.php"
end
after "deploy", "typo3:fix_perms"
task :set_permissions, :except => { :no_release => true } do
# do nothing
end
task :restart do
# do nothing
end
task :migrate do
# do nothing
end
end
namespace :typo3 do
task :fix_perms do
#fix permissions
typo3_local_folders.each do |asset|
sudo "chown -R www-data #{shared_path}/#{asset}"
sudo "chgrp -R admin #{shared_path}/#{asset}"
sudo "chmod -R 770 #{shared_path}/#{asset}"
end
sudo "chown -R www-data #{current_path}/src/typo3conf"
sudo "chgrp -R admin #{current_path}/src/typo3conf"
sudo "chmod -R 770 #{current_path}/src/typo3conf"
sudo "chmod -R 770 #{shared_path}/git_master"
sudo "chmod o+rx #{current_path}/src"
sudo "chmod o+x #{current_path}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment