Commit 3bbb7e747f38c75b8d613869def83baa082303b9

Authored by Rafael Manzo
1 parent d206f2bd

Deploy with capistrano

Capfile 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +load 'deploy'
  2 +# Uncomment if you are using Rails' asset pipeline
  3 + # load 'deploy/assets'
  4 +load 'config/deploy' # remove this line to skip loading any of the default tasks
0 5 \ No newline at end of file
... ...
Gemfile
... ... @@ -55,6 +55,10 @@ group :development, :test do
55 55  
56 56 # Fixtures made easy
57 57 gem 'factory_girl_rails'
  58 +
  59 + # Deployment
  60 + gem 'capistrano'
  61 + gem 'rvm-capistrano'
58 62 end
59 63  
60 64 # Acceptance tests
... ...
Gemfile.lock
... ... @@ -29,6 +29,12 @@ GEM
29 29 atomic (1.1.10)
30 30 bcrypt-ruby (3.0.1)
31 31 builder (3.1.4)
  32 + capistrano (2.15.4)
  33 + highline
  34 + net-scp (>= 1.0.0)
  35 + net-sftp (>= 2.0.0)
  36 + net-ssh (>= 2.0.14)
  37 + net-ssh-gateway (>= 1.1.0)
32 38 capybara (2.1.0)
33 39 mime-types (>= 1.16)
34 40 nokogiri (>= 1.3.3)
... ... @@ -68,6 +74,7 @@ GEM
68 74 railties (>= 3.0.0)
69 75 gherkin (2.12.0)
70 76 multi_json (~> 1.3)
  77 + highline (1.6.19)
71 78 hike (1.2.3)
72 79 i18n (0.6.4)
73 80 jbuilder (1.4.2)
... ... @@ -86,6 +93,13 @@ GEM
86 93 minitest (4.7.5)
87 94 modernizr-rails (2.6.2.3)
88 95 multi_json (1.7.7)
  96 + net-scp (1.1.1)
  97 + net-ssh (>= 2.6.5)
  98 + net-sftp (2.1.2)
  99 + net-ssh (>= 2.6.5)
  100 + net-ssh (2.6.7)
  101 + net-ssh-gateway (1.2.0)
  102 + net-ssh (>= 2.6.5)
89 103 nokogiri (1.6.0)
90 104 mini_portile (~> 0.5.0)
91 105 orm_adapter (0.4.0)
... ... @@ -121,6 +135,8 @@ GEM
121 135 rspec-core (~> 2.13.0)
122 136 rspec-expectations (~> 2.13.0)
123 137 rspec-mocks (~> 2.13.0)
  138 + rvm-capistrano (1.3.4)
  139 + capistrano (>= 2.0.0)
124 140 sass (3.2.9)
125 141 sass-rails (4.0.0)
126 142 railties (>= 4.0.0.beta, < 5.0)
... ... @@ -170,6 +186,7 @@ PLATFORMS
170 186 ruby
171 187  
172 188 DEPENDENCIES
  189 + capistrano
173 190 coffee-rails (~> 4.0.0)
174 191 cucumber-rails
175 192 database_cleaner
... ... @@ -180,6 +197,7 @@ DEPENDENCIES
180 197 modernizr-rails
181 198 rails (= 4.0.0)
182 199 rspec-rails
  200 + rvm-capistrano
183 201 sass-rails (~> 4.0.0.rc2)
184 202 sdoc
185 203 shoulda-matchers
... ...
config/deploy.rb 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +require "rvm/capistrano"
  2 +
  3 +set :rvm_ruby_string, :local # use the same ruby as used locally for deployment
  4 +set :rvm_autolibs_flag, "read-only" # more info: rvm help autolibs
  5 +set :rvm_type, :system
  6 +
  7 +#before 'deploy:setup', 'rvm:install_rvm' # install RVM
  8 +#before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, OR: # before 'deploy:setup', 'rvm:create_gemset' # only create gemset
  9 +
  10 +set :application, "mezuro"
  11 +set :deploy_to, "/home/mezuro/app"
  12 +set :repository, "https://github.com/mezuro/mezuro-standalone.git"
  13 +
  14 +set :user, 'mezuro'
  15 +set :use_sudo, false
  16 +
  17 +# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
  18 +# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
  19 +
  20 +role :web, "ec2-54-224-143-159.compute-1.amazonaws.com" # Your HTTP server, Apache/etc
  21 +role :app, "ec2-54-224-143-159.compute-1.amazonaws.com" # This may be the same as your `Web` server
  22 +role :db, "ec2-54-224-143-159.compute-1.amazonaws.com", :primary => true # This is where Rails migrations will run
  23 +
  24 +# if you want to clean up old releases on each deploy uncomment this:
  25 +# after "deploy:restart", "deploy:cleanup"
  26 +
  27 +# if you're still using the script/reaper helper you will need
  28 +# these http://github.com/rails/irs_process_scripts
  29 +
  30 +# If you are using Passenger mod_rails uncomment this:
  31 +namespace :deploy do
  32 + task :start do ; end
  33 + task :stop do ; end
  34 + task :restart, :roles => :app, :except => { :no_release => true } do
  35 + run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  36 + end
  37 +end
0 38 \ No newline at end of file
... ...
config/environments/production.rb
... ... @@ -37,7 +37,7 @@ Mezuro::Application.configure do
37 37  
38 38 # Specifies the header that your server uses for sending files.
39 39 # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40   - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
  40 + config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41 41  
42 42 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43 43 # config.force_ssl = true
... ...