capistrano-cookbook 0.0.5 → 0.2.0
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 +4 -4
- data/README.md +2 -1
- data/capistrano-cookbook.gemspec +1 -1
- data/lib/capistrano/cookbook.rb +0 -1
- data/lib/capistrano/cookbook/helpers/setup_config_values.rb +2 -1
- data/lib/capistrano/cookbook/tasks/compile_assets_locally.cap +1 -0
- data/lib/capistrano/cookbook/tasks/monit.cap +10 -1
- data/lib/capistrano/cookbook/tasks/restart.cap +4 -1
- data/lib/capistrano/cookbook/tasks/setup_config.cap +2 -2
- data/lib/capistrano/cookbook/templates/mongoid.example.yml.erb +1 -1
- data/lib/capistrano/cookbook/templates/monit.erb +2 -2
- data/lib/capistrano/cookbook/templates/nginx.conf.erb +7 -7
- data/lib/capistrano/cookbook/templates/secrets.yml.erb +2 -0
- data/lib/capistrano/cookbook/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8db1e37a1d94e2934595f8d547db0e7ad1cd387
|
4
|
+
data.tar.gz: 3c29f39cbe2f68e7656a3136ca701807efc67865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c866dc7c97300bb1b7e880c827f85d2407844cf6721f796d7f381025e4edd39a3ecefedc97e68b90663d7c2a0630e120a5c78eeab6c566734102bc215ea59c0
|
7
|
+
data.tar.gz: 98cec165f29f8e0633aff07045c82ea3eef5fb0289746028e9807021dc591082ad8f006a601a5e3afc28145ab59a63724ee7cde589c2b5ab9d7f307b65c8a266
|
data/README.md
CHANGED
@@ -66,7 +66,8 @@ Add the following to `deploy.rb`
|
|
66
66
|
|
67
67
|
Currently only works with Postgresql on configurations where your web server and db server are the same machine, e.g. single box deployments. This task will:
|
68
68
|
|
69
|
-
* Check to see if a remote `database.yml` exists in `APP_PATH/shared/config`, if not attempt to copy one from `APP_PATH/shared/config
|
69
|
+
* Check to see if a remote `database.yml` exists in `APP_PATH/shared/config`, if not attempt to copy one from `APP_PATH/shared/config`
|
70
|
+
* If a new `database.yml` is created, it will include a username and database name based on the application name and a random password
|
70
71
|
* Download the remote `database.yml`
|
71
72
|
* Create the Postgres user specified in `database.yml` if it doesn't already exist
|
72
73
|
* Create the Database specified in `database.yml` if it doesn't already exist
|
data/capistrano-cookbook.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency 'capistrano', '~>
|
20
|
+
spec.add_dependency 'capistrano', '~> 3.2'
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.5"
|
23
23
|
spec.add_development_dependency "rake"
|
data/lib/capistrano/cookbook.rb
CHANGED
@@ -3,7 +3,6 @@ require "capistrano/cookbook/version"
|
|
3
3
|
module Capistrano
|
4
4
|
module Cookbook
|
5
5
|
require 'capistrano/cookbook/check_revision'
|
6
|
-
require 'capistrano/cookbook/compile_assets_locally'
|
7
6
|
require 'capistrano/cookbook/logs'
|
8
7
|
require 'capistrano/cookbook/monit'
|
9
8
|
require 'capistrano/cookbook/nginx'
|
@@ -1,4 +1,5 @@
|
|
1
1
|
namespace :monit do
|
2
|
+
|
2
3
|
%w(start stop restart).each do |task_name|
|
3
4
|
desc "#{task_name} Monit"
|
4
5
|
task task_name do
|
@@ -7,4 +8,12 @@ namespace :monit do
|
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
10
|
-
|
11
|
+
|
12
|
+
desc "Reload Monit"
|
13
|
+
task 'reload' do
|
14
|
+
on roles(:app), in: :sequence, wait: 5 do
|
15
|
+
sudo "monit reload"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'capistrano/dsl'
|
1
2
|
require 'capistrano/cookbook/helpers/setup_config_values'
|
2
3
|
require 'capistrano/cookbook/helpers/substitute_strings'
|
3
4
|
require 'capistrano/cookbook/helpers/template'
|
@@ -11,7 +12,6 @@ namespace :deploy do
|
|
11
12
|
on roles(:app) do
|
12
13
|
# make the config dir
|
13
14
|
execute :mkdir, "-p #{shared_path}/config"
|
14
|
-
full_app_name = fetch(:full_app_name)
|
15
15
|
|
16
16
|
# config files to be uploaded to shared/config, see the
|
17
17
|
# definition of smart_template for details of operation.
|
@@ -42,4 +42,4 @@ after 'deploy:setup_config', 'nginx:reload'
|
|
42
42
|
|
43
43
|
# Restart monit so it will pick up any monit configurations
|
44
44
|
# we've added
|
45
|
-
after 'deploy:setup_config', 'monit:
|
45
|
+
after 'deploy:setup_config', 'monit:reload'
|
@@ -5,7 +5,7 @@
|
|
5
5
|
default:
|
6
6
|
# Defines the name of the default database that Mongoid can connect to.
|
7
7
|
# (required).
|
8
|
-
database: <%= "#{fetch(:
|
8
|
+
database: <%= "#{fetch(:application)}_#{fetch(:rails_env)}" %>
|
9
9
|
# Provides the hosts the default session can connect to. Must be an array
|
10
10
|
# of host:port pairs. (required)
|
11
11
|
hosts:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% application = fetch(:application) %>
|
2
2
|
set mail-format { subject: <%= "#{fetch(:full_app_name)} - #{fetch(:rails_env)}" %> $SERVICE $EVENT at $DATE }
|
3
3
|
|
4
|
-
check process
|
4
|
+
check process unicorn_<%=application%>
|
5
5
|
with pidfile <%= current_path %>/tmp/pids/unicorn.pid
|
6
6
|
start program = "/etc/init.d/unicorn_<%= application %>_<%= fetch(:rails_env)%> start"
|
7
7
|
stop program = "/etc/init.d/unicorn_<%= application %>_<%= fetch(:rails_env)%> stop"
|
@@ -11,7 +11,7 @@ check process unicorn
|
|
11
11
|
group unicorn
|
12
12
|
|
13
13
|
<% (0..(fetch(:unicorn_worker_count) -1)).each do |worker| %>
|
14
|
-
check process
|
14
|
+
check process unicorn_<%= application %>_worker_<%= (5000 + worker).to_s %>
|
15
15
|
with pidfile <%= current_path %>/tmp/pids/unicorn.<%= (5000 + worker).to_s %>.pid
|
16
16
|
start program = "/bin/true"
|
17
17
|
stop program = "/etc/init.d/unicorn_<%= application %>_<%= fetch(:rails_env)%> kill_worker <%= (5000 + worker).to_s %>"
|
@@ -3,9 +3,9 @@ upstream unicorn_<%= fetch(:full_app_name) %> {
|
|
3
3
|
}
|
4
4
|
|
5
5
|
server {
|
6
|
-
server_name <%= fetch(:server_name) %>;
|
7
6
|
listen 80;
|
8
7
|
root <%= fetch(:deploy_to) %>/current/public;
|
8
|
+
server_name <%= fetch(:server_name) %>;
|
9
9
|
|
10
10
|
location ^~ /assets/ {
|
11
11
|
gzip_static on;
|
@@ -13,8 +13,8 @@ server {
|
|
13
13
|
add_header Cache-Control public;
|
14
14
|
}
|
15
15
|
|
16
|
-
try_files $uri/index.html $uri @
|
17
|
-
location @
|
16
|
+
try_files $uri/index.html $uri @unicorn;
|
17
|
+
location @unicorn {
|
18
18
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
19
19
|
proxy_set_header Host $http_host;
|
20
20
|
proxy_redirect off;
|
@@ -28,9 +28,9 @@ server {
|
|
28
28
|
|
29
29
|
<% if fetch(:enable_ssl) %>
|
30
30
|
server {
|
31
|
-
|
32
|
-
listen 443;
|
31
|
+
listen 443 default deferred;
|
33
32
|
root <%= fetch(:deploy_to) %>/current/public;
|
33
|
+
server_name <%= fetch(:server_name) %>;
|
34
34
|
|
35
35
|
location ^~ /assets/ {
|
36
36
|
gzip_static on;
|
@@ -44,7 +44,7 @@ server {
|
|
44
44
|
proxy_set_header X-Forwarded-Proto https;
|
45
45
|
proxy_set_header Host $http_host;
|
46
46
|
proxy_redirect off;
|
47
|
-
proxy_pass http://
|
47
|
+
proxy_pass http://unicorn_<%= fetch(:full_app_name) %>;
|
48
48
|
}
|
49
49
|
|
50
50
|
error_page 500 502 503 504 /500.html;
|
@@ -53,5 +53,5 @@ server {
|
|
53
53
|
ssl on;
|
54
54
|
ssl_certificate <%= fetch(:deploy_to) %>/shared/ssl_cert.crt;
|
55
55
|
ssl_certificate_key <%= fetch(:deploy_to) %>/shared/ssl_private_key.key;
|
56
|
-
}
|
56
|
+
}
|
57
57
|
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-cookbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Dixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- lib/capistrano/cookbook/templates/mongoid.example.yml.erb
|
95
95
|
- lib/capistrano/cookbook/templates/monit.erb
|
96
96
|
- lib/capistrano/cookbook/templates/nginx.conf.erb
|
97
|
+
- lib/capistrano/cookbook/templates/secrets.yml.erb
|
97
98
|
- lib/capistrano/cookbook/templates/sidekiq.yml.erb
|
98
99
|
- lib/capistrano/cookbook/templates/sidekiq_init.sh.erb
|
99
100
|
- lib/capistrano/cookbook/templates/unicorn.rb.erb
|
@@ -125,4 +126,3 @@ specification_version: 4
|
|
125
126
|
summary: Selection of Capistrano 3 tasks to reduce boilerplate required when deploying
|
126
127
|
Rails and Sinatra applications
|
127
128
|
test_files: []
|
128
|
-
has_rdoc:
|