ubistrano 1.2.7
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/MIT-LICENSE +20 -0
- data/README.markdown +162 -0
- data/Rakefile +25 -0
- data/bin/ubify +13 -0
- data/changelog.markdown +54 -0
- data/example/deploy.rb +29 -0
- data/gemspec.rb +19 -0
- data/lib/ubistrano.rb +83 -0
- data/lib/ubistrano/apache.rb +38 -0
- data/lib/ubistrano/deploy.rb +67 -0
- data/lib/ubistrano/ec2.rb +113 -0
- data/lib/ubistrano/gems.rb +29 -0
- data/lib/ubistrano/helpers.rb +287 -0
- data/lib/ubistrano/log.rb +20 -0
- data/lib/ubistrano/mysql.rb +85 -0
- data/lib/ubistrano/rails.rb +76 -0
- data/lib/ubistrano/sinatra.rb +20 -0
- data/lib/ubistrano/ssh.rb +56 -0
- data/lib/ubistrano/stage.rb +29 -0
- data/lib/ubistrano/ubuntu.rb +273 -0
- data/templates/apache/virtual_host.erb +32 -0
- data/templates/log/rotate.conf.erb +9 -0
- data/templates/rails/database.yml.erb +13 -0
- data/templates/ubuntu/apache.god.erb +31 -0
- data/templates/ubuntu/god.erb +36 -0
- data/templates/ubuntu/god.god.erb +1 -0
- data/templates/ubuntu/iptables.rules.erb +31 -0
- data/templates/ubuntu/mysql.god.erb +31 -0
- data/templates/ubuntu/sshd.god.erb +31 -0
- data/ubistrano.gemspec +32 -0
- metadata +93 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
NameVirtualHost *:80
|
2
|
+
<% unless ssl.empty? %>
|
3
|
+
NameVirtualHost *:443
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<VirtualHost *:80>
|
7
|
+
<% unless domains.empty? %>
|
8
|
+
ServerName <%= domains.first %>
|
9
|
+
<% if domains.length > 1 %>
|
10
|
+
ServerAlias <%= domains[1..-1].join ' ' %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
DocumentRoot <%= deploy_to %>/current/public
|
14
|
+
ErrorLog <%= deploy_to %>/current/log/error.log
|
15
|
+
CustomLog <%= deploy_to %>/current/log/access.log combined
|
16
|
+
<% unless ssl.empty? %>
|
17
|
+
Redirect / https://<%= ssl.first %>/
|
18
|
+
<% end %>
|
19
|
+
</VirtualHost>
|
20
|
+
|
21
|
+
<% ssl.each do |s| %>
|
22
|
+
<VirtualHost *:443>
|
23
|
+
ServerName <%= s %>
|
24
|
+
DocumentRoot <%= deploy_to %>/current/public
|
25
|
+
ErrorLog <%= deploy_to %>/current/log/error.log
|
26
|
+
CustomLog <%= deploy_to %>/current/log/access.log combined
|
27
|
+
|
28
|
+
SSLEngine On
|
29
|
+
SSLCertificateFile <%= deploy_to %>/shared/cert/<%= s %>.crt
|
30
|
+
SSLCertificateKeyFile <%= deploy_to %>/shared/cert/<%= s %>.key
|
31
|
+
</VirtualHost>
|
32
|
+
<% end unless ssl.empty? %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
God.watch do |w|
|
2
|
+
w.name = 'apache'
|
3
|
+
w.start = "/etc/init.d/apache2 start"
|
4
|
+
w.stop = "/etc/init.d/apache2 stop"
|
5
|
+
w.restart = "/etc/init.d/apache2 restart"
|
6
|
+
w.interval = 30.seconds
|
7
|
+
w.start_grace = 10.seconds
|
8
|
+
w.restart_grace = 10.seconds
|
9
|
+
w.pid_file = '/var/run/apache2.pid'
|
10
|
+
w.behavior(:clean_pid_file)
|
11
|
+
|
12
|
+
w.start_if do |start|
|
13
|
+
start.condition(:process_running) do |c|
|
14
|
+
c.interval = 5.seconds
|
15
|
+
c.running = false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# lifecycle
|
20
|
+
w.lifecycle do |on|
|
21
|
+
on.condition(:flapping) do |c|
|
22
|
+
c.to_state = [:start, :restart]
|
23
|
+
c.times = 5
|
24
|
+
c.within = 5.minute
|
25
|
+
c.transition = :unmonitored
|
26
|
+
c.retry_in = 10.minutes
|
27
|
+
c.retry_times = 5
|
28
|
+
c.retry_within = 2.hours
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
# God
|
4
|
+
#
|
5
|
+
# chkconfig: - 85 15
|
6
|
+
# description: start, stop, restart God (bet you feel powerful)
|
7
|
+
#
|
8
|
+
|
9
|
+
RETVAL=0
|
10
|
+
|
11
|
+
case "$1" in
|
12
|
+
start)
|
13
|
+
sudo /usr/local/bin/god -P /var/run/god.pid -l /var/log/god.log
|
14
|
+
sudo /usr/local/bin/god load /usr/local/etc/god.god
|
15
|
+
RETVAL=$?
|
16
|
+
;;
|
17
|
+
stop)
|
18
|
+
sudo kill `cat /var/run/god.pid`
|
19
|
+
RETVAL=$?
|
20
|
+
;;
|
21
|
+
restart)
|
22
|
+
sudo kill `cat /var/run/god.pid`
|
23
|
+
sudo /usr/local/bin/god -P /var/run/god.pid -l /var/log/god.log
|
24
|
+
sudo /usr/local/bin/god load /usr/local/etc/god.god
|
25
|
+
RETVAL=$?
|
26
|
+
;;
|
27
|
+
status)
|
28
|
+
RETVAL=$?
|
29
|
+
;;
|
30
|
+
*)
|
31
|
+
echo "Usage: god {start|stop|restart|status}"
|
32
|
+
exit 1
|
33
|
+
;;
|
34
|
+
esac
|
35
|
+
|
36
|
+
exit $RETVAL
|
@@ -0,0 +1 @@
|
|
1
|
+
God.load "/usr/local/etc/god/*.god"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
*filter
|
2
|
+
|
3
|
+
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
|
4
|
+
-A INPUT -i lo -j ACCEPT
|
5
|
+
-A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT
|
6
|
+
|
7
|
+
# Accept all established inbound connections
|
8
|
+
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
9
|
+
|
10
|
+
# Allow all outbound traffic
|
11
|
+
-A OUTPUT -j ACCEPT
|
12
|
+
|
13
|
+
# Allow HTTP and HTTPS connections
|
14
|
+
-A INPUT -p tcp --dport 80 -j ACCEPT
|
15
|
+
-A INPUT -p tcp --dport 443 -j ACCEPT
|
16
|
+
|
17
|
+
# Allow SSH connections
|
18
|
+
-A INPUT -p tcp -m state --state NEW --dport <%= port %> -j ACCEPT
|
19
|
+
|
20
|
+
# Allow ping
|
21
|
+
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
|
22
|
+
|
23
|
+
# Log iptables denied calls
|
24
|
+
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
|
25
|
+
|
26
|
+
# Reject all other inbound
|
27
|
+
-A INPUT -j REJECT
|
28
|
+
-A FORWARD -j REJECT
|
29
|
+
|
30
|
+
COMMIT
|
31
|
+
# There MUST be a new line after this line!
|
@@ -0,0 +1,31 @@
|
|
1
|
+
God.watch do |w|
|
2
|
+
w.name = 'mysql'
|
3
|
+
w.start = "/etc/init.d/mysqld start"
|
4
|
+
w.stop = "/etc/init.d/mysqld start"
|
5
|
+
w.restart = "/etc/init.d/mysqld restart"
|
6
|
+
w.interval = 30.seconds
|
7
|
+
w.start_grace = 10.seconds
|
8
|
+
w.restart_grace = 10.seconds
|
9
|
+
w.pid_file = '/var/run/mysqld/mysqld.pid'
|
10
|
+
w.behavior(:clean_pid_file)
|
11
|
+
|
12
|
+
w.start_if do |start|
|
13
|
+
start.condition(:process_running) do |c|
|
14
|
+
c.interval = 5.seconds
|
15
|
+
c.running = false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# lifecycle
|
20
|
+
w.lifecycle do |on|
|
21
|
+
on.condition(:flapping) do |c|
|
22
|
+
c.to_state = [:start, :restart]
|
23
|
+
c.times = 5
|
24
|
+
c.within = 5.minute
|
25
|
+
c.transition = :unmonitored
|
26
|
+
c.retry_in = 10.minutes
|
27
|
+
c.retry_times = 5
|
28
|
+
c.retry_within = 2.hours
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
God.watch do |w|
|
2
|
+
w.name = 'sshd'
|
3
|
+
w.start = "/etc/init.d/ssh start"
|
4
|
+
w.stop = "/etc/init.d/ssh stop"
|
5
|
+
w.restart = "/etc/init.d/ssh restart"
|
6
|
+
w.interval = 30.seconds
|
7
|
+
w.start_grace = 10.seconds
|
8
|
+
w.restart_grace = 10.seconds
|
9
|
+
w.pid_file = '/var/run/sshd.pid'
|
10
|
+
w.behavior(:clean_pid_file)
|
11
|
+
|
12
|
+
w.start_if do |start|
|
13
|
+
start.condition(:process_running) do |c|
|
14
|
+
c.interval = 5.seconds
|
15
|
+
c.running = false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# lifecycle
|
20
|
+
w.lifecycle do |on|
|
21
|
+
on.condition(:flapping) do |c|
|
22
|
+
c.to_state = [:start, :restart]
|
23
|
+
c.times = 5
|
24
|
+
c.within = 5.minute
|
25
|
+
c.transition = :unmonitored
|
26
|
+
c.retry_in = 10.minutes
|
27
|
+
c.retry_times = 5
|
28
|
+
c.retry_within = 2.hours
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/ubistrano.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{ubistrano}
|
5
|
+
s.version = "1.2.7"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Winton Welsh"]
|
9
|
+
s.date = %q{2009-06-28}
|
10
|
+
s.default_executable = %q{ubify}
|
11
|
+
s.email = %q{mail@wintoni.us}
|
12
|
+
s.executables = ["ubify"]
|
13
|
+
s.extra_rdoc_files = ["README.markdown"]
|
14
|
+
s.files = ["bin", "bin/ubify", "changelog.markdown", "example", "example/deploy.rb", "gemspec.rb", "lib", "lib/ubistrano", "lib/ubistrano/apache.rb", "lib/ubistrano/deploy.rb", "lib/ubistrano/ec2.rb", "lib/ubistrano/gems.rb", "lib/ubistrano/helpers.rb", "lib/ubistrano/log.rb", "lib/ubistrano/mysql.rb", "lib/ubistrano/rails.rb", "lib/ubistrano/sinatra.rb", "lib/ubistrano/ssh.rb", "lib/ubistrano/stage.rb", "lib/ubistrano/ubuntu.rb", "lib/ubistrano.rb", "MIT-LICENSE", "Rakefile", "README.markdown", "templates", "templates/apache", "templates/apache/virtual_host.erb", "templates/log", "templates/log/rotate.conf.erb", "templates/rails", "templates/rails/database.yml.erb", "templates/ubuntu", "templates/ubuntu/apache.god.erb", "templates/ubuntu/god.erb", "templates/ubuntu/god.god.erb", "templates/ubuntu/iptables.rules.erb", "templates/ubuntu/mysql.god.erb", "templates/ubuntu/sshd.god.erb", "ubistrano.gemspec"]
|
15
|
+
s.homepage = %q{http://github.com/winton/ubistrano}
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubygems_version = %q{1.3.1}
|
18
|
+
s.summary = %q{Provision and deploy to an Ubuntu/God/Apache/Passenger stack using Capistrano}
|
19
|
+
|
20
|
+
if s.respond_to? :specification_version then
|
21
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
|
+
s.specification_version = 2
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
25
|
+
s.add_runtime_dependency(%q<amazon-ec2>, ["= 0.4.5"])
|
26
|
+
else
|
27
|
+
s.add_dependency(%q<amazon-ec2>, ["= 0.4.5"])
|
28
|
+
end
|
29
|
+
else
|
30
|
+
s.add_dependency(%q<amazon-ec2>, ["= 0.4.5"])
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ubistrano
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Winton Welsh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-06 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: amazon-ec2
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - "="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.4.5
|
24
|
+
version:
|
25
|
+
description:
|
26
|
+
email: mail@wintoni.us
|
27
|
+
executables:
|
28
|
+
- ubify
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README.markdown
|
33
|
+
files:
|
34
|
+
- bin/ubify
|
35
|
+
- changelog.markdown
|
36
|
+
- example/deploy.rb
|
37
|
+
- gemspec.rb
|
38
|
+
- lib/ubistrano/apache.rb
|
39
|
+
- lib/ubistrano/deploy.rb
|
40
|
+
- lib/ubistrano/ec2.rb
|
41
|
+
- lib/ubistrano/gems.rb
|
42
|
+
- lib/ubistrano/helpers.rb
|
43
|
+
- lib/ubistrano/log.rb
|
44
|
+
- lib/ubistrano/mysql.rb
|
45
|
+
- lib/ubistrano/rails.rb
|
46
|
+
- lib/ubistrano/sinatra.rb
|
47
|
+
- lib/ubistrano/ssh.rb
|
48
|
+
- lib/ubistrano/stage.rb
|
49
|
+
- lib/ubistrano/ubuntu.rb
|
50
|
+
- lib/ubistrano.rb
|
51
|
+
- MIT-LICENSE
|
52
|
+
- Rakefile
|
53
|
+
- README.markdown
|
54
|
+
- templates/apache/virtual_host.erb
|
55
|
+
- templates/log/rotate.conf.erb
|
56
|
+
- templates/rails/database.yml.erb
|
57
|
+
- templates/ubuntu/apache.god.erb
|
58
|
+
- templates/ubuntu/god.erb
|
59
|
+
- templates/ubuntu/god.god.erb
|
60
|
+
- templates/ubuntu/iptables.rules.erb
|
61
|
+
- templates/ubuntu/mysql.god.erb
|
62
|
+
- templates/ubuntu/sshd.god.erb
|
63
|
+
- ubistrano.gemspec
|
64
|
+
has_rdoc: true
|
65
|
+
homepage: http://github.com/winton/ubistrano
|
66
|
+
licenses: []
|
67
|
+
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: "0"
|
84
|
+
version:
|
85
|
+
requirements: []
|
86
|
+
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 1.3.5
|
89
|
+
signing_key:
|
90
|
+
specification_version: 3
|
91
|
+
summary: Provision and deploy to an Ubuntu/God/Apache/Passenger stack using Capistrano
|
92
|
+
test_files: []
|
93
|
+
|