gigpark-ec2onrails 0.9.10.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +190 -0
- data/COPYING +339 -0
- data/Manifest +160 -0
- data/README.textile +233 -0
- data/Rakefile +31 -0
- data/TODO +104 -0
- data/ec2onrails.gemspec +46 -0
- data/echoe_config.rb +27 -0
- data/examples/Capfile +3 -0
- data/examples/deploy.rb +103 -0
- data/examples/s3.yml +9 -0
- data/lib/ec2onrails.rb +20 -0
- data/lib/ec2onrails/capistrano_utils.rb +47 -0
- data/lib/ec2onrails/recipes.rb +146 -0
- data/lib/ec2onrails/recipes/db.rb +366 -0
- data/lib/ec2onrails/recipes/deploy.rb +26 -0
- data/lib/ec2onrails/recipes/server.rb +517 -0
- data/lib/ec2onrails/version.rb +29 -0
- data/server/build +74 -0
- data/server/files/etc/README +7 -0
- data/server/files/etc/aliases +5 -0
- data/server/files/etc/cron.d/ec2onrails +16 -0
- data/server/files/etc/cron.daily/app +31 -0
- data/server/files/etc/cron.daily/logrotate_post +25 -0
- data/server/files/etc/cron.hourly/app +31 -0
- data/server/files/etc/cron.monthly/app +31 -0
- data/server/files/etc/cron.weekly/app +31 -0
- data/server/files/etc/default/varnish +33 -0
- data/server/files/etc/default/varnishncsa +11 -0
- data/server/files/etc/denyhosts.conf +628 -0
- data/server/files/etc/dpkg/dpkg.cfg +13 -0
- data/server/files/etc/ec2onrails/rails_env +1 -0
- data/server/files/etc/ec2onrails/roles.yml +5 -0
- data/server/files/etc/environment +2 -0
- data/server/files/etc/event.d/god +8 -0
- data/server/files/etc/god/db_primary.god +16 -0
- data/server/files/etc/god/dkim_filter.god +17 -0
- data/server/files/etc/god/master.conf +40 -0
- data/server/files/etc/god/memcache.god +15 -0
- data/server/files/etc/god/notifications.god +11 -0
- data/server/files/etc/god/proxy.god +40 -0
- data/server/files/etc/god/system.god +37 -0
- data/server/files/etc/god/web.god +23 -0
- data/server/files/etc/init.d/ec2-every-startup +29 -0
- data/server/files/etc/init.d/ec2-first-startup +37 -0
- data/server/files/etc/init.d/nginx +78 -0
- data/server/files/etc/logrotate.d/nginx +10 -0
- data/server/files/etc/logrotate.d/rails +8 -0
- data/server/files/etc/logrotate.d/varnish +14 -0
- data/server/files/etc/memcached.conf +47 -0
- data/server/files/etc/motd.tail +13 -0
- data/server/files/etc/mysql/my.cnf +152 -0
- data/server/files/etc/nginx/conf.d/custom.conf +1 -0
- data/server/files/etc/nginx/nginx.conf.erb +152 -0
- data/server/files/etc/postfix/main.cf +4 -0
- data/server/files/etc/ssh/sshd_config +96 -0
- data/server/files/etc/sudoers +31 -0
- data/server/files/etc/syslog.conf +63 -0
- data/server/files/etc/varnish/default.vcl.erb +140 -0
- data/server/files/usr/local/ec2onrails/COPYING +339 -0
- data/server/files/usr/local/ec2onrails/bin/archive_file +44 -0
- data/server/files/usr/local/ec2onrails/bin/backup_app_db +160 -0
- data/server/files/usr/local/ec2onrails/bin/backup_dir +89 -0
- data/server/files/usr/local/ec2onrails/bin/ec2_meta_data +80 -0
- data/server/files/usr/local/ec2onrails/bin/exec_runner +76 -0
- data/server/files/usr/local/ec2onrails/bin/in_role +33 -0
- data/server/files/usr/local/ec2onrails/bin/init_services +43 -0
- data/server/files/usr/local/ec2onrails/bin/install_system_files +56 -0
- data/server/files/usr/local/ec2onrails/bin/optimize_mysql +346 -0
- data/server/files/usr/local/ec2onrails/bin/public-hostname +24 -0
- data/server/files/usr/local/ec2onrails/bin/rails_env +33 -0
- data/server/files/usr/local/ec2onrails/bin/rebundle +62 -0
- data/server/files/usr/local/ec2onrails/bin/restore_app_db +58 -0
- data/server/files/usr/local/ec2onrails/bin/set_rails_env +36 -0
- data/server/files/usr/local/ec2onrails/bin/set_roles +36 -0
- data/server/files/usr/local/ec2onrails/bin/uninstall_system_files +34 -0
- data/server/files/usr/local/ec2onrails/config +30 -0
- data/server/files/usr/local/ec2onrails/lib/aws_helper.rb +75 -0
- data/server/files/usr/local/ec2onrails/lib/god_helper.rb +84 -0
- data/server/files/usr/local/ec2onrails/lib/mysql_helper.rb +100 -0
- data/server/files/usr/local/ec2onrails/lib/roles_helper.rb +156 -0
- data/server/files/usr/local/ec2onrails/lib/s3_helper.rb +116 -0
- data/server/files/usr/local/ec2onrails/lib/system_files_helper.rb +110 -0
- data/server/files/usr/local/ec2onrails/lib/system_files_manifest.rb +107 -0
- data/server/files/usr/local/ec2onrails/lib/utils.rb +26 -0
- data/server/files/usr/local/ec2onrails/lib/vendor/ini.rb +268 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/every-startup/README +5 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/every-startup/create-mysqld-pid-dir +26 -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 +45 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/generate-default-web-cert-and-key +49 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/get-hostname +27 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/misc +27 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/prepare-mysql-data-dir +24 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-credentials +32 -0
- data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-file-permissions +30 -0
- data/server/rakefile-wrapper +26 -0
- data/server/rakefile.rb +267 -0
- data/test/autobench.conf +60 -0
- data/test/spec/lib/s3_helper_spec.rb +154 -0
- data/test/spec/lib/s3_old.yml +3 -0
- data/test/spec/lib/system_files_manifest_spec.rb +122 -0
- data/test/spec/test_files/system_files1/_manifest +13 -0
- data/test/spec/test_files/system_files1/test1 +0 -0
- data/test/spec/test_files/system_files1/test2 +0 -0
- data/test/spec/test_files/system_files1/testfolder/test3 +0 -0
- data/test/spec/test_files/system_files2/_manifest +2 -0
- data/test/spec/test_files/system_files2/test1 +0 -0
- data/test/spec/test_files/system_files2/test2 +0 -0
- data/test/spec/test_files/system_files2/testfolder/test3 +0 -0
- data/test/spec/test_files/test2 +0 -0
- data/test/test_app/Capfile +3 -0
- data/test/test_app/README +243 -0
- data/test/test_app/Rakefile +10 -0
- data/test/test_app/app/controllers/application_controller.rb +10 -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/config/boot.rb +110 -0
- data/test/test_app/config/database.yml +24 -0
- data/test/test_app/config/deploy.rb +22 -0
- data/test/test_app/config/ec2onrails/config.rb +5 -0
- data/test/test_app/config/environment.rb +41 -0
- data/test/test_app/config/environments/development.rb +17 -0
- data/test/test_app/config/environments/production.rb +28 -0
- data/test/test_app/config/environments/test.rb +28 -0
- data/test/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/test_app/config/initializers/inflections.rb +10 -0
- data/test/test_app/config/initializers/mime_types.rb +5 -0
- data/test/test_app/config/initializers/new_rails_defaults.rb +19 -0
- data/test/test_app/config/initializers/session_store.rb +15 -0
- data/test/test_app/config/locales/en.yml +5 -0
- data/test/test_app/config/routes.rb +43 -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/422.html +30 -0
- data/test/test_app/public/500.html +30 -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/index.html +275 -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 +973 -0
- data/test/test_app/public/javascripts/effects.js +1128 -0
- data/test/test_app/public/javascripts/prototype.js +4320 -0
- data/test/test_app/public/robots.txt +5 -0
- data/test/test_app/script/about +4 -0
- data/test/test_app/script/console +3 -0
- data/test/test_app/script/dbconsole +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/plugin +3 -0
- data/test/test_app/script/runner +3 -0
- data/test/test_app/script/server +3 -0
- data/test/test_app/test/performance/browsing_test.rb +9 -0
- data/test/test_app/test/test_helper.rb +38 -0
- metadata +266 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
# This file is part of EC2 on Rails.
|
2
|
+
# http://rubyforge.org/projects/ec2onrails/
|
3
|
+
#
|
4
|
+
# Copyright 2007 Paul Dowman, http://pauldowman.com/
|
5
|
+
#
|
6
|
+
# EC2 on Rails is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation; either version 2 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# EC2 on Rails is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
module Ec2onrails
|
20
|
+
class SystemFilesManifest
|
21
|
+
|
22
|
+
MANIFEST_FILE_NAME = "_manifest"
|
23
|
+
|
24
|
+
# dir is expected to contain a file named MANIFEST_FILE_NAME
|
25
|
+
def initialize(dir_or_file)
|
26
|
+
if File.directory?(dir_or_file)
|
27
|
+
@dir = dir_or_file
|
28
|
+
@file = File.join @dir, MANIFEST_FILE_NAME
|
29
|
+
raise "Can't find manifest file: #{@file}" unless File.exists?(@file)
|
30
|
+
@entries = parse(@file)
|
31
|
+
raise "Manifest doesn't match entries in #{@dir}" unless validate
|
32
|
+
else
|
33
|
+
@dir = nil
|
34
|
+
@file = dir_or_file
|
35
|
+
raise "Can't find manifest file: #{@file}" unless File.exists?(@file)
|
36
|
+
@entries = parse(@file)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Check that the manifest entries match the files in the given directory
|
41
|
+
def validate
|
42
|
+
errors = false
|
43
|
+
# make sure there's a file for each manifest entry
|
44
|
+
@entries.each_key do |filename|
|
45
|
+
unless filename == MANIFEST_FILE_NAME
|
46
|
+
file = File.join(@dir, filename)
|
47
|
+
unless File.exist?(file)
|
48
|
+
log_error "File doesn't exist: #{file}"
|
49
|
+
errors = true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# make sure there's a manifest entry for each file
|
55
|
+
Dir.glob("#{@dir}/**/*").each do |f|
|
56
|
+
f = normalize(f)
|
57
|
+
unless self[f] || f == MANIFEST_FILE_NAME
|
58
|
+
log_error "File isn't listed in manifest: #{f}"
|
59
|
+
errors = true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
return !errors
|
64
|
+
end
|
65
|
+
|
66
|
+
# Return the metadata for the given file
|
67
|
+
def [](filename)
|
68
|
+
filename = normalize(filename)
|
69
|
+
@entries[filename]
|
70
|
+
end
|
71
|
+
|
72
|
+
def normalize(filename)
|
73
|
+
return nil unless filename
|
74
|
+
filename = filename.sub(/#{@dir}/, '') if @dir
|
75
|
+
filename.sub(/^\//, '')
|
76
|
+
end
|
77
|
+
|
78
|
+
def comment_or_empty_line?(line)
|
79
|
+
!!(line =~ /^\s*((#.*)|\s*)$/)
|
80
|
+
end
|
81
|
+
|
82
|
+
def parse(file)
|
83
|
+
entries = {}
|
84
|
+
contents = File.readlines(file)
|
85
|
+
contents.each do |line|
|
86
|
+
unless comment_or_empty_line?(line)
|
87
|
+
filename = line.match(/^([^\s]+)\s*.*$/)[1]
|
88
|
+
mode = $1 if line.match(/^.*\s+mode=([^\s]*).*$/)
|
89
|
+
owner = $1 if line.match(/^.*\s+owner=([^\s]*).*$/)
|
90
|
+
entries[filename] = {:mode => mode, :owner => owner}
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
return entries
|
95
|
+
end
|
96
|
+
|
97
|
+
def filenames
|
98
|
+
@entries.keys.sort
|
99
|
+
end
|
100
|
+
|
101
|
+
def log_error(message)
|
102
|
+
puts message
|
103
|
+
STDOUT.flush
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
@@ -0,0 +1,26 @@
|
|
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
|
+
File.read("/etc/ec2onrails/rails_env").strip
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.hostname
|
13
|
+
`hostname -s`.strip
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.load_config
|
17
|
+
config = {}
|
18
|
+
begin
|
19
|
+
config = eval(File.read("/etc/ec2onrails/config.rb"))
|
20
|
+
rescue Exception => e
|
21
|
+
puts "ERROR:\n#{e.inspect}\n#{e.backtrace.join("\n")}"
|
22
|
+
end
|
23
|
+
return config
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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,26 @@
|
|
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
|
+
# /var/run/mysqld doesn't exist until MySQL starts, but God fails if it
|
23
|
+
# doesn't exist, and we use God to start MySQL.
|
24
|
+
|
25
|
+
mkdir -p /var/run/mysqld
|
26
|
+
chown mysql:mysql /var/run/mysqld
|
@@ -0,0 +1,45 @@
|
|
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
|
+
# Why have it owned (or even writeable) by app? Can't it just be owned by root and world readable? - Paul
|
32
|
+
make_dir /etc/ec2onrails app:app
|
33
|
+
make_dir /etc/ec2onrails/system_files app:app
|
34
|
+
|
35
|
+
make_dir /mnt/log
|
36
|
+
make_dir /mnt/log/fsck
|
37
|
+
make_dir /mnt/log/god
|
38
|
+
make_dir /mnt/log/mysql mysql:mysql
|
39
|
+
make_dir /mnt/log/nginx nginx:nginx
|
40
|
+
make_dir /mnt/log/varnish
|
41
|
+
|
42
|
+
make_dir /mnt/varnish/
|
43
|
+
|
44
|
+
make_dir /mnt/tmp
|
45
|
+
chmod 777 /mnt/tmp
|