Skip to content

Commit

Permalink
added capistrano
Browse files Browse the repository at this point in the history
  • Loading branch information
Wojciech Wnętrzak committed Jun 29, 2011
1 parent 45c15b6 commit 0499775
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }

load 'config/deploy' # remove this line to skip loading any of the default tasks
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ group :development do
gem "ruby-graphviz"
gem "metric_fu"
gem "tolk", :git => "git://github.com/cover/tolk.git"
gem "capistrano"
end
15 changes: 15 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ GEM
babosa (0.3.5)
bson_ext (1.3.1)
builder (2.1.2)
capistrano (2.6.0)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capybara (1.0.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
Expand Down Expand Up @@ -97,6 +103,7 @@ GEM
babosa (~> 0.3.0)
fssm (0.2.7)
haml (3.1.2)
highline (1.6.2)
hirb (0.4.5)
hiredis (0.3.2)
i18n (0.5.0)
Expand Down Expand Up @@ -125,6 +132,13 @@ GEM
syntax
mime-types (1.16)
mysql2 (0.2.11)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
net-ssh (2.1.4)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
nifty-generators (0.4.6)
nokogiri (1.4.6)
polyglot (0.3.1)
Expand Down Expand Up @@ -224,6 +238,7 @@ PLATFORMS
DEPENDENCIES
SystemTimer
bson_ext
capistrano
capybara (~> 1.0.0)
compass
database_cleaner
Expand Down
7 changes: 7 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,10 @@ On production server mysql database is used.
Credentials are stored in non tracked file config/database.yml
If you have problems with installing mysql2 gem, check this: http://stackoverflow.com/questions/3608287/installing-mysql2-gem-for-rails-3
If you don't have mysql database at all, you can bundle gems by: bundle install --without production

Deployment is done by Capistrano
Deployment process:

* make changes, commit and push to github server
* from your local machine, type: cap deploy
* That's all
49 changes: 49 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
require "bundler/capistrano"

set :application, "peergroup"
set :user, "peergroup"
set :deploy_to, "/var/www/vhosts/kb.ihloff.de/htdocs/peergroup"

set :domain, "s15395856.onlinehome-server.info"
set :rails_env, "production"

role :app, domain
role :web, domain
role :db, domain, :primary => true

set :scm, :git
set :repository, "git://github.com/wolfgangihloff/peergroup.git"
set :branch, "master"
set :deploy_via, :remote_cache
set :use_sudo, false

# variables for bundler gem
set :bundle_without, [:development, :test]

after "deploy:update_code", "deploy:link"
after "deploy", "deploy:cleanup"

namespace :deploy do
task :default do
set :migrate_target, :latest
update_code
migrate
symlink
apache.restart
end

task :restart, :roles => :app, :except => {:no_release => true} do
apache.restart
end

task :link do
run "ln -nfs #{shared_path}/config/database.yml #{latest_release}/config/database.yml"
run "ln -nfs #{shared_path}/config/redis.yml #{latest_release}/config/redis.yml"
end

namespace :apache do
task :restart do
run "touch #{File.join(current_path, 'tmp', 'restart.txt')}"
end
end
end

0 comments on commit 0499775

Please sign in to comment.