mdh-ec2onrails 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +180 -0
- data/COPYING +339 -0
- data/Manifest +162 -0
- data/README.textile +214 -0
- data/Rakefile +36 -0
- data/TODO +102 -0
- data/ec2onrails.gemspec +42 -0
- data/examples/Capfile +3 -0
- data/examples/deploy.rb +101 -0
- data/examples/s3.yml +9 -0
- data/lib/ec2onrails.rb +20 -0
- data/lib/ec2onrails/capistrano_utils.rb +43 -0
- data/lib/ec2onrails/recipes.rb +844 -0
- data/lib/ec2onrails/version.rb +31 -0
- data/server/build-ec2onrails.sh +44 -0
- data/server/files/etc/aliases +5 -0
- data/server/files/etc/aliases.db +0 -0
- data/server/files/etc/apache2/apache2.conf +295 -0
- data/server/files/etc/apache2/conf.d/app.proxy_cluster.conf +7 -0
- data/server/files/etc/apache2/conf.d/app.proxy_frontend.conf +10 -0
- data/server/files/etc/apache2/mods-available/proxy.conf +18 -0
- data/server/files/etc/apache2/sites-available/app.common +56 -0
- data/server/files/etc/apache2/sites-available/app.custom +0 -0
- data/server/files/etc/apache2/sites-available/default +14 -0
- data/server/files/etc/apache2/sites-available/default-ssl +19 -0
- data/server/files/etc/cron.d/backup_app_db_to_s3 +16 -0
- data/server/files/etc/cron.daily/app +9 -0
- data/server/files/etc/cron.daily/logrotate_post +19 -0
- data/server/files/etc/cron.hourly/app +10 -0
- data/server/files/etc/cron.monthly/app +10 -0
- data/server/files/etc/cron.weekly/app +10 -0
- data/server/files/etc/denyhosts.conf +628 -0
- data/server/files/etc/dpkg/dpkg.cfg +13 -0
- data/server/files/etc/ec2onrails/README +32 -0
- data/server/files/etc/ec2onrails/balancer_members +6 -0
- data/server/files/etc/ec2onrails/roles.yml +5 -0
- data/server/files/etc/environment +2 -0
- data/server/files/etc/god/app.god +35 -0
- data/server/files/etc/god/db.god +17 -0
- data/server/files/etc/god/examples/have_god_daemonize.god +18 -0
- data/server/files/etc/god/master.conf +35 -0
- data/server/files/etc/god/memcache.god +15 -0
- data/server/files/etc/god/notifications.god +14 -0
- data/server/files/etc/god/system.god +34 -0
- data/server/files/etc/god/web.god +36 -0
- data/server/files/etc/init.d/ec2-every-startup +29 -0
- data/server/files/etc/init.d/ec2-first-startup +36 -0
- data/server/files/etc/init.d/god +42 -0
- data/server/files/etc/init.d/nginx +78 -0
- data/server/files/etc/init.d/set_roles +3 -0
- data/server/files/etc/logrotate.d/apache2 +16 -0
- data/server/files/etc/logrotate.d/mongrel +11 -0
- data/server/files/etc/logrotate.d/nginx +11 -0
- data/server/files/etc/memcached.conf +47 -0
- data/server/files/etc/mongrel_cluster/app.yml +9 -0
- data/server/files/etc/motd.tail +13 -0
- data/server/files/etc/mysql/my.cnf +152 -0
- data/server/files/etc/nginx/nginx.conf +296 -0
- data/server/files/etc/postfix/main.cf +4 -0
- data/server/files/etc/rcS.d/S91ec2-first-startup +1 -0
- data/server/files/etc/rcS.d/S92ec2-every-startup +1 -0
- data/server/files/etc/rcS.d/S99set_roles +1 -0
- data/server/files/etc/ssh/sshd_config +94 -0
- data/server/files/etc/sudoers +1 -0
- data/server/files/etc/sudoers.full_access +26 -0
- data/server/files/etc/sudoers.restricted_access +28 -0
- data/server/files/etc/syslog.conf +69 -0
- data/server/files/usr/bin/god +26 -0
- data/server/files/usr/local/ec2onrails/COPYING +339 -0
- data/server/files/usr/local/ec2onrails/bin/archive_file.rb +44 -0
- data/server/files/usr/local/ec2onrails/bin/backup_app_db.rb +159 -0
- data/server/files/usr/local/ec2onrails/bin/ec2_meta_data.rb +80 -0
- data/server/files/usr/local/ec2onrails/bin/exec_runner +73 -0
- data/server/files/usr/local/ec2onrails/bin/init_services.rb +64 -0
- data/server/files/usr/local/ec2onrails/bin/optimize_mysql.rb +348 -0
- data/server/files/usr/local/ec2onrails/bin/rails_env +35 -0
- data/server/files/usr/local/ec2onrails/bin/rebundle.sh +70 -0
- data/server/files/usr/local/ec2onrails/bin/restore_app_db.rb +58 -0
- data/server/files/usr/local/ec2onrails/bin/set_rails_env +40 -0
- data/server/files/usr/local/ec2onrails/bin/set_roles.rb +87 -0
- data/server/files/usr/local/ec2onrails/bin/setup_web_proxy.rb +109 -0
- data/server/files/usr/local/ec2onrails/config +30 -0
- data/server/files/usr/local/ec2onrails/lib/aws_helper.rb +76 -0
- data/server/files/usr/local/ec2onrails/lib/god_helper.rb +129 -0
- data/server/files/usr/local/ec2onrails/lib/god_patch.rb +43 -0
- data/server/files/usr/local/ec2onrails/lib/mysql_helper.rb +101 -0
- data/server/files/usr/local/ec2onrails/lib/roles_helper.rb +151 -0
- data/server/files/usr/local/ec2onrails/lib/s3_helper.rb +99 -0
- data/server/files/usr/local/ec2onrails/lib/utils.rb +16 -0
- data/server/files/usr/local/ec2onrails/lib/vendor/ini.rb +268 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/every-startup/get-hostname.sh +25 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/README +5 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/create-dirs.sh +39 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/generate-default-web-cert-and-key.sh +49 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/misc.sh +27 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/prepare-mysql-data-dir.sh +24 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-credentials.sh +29 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-file-permissions.sh +30 -0
- data/server/rakefile.rb +248 -0
- data/setup.rb +1585 -0
- data/test/autobench.conf +60 -0
- data/test/spec/lib/s3_helper_spec.rb +134 -0
- data/test/spec/lib/s3_old.yml +3 -0
- data/test/spec/test_files/test1 +0 -0
- data/test/spec/test_files/test2 +0 -0
- data/test/test_app/Capfile +3 -0
- data/test/test_app/README +182 -0
- data/test/test_app/Rakefile +10 -0
- data/test/test_app/app/controllers/application.rb +7 -0
- data/test/test_app/app/controllers/db_fast_controller.rb +6 -0
- data/test/test_app/app/controllers/fast_controller.rb +5 -0
- data/test/test_app/app/controllers/slow_controller.rb +6 -0
- data/test/test_app/app/controllers/very_slow_controller.rb +6 -0
- data/test/test_app/app/helpers/application_helper.rb +3 -0
- data/test/test_app/app/helpers/db_fast_helper.rb +2 -0
- data/test/test_app/app/helpers/fast_helper.rb +2 -0
- data/test/test_app/app/helpers/slow_helper.rb +2 -0
- data/test/test_app/app/helpers/very_slow_helper.rb +2 -0
- data/test/test_app/config/boot.rb +109 -0
- data/test/test_app/config/database.yml +19 -0
- data/test/test_app/config/deploy.rb +21 -0
- data/test/test_app/config/environment.rb +60 -0
- data/test/test_app/config/environments/development.rb +21 -0
- data/test/test_app/config/environments/production.rb +18 -0
- data/test/test_app/config/environments/test.rb +19 -0
- data/test/test_app/config/routes.rb +27 -0
- data/test/test_app/db/schema.rb +7 -0
- data/test/test_app/doc/README_FOR_APP +2 -0
- data/test/test_app/public/404.html +30 -0
- data/test/test_app/public/500.html +30 -0
- data/test/test_app/public/dispatch.cgi +10 -0
- data/test/test_app/public/dispatch.fcgi +24 -0
- data/test/test_app/public/dispatch.rb +10 -0
- data/test/test_app/public/favicon.ico +0 -0
- data/test/test_app/public/images/rails.png +0 -0
- data/test/test_app/public/javascripts/application.js +2 -0
- data/test/test_app/public/javascripts/controls.js +963 -0
- data/test/test_app/public/javascripts/dragdrop.js +972 -0
- data/test/test_app/public/javascripts/effects.js +1120 -0
- data/test/test_app/public/javascripts/prototype.js +4225 -0
- data/test/test_app/public/robots.txt +1 -0
- data/test/test_app/script/about +3 -0
- data/test/test_app/script/breakpointer +3 -0
- data/test/test_app/script/console +3 -0
- data/test/test_app/script/destroy +3 -0
- data/test/test_app/script/generate +3 -0
- data/test/test_app/script/performance/benchmarker +3 -0
- data/test/test_app/script/performance/profiler +3 -0
- data/test/test_app/script/performance/request +3 -0
- data/test/test_app/script/plugin +3 -0
- data/test/test_app/script/process/inspector +3 -0
- data/test/test_app/script/process/reaper +3 -0
- data/test/test_app/script/process/spawner +3 -0
- data/test/test_app/script/runner +3 -0
- data/test/test_app/script/server +3 -0
- data/test/test_app/test/functional/db_fast_controller_test.rb +18 -0
- data/test/test_app/test/functional/fast_controller_test.rb +18 -0
- data/test/test_app/test/functional/slow_controller_test.rb +18 -0
- data/test/test_app/test/functional/very_slow_controller_test.rb +18 -0
- data/test/test_app/test/test_helper.rb +28 -0
- data/test/test_ec2onrails.rb +11 -0
- data/test/test_helper.rb +2 -0
- metadata +274 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
module Ec2onrails
|
2
|
+
module Utils
|
3
|
+
def self.run(command)
|
4
|
+
result = system command
|
5
|
+
raise("error, process exited with status #{$?.exitstatus}") unless result
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.rails_env
|
9
|
+
`/usr/local/ec2onrails/bin/rails_env`.strip
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.hostname
|
13
|
+
`hostname -s`.strip
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,268 @@
|
|
1
|
+
# from ini gem, version 0.1.1
|
2
|
+
# modified to allow keys with no value to be passed in (search for MODIFIED)
|
3
|
+
#
|
4
|
+
# This class represents the INI file and can be used to parse, modify,
|
5
|
+
# and write INI files.
|
6
|
+
#
|
7
|
+
class Ini
|
8
|
+
|
9
|
+
# :stopdoc:
|
10
|
+
class Error < StandardError; end
|
11
|
+
# :startdoc:
|
12
|
+
|
13
|
+
#
|
14
|
+
# call-seq:
|
15
|
+
# IniFile.load( filename )
|
16
|
+
# IniFile.load( filename, options )
|
17
|
+
#
|
18
|
+
# Open the given _filename_ and load the contetns of the INI file.
|
19
|
+
# The following _options_ can be passed to this method:
|
20
|
+
#
|
21
|
+
# :comment => ';' The line comment character(s)
|
22
|
+
# :parameter => '=' The parameter / value separator
|
23
|
+
#
|
24
|
+
def self.load( filename, opts = {} )
|
25
|
+
new(filename, opts)
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# call-seq:
|
30
|
+
# IniFile.new( filename )
|
31
|
+
# IniFile.new( filename, options )
|
32
|
+
#
|
33
|
+
# Create a new INI file using the given _filename_. If _filename_
|
34
|
+
# exists and is a regular file, then its contents will be parsed.
|
35
|
+
# The following _options_ can be passed to this method:
|
36
|
+
#
|
37
|
+
# :comment => ';' The line comment character(s)
|
38
|
+
# :parameter => '=' The parameter / value separator
|
39
|
+
#
|
40
|
+
def initialize( filename, opts = {} )
|
41
|
+
@fn = filename
|
42
|
+
@comment = opts[:comment] || ';'
|
43
|
+
@param = opts[:parameter] || '='
|
44
|
+
@ini = Hash.new {|h,k| h[k] = Hash.new}
|
45
|
+
|
46
|
+
@rgxp_comment = %r/\A\s*\z|\A\s*[#{@comment}]/
|
47
|
+
@rgxp_section = %r/\A\s*\[([^\]]+)\]/o
|
48
|
+
#MODIFIED: added #{@param}?... that question mark means that we will match rows
|
49
|
+
# with just a key, but no value
|
50
|
+
@rgxp_param = %r/\A([^#{@param}]+)#{@param}?(.*)\z/
|
51
|
+
|
52
|
+
parse
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# call-seq:
|
57
|
+
# write
|
58
|
+
# write( filename )
|
59
|
+
#
|
60
|
+
# Write the INI file contents to the filesystem. The given _filename_
|
61
|
+
# will be used to write the file. If _filename_ is not given, then the
|
62
|
+
# named used when constructing this object will be used.
|
63
|
+
#
|
64
|
+
def write( filename = nil )
|
65
|
+
@fn = filename unless filename.nil?
|
66
|
+
|
67
|
+
::File.open(@fn, 'w') do |f|
|
68
|
+
@ini.each do |section,hash|
|
69
|
+
f.puts "[#{section}]"
|
70
|
+
#MODIFY: do not print out the '=' if there is no value... PLUS remove spaces around the '='
|
71
|
+
hash.each {|param,val| f.puts val.nil? ? param : "#{param}#{@param}#{val}"}
|
72
|
+
f.puts
|
73
|
+
end
|
74
|
+
end
|
75
|
+
self
|
76
|
+
end
|
77
|
+
alias :save :write
|
78
|
+
|
79
|
+
#
|
80
|
+
# call-seq:
|
81
|
+
# each {|section, parameter, value| block}
|
82
|
+
#
|
83
|
+
# Yield each _section_, _parameter_, _value_ in turn to the given
|
84
|
+
# _block_. The method returns immediately if no block is supplied.
|
85
|
+
#
|
86
|
+
def each
|
87
|
+
return unless block_given?
|
88
|
+
@ini.each do |section,hash|
|
89
|
+
hash.each do |param,val|
|
90
|
+
yield section, param, val
|
91
|
+
end
|
92
|
+
end
|
93
|
+
self
|
94
|
+
end
|
95
|
+
|
96
|
+
#
|
97
|
+
# call-seq:
|
98
|
+
# each_section {|section| block}
|
99
|
+
#
|
100
|
+
# Yield each _section_ in turn to the given _block_. The method returns
|
101
|
+
# immediately if no block is supplied.
|
102
|
+
#
|
103
|
+
def each_section
|
104
|
+
return unless block_given?
|
105
|
+
@ini.each_key {|section| yield section}
|
106
|
+
self
|
107
|
+
end
|
108
|
+
|
109
|
+
#
|
110
|
+
# call-seq:
|
111
|
+
# delete_section( section )
|
112
|
+
#
|
113
|
+
# Deletes the named _section_ from the INI file. Returns the
|
114
|
+
# parameter / value pairs if the section exists in the INI file. Otherwise,
|
115
|
+
# returns +nil+.
|
116
|
+
#
|
117
|
+
def delete_section( section )
|
118
|
+
@ini.delete section.to_s
|
119
|
+
end
|
120
|
+
|
121
|
+
#
|
122
|
+
# call-seq:
|
123
|
+
# ini_file[section]
|
124
|
+
#
|
125
|
+
# Get the hash of parameter/value pairs for the given _section_. If the
|
126
|
+
# _section_ hash does not exist it will be created.
|
127
|
+
#
|
128
|
+
def []( section )
|
129
|
+
return nil if section.nil?
|
130
|
+
@ini[section.to_s]
|
131
|
+
end
|
132
|
+
|
133
|
+
#
|
134
|
+
# call-seq:
|
135
|
+
# has_section?( section )
|
136
|
+
#
|
137
|
+
# Returns +true+ if the named _section_ exists in the INI file.
|
138
|
+
#
|
139
|
+
def has_section?( section )
|
140
|
+
@ini.has_key? section.to_s
|
141
|
+
end
|
142
|
+
|
143
|
+
#
|
144
|
+
# call-seq:
|
145
|
+
# sections
|
146
|
+
#
|
147
|
+
# Returns an array of the section names.
|
148
|
+
#
|
149
|
+
def sections
|
150
|
+
@ini.keys
|
151
|
+
end
|
152
|
+
|
153
|
+
#
|
154
|
+
# call-seq:
|
155
|
+
# freeze
|
156
|
+
#
|
157
|
+
# Freeze the state of the +IniFile+ object. Any attempts to change the
|
158
|
+
# object will raise an error.
|
159
|
+
#
|
160
|
+
def freeze
|
161
|
+
super
|
162
|
+
@ini.each_value {|h| h.freeze}
|
163
|
+
@ini.freeze
|
164
|
+
self
|
165
|
+
end
|
166
|
+
|
167
|
+
#
|
168
|
+
# call-seq:
|
169
|
+
# taint
|
170
|
+
#
|
171
|
+
# Marks the INI file as tainted -- this will traverse each section marking
|
172
|
+
# each section as tainted as well.
|
173
|
+
#
|
174
|
+
def taint
|
175
|
+
super
|
176
|
+
@ini.each_value {|h| h.taint}
|
177
|
+
@ini.taint
|
178
|
+
self
|
179
|
+
end
|
180
|
+
|
181
|
+
#
|
182
|
+
# call-seq:
|
183
|
+
# dup
|
184
|
+
#
|
185
|
+
# Produces a duplicate of this INI file. The duplicate is independent of the
|
186
|
+
# original -- i.e. the duplicate can be modified without changing the
|
187
|
+
# orgiinal. The tainted state of the original is copied to the duplicate.
|
188
|
+
#
|
189
|
+
def dup
|
190
|
+
other = super
|
191
|
+
other.instance_variable_set(:@ini, Hash.new {|h,k| h[k] = Hash.new})
|
192
|
+
@ini.each_pair {|s,h| other[s].merge! h}
|
193
|
+
other.taint if self.tainted?
|
194
|
+
other
|
195
|
+
end
|
196
|
+
|
197
|
+
#
|
198
|
+
# call-seq:
|
199
|
+
# clone
|
200
|
+
#
|
201
|
+
# Produces a duplicate of this INI file. The duplicate is independent of the
|
202
|
+
# original -- i.e. the duplicate can be modified without changing the
|
203
|
+
# orgiinal. The tainted state and the frozen state of the original is copied
|
204
|
+
# to the duplicate.
|
205
|
+
#
|
206
|
+
def clone
|
207
|
+
other = dup
|
208
|
+
other.freeze if self.frozen?
|
209
|
+
other
|
210
|
+
end
|
211
|
+
|
212
|
+
#
|
213
|
+
# call-seq:
|
214
|
+
# eql?( other )
|
215
|
+
#
|
216
|
+
# Returns +true+ if the _other_ object is equivalent to this INI file. For
|
217
|
+
# two INI files to be equivalent, they must have the same sections with the
|
218
|
+
# same parameter / value pairs in each section.
|
219
|
+
#
|
220
|
+
def eql?( other )
|
221
|
+
return true if equal? other
|
222
|
+
return false unless other.instance_of? self.class
|
223
|
+
@ini == other.instance_variable_get(:@ini)
|
224
|
+
end
|
225
|
+
alias :== :eql?
|
226
|
+
|
227
|
+
|
228
|
+
private
|
229
|
+
#
|
230
|
+
# call-seq
|
231
|
+
# parse
|
232
|
+
#
|
233
|
+
# Parse the ini file contents.
|
234
|
+
#
|
235
|
+
def parse
|
236
|
+
return unless ::Kernel.test ?f, @fn
|
237
|
+
section = nil
|
238
|
+
|
239
|
+
::File.open(@fn, 'r') do |f|
|
240
|
+
while line = f.gets
|
241
|
+
line = line.chomp
|
242
|
+
|
243
|
+
case line
|
244
|
+
# ignore blank lines and comment lines
|
245
|
+
when @rgxp_comment: next
|
246
|
+
|
247
|
+
# this is a section declaration
|
248
|
+
when @rgxp_section: section = @ini[$1.strip]
|
249
|
+
|
250
|
+
# otherwise we have a parameter
|
251
|
+
when @rgxp_param
|
252
|
+
begin
|
253
|
+
#MODIFY: store no value as a nil instead of a blank
|
254
|
+
section[$1.strip] = $2.strip.size == 0 ? nil : $2.strip
|
255
|
+
rescue NoMethodError
|
256
|
+
raise Error, "parameter encountered before first section"
|
257
|
+
end
|
258
|
+
|
259
|
+
else
|
260
|
+
raise Error, "could not parse line '#{line}"
|
261
|
+
end
|
262
|
+
end # while
|
263
|
+
end # File.open
|
264
|
+
end
|
265
|
+
|
266
|
+
end
|
267
|
+
|
268
|
+
# EOF
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# This file is part of EC2 on Rails.
|
4
|
+
# http://rubyforge.org/projects/ec2onrails/
|
5
|
+
#
|
6
|
+
# Copyright 2007 Paul Dowman, http://pauldowman.com/
|
7
|
+
#
|
8
|
+
# EC2 on Rails is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# EC2 on Rails is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
# Set the hostname to this instance's public hostname
|
22
|
+
|
23
|
+
hostname `curl http://169.254.169.254/latest/meta-data/public-hostname`
|
24
|
+
sudo god reload
|
25
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# This file is part of EC2 on Rails.
|
4
|
+
# http://rubyforge.org/projects/ec2onrails/
|
5
|
+
#
|
6
|
+
# Copyright 2007 Paul Dowman, http://pauldowman.com/
|
7
|
+
#
|
8
|
+
# EC2 on Rails is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# EC2 on Rails is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
make_dir() {
|
22
|
+
mkdir -p $1
|
23
|
+
if [ $2 ] ; then
|
24
|
+
chown -R $2 $1
|
25
|
+
fi
|
26
|
+
}
|
27
|
+
|
28
|
+
make_dir /mnt/app app:app
|
29
|
+
|
30
|
+
#make sure it is setup to be able to be read/written by app user
|
31
|
+
make_dir /etc/ec2onrails app:app
|
32
|
+
|
33
|
+
make_dir /mnt/log
|
34
|
+
# make_dir /mnt/log/apache2 www-data:www-data
|
35
|
+
make_dir /mnt/log/fsck
|
36
|
+
make_dir /mnt/log/mysql mysql:mysql
|
37
|
+
|
38
|
+
make_dir /mnt/tmp
|
39
|
+
chmod 777 /mnt/tmp
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# This file is part of EC2 on Rails.
|
4
|
+
# http://rubyforge.org/projects/ec2onrails/
|
5
|
+
#
|
6
|
+
# Copyright 2007 Paul Dowman, http://pauldowman.com/
|
7
|
+
#
|
8
|
+
# EC2 on Rails is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# EC2 on Rails is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
|
22
|
+
# Generate a new self-signed cert and key for https
|
23
|
+
|
24
|
+
echo "Generating default self-signed SSL cert and key..."
|
25
|
+
|
26
|
+
export RANDFILE=/tmp/randfile
|
27
|
+
|
28
|
+
cd /tmp
|
29
|
+
openssl genrsa -out server.key 1024
|
30
|
+
openssl req -new -key server.key -out server.csr <<END
|
31
|
+
CA
|
32
|
+
.
|
33
|
+
.
|
34
|
+
.
|
35
|
+
.
|
36
|
+
.
|
37
|
+
.
|
38
|
+
.
|
39
|
+
.
|
40
|
+
|
41
|
+
END
|
42
|
+
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
|
43
|
+
|
44
|
+
mkdir -p /etc/ec2onrails/ssl/cert
|
45
|
+
mkdir -p -m 700 /etc/ec2onrails/ssl/private
|
46
|
+
mv server.key /etc/ec2onrails/ssl/private/ec2onrails-default.key
|
47
|
+
mv server.crt /etc/ec2onrails/ssl/cert/ec2onrails-default.crt
|
48
|
+
rm $RANDFILE
|
49
|
+
rm server.csr
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# This file is part of EC2 on Rails.
|
4
|
+
# http://rubyforge.org/projects/ec2onrails/
|
5
|
+
#
|
6
|
+
# Copyright 2007 Paul Dowman, http://pauldowman.com/
|
7
|
+
#
|
8
|
+
# EC2 on Rails is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# EC2 on Rails is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
|
22
|
+
cp /etc/hosts /etc/hosts.original
|
23
|
+
|
24
|
+
# make sure the db optimize is only run once...
|
25
|
+
# the setup script will look for this flag, and
|
26
|
+
# if it doesn't exist the db optimzation won't occur
|
27
|
+
touch /tmp/optimize_db_flag
|
data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/prepare-mysql-data-dir.sh
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# This file is part of EC2 on Rails.
|
4
|
+
# http://rubyforge.org/projects/ec2onrails/
|
5
|
+
#
|
6
|
+
# Copyright 2007 Paul Dowman, http://pauldowman.com/
|
7
|
+
#
|
8
|
+
# EC2 on Rails is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# EC2 on Rails is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
|
22
|
+
mkdir -p /mnt/mysql_data/tmp
|
23
|
+
chown -R mysql:mysql /mnt/mysql_data/
|
24
|
+
cp -rp /var/lib/mysql/mysql /mnt/mysql_data/
|