cap_bootstrap 0.1 → 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.
- data/changelog.md +11 -0
- data/lib/cap_bootstrap/capistrano.rb +2 -0
- data/lib/cap_bootstrap/recipes/base.rb +3 -0
- data/lib/cap_bootstrap/recipes/security.rb +14 -0
- data/lib/cap_bootstrap/recipes/templates/nginx_unicorn.erb +15 -5
- data/lib/cap_bootstrap/recipes/utilities.rb +10 -0
- data/lib/cap_bootstrap/version.rb +1 -1
- metadata +6 -3
data/changelog.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
0.2 / 2012-04-02
|
2
|
+
================
|
3
|
+
* task for tailing rails production logs, cap tail_logs
|
4
|
+
* maintenance page detection in nginx.conf, works with cap:web:disable
|
5
|
+
* put application name into unicorn upstream in anticipation of multiple apps on a server
|
6
|
+
* set up ufw firewall on install
|
7
|
+
* set timezone to UTC on install
|
8
|
+
|
9
|
+
0.1 / 2012-04-02
|
10
|
+
==================
|
11
|
+
* Gemifying the original files from Railscast 337
|
@@ -11,6 +11,9 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
11
11
|
namespace :deploy do
|
12
12
|
desc "Install everything onto the server"
|
13
13
|
task :install do
|
14
|
+
run "#{sudo} bash -c 'echo UTC > /etc/timezone'"
|
15
|
+
run "#{sudo} cp /usr/share/zoneinfo/UTC /etc/localtime"
|
16
|
+
run "#{sudo} dpkg-reconfigure -f noninteractive tzdata"
|
14
17
|
run "#{sudo} apt-get -y update"
|
15
18
|
run "#{sudo} apt-get -y install python-software-properties"
|
16
19
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
namespace :security do
|
3
|
+
desc "Setup a firewall with UFW"
|
4
|
+
task :setup_firewall, roles: :web do
|
5
|
+
run "#{sudo} apt-get -y install ufw"
|
6
|
+
run "#{sudo} ufw default deny"
|
7
|
+
run "#{sudo} ufw allow 22/tcp"
|
8
|
+
run "#{sudo} ufw allow 80/tcp"
|
9
|
+
run "#{sudo} ufw allow 443/tcp"
|
10
|
+
run "#{sudo} ufw --force enable"
|
11
|
+
end
|
12
|
+
after "deploy:install", "security:setup_firewall"
|
13
|
+
end
|
14
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
upstream
|
1
|
+
upstream unicorn_<%= application %> {
|
2
2
|
server unix:/tmp/unicorn.<%= application %>.sock fail_timeout=0;
|
3
3
|
}
|
4
4
|
|
@@ -13,15 +13,25 @@ server {
|
|
13
13
|
add_header Cache-Control public;
|
14
14
|
}
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
if (-f $document_root/system/maintenance.html) {
|
17
|
+
return 503;
|
18
|
+
}
|
19
|
+
|
20
|
+
try_files $uri/index.html $uri @unicorn_<%= application %>;
|
21
|
+
location @unicorn_<%= application %> {
|
18
22
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
19
23
|
proxy_set_header Host $http_host;
|
20
24
|
proxy_redirect off;
|
21
|
-
proxy_pass http://
|
25
|
+
proxy_pass http://unicorn_<%= application %>;
|
26
|
+
}
|
27
|
+
|
28
|
+
error_page 503 @maintenance;
|
29
|
+
location @maintenance {
|
30
|
+
rewrite ^(.*)$ /system/maintenance.html last;
|
31
|
+
break;
|
22
32
|
}
|
23
33
|
|
24
|
-
error_page 500 502
|
34
|
+
error_page 500 502 504 /500.html;
|
25
35
|
client_max_body_size 4G;
|
26
36
|
keepalive_timeout 10;
|
27
37
|
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
desc "tail production log files"
|
3
|
+
task :tail_logs, :roles => :app do
|
4
|
+
run "tail -f #{shared_path}/log/production.log" do |channel, stream, data|
|
5
|
+
puts # for an extra line break before the host name
|
6
|
+
puts "#{channel[:host]}: #{data}"
|
7
|
+
break if stream == :err
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cap_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- README.md
|
26
26
|
- Rakefile
|
27
27
|
- cap_bootstrap.gemspec
|
28
|
+
- changelog.md
|
28
29
|
- lib/cap_bootstrap.rb
|
29
30
|
- lib/cap_bootstrap/capistrano.rb
|
30
31
|
- lib/cap_bootstrap/recipes/base.rb
|
@@ -33,11 +34,13 @@ files:
|
|
33
34
|
- lib/cap_bootstrap/recipes/nodejs.rb
|
34
35
|
- lib/cap_bootstrap/recipes/postgresql.rb
|
35
36
|
- lib/cap_bootstrap/recipes/rbenv.rb
|
37
|
+
- lib/cap_bootstrap/recipes/security.rb
|
36
38
|
- lib/cap_bootstrap/recipes/templates/nginx_unicorn.erb
|
37
39
|
- lib/cap_bootstrap/recipes/templates/postgresql.yml.erb
|
38
40
|
- lib/cap_bootstrap/recipes/templates/unicorn.rb.erb
|
39
41
|
- lib/cap_bootstrap/recipes/templates/unicorn_init.erb
|
40
42
|
- lib/cap_bootstrap/recipes/unicorn.rb
|
43
|
+
- lib/cap_bootstrap/recipes/utilities.rb
|
41
44
|
- lib/cap_bootstrap/version.rb
|
42
45
|
homepage: http://github.com/cwsaylor/cap_bootstrap
|
43
46
|
licenses: []
|
@@ -53,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
56
|
version: '0'
|
54
57
|
segments:
|
55
58
|
- 0
|
56
|
-
hash:
|
59
|
+
hash: 2692874588853330221
|
57
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
61
|
none: false
|
59
62
|
requirements:
|
@@ -62,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
65
|
version: '0'
|
63
66
|
segments:
|
64
67
|
- 0
|
65
|
-
hash:
|
68
|
+
hash: 2692874588853330221
|
66
69
|
requirements: []
|
67
70
|
rubyforge_project:
|
68
71
|
rubygems_version: 1.8.11
|