AppTower-ubistrano 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ <VirtualHost *:80>
2
+
3
+ ServerName <%= domain.first %>
4
+ ServerAlias <%= domain[1..-1].join ' ' %>
5
+
6
+ DocumentRoot <%= deploy_to %>/current/public
7
+
8
+ </VirtualHost>
@@ -0,0 +1,9 @@
1
+ <%= shared_path %>/log/*.log {
2
+ daily
3
+ missingok
4
+ rotate 7
5
+ compress
6
+ delaycompress
7
+ notifempty
8
+ copytruncate
9
+ }
@@ -0,0 +1,13 @@
1
+ development: &defaults
2
+ adapter: mysql
3
+ database: <%= db_table %>
4
+ username: <%= db_user %>
5
+ password: <%= db_pass %>
6
+ host: localhost
7
+ socket: /var/run/mysqld/mysqld.sock
8
+
9
+ test:
10
+ <<: *defaults
11
+
12
+ production:
13
+ <<: *defaults
@@ -0,0 +1,10 @@
1
+ require 'sinatra'
2
+ require 'rubygems'
3
+
4
+ Sinatra::Application.default_options.merge!(
5
+ :run => false,
6
+ :env => :production
7
+ )
8
+
9
+ require 'app.rb'
10
+ run Sinatra.application
@@ -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
+ /usr/local/bin/god -P /var/run/god.pid -l /var/log/god.log
14
+ /usr/local/bin/god load /usr/local/etc/god.god
15
+ RETVAL=$?
16
+ ;;
17
+ stop)
18
+ kill `cat /var/run/god.pid`
19
+ RETVAL=$?
20
+ ;;
21
+ restart)
22
+ kill `cat /var/run/god.pid`
23
+ /usr/local/bin/god -P /var/run/god.pid -l /var/log/god.log
24
+ /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,47 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'ubistrano'
3
+ s.version = '1.0.2'
4
+ s.date = '2008-12-13'
5
+
6
+ s.summary = "Provision and deploy to an Ubuntu/God/Apache/Passenger stack using Capistrano"
7
+ s.description = "Provision and deploy to an Ubuntu/God/Apache/Passenger stack using Capistrano"
8
+
9
+ s.author = 'AppTower'
10
+ s.email = 'apptower@wintoni.us'
11
+ s.homepage = 'http://github.com/AppTower/ubistrano'
12
+
13
+ s.has_rdoc = false
14
+
15
+ # = MANIFEST =
16
+ s.files = %w[
17
+ MIT-LICENSE
18
+ README.markdown
19
+ Rakefile
20
+ changelog.rdoc
21
+ example/deploy.rb
22
+ lib/ubistrano.rb
23
+ lib/ubistrano/apache.rb
24
+ lib/ubistrano/deploy.rb
25
+ lib/ubistrano/gems.rb
26
+ lib/ubistrano/helpers.rb
27
+ lib/ubistrano/log.rb
28
+ lib/ubistrano/mysql.rb
29
+ lib/ubistrano/rails.rb
30
+ lib/ubistrano/sinatra.rb
31
+ lib/ubistrano/ssh.rb
32
+ lib/ubistrano/stage.rb
33
+ lib/ubistrano/ubuntu.rb
34
+ templates/apache/virtual_host.erb
35
+ templates/log/rotate.conf.erb
36
+ templates/rails/database.yml.erb
37
+ templates/sinatra/config.ru.erb
38
+ templates/ubuntu/apache.god.erb
39
+ templates/ubuntu/god.erb
40
+ templates/ubuntu/god.god.erb
41
+ templates/ubuntu/iptables.rules.erb
42
+ templates/ubuntu/mysql.god.erb
43
+ templates/ubuntu/sshd.god.erb
44
+ ubistrano.gemspec
45
+ ]
46
+ # = MANIFEST =
47
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: AppTower-ubistrano
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - AppTower
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-13 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Provision and deploy to an Ubuntu/God/Apache/Passenger stack using Capistrano
17
+ email: apptower@wintoni.us
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - MIT-LICENSE
26
+ - README.markdown
27
+ - Rakefile
28
+ - changelog.rdoc
29
+ - example/deploy.rb
30
+ - lib/ubistrano.rb
31
+ - lib/ubistrano/apache.rb
32
+ - lib/ubistrano/deploy.rb
33
+ - lib/ubistrano/gems.rb
34
+ - lib/ubistrano/helpers.rb
35
+ - lib/ubistrano/log.rb
36
+ - lib/ubistrano/mysql.rb
37
+ - lib/ubistrano/rails.rb
38
+ - lib/ubistrano/sinatra.rb
39
+ - lib/ubistrano/ssh.rb
40
+ - lib/ubistrano/stage.rb
41
+ - lib/ubistrano/ubuntu.rb
42
+ - templates/apache/virtual_host.erb
43
+ - templates/log/rotate.conf.erb
44
+ - templates/rails/database.yml.erb
45
+ - templates/sinatra/config.ru.erb
46
+ - templates/ubuntu/apache.god.erb
47
+ - templates/ubuntu/god.erb
48
+ - templates/ubuntu/god.god.erb
49
+ - templates/ubuntu/iptables.rules.erb
50
+ - templates/ubuntu/mysql.god.erb
51
+ - templates/ubuntu/sshd.god.erb
52
+ - ubistrano.gemspec
53
+ has_rdoc: false
54
+ homepage: http://github.com/AppTower/ubistrano
55
+ post_install_message:
56
+ rdoc_options: []
57
+
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ version:
72
+ requirements: []
73
+
74
+ rubyforge_project:
75
+ rubygems_version: 1.2.0
76
+ signing_key:
77
+ specification_version: 2
78
+ summary: Provision and deploy to an Ubuntu/God/Apache/Passenger stack using Capistrano
79
+ test_files: []
80
+