ec2onrails 0.9.9 → 0.9.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +23 -0
- data/config/hoe.rb +2 -2
- data/config/requirements.rb +1 -1
- data/lib/ec2onrails/recipes.rb +25 -33
- data/lib/ec2onrails/version.rb +7 -5
- data/website/index.html +109 -285
- data/website/index.txt +42 -98
- metadata +18 -8
data/History.txt
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
== 0.9.9.1 2009-01-27
|
2
|
+
|
3
|
+
* US AMI's: ami-5394733a (32-bit) and ami-5594733c (64-bit)
|
4
|
+
* EU AMI's: ami-761c3402 (32-bit) and ami-701c3404 (64-bit)
|
5
|
+
* This is just a bug fix release for 0.9.9, it doesn't include the (huge) changes from the github master branch (EBS, etc.)
|
6
|
+
* Updated to Ubuntu 8.04.2 LTS (https://wiki.ubuntu.com/HardyReleaseNotes/ChangeSummary/8.04.2)
|
7
|
+
* Built with ec2ubuntu build script version 125 (http://alestic.com)
|
8
|
+
* Updated to Rubygems 1.3.1
|
9
|
+
* Added github to gem sources
|
10
|
+
* Changed mysql server character set and collation to utf8
|
11
|
+
* Updated rails gems (2.2.2, 2.1.2, 2.0.5, 1.2.6)
|
12
|
+
* Updated build script to work with git repo
|
13
|
+
* Removed PHP packages
|
14
|
+
* Apache now sets the X_FORWARDED_PROTO header to "https" for SSL requests so request.ssl? will work
|
15
|
+
* Apache now removes the Client-IP HTTP header if it's set to prevent Rails from raising an erroneous "IP spoofing attack?!" exception
|
16
|
+
* Bug fix: now sets the db_primary hostname alias on all hosts, not just those in the app role
|
17
|
+
* Bug fix: increased the time to wait for mongrel processes to restart before re-enabling monitoring (to avoid warning messages from monit)
|
18
|
+
* Bug fix: fixed server:install_packages capistrano task (now updates package list)
|
19
|
+
* Bug fix: now automatically handles an Elastic IP being associated or disassociated (automatically checks every 15 mins to see if the hostname has been changed and resets anything that depends on the hostname)
|
20
|
+
* Bug fix: doesn't try to rotate apache logs if they don't exist. This previously resulted in a warning email.
|
21
|
+
* Bug fix: Apache now compresses .js files properly
|
22
|
+
|
23
|
+
|
1
24
|
== 0.9.9 2008-07-01
|
2
25
|
|
3
26
|
* ami-c9bc58a0 (32-bit) and ami-cbbc58a2 (64-bit)
|
data/config/hoe.rb
CHANGED
@@ -2,7 +2,7 @@ require 'ec2onrails/version'
|
|
2
2
|
|
3
3
|
AUTHOR = 'Paul Dowman' # can also be an array of Authors
|
4
4
|
EMAIL = "paul@pauldowman.com"
|
5
|
-
DESCRIPTION = "Client-side libraries (Capistrano tasks) for managing and deploying to EC2 on Rails servers."
|
5
|
+
DESCRIPTION = "Client-side libraries (Capistrano tasks) for managing and deploying to 'EC2 on Rails' servers."
|
6
6
|
GEM_NAME = 'ec2onrails' # what ppl will type to install your gem
|
7
7
|
RUBYFORGE_PROJECT = 'ec2onrails' # The unix name for your project
|
8
8
|
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
@@ -59,7 +59,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
59
59
|
|
60
60
|
# == Optional
|
61
61
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
|
62
|
-
p.extra_deps = [['capistrano', '
|
62
|
+
p.extra_deps = [['capistrano', '>= 2.5.3'], ['archive-tar-minitar', '>= 0.5.2'], ['optiflag', '>= 0.6.5']] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
63
63
|
|
64
64
|
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
65
65
|
|
data/config/requirements.rb
CHANGED
data/lib/ec2onrails/recipes.rb
CHANGED
@@ -37,8 +37,6 @@ Capistrano::Configuration.instance.load do
|
|
37
37
|
cfg = ec2onrails_config
|
38
38
|
|
39
39
|
set :ec2onrails_version, Ec2onrails::VERSION::STRING
|
40
|
-
set :image_id_32_bit, Ec2onrails::VERSION::AMI_ID_32_BIT
|
41
|
-
set :image_id_64_bit, Ec2onrails::VERSION::AMI_ID_64_BIT
|
42
40
|
set :deploy_to, "/mnt/app"
|
43
41
|
set :use_sudo, false
|
44
42
|
set :user, "app"
|
@@ -64,8 +62,8 @@ Capistrano::Configuration.instance.load do
|
|
64
62
|
DESC
|
65
63
|
task :start, :roles => :app_admin do
|
66
64
|
run_init_script("mongrel", "start")
|
67
|
-
|
68
|
-
sudo "monit -g app monitor all"
|
65
|
+
# Give the service time to start before attempting to monitor it or monit will complain
|
66
|
+
sudo "sh -c 'sleep 75 && monit -g app monitor all'"
|
69
67
|
end
|
70
68
|
|
71
69
|
desc <<-DESC
|
@@ -93,8 +91,10 @@ Capistrano::Configuration.instance.load do
|
|
93
91
|
EC2 on Rails.
|
94
92
|
DESC
|
95
93
|
task :ami_ids do
|
96
|
-
puts "32-bit server image for EC2 on Rails #{ec2onrails_version}: #{
|
97
|
-
puts "64-bit server image for EC2 on Rails #{ec2onrails_version}: #{
|
94
|
+
puts "32-bit server image (US location) for EC2 on Rails #{ec2onrails_version}: #{Ec2onrails::VERSION::AMI_ID_32_BIT_US}"
|
95
|
+
puts "64-bit server image (US location) for EC2 on Rails #{ec2onrails_version}: #{Ec2onrails::VERSION::AMI_ID_64_BIT_US}"
|
96
|
+
puts "32-bit server image (EU location) for EC2 on Rails #{ec2onrails_version}: #{Ec2onrails::VERSION::AMI_ID_32_BIT_EU}"
|
97
|
+
puts "64-bit server image (EU location) for EC2 on Rails #{ec2onrails_version}: #{Ec2onrails::VERSION::AMI_ID_64_BIT_EU}"
|
98
98
|
end
|
99
99
|
|
100
100
|
desc <<-DESC
|
@@ -129,6 +129,7 @@ Capistrano::Configuration.instance.load do
|
|
129
129
|
Prepare a newly-started instance for a cold deploy.
|
130
130
|
DESC
|
131
131
|
task :setup, :roles => all_admin_role_names do
|
132
|
+
server.update_hostname
|
132
133
|
server.set_admin_mail_forward_address
|
133
134
|
server.set_timezone
|
134
135
|
server.install_packages
|
@@ -307,6 +308,16 @@ Capistrano::Configuration.instance.load do
|
|
307
308
|
rails_env = fetch(:rails_env, "production")
|
308
309
|
sudo "/usr/local/ec2onrails/bin/set_rails_env #{rails_env}"
|
309
310
|
end
|
311
|
+
|
312
|
+
desc <<-DESC
|
313
|
+
Tell the server that an elastic IP has been assigned so it can
|
314
|
+
reconfigure the things that depend on knowing it's hostname.
|
315
|
+
(It checks every 15 minutes anyway so this is not strictly
|
316
|
+
necessary.)
|
317
|
+
DESC
|
318
|
+
task :update_hostname, :roles => all_admin_role_names do
|
319
|
+
sudo "/usr/local/ec2onrails/bin/update_hostname"
|
320
|
+
end
|
310
321
|
|
311
322
|
desc <<-DESC
|
312
323
|
Upgrade to the newest versions of all Ubuntu packages.
|
@@ -321,18 +332,7 @@ Capistrano::Configuration.instance.load do
|
|
321
332
|
DESC
|
322
333
|
task :upgrade_gems, :roles => all_admin_role_names do
|
323
334
|
sudo "gem update --system --no-rdoc --no-ri"
|
324
|
-
sudo "gem update --no-rdoc --no-ri"
|
325
|
-
ch[:data] ||= ""
|
326
|
-
ch[:data] << data
|
327
|
-
if data =~ />\s*$/
|
328
|
-
puts data
|
329
|
-
choice = Capistrano::CLI.ui.ask("The gem command is asking for a number:")
|
330
|
-
ch.send_data("#{choice}\n")
|
331
|
-
else
|
332
|
-
puts data
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
335
|
+
sudo "gem update --no-rdoc --no-ri"
|
336
336
|
end
|
337
337
|
|
338
338
|
desc <<-DESC
|
@@ -345,6 +345,7 @@ Capistrano::Configuration.instance.load do
|
|
345
345
|
DESC
|
346
346
|
task :install_packages, :roles => all_admin_role_names do
|
347
347
|
if cfg[:packages] && cfg[:packages].any?
|
348
|
+
sudo "aptitude -q update"
|
348
349
|
run "export DEBIAN_FRONTEND=noninteractive; sudo aptitude -q -y install #{cfg[:packages].join(' ')}"
|
349
350
|
end
|
350
351
|
end
|
@@ -355,18 +356,8 @@ Capistrano::Configuration.instance.load do
|
|
355
356
|
DESC
|
356
357
|
task :install_gems, :roles => all_admin_role_names do
|
357
358
|
if cfg[:rubygems]
|
358
|
-
cfg[:rubygems].each do |
|
359
|
-
sudo "gem install #{
|
360
|
-
ch[:data] ||= ""
|
361
|
-
ch[:data] << data
|
362
|
-
if data =~ />\s*$/
|
363
|
-
puts data
|
364
|
-
choice = Capistrano::CLI.ui.ask("The gem command is asking for a number:")
|
365
|
-
ch.send_data("#{choice}\n")
|
366
|
-
else
|
367
|
-
puts data
|
368
|
-
end
|
369
|
-
end
|
359
|
+
cfg[:rubygems].each do |g|
|
360
|
+
sudo "gem install #{g} --no-rdoc --no-ri"
|
370
361
|
end
|
371
362
|
end
|
372
363
|
end
|
@@ -445,9 +436,10 @@ Capistrano::Configuration.instance.load do
|
|
445
436
|
end
|
446
437
|
|
447
438
|
desc <<-DESC
|
448
|
-
Enable ssl for the web server.
|
449
|
-
/etc/ssl/certs/default.pem
|
450
|
-
/etc/ssl/private/default.key
|
439
|
+
Enable ssl for the web server. You'll need to deploy a valid
|
440
|
+
SSL certificate file to /etc/ssl/certs/default.pem
|
441
|
+
and a valid SSL key file to /etc/ssl/private/default.key
|
442
|
+
(use the deploy_files task).
|
451
443
|
DESC
|
452
444
|
task :enable_ssl, :roles => :web_admin do
|
453
445
|
sudo "a2enmod ssl"
|
data/lib/ec2onrails/version.rb
CHANGED
@@ -21,11 +21,13 @@ module Ec2onrails #:nodoc:
|
|
21
21
|
MAJOR = 0
|
22
22
|
MINOR = 9
|
23
23
|
TINY = 9
|
24
|
-
|
25
|
-
|
26
|
-
STRING = [MAJOR, MINOR, TINY].join('.')
|
24
|
+
BUGFIX = 1
|
25
|
+
STRING = [MAJOR, MINOR, TINY, BUGFIX].join('.')
|
27
26
|
|
28
|
-
|
29
|
-
|
27
|
+
AMI_ID_32_BIT_US = 'ami-5394733a'
|
28
|
+
AMI_ID_64_BIT_US = 'ami-5594733c'
|
29
|
+
|
30
|
+
AMI_ID_32_BIT_EU = 'ami-761c3402'
|
31
|
+
AMI_ID_64_BIT_EU = 'ami-701c3404'
|
30
32
|
end
|
31
33
|
end
|
data/website/index.html
CHANGED
@@ -33,301 +33,125 @@
|
|
33
33
|
<h1>EC2 on Rails</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/ec2onrails"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/ec2onrails" class="numbers">0.9.9</a>
|
36
|
+
<a href="http://rubyforge.org/projects/ec2onrails" class="numbers">0.9.9.1</a>
|
37
37
|
</div>
|
38
|
-
<h2>Deploy a Ruby on Rails app on
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
<
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
<p>If you have an <span class="caps">EC2</span> account and can start <span class="caps">EC2</span> instances you’re five minutes away from deploying
|
48
|
-
your Rails app.</p>
|
49
|
-
|
50
|
-
|
51
|
-
<p><span class="caps">EC2</span> on Rails is <a href="http://gettingreal.37signals.com/ch04_Make_Opinionated_Software.php">opinionated software</a>:
|
52
|
-
the opinion is that for many rails apps the server setup can be generalized
|
53
|
-
and shared the same way as the web application framework itself. For many people (Twitter, this isn’t for you)
|
54
|
-
the server image can be treated the same way as other shared libraries. And if the day comes when your needs are
|
55
|
-
unique enough that <span class="caps">EC2</span> on Rails can’t be configured to work for you then you can bundle your own image from it
|
56
|
-
or fork the build source and customize it.</p>
|
57
|
-
|
58
|
-
|
59
|
-
<p>But until then, why spend your time configuring servers?</p>
|
60
|
-
|
61
|
-
|
62
|
-
<p>Features of the <span class="caps">EC2</span> image:</p>
|
63
|
-
|
64
|
-
|
65
|
-
<ul>
|
38
|
+
<h2>Deploy a Ruby on Rails app on EC2 in five minutes</h2>
|
39
|
+
<p>EC2 on Rails is an Ubuntu Linux server image for <a href="http://www.amazon.com/b/ref=sc_fe_l_2/102-6342260-7987311?ie=UTF8&node=201590011&no=3435361">Amazon’s EC2 hosting service</a> that’s ready to run a standard Ruby on Rails application with little or no customization. It’s a Ruby on Rails <a href="http://en.wikipedia.org/wiki/Virtual_appliance">virtual appliance</a>.</p>
|
40
|
+
<p>If you have an EC2 account and can start EC2 instances you’re five minutes away from deploying your Rails app.</p>
|
41
|
+
<p>EC2 on Rails is <a href="http://gettingreal.37signals.com/ch04_Make_Opinionated_Software.php">opinionated software</a>: the opinion is that for many rails apps the server setup can be generalized and shared the same way as the web application framework itself. For many people (Twitter, this isn’t for you) the server image can be treated the same way as other shared libraries. And if the day comes when your needs are unique enough that EC2 on Rails can’t be configured to work for you then you can bundle your own image from it or fork the build source and customize it.</p>
|
42
|
+
<p>But until then, why spend your time configuring servers?</p>
|
43
|
+
<p>Features of the EC2 image:</p>
|
44
|
+
<ul>
|
66
45
|
<li>Ready to deploy a Rails app with little or no configuration of the server required</li>
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
<
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
<p><em>I will keep these images for as long as possible, they will not be deleted for at least a few years.</em></p>
|
103
|
-
|
104
|
-
|
105
|
-
<h4>1. Install the gem</h4>
|
106
|
-
|
107
|
-
|
46
|
+
<li>Automatic backup of MySQL database to S3 (full backup nightly + incremental backup using binary logs every 5 minutes)</li>
|
47
|
+
<li>Capistrano tasks to customize the server image, archive and restore the database to/from S3, and more (available as a rubygem)</li>
|
48
|
+
<li>Mongrel_cluster behind Apache 2.2, configured according to <a href="http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/">Coda Hale’s excellent guide</a></li>
|
49
|
+
<li>Ruby on Rails 2.1.0, 2.0.2 and 1.2.6</li>
|
50
|
+
<li>Ruby 1.8.6</li>
|
51
|
+
<li>MySQL 5</li>
|
52
|
+
<li><a href="http://www.danga.com/memcached/">memcached</a></li>
|
53
|
+
<li><a href="http://www.tildeslash.com/monit/">monit</a> configured to monitor apache, mongrel, mysql, memcached, drive space and system load</li>
|
54
|
+
<li>Ubuntu 8.04 <span class="caps">LTS</span> “Hardy” base image built using <a href="http://alestic.com/">Eric Hammond’s EC2 Ubuntu script</a></li>
|
55
|
+
<li><span class="caps">SSL</span> support</li>
|
56
|
+
<li>Amazon <span class="caps">AMI</span> tools installed</li>
|
57
|
+
<li>MySQL, Apache, and syslog configured to use /mnt for data and logging so you don’t fill up EC2’s small root filesystem</li>
|
58
|
+
<li>Automatically archives Rails and Apache logs to S3 nightly.</li>
|
59
|
+
<li>32-bit and 64-bit images available (supports all instance types, small to extra large).</li>
|
60
|
+
<li>Created using a build file, full source is <a href="http://github.com/pauldowman/ec2onrails/tree/master">available</a> (the EC2 on Rails script is run from <a href="http://alestic.com/">Eric Hammond’s EC2 Ubuntu script</a>)</li>
|
61
|
+
<li>Can be used as a clustered Rails app running on multiple instances</li>
|
62
|
+
<li>Automatically runs hourly, daily, weekly and monthly scripts if they exist in Rails application’s script directory</li>
|
63
|
+
<li>Local <a href="http://www.postfix.org/">Postfix</a> <span class="caps">SMTP</span> mail server (only available from within the instance, not listening on external network interfaces)</li>
|
64
|
+
</ul>
|
65
|
+
<h2>Using the image</h2>
|
66
|
+
<p>This documentation will be improved soon, for now hopefully this covers the basics.</p>
|
67
|
+
<p>The current <span class="caps">AMI</span> id’s in the U.S. region are:</p>
|
68
|
+
<ul>
|
69
|
+
<li>ami-5394733a (32-bit)</li>
|
70
|
+
<li>ami-5594733c (64-bit)</li>
|
71
|
+
</ul>
|
72
|
+
<p>The current <span class="caps">AMI</span> id’s in the E.U. region are:</p>
|
73
|
+
<ul>
|
74
|
+
<li>ami-761c3402 (32-bit)</li>
|
75
|
+
<li>ami-701c3404 (64-bit)</li>
|
76
|
+
</ul>
|
77
|
+
<p><em>I will keep these images available for as long as possible, they will not be deleted for at least a few years.</em></p>
|
78
|
+
<h4>1. Install the gem</h4>
|
108
79
|
<pre>sudo gem install ec2onrails</pre>
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
<a href="http://
|
116
|
-
|
117
|
-
<
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
to the instance defined in your Capistrano “db” role.</p>
|
126
|
-
|
127
|
-
|
128
|
-
<h4>4. Start up one or more instances of the image.</h4>
|
129
|
-
|
130
|
-
|
131
|
-
<p>There is nothing <span class="caps">EC2</span> on Rails-specific here yet (though soon there will be a Capistrano task to do this for you),
|
132
|
-
if you’ve started <span class="caps">EC2</span> instances before you can skip this section. Otherwise, I’m not going to lie, this part is complicated
|
133
|
-
and will take a lot more than 5 minutes the first time.</p>
|
134
|
-
|
135
|
-
|
136
|
-
<p>Read the
|
137
|
-
<a href="http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html">running an instance section</a>
|
138
|
-
in Amazon’s getting started guide.</p>
|
139
|
-
|
140
|
-
|
141
|
-
<p>For the <span class="caps">AMI</span> id’s of the current images do <code>cap ec2onrails:ami_ids</code> from within the app that you
|
142
|
-
configured in the previous step (they’re also listed earlier on this page).</p>
|
143
|
-
|
144
|
-
|
145
|
-
<p><em><span class="caps">NOTE</span>: Only use the images that match the current version of the gem.</em></p>
|
146
|
-
|
147
|
-
|
148
|
-
<p>Please see the <a href="http://ec2onrails.rubyforge.org/svn/trunk/gem/History.txt">change log</a> for release notes, and
|
149
|
-
see the <a href="http://rubyforge.org/tracker/?atid=17558&group_id=4552&func=browse">list of open issues</a>.</p>
|
150
|
-
|
151
|
-
|
152
|
-
<p>As is <a href="http://docs.amazonwebservices.com/AWSEC2/2007-08-29/DeveloperGuide/public-ami-guidelines.html">standard for public <span class="caps">AMI</span>’s</a>,
|
153
|
-
password-based logins are disabled. You log in with your own
|
154
|
-
<a href="http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html">public/private keypair</a>.</p>
|
155
|
-
|
156
|
-
|
157
|
-
<p>Most basic things can be configured automatically by the Capistrano tasks, but if you want to
|
158
|
-
you can login by ssh as a user named “admin” (has sudo ability) or as “app” (the user
|
159
|
-
that the app runs as, does not have sudo ability). The Capistrano tasks automatically
|
160
|
-
use the app user to deploy the app, and the admin user for server admin tasks
|
161
|
-
that require sudo.</p>
|
162
|
-
|
163
|
-
|
164
|
-
<p><span class="caps">IMPORTANT</span>: Double-check <a href="http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html">your firewall settings</a>.
|
165
|
-
Be sure that you haven’t allowed public access to any ports other than <span class="caps">TCP 22</span> and <span class="caps">TCP 80</span>
|
166
|
-
(and possibly <span class="caps">TCP 443</span> if you’re going to enable <span class="caps">HTTPS</span>).
|
167
|
-
If you’re using multiple instances, be sure to allow them network access to each other.</p>
|
168
|
-
|
169
|
-
|
170
|
-
<h4>5. Copy your public key from the server to keep Capistrano happy</h4>
|
171
|
-
|
172
|
-
|
173
|
-
<p>This is a workaround for a quirk in Capistrano. Technically all you should need to connect to the server is the private
|
174
|
-
key file, the public key is on the server. But for some reason
|
175
|
-
<a href="http://groups.google.com/group/capistrano/browse_thread/thread/1102208ff925d18">Capistrano requires that you have both the public key and the private key files together on the client</a>.</p>
|
176
|
-
|
177
|
-
|
178
|
-
<p>There is a Capistrano task that tries to fix this for you. From within the root of your rails app do:</p>
|
179
|
-
|
180
|
-
|
80
|
+
<h4>2. Add the config files to your Rails app</h4>
|
81
|
+
<p>Put <a href="http://github.com/pauldowman/ec2onrails/raw/0.9.9.1/documentation/examples/Capfile">Capfile</a> in the root of your rails folder, and put <a href="http://github.com/pauldowman/ec2onrails/raw/0.9.9.1/documentation/examples/deploy.rb">deploy.rb</a> and <a href="http://github.com/pauldowman/ec2onrails/raw/0.9.9.1/documentation/examples/s3.yml">s3.yml</a> in the config folder.</p>
|
82
|
+
<p><em>Be sure to customize those files and read the comments.</em></p>
|
83
|
+
<p>Also, use the hostname “db_primary” in your database.yml file. After running “cap ec2onrails:server:set_roles” it will resolve to the instance defined in your Capistrano “db” role.</p>
|
84
|
+
<h4>4. Start up one or more instances of the image.</h4>
|
85
|
+
<p>There is nothing EC2 on Rails-specific here yet (though soon there will be a Capistrano task to do this for you), if you’ve started EC2 instances before you can skip this section. Otherwise, I’m not going to lie, this part is complicated and will take a lot more than 5 minutes the first time.</p>
|
86
|
+
<p>Read the <a href="http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html">running an instance section</a> in Amazon’s getting started guide.</p>
|
87
|
+
<p>For the <span class="caps">AMI</span> id’s of the current images do <code>cap ec2onrails:ami_ids</code> from within the app that you configured in the previous step (they’re also listed earlier on this page).</p>
|
88
|
+
<p><em><span class="caps">NOTE</span>: Only use the images that match the current version of the gem.</em></p>
|
89
|
+
<p>Please see the <a href="http://github.com/pauldowman/ec2onrails/tree/0.9.9.1/gem/History.txt">change log</a> for release notes, and see the <a href="http://rubyforge.org/tracker/?atid=17558&group_id=4552&func=browse">list of open issues</a>.</p>
|
90
|
+
<p>As is <a href="http://docs.amazonwebservices.com/AWSEC2/2007-08-29/DeveloperGuide/public-ami-guidelines.html">standard for public AMI’s</a>, password-based logins are disabled. You log in with your own <a href="http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html">public/private keypair</a>.</p>
|
91
|
+
<p>Most basic things can be configured automatically by the Capistrano tasks, but if you want to you can login by ssh as a user named “admin” (has sudo ability) or as “app” (the user that the app runs as, does not have sudo ability). The Capistrano tasks automatically use the app user to deploy the app, and the admin user for server admin tasks that require sudo.</p>
|
92
|
+
<p><span class="caps">IMPORTANT</span>: Double-check <a href="http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html">your firewall settings</a>. Be sure that you haven’t allowed public access to any ports other than <span class="caps">TCP</span> 22 and <span class="caps">TCP</span> 80 (and possibly <span class="caps">TCP</span> 443 if you’re going to enable <span class="caps">HTTPS</span>). If you’re using multiple instances, be sure to allow them network access to each other.</p>
|
93
|
+
<h4>5. Copy your public key from the server to keep Capistrano happy</h4>
|
94
|
+
<p>This is a workaround for a quirk in Capistrano. Technically all you should need to connect to the server is the private key file, the public key is on the server. But for some reason <a href="http://groups.google.com/group/capistrano/browse_thread/thread/1102208ff925d18">Capistrano requires that you have both the public key and the private key files together on the client</a>.</p>
|
95
|
+
<p>There is a Capistrano task that tries to fix this for you. From within the root of your rails app do:</p>
|
181
96
|
<pre>cap ec2onrails:get_public_key_from_server</pre>
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
<h4>6. Deploy the app with Capistrano</h4>
|
187
|
-
|
188
|
-
|
189
|
-
<p>Now that the gem is installed, your deploy.rb is configured and you can start and stop <span class="caps">EC2</span> instances,
|
190
|
-
this is the only thing you’ll need to do from now on.</p>
|
191
|
-
|
192
|
-
|
97
|
+
<p>Note, this will only work if you have an external ssh command in the path, it won’t work for most Windows users.</p>
|
98
|
+
<h4>6. Deploy the app with Capistrano</h4>
|
99
|
+
<p>Now that the gem is installed, your deploy.rb is configured and you can start and stop EC2 instances, this is the only thing you’ll need to do from now on.</p>
|
193
100
|
<pre>
|
194
101
|
cap ec2onrails:setup
|
195
102
|
cap deploy:cold
|
196
103
|
</pre>
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
<h2>Capistrano tasks</h2>
|
207
|
-
|
208
|
-
|
209
|
-
<p><a href="http://capify.org">Capistrano</a> is the most commonly used Rails deployment tool. It comes with many standard “tasks”,
|
210
|
-
and the <span class="caps">EC2</span> on Rails gem includes Capistrano tasks specifically for configuring the server instance.</p>
|
211
|
-
|
212
|
-
|
213
|
-
<p>Capistrano is run from the command-line using the “cap” command, with a task name given as an argument.</p>
|
214
|
-
|
215
|
-
|
216
|
-
<h3>Commonly-used tasks</h3>
|
217
|
-
|
218
|
-
|
219
|
-
<p>You’ll mostly need just the following Capistrano tasks:</p>
|
220
|
-
|
221
|
-
|
222
|
-
<ul>
|
223
|
-
<li><code>cap ec2onrails:ami_ids</code>
|
104
|
+
<p>Yes, it’s that easy! The setup task will set the server’s timezone, install any gems and Ubuntu packages that you specified in the config file, and create your database.</p>
|
105
|
+
<p>That’s it, your app is now running on EC2!!</p>
|
106
|
+
<h2>Capistrano tasks</h2>
|
107
|
+
<p><a href="http://capify.org">Capistrano</a> is the most commonly used Rails deployment tool. It comes with many standard “tasks”, and the EC2 on Rails gem includes Capistrano tasks specifically for configuring the server instance.</p>
|
108
|
+
<p>Capistrano is run from the command-line using the “cap” command, with a task name given as an argument.</p>
|
109
|
+
<h3>Commonly-used tasks</h3>
|
110
|
+
<p>In addition to the <code>cap ec2onrails:setup</code> task, you’ll mostly need just the following Capistrano tasks:</p>
|
111
|
+
<ul>
|
112
|
+
<li><code>cap ec2onrails:ami_ids</code><br />
|
224
113
|
Shows the <span class="caps">AMI</span> id’s of the images that match the current version of the gem.</li>
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
<li><code>cap ec2onrails:
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
Restore the MySQL database from the bucket specified in your deploy.rb
|
265
|
-
For example, I use this to restore the current production data (from my actual production backup
|
266
|
-
bucket) onto a staging server that has the current production version of my
|
267
|
-
app. I then deploy the new version which tests migrations exactly as they’ll
|
268
|
-
run on the production server.</li>
|
269
|
-
</ul>
|
270
|
-
|
271
|
-
|
272
|
-
<p>To get a full list of the Capistrano tasks at any time type <code>cap -T</code> from with your rails app root.</p>
|
273
|
-
|
274
|
-
|
275
|
-
<h2>Building the image</h2>
|
276
|
-
|
277
|
-
|
278
|
-
<p>Building the image is not required, most people will simply use the prebuilt public
|
279
|
-
image, but there is also a build script that builds the image. It’s meant to be called by
|
280
|
-
<a href="http://alestic.com/">Eric Hammond’s <span class="caps">EC2</span> Ubuntu script</a>.</p>
|
281
|
-
|
282
|
-
|
283
|
-
<h2>Mailing lists</h2>
|
284
|
-
|
285
|
-
|
286
|
-
<p>There are two Google groups, one for
|
287
|
-
<a href="http://groups.google.com/group/ec2-on-rails-announce">announcements</a>
|
288
|
-
(usually just new release announcements) and one for
|
289
|
-
<a href="http://groups.google.com/group/ec2-on-rails-discuss">discussion</a>.</p>
|
290
|
-
|
291
|
-
|
292
|
-
<h2>Comments</h2>
|
293
|
-
|
294
|
-
|
295
|
-
<p>Comments are welcome. Send an email to <a href="http://pauldowman.com/contact/">Paul Dowman</a>
|
296
|
-
or to the <a href="http://groups.google.com/group/ec2-on-rails-discuss">Google group</a>.
|
297
|
-
If you find bugs please file them
|
298
|
-
<a href="http://rubyforge.org/tracker/?atid=17558&group_id=4552&func=browse">here</a>
|
299
|
-
or send me an <a href="http://pauldowman.com/contact/">email</a>.</p>
|
300
|
-
|
301
|
-
|
302
|
-
<h2>Change log</h2>
|
303
|
-
|
304
|
-
|
305
|
-
<p>See the <a href="http://ec2onrails.rubyforge.org/svn/trunk/gem/History.txt">change log</a>.</p>
|
306
|
-
|
307
|
-
|
308
|
-
<h2>How to submit patches</h2>
|
309
|
-
|
310
|
-
|
311
|
-
Pleae read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a>.
|
312
|
-
The source code can be checked out anonymously using:
|
313
|
-
<pre>
|
314
|
-
svn checkout http://ec2onrails.rubyforge.org/svn/trunk ec2onrails
|
315
|
-
</pre>
|
316
|
-
|
317
|
-
<p>Patches can be submitted to the <a href="http://rubyforge.org/tracker/?atid=17560&group_id=4552&func=browse">RubyForge Tracker</a>
|
318
|
-
or <a href="http://pauldowman.com/contact/">emailed directly to me</a> .</p>
|
319
|
-
|
320
|
-
|
321
|
-
<h2>License</h2>
|
322
|
-
|
323
|
-
|
324
|
-
<p>This code is free to use under the terms of the <span class="caps">GPL</span> v2.</p>
|
325
|
-
|
326
|
-
|
327
|
-
<p>If you find <span class="caps">EC2</span> on Rails useful please <a href="http://www.workingwithrails.com/person/10131-paul-dowman">recommend Paul Dowman</a>
|
328
|
-
at Working With Rails.</p>
|
114
|
+
</ul>
|
115
|
+
<ul>
|
116
|
+
<li><code>cap ec2onrails:setup</code><br />
|
117
|
+
This task configures a newly-launched instance. This is the first thing you should do after starting a new instance. It can be run more than once without ill effect. After running “cap ec2onrails:setup” the next thing to do is run “cap deploy:cold”</li>
|
118
|
+
</ul>
|
119
|
+
<ul>
|
120
|
+
<li><code>cap ec2onrails:server:set_roles</code><br />
|
121
|
+
Customizes each instance for it’s role(s) (as defined in your Capistrano deploy.rb file). Run this after starting or stopping instances. For now this just makes sure that only the appropriate services (Apache, Mongrel, and/or MySQL) are running. Eventually this will customize settings for the running services also. Note that an instance can have more than one role. If there’s only one instance it will have all roles.</li>
|
122
|
+
</ul>
|
123
|
+
<p>Note that due to the way that Capistrano works all tasks are run against all hosts that are currently defined in the deploy.rb file. So if you start a new instance then add it to your deploy.rb you will need to run “cap ec2onrails:setup” again which will be run on all existing instances.</p>
|
124
|
+
<h3>Database management tasks</h3>
|
125
|
+
<ul>
|
126
|
+
<li><code>cap ec2onrails:db:archive</code><br />
|
127
|
+
Archive the MySQL database to the bucket specified in your deploy.rb. This is for archiving a snapshot of your database into any S3 bucket. For example, you might want to do this before deploying.</li>
|
128
|
+
</ul>
|
129
|
+
<ul>
|
130
|
+
<li><code>cap ec2onrails:db:restore</code><br />
|
131
|
+
Restore the MySQL database from the bucket specified in your deploy.rb. For example, I use this to restore the current production data (from my actual production backup bucket) onto a staging server that has the current production version of my app. I then deploy the new version which tests migrations exactly as they’ll run on the production server.</li>
|
132
|
+
</ul>
|
133
|
+
<p>To get a full list of the Capistrano tasks at any time type <code>cap -T</code> from with your rails app root.</p>
|
134
|
+
<h2>Building the image</h2>
|
135
|
+
<p>Building the image is not required, most people will simply use the prebuilt public image, but there is also a build script that builds the image. It’s meant to be called by <a href="http://alestic.com/">Eric Hammond’s EC2 Ubuntu script</a>.</p>
|
136
|
+
<h2>Mailing lists</h2>
|
137
|
+
<p>There are two Google groups, one for <a href="http://groups.google.com/group/ec2-on-rails-announce">announcements</a> (usually just new release announcements) and one for <a href="http://groups.google.com/group/ec2-on-rails-discuss">discussion</a>.</p>
|
138
|
+
<h2>Comments</h2>
|
139
|
+
<p>Comments are welcome. Send an email to <a href="http://pauldowman.com/contact/">Paul Dowman</a> or to the <a href="http://groups.google.com/group/ec2-on-rails-discuss">Google group</a>.</p>
|
140
|
+
<p>If you find bugs please file them <a href="http://rubyforge.org/tracker/?atid=17558&group_id=4552&func=browse">here</a> or send me an <a href="http://pauldowman.com/contact/">email</a>.</p>
|
141
|
+
<h2>Change log</h2>
|
142
|
+
<p>See the <a href="http://github.com/pauldowman/ec2onrails/blob/0.9.9.1/gem/History.txt">change log</a>.</p>
|
143
|
+
<h2>How to submit patches</h2>
|
144
|
+
<p>Pleae read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a>.</p>
|
145
|
+
<p>The source code can be checked out anonymously using: <br />
|
146
|
+
<pre><br />
|
147
|
+
git clone git://github.com/pauldowman/ec2onrails.git<br />
|
148
|
+
</pre></p>
|
149
|
+
<p>Send me a <a href="http://github.com/pauldowman/ec2onrails/tree">pull request on Github</a>, submit a patch to the <a href="http://rubyforge.org/tracker/?atid=17560&group_id=4552&func=browse">RubyForge Tracker</a> or <a href="http://pauldowman.com/contact/">email me directly</a>.</p>
|
150
|
+
<h2>License</h2>
|
151
|
+
<p>This code is free to use under the terms of the <span class="caps">GPL</span> v2.</p>
|
152
|
+
<p>If you find EC2 on Rails useful please <a href="http://www.workingwithrails.com/person/10131-paul-dowman">recommend Paul Dowman</a> at Working With Rails.</p>
|
329
153
|
<p class="coda">
|
330
|
-
<a href="http://pauldowman.com/contact/">Paul Dowman</a>,
|
154
|
+
<a href="http://pauldowman.com/contact/">Paul Dowman</a>, 27th January 2009<br>
|
331
155
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
332
156
|
</p>
|
333
157
|
</div>
|
data/website/index.txt
CHANGED
@@ -1,22 +1,12 @@
|
|
1
1
|
h1. EC2 on Rails
|
2
2
|
|
3
|
-
|
4
3
|
h2. Deploy a Ruby on Rails app on EC2 in five minutes
|
5
4
|
|
6
|
-
EC2 on Rails is an Ubuntu Linux server image for
|
7
|
-
"Amazon's EC2 hosting service":http://www.amazon.com/b/ref=sc_fe_l_2/102-6342260-7987311?ie=UTF8&node=201590011&no=3435361
|
8
|
-
that's ready to run a standard Ruby on Rails application with little or no customization.
|
9
|
-
It's a Ruby on Rails "virtual appliance":http://en.wikipedia.org/wiki/Virtual_appliance.
|
5
|
+
EC2 on Rails is an Ubuntu Linux server image for "Amazon's EC2 hosting service":http://www.amazon.com/b/ref=sc_fe_l_2/102-6342260-7987311?ie=UTF8&node=201590011&no=3435361 that's ready to run a standard Ruby on Rails application with little or no customization. It's a Ruby on Rails "virtual appliance":http://en.wikipedia.org/wiki/Virtual_appliance.
|
10
6
|
|
11
|
-
If you have an EC2 account and can start EC2 instances you're five minutes away from deploying
|
12
|
-
your Rails app.
|
7
|
+
If you have an EC2 account and can start EC2 instances you're five minutes away from deploying your Rails app.
|
13
8
|
|
14
|
-
EC2 on Rails is "opinionated software":http://gettingreal.37signals.com/ch04_Make_Opinionated_Software.php:
|
15
|
-
the opinion is that for many rails apps the server setup can be generalized
|
16
|
-
and shared the same way as the web application framework itself. For many people (Twitter, this isn't for you)
|
17
|
-
the server image can be treated the same way as other shared libraries. And if the day comes when your needs are
|
18
|
-
unique enough that EC2 on Rails can't be configured to work for you then you can bundle your own image from it
|
19
|
-
or fork the build source and customize it.
|
9
|
+
EC2 on Rails is "opinionated software":http://gettingreal.37signals.com/ch04_Make_Opinionated_Software.php: the opinion is that for many rails apps the server setup can be generalized and shared the same way as the web application framework itself. For many people (Twitter, this isn't for you) the server image can be treated the same way as other shared libraries. And if the day comes when your needs are unique enough that EC2 on Rails can't be configured to work for you then you can bundle your own image from it or fork the build source and customize it.
|
20
10
|
|
21
11
|
But until then, why spend your time configuring servers?
|
22
12
|
|
@@ -25,8 +15,7 @@ Features of the EC2 image:
|
|
25
15
|
* Ready to deploy a Rails app with little or no configuration of the server required
|
26
16
|
* Automatic backup of MySQL database to S3 (full backup nightly + incremental backup using binary logs every 5 minutes)
|
27
17
|
* Capistrano tasks to customize the server image, archive and restore the database to/from S3, and more (available as a rubygem)
|
28
|
-
* Mongrel_cluster behind Apache 2.2, configured according to
|
29
|
-
"Coda Hale's excellent guide":http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/
|
18
|
+
* Mongrel_cluster behind Apache 2.2, configured according to "Coda Hale's excellent guide":http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/
|
30
19
|
* Ruby on Rails 2.1.0, 2.0.2 and 1.2.6
|
31
20
|
* Ruby 1.8.6
|
32
21
|
* MySQL 5
|
@@ -38,7 +27,7 @@ Features of the EC2 image:
|
|
38
27
|
* MySQL, Apache, and syslog configured to use /mnt for data and logging so you don't fill up EC2's small root filesystem
|
39
28
|
* Automatically archives Rails and Apache logs to S3 nightly.
|
40
29
|
* 32-bit and 64-bit images available (supports all instance types, small to extra large).
|
41
|
-
* Created using a build file, full source is "available":http://
|
30
|
+
* Created using a build file, full source is "available":http://github.com/pauldowman/ec2onrails/tree/master (the EC2 on Rails script is run from "Eric Hammond's EC2 Ubuntu script":http://alestic.com/)
|
42
31
|
* Can be used as a clustered Rails app running on multiple instances
|
43
32
|
* Automatically runs hourly, daily, weekly and monthly scripts if they exist in Rails application's script directory
|
44
33
|
* Local "Postfix":http://www.postfix.org/ SMTP mail server (only available from within the instance, not listening on external network interfaces)
|
@@ -48,11 +37,15 @@ h2. Using the image
|
|
48
37
|
|
49
38
|
This documentation will be improved soon, for now hopefully this covers the basics.
|
50
39
|
|
51
|
-
The current AMI id's are:
|
52
|
-
* ami-
|
53
|
-
* ami-
|
40
|
+
The current AMI id's in the U.S. region are:
|
41
|
+
* ami-5394733a (32-bit)
|
42
|
+
* ami-5594733c (64-bit)
|
43
|
+
|
44
|
+
The current AMI id's in the E.U. region are:
|
45
|
+
* ami-761c3402 (32-bit)
|
46
|
+
* ami-701c3404 (64-bit)
|
54
47
|
|
55
|
-
_I will keep these images for as long as possible, they will not be deleted for at least a few years._
|
48
|
+
_I will keep these images available for as long as possible, they will not be deleted for at least a few years._
|
56
49
|
|
57
50
|
|
58
51
|
h4. 1. Install the gem
|
@@ -61,57 +54,34 @@ h4. 1. Install the gem
|
|
61
54
|
|
62
55
|
h4. 2. Add the config files to your Rails app
|
63
56
|
|
64
|
-
Put "Capfile":http://ec2onrails.
|
65
|
-
in the root of your rails folder, and put
|
66
|
-
"deploy.rb":http://ec2onrails.rubyforge.org/svn/trunk/documentation/examples/deploy.rb
|
67
|
-
and
|
68
|
-
"s3.yml":http://ec2onrails.rubyforge.org/svn/trunk/documentation/examples/s3.yml
|
69
|
-
in the config folder.
|
57
|
+
Put "Capfile":http://github.com/pauldowman/ec2onrails/raw/0.9.9.1/documentation/examples/Capfile in the root of your rails folder, and put "deploy.rb":http://github.com/pauldowman/ec2onrails/raw/0.9.9.1/documentation/examples/deploy.rb and "s3.yml":http://github.com/pauldowman/ec2onrails/raw/0.9.9.1/documentation/examples/s3.yml in the config folder.
|
70
58
|
|
71
59
|
_Be sure to customize those files and read the comments._
|
72
60
|
|
73
|
-
Also, use the hostname "db_primary" in your database.yml file. After running "cap ec2onrails:server:set_roles" it will resolve
|
74
|
-
to the instance defined in your Capistrano "db" role.
|
61
|
+
Also, use the hostname "db_primary" in your database.yml file. After running "cap ec2onrails:server:set_roles" it will resolve to the instance defined in your Capistrano "db" role.
|
75
62
|
|
76
63
|
h4. 4. Start up one or more instances of the image.
|
77
64
|
|
78
|
-
There is nothing EC2 on Rails-specific here yet (though soon there will be a Capistrano task to do this for you),
|
79
|
-
if you've started EC2 instances before you can skip this section. Otherwise, I'm not going to lie, this part is complicated
|
80
|
-
and will take a lot more than 5 minutes the first time.
|
65
|
+
There is nothing EC2 on Rails-specific here yet (though soon there will be a Capistrano task to do this for you), if you've started EC2 instances before you can skip this section. Otherwise, I'm not going to lie, this part is complicated and will take a lot more than 5 minutes the first time.
|
81
66
|
|
82
|
-
Read the
|
83
|
-
"running an instance section":http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html
|
84
|
-
in Amazon's getting started guide.
|
67
|
+
Read the "running an instance section":http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html in Amazon's getting started guide.
|
85
68
|
|
86
|
-
For the AMI id's of the current images do <code>cap ec2onrails:ami_ids</code> from within the app that you
|
87
|
-
configured in the previous step (they're also listed earlier on this page).
|
69
|
+
For the AMI id's of the current images do <code>cap ec2onrails:ami_ids</code> from within the app that you configured in the previous step (they're also listed earlier on this page).
|
88
70
|
|
89
71
|
_NOTE: Only use the images that match the current version of the gem._
|
90
72
|
|
91
|
-
Please see the "change log":http://ec2onrails.
|
92
|
-
see the "list of open issues":http://rubyforge.org/tracker/?atid=17558&group_id=4552&func=browse.
|
73
|
+
Please see the "change log":http://github.com/pauldowman/ec2onrails/tree/0.9.9.1/gem/History.txt for release notes, and see the "list of open issues":http://rubyforge.org/tracker/?atid=17558&group_id=4552&func=browse.
|
93
74
|
|
94
|
-
As is "standard for public AMI's":http://docs.amazonwebservices.com/AWSEC2/2007-08-29/DeveloperGuide/public-ami-guidelines.html,
|
95
|
-
password-based logins are disabled. You log in with your own
|
96
|
-
"public/private keypair":http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html.
|
75
|
+
As is "standard for public AMI's":http://docs.amazonwebservices.com/AWSEC2/2007-08-29/DeveloperGuide/public-ami-guidelines.html, password-based logins are disabled. You log in with your own "public/private keypair":http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html.
|
97
76
|
|
98
|
-
Most basic things can be configured automatically by the Capistrano tasks, but if you want to
|
99
|
-
you can login by ssh as a user named "admin" (has sudo ability) or as "app" (the user
|
100
|
-
that the app runs as, does not have sudo ability). The Capistrano tasks automatically
|
101
|
-
use the app user to deploy the app, and the admin user for server admin tasks
|
102
|
-
that require sudo.
|
77
|
+
Most basic things can be configured automatically by the Capistrano tasks, but if you want to you can login by ssh as a user named "admin" (has sudo ability) or as "app" (the user that the app runs as, does not have sudo ability). The Capistrano tasks automatically use the app user to deploy the app, and the admin user for server admin tasks that require sudo.
|
103
78
|
|
104
|
-
IMPORTANT: Double-check "your firewall settings":http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html.
|
105
|
-
Be sure that you haven't allowed public access to any ports other than TCP 22 and TCP 80
|
106
|
-
(and possibly TCP 443 if you're going to enable HTTPS).
|
107
|
-
If you're using multiple instances, be sure to allow them network access to each other.
|
79
|
+
IMPORTANT: Double-check "your firewall settings":http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html. Be sure that you haven't allowed public access to any ports other than TCP 22 and TCP 80 (and possibly TCP 443 if you're going to enable HTTPS). If you're using multiple instances, be sure to allow them network access to each other.
|
108
80
|
|
109
81
|
|
110
82
|
h4. 5. Copy your public key from the server to keep Capistrano happy
|
111
83
|
|
112
|
-
This is a workaround for a quirk in Capistrano. Technically all you should need to connect to the server is the private
|
113
|
-
key file, the public key is on the server. But for some reason
|
114
|
-
"Capistrano requires that you have both the public key and the private key files together on the client":http://groups.google.com/group/capistrano/browse_thread/thread/1102208ff925d18.
|
84
|
+
This is a workaround for a quirk in Capistrano. Technically all you should need to connect to the server is the private key file, the public key is on the server. But for some reason "Capistrano requires that you have both the public key and the private key files together on the client":http://groups.google.com/group/capistrano/browse_thread/thread/1102208ff925d18.
|
115
85
|
|
116
86
|
There is a Capistrano task that tries to fix this for you. From within the root of your rails app do:
|
117
87
|
|
@@ -122,111 +92,85 @@ Note, this will only work if you have an external ssh command in the path, it wo
|
|
122
92
|
|
123
93
|
h4. 6. Deploy the app with Capistrano
|
124
94
|
|
125
|
-
Now that the gem is installed, your deploy.rb is configured and you can start and stop EC2 instances,
|
126
|
-
this is the only thing you'll need to do from now on.
|
95
|
+
Now that the gem is installed, your deploy.rb is configured and you can start and stop EC2 instances, this is the only thing you'll need to do from now on.
|
127
96
|
|
128
97
|
<pre>
|
129
98
|
cap ec2onrails:setup
|
130
99
|
cap deploy:cold
|
131
100
|
</pre>
|
132
101
|
|
133
|
-
Yes, it's that easy! The setup task will set the server's timezone, install any
|
134
|
-
gems and Ubuntu packages that you specified in the config file, and
|
135
|
-
create your database.
|
102
|
+
Yes, it's that easy! The setup task will set the server's timezone, install any gems and Ubuntu packages that you specified in the config file, and create your database.
|
136
103
|
|
137
104
|
That's it, your app is now running on EC2!!
|
138
105
|
|
139
106
|
|
140
107
|
h2. Capistrano tasks
|
141
108
|
|
142
|
-
"Capistrano":http://capify.org is the most commonly used Rails deployment tool. It comes with many standard "tasks",
|
143
|
-
and the EC2 on Rails gem includes Capistrano tasks specifically for configuring the server instance.
|
109
|
+
"Capistrano":http://capify.org is the most commonly used Rails deployment tool. It comes with many standard "tasks", and the EC2 on Rails gem includes Capistrano tasks specifically for configuring the server instance.
|
144
110
|
|
145
111
|
Capistrano is run from the command-line using the "cap" command, with a task name given as an argument.
|
146
112
|
|
147
113
|
h3. Commonly-used tasks
|
148
114
|
|
149
|
-
|
115
|
+
In addition to the <code>cap ec2onrails:setup</code> task, you'll mostly need just the following Capistrano tasks:
|
150
116
|
|
151
117
|
* <code>cap ec2onrails:ami_ids</code>
|
152
118
|
Shows the AMI id's of the images that match the current version of the gem.
|
153
119
|
|
154
120
|
* <code>cap ec2onrails:setup</code>
|
155
|
-
This task configures a newly-launched instance. This is the first thing you should do after
|
156
|
-
starting a new instance. It can be run more than once without ill effect. After running
|
157
|
-
"cap ec2onrails:setup" the next thing to do is run "cap deploy:cold"
|
121
|
+
This task configures a newly-launched instance. This is the first thing you should do after starting a new instance. It can be run more than once without ill effect. After running "cap ec2onrails:setup" the next thing to do is run "cap deploy:cold"
|
158
122
|
|
159
123
|
* <code>cap ec2onrails:server:set_roles</code>
|
160
|
-
Customizes each instance for it's role(s) (as defined in your Capistrano deploy.rb file).
|
161
|
-
Run this after starting or stopping instances.
|
162
|
-
For now this just makes sure that only the appropriate services (Apache, Mongrel, and/or MySQL)
|
163
|
-
are running. Eventually this will customize settings for the running services also. Note that
|
164
|
-
an instance can have more than one role. If there's only one instance it will have all roles.
|
124
|
+
Customizes each instance for it's role(s) (as defined in your Capistrano deploy.rb file). Run this after starting or stopping instances. For now this just makes sure that only the appropriate services (Apache, Mongrel, and/or MySQL) are running. Eventually this will customize settings for the running services also. Note that an instance can have more than one role. If there's only one instance it will have all roles.
|
165
125
|
|
166
|
-
Note that due to the way that Capistrano works all tasks are run
|
167
|
-
against all hosts that are currently defined in the deploy.rb file.
|
168
|
-
So if you start a new instance then add it to your deploy.rb you will need to run
|
169
|
-
"cap ec2onrails:setup" again which will be run on all existing instances.
|
126
|
+
Note that due to the way that Capistrano works all tasks are run against all hosts that are currently defined in the deploy.rb file. So if you start a new instance then add it to your deploy.rb you will need to run "cap ec2onrails:setup" again which will be run on all existing instances.
|
170
127
|
|
171
128
|
|
172
129
|
h3. Database management tasks
|
173
130
|
|
174
131
|
* <code>cap ec2onrails:db:archive</code>
|
175
|
-
Archive the MySQL database to the bucket specified in your deploy.rb. This is for archiving a snapshot of your
|
176
|
-
database into any S3 bucket. For example, you might want to do this before deploying.
|
132
|
+
Archive the MySQL database to the bucket specified in your deploy.rb. This is for archiving a snapshot of your database into any S3 bucket. For example, you might want to do this before deploying.
|
177
133
|
|
178
134
|
* <code>cap ec2onrails:db:restore</code>
|
179
|
-
Restore the MySQL database from the bucket specified in your deploy.rb
|
180
|
-
For example, I use this to restore the current production data (from my actual production backup
|
181
|
-
bucket) onto a staging server that has the current production version of my
|
182
|
-
app. I then deploy the new version which tests migrations exactly as they'll
|
183
|
-
run on the production server.
|
135
|
+
Restore the MySQL database from the bucket specified in your deploy.rb. For example, I use this to restore the current production data (from my actual production backup bucket) onto a staging server that has the current production version of my app. I then deploy the new version which tests migrations exactly as they'll run on the production server.
|
184
136
|
|
185
137
|
To get a full list of the Capistrano tasks at any time type <code>cap -T</code> from with your rails app root.
|
186
138
|
|
187
139
|
h2. Building the image
|
188
140
|
|
189
|
-
Building the image is not required, most people will simply use the prebuilt public
|
190
|
-
image, but there is also a build script that builds the image. It's meant to be called by
|
191
|
-
"Eric Hammond's EC2 Ubuntu script":http://alestic.com/.
|
141
|
+
Building the image is not required, most people will simply use the prebuilt public image, but there is also a build script that builds the image. It's meant to be called by "Eric Hammond's EC2 Ubuntu script":http://alestic.com/.
|
192
142
|
|
193
143
|
|
194
144
|
h2. Mailing lists
|
195
145
|
|
196
|
-
There are two Google groups, one for
|
197
|
-
"announcements":http://groups.google.com/group/ec2-on-rails-announce
|
198
|
-
(usually just new release announcements) and one for
|
199
|
-
"discussion":http://groups.google.com/group/ec2-on-rails-discuss.
|
146
|
+
There are two Google groups, one for "announcements":http://groups.google.com/group/ec2-on-rails-announce (usually just new release announcements) and one for "discussion":http://groups.google.com/group/ec2-on-rails-discuss.
|
200
147
|
|
201
148
|
|
202
149
|
h2. Comments
|
203
150
|
|
204
|
-
Comments are welcome. Send an email to "Paul Dowman":http://pauldowman.com/contact/
|
205
|
-
|
206
|
-
If you find bugs please file them
|
207
|
-
"here":http://rubyforge.org/tracker/?atid=17558&group_id=4552&func=browse
|
208
|
-
or send me an "email":http://pauldowman.com/contact/.
|
151
|
+
Comments are welcome. Send an email to "Paul Dowman":http://pauldowman.com/contact/ or to the "Google group":http://groups.google.com/group/ec2-on-rails-discuss.
|
152
|
+
|
153
|
+
If you find bugs please file them "here":http://rubyforge.org/tracker/?atid=17558&group_id=4552&func=browse or send me an "email":http://pauldowman.com/contact/.
|
209
154
|
|
210
155
|
|
211
156
|
h2. Change log
|
212
157
|
|
213
|
-
See the "change log":http://ec2onrails.
|
158
|
+
See the "change log":http://github.com/pauldowman/ec2onrails/blob/0.9.9.1/gem/History.txt.
|
214
159
|
|
215
160
|
|
216
161
|
h2. How to submit patches
|
217
162
|
|
218
163
|
Pleae read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/.
|
164
|
+
|
219
165
|
The source code can be checked out anonymously using:
|
220
166
|
<pre>
|
221
|
-
|
167
|
+
git clone git://github.com/pauldowman/ec2onrails.git
|
222
168
|
</pre>
|
223
169
|
|
224
|
-
|
225
|
-
or "emailed directly to me":http://pauldowman.com/contact/ .
|
170
|
+
Send me a "pull request on Github":http://github.com/pauldowman/ec2onrails/tree, submit a patch to the "RubyForge Tracker":http://rubyforge.org/tracker/?atid=17560&group_id=4552&func=browse or "email me directly":http://pauldowman.com/contact/.
|
226
171
|
|
227
172
|
h2. License
|
228
173
|
|
229
174
|
This code is free to use under the terms of the GPL v2.
|
230
175
|
|
231
|
-
If you find EC2 on Rails useful please "recommend Paul Dowman":http://www.workingwithrails.com/person/10131-paul-dowman
|
232
|
-
at Working With Rails.
|
176
|
+
If you find EC2 on Rails useful please "recommend Paul Dowman":http://www.workingwithrails.com/person/10131-paul-dowman at Working With Rails.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ec2onrails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.9
|
4
|
+
version: 0.9.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Dowman
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-27 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -18,9 +18,9 @@ dependencies:
|
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- - "
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.
|
23
|
+
version: 2.5.3
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: archive-tar-minitar
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.5.
|
33
|
+
version: 0.5.2
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: optiflag
|
@@ -42,7 +42,17 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 0.6.5
|
44
44
|
version:
|
45
|
-
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: hoe
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.8.0
|
54
|
+
version:
|
55
|
+
description: Client-side libraries (Capistrano tasks) for managing and deploying to 'EC2 on Rails' servers.
|
46
56
|
email: paul@pauldowman.com
|
47
57
|
executables: []
|
48
58
|
|
@@ -104,10 +114,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
114
|
requirements: []
|
105
115
|
|
106
116
|
rubyforge_project: ec2onrails
|
107
|
-
rubygems_version: 1.
|
117
|
+
rubygems_version: 1.3.1
|
108
118
|
signing_key:
|
109
119
|
specification_version: 2
|
110
|
-
summary: Client-side libraries (Capistrano tasks) for managing and deploying to EC2 on Rails servers.
|
120
|
+
summary: Client-side libraries (Capistrano tasks) for managing and deploying to 'EC2 on Rails' servers.
|
111
121
|
test_files:
|
112
122
|
- test/test_ec2onrails.rb
|
113
123
|
- test/test_helper.rb
|