capistrano-cookbook 0.0.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24fea359d760de78d19d72b1a0af83d8148d8975
4
- data.tar.gz: 08f245a70c063b265bb0cc46cee92ee029018315
3
+ metadata.gz: a8db1e37a1d94e2934595f8d547db0e7ad1cd387
4
+ data.tar.gz: 3c29f39cbe2f68e7656a3136ca701807efc67865
5
5
  SHA512:
6
- metadata.gz: 101652399da7e307d8ed948f0c84760b626ffec8cc1ab0d804335a51edebebea0b1be7d7e5a3fb2cfa930c3aeef7acdb713329b268f8979eddd44441fd13959d
7
- data.tar.gz: 8a4a88326f3bb089405304d960421bb3f058f7918ad1b8c0d14db63cd8d1e318dca37f2d691d751367c95f7c8827aaa5494e2cd6eb16c9344d0935a7039f9dd3
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
@@ -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', '~> 3.1'
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"
@@ -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'
@@ -50,8 +50,9 @@ module Capistrano
50
50
  monit
51
51
  unicorn.rb
52
52
  unicorn_init.sh
53
+ secrets.yml
53
54
  )
54
55
  end
55
56
  end
56
57
  end
57
- end
58
+ end
@@ -8,6 +8,7 @@ namespace :deploy do
8
8
  run_locally do
9
9
  execute"rsync -av ./public/assets/ #{role.user}@#{role.hostname}:#{release_path}/public/assets/;"
10
10
  end
11
+ sudo "chmod -R 755 #{release_path}/public/assets/"
11
12
  end
12
13
  run_locally do
13
14
  execute "rm -rf ./public/assets"
@@ -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
- end
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
@@ -7,4 +7,7 @@ namespace :deploy do
7
7
  end
8
8
  end
9
9
  end
10
- end
10
+ end
11
+
12
+ # Automatically restart after a deploy
13
+ after 'deploy', 'deploy:restart'
@@ -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:restart'
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(:applocation)}_#{fetch(:rails_env)}" %>
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 unicorn
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 unicorn_worker_<%= (5000 + worker).to_s %>
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 @unicorn_<%= fetch(:full_app_name) %>;
17
- location @unicorn_<%= fetch(:full_app_name) %> {
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
- server_name <%= fetch(:server_name) %>;
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://unicorn;
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 %>
@@ -0,0 +1,2 @@
1
+ <%= fetch(:rails_env) %>:
2
+ secret_key_base: <%= SecureRandom.hex(60) %>
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Cookbook
3
- VERSION = "0.0.5"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  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.5
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-04-19 00:00:00.000000000 Z
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.1'
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.1'
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: