capistrano-rails-server 1.2.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjAxZjY0MGE0YzEyMDA3NzRhMWRlNjQ1YzU1NjNkMWFiNTQ3ODNkMA==
5
- data.tar.gz: !binary |-
6
- NDYyMWNjMmNmMTAyNjg5ZDg2ZmIxZjMwNTk1YmUwOWRkOTQ3ZDVmZA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MWY1NjBkOWI2NTQ4ODdhZmEzZTgwMWE4MTA1M2RkMWNjNGUyYTY4NWU4NzBh
10
- Njg1ZjhiZTRhNzUwZWM0NjYwYWM1OTdhOGMxMTAxMWUzYTM5OGM2ZjNkMzdm
11
- ZDExN2Q0NmI5ZDRkMzJlNTZhZWYzZmM2MDk3MWY3ZDU4YmNkYmM=
12
- data.tar.gz: !binary |-
13
- MDFiYmUwOTJiOTI4ZWU1NTNjODZiY2U2MjM4MGU2MjBiMDRmMTMyOWU4ODY4
14
- NTFiZDgxMDJjZjM4ZmVhOWRlM2I5NmFjYjZkZDAyNjE4MDM0OGVkOGQ4ZGU0
15
- M2Y1NjAyMjllMmIwNjRjOTVjNWIxNTM4YjYwNThkYzNkYWUzNjE=
2
+ SHA1:
3
+ metadata.gz: 613a89501daa928a62b27da2bfc2346f59f48993
4
+ data.tar.gz: ff8c701ecd4deb2b9461d56e36383fb6a3c7e0a5
5
+ SHA512:
6
+ metadata.gz: d6a5314403abc7b45316066de790b575bb178db2eb0f88122f4a82650b9fe3e3ab5132d2a7aeb4bc191c64bee97686bb705b53ea14779b0594ebd285117387f8
7
+ data.tar.gz: 10770ec5618d16b2b5ae57fd2c44770f16c976746dd702e3d258c8cc894cdc60e8221eaaed552787ccb44844841a2af49a10ccf3e2406cdef4a8e2a42a7d13f9
data/README.md CHANGED
@@ -1,173 +1,163 @@
1
- #capistrano-rails-server gem#
2
-
3
- Capistrano-rails-server is collection of capistrano recipes for setting up production server for ROR. The current testing environment is Ubuntu 12.04LTS.
4
- ## Installation ##
5
- Add these lines to your application's Gemfile:
6
-
7
- gem 'capistrano'
8
- gem 'capistrano-rails-server'
9
- gem 'unicorn'
10
-
11
- And then execute:
12
-
13
- $ bundle install
14
-
15
- ## Using ##
16
-
17
- ### Prepare your app ###
18
- Run `$ cap init` in your app folder (details [here](http://www.capistranorb.com/documentation/getting-started/preparing-your-application/)).
19
-
20
- Than include recipes from this gem to your `deploy.conf`:
21
-
22
- example `deploy.conf` file:
23
-
24
- ```ruby
25
- require "bundler/capistrano"
26
- load "deploy/assets"
27
-
28
- # uncomment this if you need non en-US locale for postgresql server
29
- #set :postgresql_locale, "ru_RU"
30
- #set :postgresql_rebuild, true
31
-
32
- # uncomment this if you need another version of ruby or using another OS
33
- #set_default :ruby_version, "2.0.0-p247"
34
- #set_default :rbenv_bootstrap, "bootstrap-ubuntu-12-04"
35
-
36
- set :application, "yourappuser"
37
-
38
- server "yourapp.address", :app, :web, :db, :primary => true
39
-
40
- set :user, "yourapp"
41
- set :use_sudo, false
42
- set :deploy_to, "/home/#{user}/apps/#{application}"
43
- #set :deploy_via, :remote_cache
44
- set :repository, "yourrepo"
45
- set :branch, "master"
46
-
47
- default_run_options[:pty] = true
48
- ssh_options[:forward_agent] = true
49
-
50
- after 'deploy:update_code', 'deploy:migrate'
51
- set :keep_releases, 5
52
- after 'deploy', 'deploy:cleanup'
53
-
54
- # you can comment out any recipe if you don't need it
55
- require "capistrano-rails-server/recipes/base"
56
- require "capistrano-rails-server/recipes/nginx"
57
- require "capistrano-rails-server/recipes/unicorn"
58
- require "capistrano-rails-server/recipes/postgresql"
59
- require "capistrano-rails-server/recipes/rbenv"
60
- require "capistrano-rails-server/recipes/check"
61
- # uncomment this if you need to generate deployment ssh key for private repository
62
- # public key will be printed at the end of deploy:install task
63
- #require "capistrano-rails-server/recipes/key"
64
-
65
- ```
66
- ### Prepare server (instructions for Ubuntu 12.04) ###
67
-
68
- Create admin group:
69
-
70
- # addgroup admin
71
-
72
- Create user for deployment:
73
-
74
- # adduser yourappuser --ingroup admin
75
-
76
- (Optional) Edit `/etc/sudoers` file if you don't want to enter user's password several time during recipes running:
77
-
78
- replace line
79
-
80
- %admin ALL=(ALL) ALL
81
-
82
- with
83
-
84
- %admin ALL=(ALL) NOPASSWD:ALL
85
-
86
- ### Deploying ###
87
-
88
-
89
- After that run command to install all software needed:
90
-
91
- $ cap deploy:install
92
-
93
- And configure it:
94
-
95
- $ cap deploy:setup
96
-
97
-
98
- Thats all, now you can deploy your app:
99
-
100
- $ cap deploy
101
-
102
- ## Options ##
103
- ### Available cap tasks ###
104
- `deploy:install` - install all software.
105
-
106
- `deploy:setup` - configure all software.
107
-
108
- `rbenv:install`
109
-
110
- `nginx:install`
111
-
112
- `nginx:setup`
113
-
114
- `nginx:start`
115
-
116
- `nginx:stop`
117
-
118
- `nginx:restart`
119
-
120
- `unicorn:setup`
121
-
122
- `unicorn:start`
123
-
124
- `unicorn:stop`
125
-
126
- `unicorn:restart`
127
-
128
- `postgresql:install`
129
-
130
- `postgresql:setup`
131
-
132
- `postgresql:create_database`
133
-
134
- `postgresql:rebuild` - rebuild Postgresql cluster with given locale and encoding. WARNING! This task removes all existing databases.
135
-
136
- `key:generate`
137
-
138
- `key:show` - show generated deployment key.
139
-
140
- `key:remove`
141
-
142
- ### Available options and defaults ###
143
- You can overwrite any of these options in `deploy.conf` file.
144
-
145
- `ruby_version`
146
-
147
- `rbenv_bootstrap`
148
-
149
- `postgresql_host`
150
-
151
- `postgresql_user`
152
-
153
- `postgresql_password`
154
-
155
- `postgresql_database`
156
-
157
- `postgresql_rebuild`
158
-
159
- `postgresql_encoding` - useful only if postgresql_rebuild is true
160
-
161
- `postgresql_locale` - useful only if postgresql_rebuild is true
162
-
163
- `unicorn_user`
164
-
165
- `unicorn_env` - production or development
166
-
167
- `unicorn_pid`
168
-
169
- `unicorn_config`
170
-
171
- `unicorn_log`
172
-
173
- `unicorn_workers`
1
+ #capistrano-rails-server gem#
2
+
3
+ Capistrano-rails-server is a collection of capistrano recipes for setting up production server for RoR. The current testing environment is Ubuntu 12.04 LTS.
4
+
5
+ Components: RVM, Nginx, Passenger, Postgresql, Postfix
6
+
7
+ ## Installation ##
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'capistrano-rails-server', :require => false
11
+
12
+ And then execute:
13
+
14
+ $ bundle install
15
+
16
+ ## Using ##
17
+
18
+ ### Configure your app ###
19
+ Run `$ cap init` in your app folder if you don't have deploy.rb in your config dir (details [here](http://www.capistranorb.com/documentation/getting-started/preparing-your-application/)).
20
+
21
+ Then include these lines to the end of your `deploy.rb`:
22
+
23
+ ```ruby
24
+ # uncomment this if you need non en-US locale for postgresql server
25
+ #set :postgresql_locale, "ru_RU"
26
+ #set :postgresql_rebuild, true
27
+
28
+ # uncomment this if you want to overwrite default config templates
29
+ #set :templates, {
30
+ # "nginx_passenger.erb" => File.expand_path("../templates/my_cool_nginx_template.erb", __FILE__),
31
+ # ...
32
+ #}
33
+
34
+ # uncomment this if you need another version of Ruby
35
+ #set_default :rvm_ruby_string, "2.0.0-p353"
36
+ #
37
+ # see other available params in documentation
38
+ # https://github.com/Drakula2k/capistrano-rails-server
39
+
40
+
41
+ # you can remove any recipe if you don't need it
42
+ set :capistrano_rails_server, [:base, :nginx, :passenger, :postgresql, :postfix, :rvm, :check, :key]
43
+ require 'capistrano-rails-server'
44
+
45
+ ```
46
+ ### Prepare server (instructions for Ubuntu 12.04) ###
47
+
48
+ Create admin group:
49
+
50
+ # addgroup admin
51
+
52
+ Create user for deployment:
53
+
54
+ # adduser yourappuser --ingroup admin
55
+
56
+ (Optional) Edit `/etc/sudoers` file if you don't want to enter user's password several time during recipes running (don't forget to undo it after installing!):
57
+
58
+ replace line
59
+
60
+ %admin ALL=(ALL) ALL
61
+
62
+ with
63
+
64
+ %admin ALL=(ALL) NOPASSWD:ALL
65
+
66
+ ### Deploying ###
67
+
68
+
69
+ After that run command to install all software needed:
70
+
71
+ $ cap deploy:install
72
+
73
+ And configure it:
74
+
75
+ $ cap deploy:setup
76
+
77
+
78
+ Thats all, now you can deploy your app:
79
+
80
+ $ cap deploy
81
+
82
+ ## Options ##
83
+ ### Available cap tasks ###
84
+ `deploy:install` - install all software.
85
+
86
+ `deploy:setup` - configure all software.
87
+
88
+ `rvm_wrap:install`
89
+
90
+ `nginx:install`
91
+
92
+ `nginx:setup`
93
+
94
+ `nginx:start`
95
+
96
+ `nginx:stop`
97
+
98
+ `nginx:restart`
99
+
100
+ `passenger:setup`
101
+
102
+ `nginx:start`
103
+
104
+ `nginx:stop`
105
+
106
+ `passenger:restart`
107
+
108
+ `postgresql:install`
109
+
110
+ `postgresql:setup`
111
+
112
+ `postgresql:create_database`
113
+
114
+ `postgresql:rebuild` - rebuild Postgresql cluster with given locale and encoding. WARNING! This task removes all existing databases.
115
+
116
+ `postgresql:import`
117
+
118
+ `postgresql:export`
119
+
120
+ `key:generate`
121
+
122
+ `key:show` - show generated deployment key.
123
+
124
+ `key:remove`
125
+
126
+ `postfix:install`
127
+
128
+ `postfix:stats` - show postfix stats
129
+
130
+ ### Available options and defaults for all recipes###
131
+ You can overwrite any of these options in `deploy.rb` file.
132
+
133
+ #### system ####
134
+
135
+ `system_codename` ("precise") - system codename for repositories
136
+
137
+ `templates` - configs templates overrides
138
+
139
+ #### :rvm ####
140
+
141
+ `rvm_ruby_string` ("2.0.0-p353")
142
+
143
+ #### :postgresql ####
144
+
145
+ `postgresql_host` ("localhost")
146
+
147
+ `postgresql_user` (application)
148
+
149
+ `postgresql_password` (console password_prompt)
150
+
151
+ `postgresql_database` ("#{application}_production")
152
+
153
+ `postgresql_rebuild` (false)
154
+
155
+ `postgresql_encoding` ("UTF-8") - useful only if postgresql_rebuild is true
156
+
157
+ `postgresql_locale` ("en_US") - useful only if postgresql_rebuild is true
158
+
159
+ #### :passenger ####
160
+
161
+ `passenger_user` (user)
162
+
163
+ `passenger_env` ("production") - production or development
@@ -1,20 +1,20 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
-
5
- Gem::Specification.new do |s|
6
- s.name = 'capistrano-rails-server'
7
- s.version = '1.2.0'
8
- s.date = '2013-07-16'
9
- s.summary = "Capistrano recipes to setup Rbenv, Nginx, Unicorn and Postgresql production environment."
10
- s.description =
11
- "That gem includes capistrano recipes to install and configure ROR production development with Rbenv, Nginx, Unicorn and Postgresql."
12
- s.authors = ["Drakula2k"]
13
- s.email = 'drakula2k@gmail.com'
14
- s.homepage = 'https://github.com/Drakula2k/capistrano-rails-server'
15
- s.files = `git ls-files`.split($/)
16
- s.require_paths = ["lib"]
17
- s.add_dependency "capistrano"
18
- s.add_development_dependency "rake"
19
-
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "capistrano-rails-server"
7
+ s.version = "2.0.2"
8
+ s.date = "2014-03-27"
9
+ s.summary = "Capistrano recipes to setup RVM, Nginx, Passenger, Postgresql and Postfix production environment."
10
+ s.description =
11
+ "That gem includes capistrano recipes to install and configure ROR production environment with RVM, Nginx, Passenger, Postgresql and Postfix."
12
+ s.authors = ["Drakula2k"]
13
+ s.email = "drakula2k@gmail.com"
14
+ s.homepage = "https://github.com/Drakula2k/capistrano-rails-server"
15
+ s.files = `git ls-files`.split($/)
16
+ s.require_paths = ["lib"]
17
+ s.add_dependency "capistrano", "~> 2.15"
18
+ s.add_dependency "rvm-capistrano", "~> 1.5"
19
+ s.add_development_dependency "rake"
20
20
  end
@@ -0,0 +1,16 @@
1
+ require 'capistrano-rails-server/recipes/common'
2
+
3
+ @configuration = Capistrano::Configuration.respond_to?(:instance) ?
4
+ Capistrano::Configuration.instance(:must_exist) :
5
+ Capistrano.configuration(:must_exist)
6
+
7
+ @configuration.load do
8
+ set_default(:capistrano_rails_server, [:base, :nginx, :passenger, :postgresql, :postfix, :rvm, :check, :key])
9
+ set_default(:system_codename, "precise")
10
+ set_default(:templates, {})
11
+
12
+ capistrano_rails_server.each do |recipe|
13
+ require "capistrano-rails-server/recipes/#{recipe}"
14
+ end
15
+
16
+ end
@@ -1,15 +1,23 @@
1
- require "capistrano-rails-server/recipes/common"
2
-
3
- configuration = Capistrano::Configuration.respond_to?(:instance) ?
4
- Capistrano::Configuration.instance(:must_exist) :
5
- Capistrano.configuration(:must_exist)
6
-
7
- configuration.load do
1
+ @configuration.load do
8
2
  namespace :deploy do
3
+ desc "Increase SSH timeouts for running long operations like Ruby compiling"
4
+ task :ssh do
5
+ cmd = %Q{grep -R "ClientAliveInterval" /etc/ssh/sshd_config}
6
+ content = capture( %Q{bash -c '#{cmd}' || echo "false"}).strip
7
+ if content == 'false'
8
+ run %Q{#{sudo} bash -c "echo 'ClientAliveInterval 18' >> /etc/ssh/sshd_config"}
9
+ run %Q{#{sudo} bash -c "echo 'ClientAliveCountMax 100' >> /etc/ssh/sshd_config"}
10
+ run "#{sudo} service ssh restart"
11
+ else
12
+ run 'echo "sshd_config is already updated!"'
13
+ end
14
+ end
15
+ before "deploy:install", "deploy:ssh"
16
+
9
17
  desc "Install everything onto the server"
10
18
  task :install do
11
19
  run "#{sudo} apt-get -y update"
12
- run "#{sudo} apt-get -y install python-software-properties software-properties-common"
20
+ run "#{sudo} apt-get -y install python-software-properties software-properties-common git"
13
21
  end
14
22
 
15
23
  # Overwrite with no sudo
@@ -1,10 +1,4 @@
1
- require "capistrano-rails-server/recipes/common"
2
-
3
- configuration = Capistrano::Configuration.respond_to?(:instance) ?
4
- Capistrano::Configuration.instance(:must_exist) :
5
- Capistrano.configuration(:must_exist)
6
-
7
- configuration.load do
1
+ @configuration.load do
8
2
  namespace :check do
9
3
  desc "Make sure local git is in sync with remote."
10
4
  task :revision, roles: :web do