diff --git a/Capfile b/Capfile new file mode 100644 index 000000000..e04728e8d --- /dev/null +++ b/Capfile @@ -0,0 +1,4 @@ +load 'deploy' if respond_to?(:namespace) # cap2 differentiator +Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } + +load 'config/deploy' # remove this line to skip loading any of the default tasks \ No newline at end of file diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 000000000..d872d2932 --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,39 @@ +set :application, "planningalerts.org.au/app" +set :repository, "git://git.openaustralia.org/planningalerts-app.git" + +set :scm, :git + +set :stage, "test" unless exists? :stage + +set :use_sudo, false + +if stage == "production" + set :deploy_to, "/srv/www/www.#{application}" +elsif stage == "test" + set :deploy_to, "/srv/www/test.#{application}" + #set :branch, "test" +end + +set :user, "deploy" + +role :web, "openaustralia.org" + +namespace :deploy do + desc "After a code update, we link additional config and the scrapers" + after "deploy:update_code" do + links = { + "#{release_path}/config/database.yml" => "#{deploy_to}/shared/database.yml", + "#{release_path}/app/models/configuration.rb" => "#{deploy_to}/shared/configuration.rb", + "#{release_path}/config/production.sphinx.conf" => "#{deploy_to}/shared/production.sphinx.conf", + "#{release_path}/config/sphinx.yml" => "#{deploy_to}/shared/sphinx.yml", + "#{deploy_to}/../parsers/current/public" => "#{current_path}/public/scrapers" + } + + # "ln -sf " creates a symbolic link but deletes if it already exists + run links.map {|a| "ln -sf #{a.last} #{a.first}"}.join(";") + end + + task :restart, :except => { :no_release => true } do + run "touch #{File.join(current_path,'tmp','restart.txt')}" + end +end \ No newline at end of file