ricodigo-capistrano-recipes 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +1 -0
- data/VERSION +1 -1
- data/bin/ricodigo-install-server +145 -0
- data/ricodigo-capistrano-recipes.gemspec +8 -2
- metadata +39 -25
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -0,0 +1,145 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'net/ssh'
|
4
|
+
|
5
|
+
|
6
|
+
host = ARGV[0]
|
7
|
+
user = ARGV[1]
|
8
|
+
|
9
|
+
if !host || !user
|
10
|
+
$stderr.puts "Usage: #{File.basename($0)} <host> <user>"
|
11
|
+
exit 1
|
12
|
+
end
|
13
|
+
|
14
|
+
def setup_repos(ssh)
|
15
|
+
puts ">> Adding extra repos.."
|
16
|
+
cmd = 'echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" > /etc/apt/sources.list.d/mongo.list'
|
17
|
+
ssh.exec! %@sudo bash -c '#{cmd}'@ do |c,s,d|
|
18
|
+
puts d
|
19
|
+
end
|
20
|
+
|
21
|
+
ssh.exec! 'sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10' do |c,s,d|
|
22
|
+
puts d
|
23
|
+
end
|
24
|
+
|
25
|
+
ssh.exec! "sudo apt-get update" do |c,s,d|
|
26
|
+
puts d
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def install_packages(ssh)
|
31
|
+
puts ">> Installing packages..."
|
32
|
+
packages = %w[
|
33
|
+
bind9 build-essential ufw libreadline6-dev git-core
|
34
|
+
libxslt1-dev libxml2-dev libssl-dev nginx mongodb-10gen curl
|
35
|
+
libcurl4-openssl-dev graphicsmagick
|
36
|
+
]
|
37
|
+
|
38
|
+
ssh.exec! "sudo apt-get install -y --force-yes #{packages.join(" ")}" do |channel, stream, data|
|
39
|
+
puts data
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def install_postfix(ssh)
|
44
|
+
ssh.exec!("sudo apt-get install postfix -y --force-yes") do |channel, stream, data|
|
45
|
+
puts data
|
46
|
+
if data =~ /General type of mail configuration:\s*$/
|
47
|
+
answer = $stdin.gets
|
48
|
+
channel.send_data(answer)
|
49
|
+
elsif data =~ /System mail name:\s*$/
|
50
|
+
answer = $stdin.gets
|
51
|
+
channel.send_data(answer)
|
52
|
+
elsif data =~ /Root and postmaster mail recipient:\s*$/
|
53
|
+
answer = $stdin.gets
|
54
|
+
channel.send_data(answer)
|
55
|
+
elsif data =~ /Other destinations to accept mail for \(blank for none\):\s*$/
|
56
|
+
answer = $stdin.gets
|
57
|
+
channel.send_data(answer)
|
58
|
+
elsif data =~ /Force synchronous updates on mail queue\?\s*$/
|
59
|
+
channel.send_data("no\n")
|
60
|
+
elsif data =~ /Local networks:\s*$/
|
61
|
+
channel.send_data("\n")
|
62
|
+
elsif data =~ /Mailbox size limit \(bytes\):\s*$/
|
63
|
+
channel.send_data("0\n")
|
64
|
+
elsif data =~ /Local address extension character:\s*$/
|
65
|
+
channel.send_data("\n")
|
66
|
+
elsif data =~ /Internet protocols to use:\s*$/
|
67
|
+
channel.send_data("1\n")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def setup_firewall(ssh)
|
73
|
+
puts ">> Setup firewall..."
|
74
|
+
|
75
|
+
ssh.exec! "sudo ufw disable" do |channel, stream, data|
|
76
|
+
puts data
|
77
|
+
end
|
78
|
+
|
79
|
+
commands = []
|
80
|
+
commands << "sudo ufw allow to any port 80"
|
81
|
+
commands << "sudo ufw allow to any port 443"
|
82
|
+
commands << "sudo ufw allow to any port 22"
|
83
|
+
commands << "sudo ufw allow to any port 53"
|
84
|
+
commands << "sudo ufw allow to any port 25"
|
85
|
+
commands << "sudo ufw allow to any port 587"
|
86
|
+
commands << "sudo ufw default deny"
|
87
|
+
|
88
|
+
ssh.exec!(commands.join(" && ")) {|c,s,d| puts d }
|
89
|
+
ssh.exec!("sudo ufw enable") {|c,s,d| puts d }
|
90
|
+
|
91
|
+
ssh.exec! "iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT"
|
92
|
+
ssh.exec! "iptables -A INPUT -i lo -j ACCEPT"
|
93
|
+
end
|
94
|
+
|
95
|
+
def install_rvm(ssh)
|
96
|
+
puts "Installing RVM..."
|
97
|
+
|
98
|
+
ssh.exec!("sudo bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)") {|c,s,d| puts d }
|
99
|
+
|
100
|
+
command = %@
|
101
|
+
mv /etc/bash.bashrc /tmp/rd_bash.bashrc -f
|
102
|
+
echo ". /etc/rvmrc" >> /etc/bash.bashrc
|
103
|
+
echo ". /usr/local/rvm/scripts/rvm" >> /etc/bash.bashrc
|
104
|
+
cat /tmp/rd_bash.bashrc >> /etc/bash.bashrc
|
105
|
+
source /etc/rvmrc
|
106
|
+
source /usr/local/rvm/scripts/rvm
|
107
|
+
|
108
|
+
rvm install 1.9.2
|
109
|
+
rvm install ree
|
110
|
+
|
111
|
+
rvm use 1.9.2 --default
|
112
|
+
@
|
113
|
+
|
114
|
+
ssh.exec!("sudo bash -c '#{command}'") {|c,s,d| puts d }
|
115
|
+
end
|
116
|
+
|
117
|
+
def install_gems(ssh)
|
118
|
+
puts ">> Installing required gems..."
|
119
|
+
|
120
|
+
command = %@
|
121
|
+
echo "gem: --no-ri --no-rdoc" >> /etc/gemrc
|
122
|
+
echo "update: --no-ri --no-rdoc" >> /etc/gemrc
|
123
|
+
echo "install: --no-ri --no-rdoc" >> /etc/gemrc
|
124
|
+
@
|
125
|
+
ssh.exec!("sudo bash -c '#{command}'") {|c,s,d| puts d }
|
126
|
+
|
127
|
+
gems = %w[
|
128
|
+
rails mongoid whenever capistrano unicorn mongoid_ext magent
|
129
|
+
bson_ext sanitize uuidtools ruby-stemmer mini_magick magic
|
130
|
+
haml sass compass mechanize nokogiri rdiscount
|
131
|
+
]
|
132
|
+
|
133
|
+
ssh.exec! "rvmsudo gem install #{gems.join(" ")} --no-ri --no-rdoc" do |channel, stream, data|
|
134
|
+
puts data
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
Net::SSH.start(host, user) do |ssh|
|
139
|
+
# setup_repos(ssh)
|
140
|
+
# install_packages(ssh)
|
141
|
+
# install_postfix(ssh)
|
142
|
+
# setup_firewall(ssh) unless host =~ /amazonaws\.com$/
|
143
|
+
# install_rvm(ssh)
|
144
|
+
install_gems(ssh)
|
145
|
+
end
|
@@ -5,13 +5,15 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ricodigo-capistrano-recipes}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David A. Cuadrado"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-25}
|
13
|
+
s.default_executable = %q{ricodigo-install-server}
|
13
14
|
s.description = %q{our capistrano recipes. forked from capistrano-recipes}
|
14
15
|
s.email = %q{krawek@gmail.com}
|
16
|
+
s.executables = ["ricodigo-install-server"]
|
15
17
|
s.extra_rdoc_files = [
|
16
18
|
"LICENSE",
|
17
19
|
"README.rdoc"
|
@@ -24,6 +26,7 @@ Gem::Specification.new do |s|
|
|
24
26
|
"README.rdoc",
|
25
27
|
"Rakefile",
|
26
28
|
"VERSION",
|
29
|
+
"bin/ricodigo-install-server",
|
27
30
|
"generators/app.bluepill.erb",
|
28
31
|
"generators/nginx.conf.erb",
|
29
32
|
"generators/unicorn.rb.erb",
|
@@ -54,6 +57,7 @@ Gem::Specification.new do |s|
|
|
54
57
|
s.specification_version = 3
|
55
58
|
|
56
59
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
60
|
+
s.add_runtime_dependency(%q<net-ssh>, [">= 0"])
|
57
61
|
s.add_runtime_dependency(%q<capistrano>, [">= 2.5.9"])
|
58
62
|
s.add_runtime_dependency(%q<capistrano-ext>, [">= 1.2.1"])
|
59
63
|
s.add_runtime_dependency(%q<mongoid>, [">= 0"])
|
@@ -64,6 +68,7 @@ Gem::Specification.new do |s|
|
|
64
68
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
65
69
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
66
70
|
else
|
71
|
+
s.add_dependency(%q<net-ssh>, [">= 0"])
|
67
72
|
s.add_dependency(%q<capistrano>, [">= 2.5.9"])
|
68
73
|
s.add_dependency(%q<capistrano-ext>, [">= 1.2.1"])
|
69
74
|
s.add_dependency(%q<mongoid>, [">= 0"])
|
@@ -75,6 +80,7 @@ Gem::Specification.new do |s|
|
|
75
80
|
s.add_dependency(%q<rcov>, [">= 0"])
|
76
81
|
end
|
77
82
|
else
|
83
|
+
s.add_dependency(%q<net-ssh>, [">= 0"])
|
78
84
|
s.add_dependency(%q<capistrano>, [">= 2.5.9"])
|
79
85
|
s.add_dependency(%q<capistrano-ext>, [">= 1.2.1"])
|
80
86
|
s.add_dependency(%q<mongoid>, [">= 0"])
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 4
|
9
|
+
version: 0.1.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- David A. Cuadrado
|
@@ -14,12 +14,25 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-05-
|
18
|
-
default_executable:
|
17
|
+
date: 2011-05-25 00:00:00 -05:00
|
18
|
+
default_executable: ricodigo-install-server
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
21
|
+
name: net-ssh
|
22
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
prerelease: false
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: capistrano
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
23
36
|
none: false
|
24
37
|
requirements:
|
25
38
|
- - ">="
|
@@ -31,10 +44,10 @@ dependencies:
|
|
31
44
|
version: 2.5.9
|
32
45
|
type: :runtime
|
33
46
|
prerelease: false
|
34
|
-
version_requirements: *
|
47
|
+
version_requirements: *id002
|
35
48
|
- !ruby/object:Gem::Dependency
|
36
49
|
name: capistrano-ext
|
37
|
-
requirement: &
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
38
51
|
none: false
|
39
52
|
requirements:
|
40
53
|
- - ">="
|
@@ -46,10 +59,10 @@ dependencies:
|
|
46
59
|
version: 1.2.1
|
47
60
|
type: :runtime
|
48
61
|
prerelease: false
|
49
|
-
version_requirements: *
|
62
|
+
version_requirements: *id003
|
50
63
|
- !ruby/object:Gem::Dependency
|
51
64
|
name: mongoid
|
52
|
-
requirement: &
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
66
|
none: false
|
54
67
|
requirements:
|
55
68
|
- - ">="
|
@@ -59,10 +72,10 @@ dependencies:
|
|
59
72
|
version: "0"
|
60
73
|
type: :runtime
|
61
74
|
prerelease: false
|
62
|
-
version_requirements: *
|
75
|
+
version_requirements: *id004
|
63
76
|
- !ruby/object:Gem::Dependency
|
64
77
|
name: unicorn
|
65
|
-
requirement: &
|
78
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
66
79
|
none: false
|
67
80
|
requirements:
|
68
81
|
- - ">="
|
@@ -72,10 +85,10 @@ dependencies:
|
|
72
85
|
version: "0"
|
73
86
|
type: :runtime
|
74
87
|
prerelease: false
|
75
|
-
version_requirements: *
|
88
|
+
version_requirements: *id005
|
76
89
|
- !ruby/object:Gem::Dependency
|
77
90
|
name: magent
|
78
|
-
requirement: &
|
91
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
79
92
|
none: false
|
80
93
|
requirements:
|
81
94
|
- - ">="
|
@@ -85,10 +98,10 @@ dependencies:
|
|
85
98
|
version: "0"
|
86
99
|
type: :runtime
|
87
100
|
prerelease: false
|
88
|
-
version_requirements: *
|
101
|
+
version_requirements: *id006
|
89
102
|
- !ruby/object:Gem::Dependency
|
90
103
|
name: jeweler
|
91
|
-
requirement: &
|
104
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
92
105
|
none: false
|
93
106
|
requirements:
|
94
107
|
- - ~>
|
@@ -100,10 +113,10 @@ dependencies:
|
|
100
113
|
version: 1.6.0
|
101
114
|
type: :development
|
102
115
|
prerelease: false
|
103
|
-
version_requirements: *
|
116
|
+
version_requirements: *id007
|
104
117
|
- !ruby/object:Gem::Dependency
|
105
118
|
name: shoulda
|
106
|
-
requirement: &
|
119
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
107
120
|
none: false
|
108
121
|
requirements:
|
109
122
|
- - ">="
|
@@ -113,10 +126,10 @@ dependencies:
|
|
113
126
|
version: "0"
|
114
127
|
type: :development
|
115
128
|
prerelease: false
|
116
|
-
version_requirements: *
|
129
|
+
version_requirements: *id008
|
117
130
|
- !ruby/object:Gem::Dependency
|
118
131
|
name: bundler
|
119
|
-
requirement: &
|
132
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
120
133
|
none: false
|
121
134
|
requirements:
|
122
135
|
- - ~>
|
@@ -128,10 +141,10 @@ dependencies:
|
|
128
141
|
version: 1.0.0
|
129
142
|
type: :development
|
130
143
|
prerelease: false
|
131
|
-
version_requirements: *
|
144
|
+
version_requirements: *id009
|
132
145
|
- !ruby/object:Gem::Dependency
|
133
146
|
name: rcov
|
134
|
-
requirement: &
|
147
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
135
148
|
none: false
|
136
149
|
requirements:
|
137
150
|
- - ">="
|
@@ -141,11 +154,11 @@ dependencies:
|
|
141
154
|
version: "0"
|
142
155
|
type: :development
|
143
156
|
prerelease: false
|
144
|
-
version_requirements: *
|
157
|
+
version_requirements: *id010
|
145
158
|
description: our capistrano recipes. forked from capistrano-recipes
|
146
159
|
email: krawek@gmail.com
|
147
|
-
executables:
|
148
|
-
|
160
|
+
executables:
|
161
|
+
- ricodigo-install-server
|
149
162
|
extensions: []
|
150
163
|
|
151
164
|
extra_rdoc_files:
|
@@ -159,6 +172,7 @@ files:
|
|
159
172
|
- README.rdoc
|
160
173
|
- Rakefile
|
161
174
|
- VERSION
|
175
|
+
- bin/ricodigo-install-server
|
162
176
|
- generators/app.bluepill.erb
|
163
177
|
- generators/nginx.conf.erb
|
164
178
|
- generators/unicorn.rb.erb
|
@@ -191,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
205
|
requirements:
|
192
206
|
- - ">="
|
193
207
|
- !ruby/object:Gem::Version
|
194
|
-
hash:
|
208
|
+
hash: -2322525543932527939
|
195
209
|
segments:
|
196
210
|
- 0
|
197
211
|
version: "0"
|