capistrano-devops 0.0.1 → 0.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 +4 -4
- data/README.md +7 -1
- data/lib/capistrano/devops/templates/rainbows_init.erb +1 -1
- data/lib/capistrano/devops/version.rb +1 -1
- data/lib/capistrano/tasks/papertrail.rake +63 -35
- data/lib/capistrano/tasks/ssh.rake +2 -0
- data/sample_app/Gemfile +1 -0
- data/sample_app/Gemfile.lock +3 -1
- data/sample_app/config/deploy.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb762a5df31afd7dbbb7dfd068b99a22df9bc89e
|
4
|
+
data.tar.gz: 73aa1d0a9f46a26d81912acd1a5977a33b6ceee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0a0f0bd27a41e04c080ee3ef0425127c5f366870d7ce9568742beacf34d754dd98269b88af24056afdff3aa4db4bffce6747102ded316f6e084e659f554742f
|
7
|
+
data.tar.gz: 75bcd6ef3704415f47ddbce0f9644fa0b48d1dcfac2274ac794dbf21f12c4f14f46483fa9ab30369894d422f7ac11f55c7bb9c3115e41787b5f391b8bbd94cf2
|
data/README.md
CHANGED
@@ -18,7 +18,13 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
add in Capfile
|
22
|
+
|
23
|
+
require 'capistrano/devops'
|
24
|
+
|
25
|
+
add in deploy.rb
|
26
|
+
|
27
|
+
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
|
22
28
|
|
23
29
|
## Contributing
|
24
30
|
|
@@ -14,7 +14,7 @@ set -e
|
|
14
14
|
TIMEOUT=${TIMEOUT-60}
|
15
15
|
APP_ROOT=<%= current_path %>
|
16
16
|
PID=<%= fetch(:rainbows_pid) %>
|
17
|
-
CMD="cd <%= current_path %>; bundle exec rainbows -D -c <%= fetch(:rainbows_config) %> -E <%= fetch(:rails_env) %>"
|
17
|
+
CMD="cd <%= current_path %>; bundle exec rainbows -D -c <%= fetch(:rainbows_config) %> -E <%= fetch(:rails_env, 'production') %>"
|
18
18
|
AS_USER=<%= fetch(:rainbows_user) %>
|
19
19
|
set -u
|
20
20
|
|
@@ -3,48 +3,76 @@ load File.expand_path("../set_rails_env.rake", __FILE__)
|
|
3
3
|
namespace :papertrail do
|
4
4
|
# desc 'Adds papertrail to rsyslog as an output channel'
|
5
5
|
task :add_to_rsyslog do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
on roles(:all) do
|
7
|
+
as :root do
|
8
|
+
within '/etc' do
|
9
|
+
# TODO: this is awfully familiar to the ssh block, need to DRY up
|
10
|
+
file = capture(:cat, 'rsyslog.conf')
|
11
|
+
lines = file.split("\n")
|
12
|
+
lines << "*.* @#{fetch(:papertrail_host, 'logs.papertrailapp.com')}:#{fetch(:papertrail_port, 1234)}" + "\n"
|
13
|
+
new_file = StringIO.new(lines.join("\n"))
|
14
|
+
upload! new_file, '/tmp/rsyslog.conf'
|
15
|
+
execute :mv, '/tmp/rsyslog.conf', 'rsyslog.conf'
|
16
|
+
execute :service, 'rsyslog restart'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
12
20
|
end
|
13
21
|
|
14
|
-
# desc 'Install remote_syslog'
|
22
|
+
# desc 'Install remote_syslog on all app servers'
|
15
23
|
task :remote_syslog do
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
24
|
+
on roles(:app) do
|
25
|
+
as :root do
|
26
|
+
execute :gem, 'install remote_syslog'
|
27
|
+
|
28
|
+
LOG_FILES_YML = <<-EOF
|
29
|
+
files:
|
30
|
+
- #{shared_path.join('log').to_s}/*
|
31
|
+
destination:
|
32
|
+
host: #{fetch(:papertrail_host, 'logs.papertrailapp.com')}
|
33
|
+
port: #{fetch(:papertrail_port, 1234)}
|
34
|
+
prepend: #{fetch(:application)}
|
35
|
+
EOF
|
36
|
+
|
37
|
+
within '/etc' do
|
38
|
+
# again, DRY this up (because as() doesn't work with upload! or within yet)
|
39
|
+
upload! StringIO.new(LOG_FILES_YML), '/tmp/log_files.yml'
|
40
|
+
execute :mv, '/tmp/log_files.yml', 'log_files.yml'
|
41
|
+
end
|
42
|
+
|
43
|
+
within '/etc/init' do
|
44
|
+
|
45
|
+
UPSTART_CONF = <<-EOF
|
46
|
+
description "Monitor files and send to remote syslog"
|
47
|
+
start on runlevel [2345]
|
48
|
+
stop on runlevel [!2345]
|
49
|
+
|
50
|
+
respawn
|
51
|
+
|
52
|
+
pre-start exec /usr/bin/test -e /etc/log_files.yml
|
53
|
+
|
54
|
+
exec /usr/local/bin/remote_syslog -D --tls
|
55
|
+
EOF
|
56
|
+
|
57
|
+
# TODO: find out where the remote_syslog is (or if it even got installed)
|
58
|
+
# find / -name remote_syslog
|
59
|
+
|
60
|
+
# again, DRY this up (because as() doesn't work with upload! or within yet)
|
61
|
+
upload! StringIO.new(UPSTART_CONF), '/tmp/remote_syslog.conf'
|
62
|
+
execute :mv, '/tmp/remote_syslog.conf', 'remote_syslog.conf'
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
execute :service, 'remote_syslog start'
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
44
70
|
end
|
45
71
|
|
46
72
|
desc 'Installs papertrail and adds remote_syslog'
|
47
73
|
task :install do
|
74
|
+
invoke 'papertrail:add_to_rsyslog'
|
75
|
+
invoke 'papertrail:remote_syslog'
|
48
76
|
end
|
49
77
|
|
50
78
|
end
|
data/sample_app/Gemfile
CHANGED
data/sample_app/Gemfile.lock
CHANGED
@@ -22,7 +22,7 @@ GIT
|
|
22
22
|
|
23
23
|
GIT
|
24
24
|
remote: git://github.com/parasquid/capistrano-devops.git
|
25
|
-
revision:
|
25
|
+
revision: cef01cf1a586a3584454ecdea62d4d45d4cf117e
|
26
26
|
specs:
|
27
27
|
capistrano-devops (0.0.1)
|
28
28
|
capistrano (~> 3)
|
@@ -70,6 +70,7 @@ GEM
|
|
70
70
|
execjs
|
71
71
|
coffee-script-source (1.6.3)
|
72
72
|
erubis (2.7.0)
|
73
|
+
eventmachine (1.0.3)
|
73
74
|
execjs (2.0.2)
|
74
75
|
hike (1.2.3)
|
75
76
|
i18n (0.6.5)
|
@@ -172,6 +173,7 @@ DEPENDENCIES
|
|
172
173
|
capistrano-rails
|
173
174
|
capistrano-rbenv!
|
174
175
|
coffee-rails (~> 4.0.0)
|
176
|
+
eventmachine
|
175
177
|
jbuilder (~> 1.2)
|
176
178
|
jquery-rails
|
177
179
|
multi_json!
|
data/sample_app/config/deploy.rb
CHANGED
@@ -18,7 +18,7 @@ set :log_level, :debug
|
|
18
18
|
# set :pty, true
|
19
19
|
|
20
20
|
# set :linked_files, %w{config/database.yml}
|
21
|
-
|
21
|
+
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
|
22
22
|
|
23
23
|
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
|
24
24
|
set :keep_releases, 5
|
@@ -55,6 +55,8 @@ namespace :deploy do
|
|
55
55
|
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
before "deploy:symlink:shared", "deploy:checkout_subdir"
|
59
59
|
|
60
60
|
end
|
61
|
+
|
62
|
+
set :papertrail_port, 31378
|
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.
|
4
|
+
version: 0.0.2
|
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-
|
11
|
+
date: 2013-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|