Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Deployment with Capistrano now working

  • Loading branch information...
commit 0f074cead7a8819924d090fcde251dd2e95d100c 1 parent cee45d4
@mitio mitio authored
Showing with 29 additions and 16 deletions.
  1. +1 −0  Capfile
  2. +28 −16 config/deploy.rb
View
1  Capfile
@@ -2,3 +2,4 @@ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
+require 'bundler/capistrano'
View
44 config/deploy.rb
@@ -1,21 +1,26 @@
-set :application, "Trane Revisited"
-set :repository, "git://github.com/fmi/trane.git"
+set :application, 'Trane Revisited'
+set :scm, :git
+set :repository, 'git://github.com/skanev/evans.git'
+set :deploy_to, '/data/rails/evans'
+set :user, 'pyfmi'
+set :use_sudo, false
-set :scm, :git
-set :use_sudo, false
+role :web, 'ruby.bg'
+role :app, 'ruby.bg'
+role :db, 'ruby.bg', :primary => true
-role :web, "fmi.py-bg.net"
-role :app, "fmi.py-bg.net"
-role :db, "fmi.py-bg.net", :primary => true
-
-set :user, :pyfmi
-set :deploy_to, '/data/rails/pyfmi'
+set :normalize_asset_timestamps, false
namespace :deploy do
task :restart, :roles => :app, :except => {:no_release => true} do
run "touch #{current_path}/tmp/restart.txt"
end
+ task :setup_gems, :except => {:no_release => true} do
+ run "mkdir -p '#{shared_path}/bundled_gems'; ln -nfs '#{shared_path}/bundled_gems' #{release_path}/vendor/bundle"
+ run "cd '#{release_path}' && bundle install --deployment && cd -"
+ end
+
task :symlink_shared, :roles => :app do
run "ln -nfs #{shared_path}/database.yml #{release_path}/config/database.yml"
run "ln -nfs #{shared_path}/secret_token.txt #{release_path}/config/secret_token.txt"
@@ -23,9 +28,20 @@
run "ln -nfs #{shared_path}/mail_settings #{release_path}/config/mail_settings"
run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads"
end
+
+ namespace :assets do
+ task :precompile do
+ run "cd #{release_path} && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"
+ end
+ end
end
+after 'deploy:update_code', 'deploy:setup_gems'
+after 'deploy:update_code', 'deploy:symlink_shared'
+after 'deploy:update_code', 'deploy:assets:precompile'
+
namespace :sync do
+ # TODO: FIXME
task :db, :roles => :app do
system <<-END
ssh pyfmi@fmi.py-bg.net "pg_dump --format=c pyfmi | gzip -c" |
@@ -34,6 +50,7 @@
END
end
+ # TODO: FIXME
task :uploads, :roles => :app do
system <<-END
rsync --exclude tmp -av --delete \
@@ -42,14 +59,9 @@
END
end
+ # TODO: FIXME
task :secrets, :roles => :app do
system "scp pyfmi@fmi.py-bg.net:#{shared_path}/pepper.txt config/pepper.txt"
system "scp pyfmi@fmi.py-bg.net:#{shared_path}/secret_token.txt config/secret_token.txt"
end
end
-
-after 'deploy:update_code', 'deploy:symlink_shared'
-
-require 'config/boot'
-require 'hoptoad_notifier/capistrano'
-require 'bundler/capistrano'
Please sign in to comment.
Something went wrong with that request. Please try again.