capistrano-devops 0.0.3 → 0.0.4

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: eba69848b365f41bf57691041ed336f90c4a7913
4
- data.tar.gz: 23170fe2ba77ccef73946233c63b0b8cb9fe6274
3
+ metadata.gz: 80fc78f1d316bac15d1724ecf16b4acd4d80fd54
4
+ data.tar.gz: d43311420c436c058f8b9dac144cef7cb9402eb1
5
5
  SHA512:
6
- metadata.gz: d7b9f9de45a9f713c6072ff5dfe1b81a67cda1d91b50da0a711a647f1907df3facb782023955bebebe78c9bfe245ebf0a217953eac2060c8cb8443540121b41e
7
- data.tar.gz: 9ddfb7affac8e3bc2e112e1ac34e8d059d17620d4d704280fcf8f4b1e21249a8cea147ee6182152fce735c7e5b85884769d72918dffef38c8f3c78d8054c1c7c
6
+ metadata.gz: 79663e3c80e72c81d8419f9d898c5d6420a5ed45d6ab5eba22223302969ef81da927175355e4a8bce41671982ba73c25be7493a3fffe7fa7d8a00b96d2252abd
7
+ data.tar.gz: b38e348881892c97e4c353cf3e47ef7f4172b583688ecc44138af358a28a42451f092356b425ec02bd498979ab79e65647e1f907c75e1b356774f3cb0baec9e2
@@ -1,6 +1,7 @@
1
1
  require "capistrano/devops/version"
2
2
  require 'capistrano/devops/base'
3
3
  require 'capistrano/devops/papertrail'
4
+ require 'capistrano/devops/nginx'
4
5
  require 'capistrano/devops/rainbows'
5
6
  require 'capistrano/devops/postgresql'
6
7
  require 'capistrano/devops/ssh'
@@ -0,0 +1 @@
1
+ load File.expand_path("../../tasks/nginx.rake", __FILE__)
@@ -0,0 +1,34 @@
1
+ upstream backend_<%= fetch(:application) %> {
2
+ server unix:/tmp/rainbows.<%= fetch(:application) %>.sock fail_timeout=0;
3
+ }
4
+
5
+ server {
6
+ listen 80;
7
+ server_name <%= fetch(:server_name) %>;
8
+ root <%= current_path %>/public;
9
+
10
+ location /nginx_status {
11
+ stub_status on;
12
+ access_log off;
13
+ allow 127.0.0.1;
14
+ deny all;
15
+ }
16
+
17
+ location ^~ /assets/ {
18
+ gzip_static on;
19
+ expires max;
20
+ add_header Cache-Control public;
21
+ }
22
+
23
+ try_files $uri/index.html $uri @backend_<%= fetch(:application) %>;
24
+ location @backend_<%= fetch(:application) %> {
25
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
26
+ proxy_set_header Host $http_host;
27
+ proxy_redirect off;
28
+ proxy_pass http://backend_<%= fetch(:application) %>;
29
+ }
30
+
31
+ error_page 500 502 503 504 /500.html;
32
+ client_max_body_size 4G;
33
+ keepalive_timeout 10;
34
+ }
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Devops
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -0,0 +1,39 @@
1
+ set :server_name, ->{ fetch(:application) }
2
+
3
+ namespace :nginx do
4
+ desc "Installs nginx on all app servers"
5
+ task :install do
6
+ on roles(:app) do |host|
7
+ execute :sudo, "apt-get -y update"
8
+ execute :sudo, "apt-get -y install nginx"
9
+ end
10
+ end
11
+
12
+ %w[start stop restart].each do |command|
13
+ desc "#{command} nginx"
14
+ task command do
15
+ on roles :app do
16
+ as :root do
17
+ execute :service, "nginx #{command}"
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ namespace :nginx do
25
+ namespace :rainbows do
26
+ desc "Setup nginx configuration for this application (rainbows)"
27
+ task :setup do
28
+ on roles :web do
29
+ template "nginx_rainbows.erb", "/tmp/nginx_conf"
30
+
31
+ as :root do
32
+ execute :mv, "/tmp/nginx_conf /etc/nginx/sites-enabled/#{fetch(:application)}"
33
+ execute :rm, "-f /etc/nginx/sites-enabled/default"
34
+ end
35
+ end
36
+ after 'nginx:rainbows:setup', 'nginx:restart'
37
+ end
38
+ end
39
+ end
@@ -7,6 +7,7 @@ namespace :papertrail do
7
7
  as :root do
8
8
  within '/etc' do
9
9
  # TODO: this is awfully familiar to the ssh block, need to DRY up
10
+ # TODO: instead of appending at the bottom, create a .conf in /etc/rsyslog.d/
10
11
  file = capture(:cat, 'rsyslog.conf')
11
12
  lines = file.split("\n")
12
13
  lines << "*.* @#{fetch(:papertrail_host, 'logs.papertrailapp.com')}:#{fetch(:papertrail_port, 1234)}" + "\n"
@@ -66,8 +67,16 @@ EOF
66
67
 
67
68
  end
68
69
 
69
- execute :service, 'remote_syslog restart'
70
+ end
71
+ end
72
+ invoke 'papertrail:restart_remote_syslog'
73
+ end
70
74
 
75
+ desc 'Restarts remote syslog'
76
+ task :restart_remote_syslog do
77
+ on roles(:app) do
78
+ as :root do
79
+ execute :service, 'remote_syslog restart'
71
80
  end
72
81
  end
73
82
  end
data/sample_app/Gemfile CHANGED
@@ -44,8 +44,8 @@ group :development do
44
44
  gem 'capistrano', github: 'capistrano/capistrano'
45
45
  gem 'capistrano-rails'
46
46
  gem 'capistrano-bundler'
47
- gem 'capistrano-devops', github: 'parasquid/capistrano-devops'
48
- # gem 'capistrano-devops', path: '../../capistrano-devops'
47
+ # gem 'capistrano-devops', github: 'parasquid/capistrano-devops'
48
+ gem 'capistrano-devops', path: '../../capistrano-devops'
49
49
  gem 'capistrano-rbenv', github: "capistrano/rbenv"
50
50
  end
51
51
 
@@ -20,11 +20,10 @@ GIT
20
20
  specs:
21
21
  multi_json (1.8.2)
22
22
 
23
- GIT
24
- remote: git://github.com/parasquid/capistrano-devops.git
25
- revision: bebdfb4ac33f80fba5cc06e93af96ced0f741f9a
23
+ PATH
24
+ remote: ../../capistrano-devops
26
25
  specs:
27
- capistrano-devops (0.0.2)
26
+ capistrano-devops (0.0.4)
28
27
  capistrano (~> 3)
29
28
  capistrano-bundler
30
29
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-devops
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - tristan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-08 00:00:00.000000000 Z
11
+ date: 2013-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -54,14 +54,17 @@ files:
54
54
  - lib/capistrano-devops.rb
55
55
  - lib/capistrano/devops.rb
56
56
  - lib/capistrano/devops/base.rb
57
+ - lib/capistrano/devops/nginx.rb
57
58
  - lib/capistrano/devops/papertrail.rb
58
59
  - lib/capistrano/devops/postgresql.rb
59
60
  - lib/capistrano/devops/rainbows.rb
60
61
  - lib/capistrano/devops/ssh.rb
62
+ - lib/capistrano/devops/templates/nginx_rainbows.erb
61
63
  - lib/capistrano/devops/templates/rainbows.erb
62
64
  - lib/capistrano/devops/templates/rainbows_init.erb
63
65
  - lib/capistrano/devops/utilities.rb
64
66
  - lib/capistrano/devops/version.rb
67
+ - lib/capistrano/tasks/nginx.rake
65
68
  - lib/capistrano/tasks/papertrail.rake
66
69
  - lib/capistrano/tasks/postgresql.rake
67
70
  - lib/capistrano/tasks/rainbows.rake
@@ -145,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
148
  version: '0'
146
149
  requirements: []
147
150
  rubyforge_project:
148
- rubygems_version: 2.0.3
151
+ rubygems_version: 2.1.11
149
152
  signing_key:
150
153
  specification_version: 4
151
154
  summary: yay