ec2onrails 0.9.8.1 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,12 +1,30 @@
1
- == 0.9.8.1 2007-05-20
1
+ == 0.9.9 2008-07-01
2
+
3
+ * ami-c9bc58a0 (32-bit) and ami-cbbc58a2 (64-bit)
4
+ * This is another test release, still not intended to be production-ready. Look for version 1.0. Almost there!!
5
+ * Updated to Ubuntu 8.04 "Hardy"
6
+ * Added new required option to :ec2onrails_config in deploy.rb: ec2onrails_config[:archive_to_bucket_subdir] is used by the ec2onrails:db:archive Capistrano task. See http://ec2onrails.rubyforge.org/svn/trunk/documentation/examples/deploy.rb
7
+ * Database backup script parameters changed, now takes --reset to reset the binary logs, no longer takes --no-reset (not resetting the binary logs is now the default)
8
+ * Database backup script no longer resets binary log file numbering
9
+ * Now includes Rails 2.1.0 (still includes 2.0.2 and 1.2.6)
10
+ * Incremental database backup frequency increased to every 5 minutes since it's very inexpensive to do
11
+ * No longer randomize passwords on startup since they're disabled already
12
+ * Installed git-core package
13
+ * MySQL backup and restore scripts now use /mnt/tmp instead of /tmp for temp files in case database dump files are huge
14
+ * MySQL backup now uses --create-options option on mysqldump to preserve MySQL-specific create table options
15
+ * Built with ec2ubuntu build script version 68 (http://alestic.com)
16
+ * Updated Capistrano tasks to work with Capistrano 2.4.3
17
+
18
+
19
+ == 0.9.8.1 2008-05-20
2
20
 
3
21
  * ami-b657b2df (32-bit) and ami-8957b2e0 (64-bit) (same AMI's as 0.9.8, this is an update to the RubyGem only)
4
22
  * This is another test release, still not intended to be production-ready. Look for version 1.0. Almost there!!
5
23
  * Bug fix: if :ec2onrails[:enable_ssl] = true the setup task fails due to /etc/init.d/apache2 not executable
6
- * Bug fix: retry the the first mysqld startup, because on first startup sometimes the /etc/init.d/mysql startup script thinks it failed because mysqld took too long to physically write the logs full.
24
+ * Bug fix: retry if needed on the first mysqld startup, because on first startup sometimes the /etc/init.d/mysql startup script thinks it failed because mysqld took too long to physically write the logs full.
7
25
 
8
26
 
9
- == 0.9.8 2007-05-19
27
+ == 0.9.8 2008-05-19
10
28
 
11
29
  * ami-b657b2df (32-bit) and ami-8957b2e0 (64-bit)
12
30
  * This is another test release, still not intended to be production-ready. Look for version 1.0. Almost there!!
data/config/hoe.rb CHANGED
@@ -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', '>= 2.3.0'], ['archive-tar-minitar', '>= 0.5.1'], ['optiflag', '>= 0.6.5']] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
62
+ p.extra_deps = [['capistrano', '= 2.4.3'], ['archive-tar-minitar', '>= 0.5.1'], ['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
 
@@ -64,7 +64,8 @@ Capistrano::Configuration.instance.load do
64
64
  DESC
65
65
  task :start, :roles => :app_admin do
66
66
  run_init_script("mongrel", "start")
67
- sudo "sleep 30 && monit -g app monitor all" # give the service 30 seconds to start before attempting to monitor it
67
+ run "sleep 30" # give the service 30 seconds to start before attempting to monitor it
68
+ sudo "monit -g app monitor all"
68
69
  end
69
70
 
70
71
  desc <<-DESC
@@ -169,7 +170,7 @@ Capistrano::Configuration.instance.load do
169
170
  unless hostnames_for_role(:db, :primary => true).empty?
170
171
  db_config = YAML::load(ERB.new(File.read("config/database.yml")).result)[rails_env.to_s]
171
172
  cfg[:db_name] = db_config['database']
172
- cfg[:db_user] = db_config['username']
173
+ cfg[:db_user] = db_config['username'] || db_config['user']
173
174
  cfg[:db_password] = db_config['password']
174
175
  cfg[:db_host] = db_config['host']
175
176
  cfg[:db_socket] = db_config['socket']
@@ -197,6 +198,11 @@ Capistrano::Configuration.instance.load do
197
198
  on_rollback { drop }
198
199
  load_config
199
200
  start
201
+
202
+ # For some reason the default db on Hardy contains users with '' as the name.
203
+ # This causes authentication problems when connecting from localhost
204
+ run %{mysql -u root -D mysql -e "delete from user where User = ''; flush privileges;"}
205
+
200
206
  run %{mysql -u root -e "create database if not exists #{cfg[:db_name]};"}
201
207
  run %{mysql -u root -e "grant all on #{cfg[:db_name]}.* to '#{cfg[:db_user]}'@'%' identified by '#{cfg[:db_password]}';"}
202
208
  run %{mysql -u root -e "grant reload on *.* to '#{cfg[:db_user]}'@'%' identified by '#{cfg[:db_password]}';"}
@@ -204,7 +210,7 @@ Capistrano::Configuration.instance.load do
204
210
  end
205
211
 
206
212
  desc <<-DESC
207
- Make sure the MySQL server has been started, just in case the db role
213
+ [internal] Make sure the MySQL server has been started, just in case the db role
208
214
  hasn't been set, e.g. when called from ec2onrails:setup.
209
215
  (But don't enable monitoring on it.)
210
216
  DESC
@@ -212,7 +218,7 @@ Capistrano::Configuration.instance.load do
212
218
  sudo "chmod a+x /etc/init.d/mysql"
213
219
  # The mysql init script can fail on the first startup if mysql takes too long
214
220
  # to create the logfiles, so try again
215
- sudo "/etc/init.d/mysql start || (sleep 10 && /etc/init.d/mysql start)"
221
+ sudo "sh -c '/etc/init.d/mysql start || (sleep 10 && /etc/init.d/mysql start)'"
216
222
  end
217
223
 
218
224
  desc <<-DESC
@@ -246,10 +252,10 @@ Capistrano::Configuration.instance.load do
246
252
  desc <<-DESC
247
253
  Dump the MySQL database to the S3 bucket specified by \
248
254
  ec2onrails_config[:archive_to_bucket]. The filename will be \
249
- "app-<timestamp>.sql.gz".
255
+ "database-archive/<timestamp>/dump.sql.gz".
250
256
  DESC
251
257
  task :archive, :roles => :db do
252
- run "/usr/local/ec2onrails/bin/backup_app_db.rb --noreset --bucket #{cfg[:archive_to_bucket]} --dir database-#{Time.new.strftime('%Y-%m-%d--%H-%M-%S')}"
258
+ run "/usr/local/ec2onrails/bin/backup_app_db.rb --bucket #{cfg[:archive_to_bucket]} --dir #{cfg[:archive_to_bucket_subdir]}"
253
259
  end
254
260
 
255
261
  desc <<-DESC
@@ -267,7 +273,7 @@ Capistrano::Configuration.instance.load do
267
273
  make sense).
268
274
  DESC
269
275
  task :init_backup, :roles => :db do
270
- run "/usr/local/ec2onrails/bin/backup_app_db.rb"
276
+ run "/usr/local/ec2onrails/bin/backup_app_db.rb --reset"
271
277
  end
272
278
  end
273
279
 
@@ -435,7 +441,7 @@ Capistrano::Configuration.instance.load do
435
441
  Set the email address that mail to the admin user forwards to.
436
442
  DESC
437
443
  task :set_admin_mail_forward_address, :roles => all_admin_role_names do
438
- put cfg[:admin_mail_forward_address], "/home/admin/.forward"
444
+ put cfg[:admin_mail_forward_address], "/home/admin/.forward" if cfg[:admin_mail_forward_address]
439
445
  end
440
446
 
441
447
  desc <<-DESC
@@ -20,11 +20,12 @@ module Ec2onrails #:nodoc:
20
20
  module VERSION #:nodoc:
21
21
  MAJOR = 0
22
22
  MINOR = 9
23
- TINY = 8
24
- GEM_UPDATE = 1
25
- STRING = [MAJOR, MINOR, TINY, GEM_UPDATE].join('.')
23
+ TINY = 9
24
+ # GEM_UPDATE = 0
25
+ # STRING = [MAJOR, MINOR, TINY, GEM_UPDATE].join('.')
26
+ STRING = [MAJOR, MINOR, TINY].join('.')
26
27
 
27
- AMI_ID_32_BIT = 'ami-b657b2df'
28
- AMI_ID_64_BIT = 'ami-8957b2e0'
28
+ AMI_ID_32_BIT = 'ami-c9bc58a0'
29
+ AMI_ID_64_BIT = 'ami-cbbc58a2'
29
30
  end
30
31
  end
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
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.8.1</a>
36
+ <a href="http://rubyforge.org/projects/ec2onrails" class="numbers">0.9.9</a>
37
37
  </div>
38
38
  <h2>Deploy a Ruby on Rails app on <span class="caps">EC2</span> in five minutes</h2>
39
39
 
@@ -44,11 +44,19 @@ that&#8217;s ready to run a standard Ruby on Rails application with little or no
44
44
  It&#8217;s a Ruby on Rails <a href="http://en.wikipedia.org/wiki/Virtual_appliance">virtual appliance</a>.</p>
45
45
 
46
46
 
47
- <p>If you have an <span class="caps">EC2</span> account and a public keypair you&#8217;re five minutes away from deploying
47
+ <p>If you have an <span class="caps">EC2</span> account and can start <span class="caps">EC2</span> instances you&#8217;re five minutes away from deploying
48
48
  your Rails app.</p>
49
49
 
50
50
 
51
- <p><em>Deploying a simple rails app is simple, and complex customization (if required) is possible.</em></p>
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&#8217;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&#8217;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>
52
60
 
53
61
 
54
62
  <p>Features of the <span class="caps">EC2</span> image:</p>
@@ -56,34 +64,42 @@ your Rails app.</p>
56
64
 
57
65
  <ul>
58
66
  <li>Ready to deploy a Rails app with little or no configuration of the server required</li>
59
- <li>Automatic backup of MySQL database to S3 (full backup nightly + incremental backup using binary logs every 10 minutes)</li>
67
+ <li>Automatic backup of MySQL database to S3 (full backup nightly + incremental backup using binary logs every 5 minutes)</li>
60
68
  <li>Capistrano tasks to customize the server image, archive and restore the database to/from S3, and more (available as a rubygem)</li>
61
69
  <li>Mongrel_cluster behind Apache 2.2, configured according to
62
70
  <a href="http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/">Coda Hale&#8217;s excellent guide</a></li>
63
- <li>Ruby on Rails 2.0.2 and 1.2.6</li>
71
+ <li>Ruby on Rails 2.1.0, 2.0.2 and 1.2.6</li>
64
72
  <li>Ruby 1.8.6</li>
65
73
  <li>MySQL 5</li>
66
74
  <li><a href="http://www.danga.com/memcached/">memcached</a></li>
67
- <li><a href="http://www.tildeslash.com/monit/">monit</a> system monitoring</li>
68
- <li>Ubuntu 7.10 &#8220;Gutsy&#8221; base image built using <a href="http://alestic.com/">Eric Hammond&#8217;s <span class="caps">EC2</span> Ubuntu script</a></li>
75
+ <li><a href="http://www.tildeslash.com/monit/">monit</a> configured to monitor apache, mongrel, mysql, memcached, drive space and system load</li>
76
+ <li>Ubuntu 8.04 <span class="caps">LTS</span> &#8220;Hardy&#8221; base image built using <a href="http://alestic.com/">Eric Hammond&#8217;s <span class="caps">EC2</span> Ubuntu script</a></li>
69
77
  <li><span class="caps">SSL</span> support</li>
70
78
  <li>Amazon <span class="caps">AMI</span> tools installed</li>
71
- <li>A script to rebundle a customized version of the image in one step if required</li>
72
79
  <li>MySQL, Apache, and syslog configured to use /mnt for data and logging so you don&#8217;t fill up <span class="caps">EC2</span>&#8217;s small root filesystem</li>
73
80
  <li>Automatically archives Rails and Apache logs to S3 nightly.</li>
74
81
  <li>32-bit and 64-bit images available (supports all instance types, small to extra large).</li>
75
82
  <li>Created using a build file, full source is <a href="http://rubyforge.org/scm/?group_id=4552">available</a> (the <span class="caps">EC2</span> on Rails script is run from <a href="http://alestic.com/">Eric Hammond&#8217;s <span class="caps">EC2</span> Ubuntu script</a>)</li>
76
- <li>Supports multiple instances</li>
83
+ <li>Can be used as a clustered Rails app running on multiple instances</li>
77
84
  <li>Automatically runs hourly, daily, weekly and monthly scripts if they exist in Rails application&#8217;s script directory</li>
78
- <li>Local <span class="caps">SMTP</span> server (postfix)</li>
85
+ <li>Local <a href="http://www.postfix.org/">Postfix</a> SMTP mail server (only available from within the instance, not listening on external network interfaces)</li>
79
86
  </ul>
80
87
 
81
88
 
82
89
  <h2>Using the image</h2>
83
90
 
84
91
 
85
- <p>This documentation will be improved soon, for now hopefully this covers the basics.
86
- For the <span class="caps">AMI</span> id&#8217;s of the current images see the <a href="http://ec2onrails.rubyforge.org/svn/trunk/gem/History.txt">change log</a>.</p>
92
+ <p>This documentation will be improved soon, for now hopefully this covers the basics.</p>
93
+
94
+
95
+ The current <span class="caps">AMI</span> id&#8217;s are:
96
+ <ul>
97
+ <li>ami-c9bc58a0 (32-bit)</li>
98
+ <li>ami-cbbc58a2 (64-bit)</li>
99
+ </ul>
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>
87
103
 
88
104
 
89
105
  <h4>1. Install the gem</h4>
@@ -102,11 +118,10 @@ and
102
118
  in the config folder.</p>
103
119
 
104
120
 
105
- <p>Be sure to customize those files and read the comments.</p>
121
+ <p><em>Be sure to customize those files and read the comments.</em></p>
106
122
 
107
123
 
108
- <p>Also, if you&#8217;re using a separate instance for the database, use the hostname &#8220;db_primary&#8221;
109
- in your database.yml file. After running &#8220;cap ec2onrails:server:set_roles&#8221; it will resolve
124
+ <p>Also, use the hostname &#8220;db_primary&#8221; in your database.yml file. After running &#8220;cap ec2onrails:server:set_roles&#8221; it will resolve
110
125
  to the instance defined in your Capistrano &#8220;db&#8221; role.</p>
111
126
 
112
127
 
@@ -115,7 +130,7 @@ to the instance defined in your Capistrano &#8220;db&#8221; role.</p>
115
130
 
116
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),
117
132
  if you&#8217;ve started <span class="caps">EC2</span> instances before you can skip this section. Otherwise, I&#8217;m not going to lie, this part is complicated
118
- the first time.</p>
133
+ and will take a lot more than 5 minutes the first time.</p>
119
134
 
120
135
 
121
136
  <p>Read the
@@ -123,8 +138,8 @@ the first time.</p>
123
138
  in Amazon&#8217;s getting started guide.</p>
124
139
 
125
140
 
126
- <p>For the <span class="caps">AMI</span> id&#8217;s of the current images see the <a href="http://ec2onrails.rubyforge.org/svn/trunk/gem/History.txt">change log</a>
127
- or do <code>cap ec2onrails:ami_ids</code> from within the app that you configured in the previous step.</p>
141
+ <p>For the <span class="caps">AMI</span> id&#8217;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&#8217;re also listed earlier on this page).</p>
128
143
 
129
144
 
130
145
  <p><em><span class="caps">NOTE</span>: Only use the images that match the current version of the gem.</em></p>
@@ -146,8 +161,9 @@ use the app user to deploy the app, and the admin user for server admin tasks
146
161
  that require sudo.</p>
147
162
 
148
163
 
149
- <p>Double-check <a href="http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html">your firewall settings</a>.
150
- Be sure that you haven&#8217;t allowed public access to any ports other than <span class="caps">TCP 22</span> and <span class="caps">TCP 80</span>.
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&#8217;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&#8217;re going to enable <span class="caps">HTTPS</span>).
151
167
  If you&#8217;re using multiple instances, be sure to allow them network access to each other.</p>
152
168
 
153
169
 
@@ -170,7 +186,8 @@ key file, the public key is on the server. But for some reason
170
186
  <h4>6. Deploy the app with Capistrano</h4>
171
187
 
172
188
 
173
- <p>Now that the gem is installed, your deploy.rb is configured and you can start and stop <span class="caps">EC2</span> instances, this is the only thing you&#8217;ll need to do from now on.</p>
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&#8217;ll need to do from now on.</p>
174
191
 
175
192
 
176
193
  <pre>
@@ -189,106 +206,78 @@ create your database.</p>
189
206
  <h2>Capistrano tasks</h2>
190
207
 
191
208
 
192
- <p>I&#8217;ll post full documentation for the Capistrano tasks soon, in the meantime here&#8217;s a brief summary:</p>
209
+ <p><a href="http://capify.org">Capistrano</a> is the most commonly used Rails deployment tool. It comes with many standard &#8220;tasks&#8221;,
210
+ and the <span class="caps">EC2</span> on Rails gem includes Capistrano tasks specifically for configuring the server instance.</p>
193
211
 
194
212
 
195
- Server config tasks. These run as the admin user. You can specify lists of
196
- gems and Ubuntu packages to be installed. The deploy_files task uploads
197
- files to the server (they will be owned by root). It&#8217;s intended mainly for
198
- customized config files for new packages installed via the install_packages
199
- task.
200
- <ul>
201
- <li><code>cap ec2onrails:server:deploy_files</code></li>
202
- <li><code>cap ec2onrails:server:set_timezone</code></li>
203
- <li><code>cap ec2onrails:server:upgrade_gems</code></li>
204
- <li><code>cap ec2onrails:server:upgrade_packages</code></li>
205
- <li><code>cap ec2onrails:server:install_gems</code></li>
206
- <li><code>cap ec2onrails:server:install_packages</code></li>
207
- <li><code>cap ec2onrails:server:upgrade_and_install_all</code></li>
208
- <li><code>cap ec2onrails:server:restart_services</code></li>
209
- <li><code>cap ec2onrails:server:set_roles</code>
210
- - Customizes each instance for it&#8217;s role(s) (as defined in your Capistrano deploy.rb file).
211
- For now this just makes sure that only the appropriate services (Apache, Mongrel, and/or MySQL)
212
- are running. Eventually this will customize settings for the running services also. Note that
213
- an instance can have more than one role. If there&#8217;s only one instance it will have all roles.</li>
214
- </ul>
213
+ <p>Capistrano is run from the command-line using the &#8220;cap&#8221; command, with a task name given as an argument.</p>
215
214
 
216
215
 
217
- Database management tasks: archive and restore can operate on any specified S3 bucket.
218
- For example, I use this to restore the current production data (from my actual production backup
219
- bucket) onto a staging server that has the current production version of my
220
- app. I then deploy the new version which tests migrations exactly as they&#8217;ll
221
- run on the production server.
222
- <ul>
223
- <li><code>cap ec2onrails:db:archive</code></li>
224
- <li><code>cap ec2onrails:db:restore</code></li>
225
- <li><code>cap ec2onrails:db:create</code></li>
226
- <li><code>cap ec2onrails:db:drop</code></li>
227
- <li><code>cap ec2onrails:db:recreate</code></li>
228
- <li><code>cap ec2onrails:db:set_root_password</code></li>
229
- </ul>
216
+ <h3>Commonly-used tasks</h3>
217
+
218
+
219
+ <p>You&#8217;ll mostly need just the following Capistrano tasks:</p>
230
220
 
231
221
 
232
222
  <ul>
233
223
  <li><code>cap ec2onrails:ami_ids</code>
234
- - Shows the <span class="caps">AMI</span> id&#8217;s of the images that match the current version of the gem.</li>
224
+ Shows the <span class="caps">AMI</span> id&#8217;s of the images that match the current version of the gem.</li>
235
225
  </ul>
236
226
 
237
227
 
238
228
  <ul>
239
229
  <li><code>cap ec2onrails:setup</code>
240
- - This is a convenience task to get a new instance completely set up in one
241
- step, everything except deploying the app.</li>
230
+ This task configures a newly-launched instance. This is the first thing you should do after
231
+ starting a new instance. It can be run more than once without ill effect. After running
232
+ &#8220;cap ec2onrails:setup&#8221; the next thing to do is run &#8220;cap deploy:cold&#8221;</li>
242
233
  </ul>
243
234
 
244
235
 
245
236
  <ul>
246
- <li><code>cap ec2onrails:restore_db_and_deploy</code>
247
- - Another convenience task to recreate the db, restore data to it from an s3
248
- bucket and deploy the app, useful to set up a staging server.</li>
237
+ <li><code>cap ec2onrails:server:set_roles</code>
238
+ Customizes each instance for it&#8217;s role(s) (as defined in your Capistrano deploy.rb file).
239
+ Run this after starting or stopping instances.
240
+ For now this just makes sure that only the appropriate services (Apache, Mongrel, and/or MySQL)
241
+ are running. Eventually this will customize settings for the running services also. Note that
242
+ an instance can have more than one role. If there&#8217;s only one instance it will have all roles.</li>
249
243
  </ul>
250
244
 
251
245
 
252
- <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>
253
-
246
+ <p>Note that due to the way that Capistrano works all tasks are run
247
+ against all hosts that are currently defined in the deploy.rb file.
248
+ So if you start a new instance then add it to your deploy.rb you will need to run
249
+ &#8220;cap ec2onrails:setup&#8221; again which will be run on all existing instances.</p>
254
250
 
255
- <h2>Saving your own customized version of the image.</h2>
256
251
 
252
+ <h3>Database management tasks</h3>
257
253
 
258
- I&#8217;m trying to make the image configurable enough that you won&#8217;t need to do this, but
259
- if you want to save a customized version of the image, there is a script to do it:
260
- <code>/usr/local/ec2onrails/bin/rebundle.sh</code>. It takes a long time and there
261
- are long periods with no output so you might want to hit a key once in a while
262
- (or set &#8220;ServerAliveInterval 60&#8221; in your ssh_config file) to avoid being disconnected
263
- while it&#8217;s running.
264
254
 
265
- <p>It expects a directory, /mnt/aws-config, that contains a config file and your <span class="caps">AWS</span>
266
- access identifiers. The contents of the directory are the following three files:</p>
255
+ <ul>
256
+ <li><code>cap ec2onrails:db:archive</code>
257
+ Archive the MySQL database to the bucket specified in your deploy.rb. This is for archiving a snapshot of your
258
+ database into any S3 bucket. For example, you might want to do this before deploying.</li>
259
+ </ul>
267
260
 
268
261
 
269
262
  <ul>
270
- <li>cert-XXXX.pem and pk-XXXX.pem. These are the X.509 certificate and private key files from your Amazon access key identifiers.</li>
271
- <li>A file named config. It&#8217;s contents should look like the following:</li>
263
+ <li><code>cap ec2onrails:db:restore</code>
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&#8217;ll
268
+ run on the production server.</li>
272
269
  </ul>
273
270
 
274
271
 
275
- <pre>
276
- AWS_ACCOUNT_ID=1234-1234-1234
277
- KEY_FILE_NAME=pk-XXXX.pem
278
- CERT_FILE_NAME=cert-XXXX.pem
279
- AWS_ACCESS_KEY_ID=ABC0123
280
- AWS_SECRET_ACCESS_KEY=abc0123abc0123abc0123
281
- BUCKET_BASE_NAME=a-string-identifier
282
- </pre>
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
+
283
274
 
284
275
  <h2>Building the image</h2>
285
276
 
286
277
 
287
278
  <p>Building the image is not required, most people will simply use the prebuilt public
288
- image, but there is also a Rake build script that builds the image, and optionally bundles
289
- and uploads it to S3.
290
- It should run on any Linux system, including one of the stock Fedora-based Amazon public <span class="caps">AMI</span>&#8217;s
291
- (it is tested on <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=994&#38;categoryID=101">Amazon&#8217;s <span class="caps">FC6</span> x86_64 image</a>).</p>
279
+ image, but there is also a build script that builds the image. It&#8217;s meant to be called by
280
+ <a href="http://alestic.com/">Eric Hammond&#8217;s <span class="caps">EC2</span> Ubuntu script</a>.</p>
292
281
 
293
282
 
294
283
  <h2>Mailing lists</h2>
@@ -296,7 +285,7 @@ It should run on any Linux system, including one of the stock Fedora-based Amazo
296
285
 
297
286
  <p>There are two Google groups, one for
298
287
  <a href="http://groups.google.com/group/ec2-on-rails-announce">announcements</a>
299
- and one for
288
+ (usually just new release announcements) and one for
300
289
  <a href="http://groups.google.com/group/ec2-on-rails-discuss">discussion</a>.</p>
301
290
 
302
291
 
@@ -338,7 +327,7 @@ or <a href="http://pauldowman.com/contact/">emailed directly to me</a> .</p>
338
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>
339
328
  at Working With Rails.</p>
340
329
  <p class="coda">
341
- <a href="http://pauldowman.com/contact/">Paul Dowman</a>, 19th May 2008<br>
330
+ <a href="http://pauldowman.com/contact/">Paul Dowman</a>, 30th June 2008<br>
342
331
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
343
332
  </p>
344
333
  </div>
data/website/index.txt CHANGED
@@ -8,40 +8,51 @@ EC2 on Rails is an Ubuntu Linux server image for
8
8
  that's ready to run a standard Ruby on Rails application with little or no customization.
9
9
  It's a Ruby on Rails "virtual appliance":http://en.wikipedia.org/wiki/Virtual_appliance.
10
10
 
11
- If you have an EC2 account and a public keypair you're five minutes away from deploying
11
+ If you have an EC2 account and can start EC2 instances you're five minutes away from deploying
12
12
  your Rails app.
13
13
 
14
- _Deploying a simple rails app is simple, and complex customization (if required) is possible._
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.
20
+
21
+ But until then, why spend your time configuring servers?
15
22
 
16
23
  Features of the EC2 image:
17
24
 
18
25
  * Ready to deploy a Rails app with little or no configuration of the server required
19
- * Automatic backup of MySQL database to S3 (full backup nightly + incremental backup using binary logs every 10 minutes)
26
+ * Automatic backup of MySQL database to S3 (full backup nightly + incremental backup using binary logs every 5 minutes)
20
27
  * Capistrano tasks to customize the server image, archive and restore the database to/from S3, and more (available as a rubygem)
21
28
  * Mongrel_cluster behind Apache 2.2, configured according to
22
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/
23
- * Ruby on Rails 2.0.2 and 1.2.6
30
+ * Ruby on Rails 2.1.0, 2.0.2 and 1.2.6
24
31
  * Ruby 1.8.6
25
32
  * MySQL 5
26
33
  * "memcached":http://www.danga.com/memcached/
27
- * "monit":http://www.tildeslash.com/monit/ system monitoring
28
- * Ubuntu 7.10 "Gutsy" base image built using "Eric Hammond's EC2 Ubuntu script":http://alestic.com/
34
+ * "monit":http://www.tildeslash.com/monit/ configured to monitor apache, mongrel, mysql, memcached, drive space and system load
35
+ * Ubuntu 8.04 LTS "Hardy" base image built using "Eric Hammond's EC2 Ubuntu script":http://alestic.com/
29
36
  * SSL support
30
37
  * Amazon AMI tools installed
31
- * A script to rebundle a customized version of the image in one step if required
32
38
  * MySQL, Apache, and syslog configured to use /mnt for data and logging so you don't fill up EC2's small root filesystem
33
39
  * Automatically archives Rails and Apache logs to S3 nightly.
34
40
  * 32-bit and 64-bit images available (supports all instance types, small to extra large).
35
41
  * Created using a build file, full source is "available":http://rubyforge.org/scm/?group_id=4552 (the EC2 on Rails script is run from "Eric Hammond's EC2 Ubuntu script":http://alestic.com/)
36
- * Supports multiple instances
42
+ * Can be used as a clustered Rails app running on multiple instances
37
43
  * Automatically runs hourly, daily, weekly and monthly scripts if they exist in Rails application's script directory
38
- * Local SMTP server (postfix)
44
+ * Local "Postfix":http://www.postfix.org/ SMTP mail server (only available from within the instance, not listening on external network interfaces)
39
45
 
40
46
 
41
47
  h2. Using the image
42
48
 
43
49
  This documentation will be improved soon, for now hopefully this covers the basics.
44
- For the AMI id's of the current images see the "change log":http://ec2onrails.rubyforge.org/svn/trunk/gem/History.txt.
50
+
51
+ The current AMI id's are:
52
+ * ami-c9bc58a0 (32-bit)
53
+ * ami-cbbc58a2 (64-bit)
54
+
55
+ _I will keep these images for as long as possible, they will not be deleted for at least a few years._
45
56
 
46
57
 
47
58
  h4. 1. Install the gem
@@ -57,24 +68,23 @@ and
57
68
  "s3.yml":http://ec2onrails.rubyforge.org/svn/trunk/documentation/examples/s3.yml
58
69
  in the config folder.
59
70
 
60
- Be sure to customize those files and read the comments.
71
+ _Be sure to customize those files and read the comments._
61
72
 
62
- Also, if you're using a separate instance for the database, use the hostname "db_primary"
63
- in your database.yml file. After running "cap ec2onrails:server:set_roles" it will resolve
73
+ Also, use the hostname "db_primary" in your database.yml file. After running "cap ec2onrails:server:set_roles" it will resolve
64
74
  to the instance defined in your Capistrano "db" role.
65
75
 
66
76
  h4. 4. Start up one or more instances of the image.
67
77
 
68
78
  There is nothing EC2 on Rails-specific here yet (though soon there will be a Capistrano task to do this for you),
69
79
  if you've started EC2 instances before you can skip this section. Otherwise, I'm not going to lie, this part is complicated
70
- the first time.
80
+ and will take a lot more than 5 minutes the first time.
71
81
 
72
82
  Read the
73
83
  "running an instance section":http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html
74
84
  in Amazon's getting started guide.
75
85
 
76
- For the AMI id's of the current images see the "change log":http://ec2onrails.rubyforge.org/svn/trunk/gem/History.txt
77
- or do <code>cap ec2onrails:ami_ids</code> from within the app that you configured in the previous step.
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).
78
88
 
79
89
  _NOTE: Only use the images that match the current version of the gem._
80
90
 
@@ -91,8 +101,9 @@ that the app runs as, does not have sudo ability). The Capistrano tasks automati
91
101
  use the app user to deploy the app, and the admin user for server admin tasks
92
102
  that require sudo.
93
103
 
94
- Double-check "your firewall settings":http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/running-an-instance.html.
95
- Be sure that you haven't allowed public access to any ports other than TCP 22 and TCP 80.
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).
96
107
  If you're using multiple instances, be sure to allow them network access to each other.
97
108
 
98
109
 
@@ -111,7 +122,8 @@ Note, this will only work if you have an external ssh command in the path, it wo
111
122
 
112
123
  h4. 6. Deploy the app with Capistrano
113
124
 
114
- 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.
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.
115
127
 
116
128
  <pre>
117
129
  cap ec2onrails:setup
@@ -124,94 +136,66 @@ create your database.
124
136
 
125
137
  That's it, your app is now running on EC2!!
126
138
 
139
+
127
140
  h2. Capistrano tasks
128
141
 
129
- I'll post full documentation for the Capistrano tasks soon, in the meantime here's a brief summary:
130
-
131
- Server config tasks. These run as the admin user. You can specify lists of
132
- gems and Ubuntu packages to be installed. The deploy_files task uploads
133
- files to the server (they will be owned by root). It's intended mainly for
134
- customized config files for new packages installed via the install_packages
135
- task.
136
- * <code>cap ec2onrails:server:deploy_files</code>
137
- * <code>cap ec2onrails:server:set_timezone</code>
138
- * <code>cap ec2onrails:server:upgrade_gems</code>
139
- * <code>cap ec2onrails:server:upgrade_packages</code>
140
- * <code>cap ec2onrails:server:install_gems</code>
141
- * <code>cap ec2onrails:server:install_packages</code>
142
- * <code>cap ec2onrails:server:upgrade_and_install_all</code>
143
- * <code>cap ec2onrails:server:restart_services</code>
144
- * <code>cap ec2onrails:server:set_roles</code>
145
- - Customizes each instance for it's role(s) (as defined in your Capistrano deploy.rb file).
146
- For now this just makes sure that only the appropriate services (Apache, Mongrel, and/or MySQL)
147
- are running. Eventually this will customize settings for the running services also. Note that
148
- an instance can have more than one role. If there's only one instance it will have all roles.
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.
149
144
 
150
- Database management tasks: archive and restore can operate on any specified S3 bucket.
151
- For example, I use this to restore the current production data (from my actual production backup
152
- bucket) onto a staging server that has the current production version of my
153
- app. I then deploy the new version which tests migrations exactly as they'll
154
- run on the production server.
155
- * <code>cap ec2onrails:db:archive</code>
156
- * <code>cap ec2onrails:db:restore</code>
157
- * <code>cap ec2onrails:db:create</code>
158
- * <code>cap ec2onrails:db:drop</code>
159
- * <code>cap ec2onrails:db:recreate</code>
160
- * <code>cap ec2onrails:db:set_root_password</code>
145
+ Capistrano is run from the command-line using the "cap" command, with a task name given as an argument.
161
146
 
162
- * <code>cap ec2onrails:ami_ids</code>
163
- - Shows the AMI id's of the images that match the current version of the gem.
147
+ h3. Commonly-used tasks
164
148
 
165
- * <code>cap ec2onrails:setup</code>
166
- - This is a convenience task to get a new instance completely set up in one
167
- step, everything except deploying the app.
149
+ You'll mostly need just the following Capistrano tasks:
168
150
 
169
- * <code>cap ec2onrails:restore_db_and_deploy</code>
170
- - Another convenience task to recreate the db, restore data to it from an s3
171
- bucket and deploy the app, useful to set up a staging server.
151
+ * <code>cap ec2onrails:ami_ids</code>
152
+ Shows the AMI id's of the images that match the current version of the gem.
172
153
 
173
- To get a full list of the Capistrano tasks at any time type <code>cap -T</code> from with your rails app root.
154
+ * <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"
174
158
 
159
+ * <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.
175
165
 
176
- h2. Saving your own customized version of the image.
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.
177
170
 
178
- I'm trying to make the image configurable enough that you won't need to do this, but
179
- if you want to save a customized version of the image, there is a script to do it:
180
- <code>/usr/local/ec2onrails/bin/rebundle.sh</code>. It takes a long time and there
181
- are long periods with no output so you might want to hit a key once in a while
182
- (or set "ServerAliveInterval 60" in your ssh_config file) to avoid being disconnected
183
- while it's running.
184
171
 
185
- It expects a directory, /mnt/aws-config, that contains a config file and your AWS
186
- access identifiers. The contents of the directory are the following three files:
172
+ h3. Database management tasks
187
173
 
188
- * cert-XXXX.pem and pk-XXXX.pem. These are the X.509 certificate and private key files from your Amazon access key identifiers.
189
- * A file named config. It's contents should look like the following:
174
+ * <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.
190
177
 
191
- <pre>
192
- AWS_ACCOUNT_ID=1234-1234-1234
193
- KEY_FILE_NAME=pk-XXXX.pem
194
- CERT_FILE_NAME=cert-XXXX.pem
195
- AWS_ACCESS_KEY_ID=ABC0123
196
- AWS_SECRET_ACCESS_KEY=abc0123abc0123abc0123
197
- BUCKET_BASE_NAME=a-string-identifier
198
- </pre>
178
+ * <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.
199
184
 
185
+ To get a full list of the Capistrano tasks at any time type <code>cap -T</code> from with your rails app root.
200
186
 
201
187
  h2. Building the image
202
188
 
203
189
  Building the image is not required, most people will simply use the prebuilt public
204
- image, but there is also a Rake build script that builds the image, and optionally bundles
205
- and uploads it to S3.
206
- It should run on any Linux system, including one of the stock Fedora-based Amazon public AMI's
207
- (it is tested on "Amazon's FC6 x86_64 image":http://developer.amazonwebservices.com/connect/entry.jspa?externalID=994&categoryID=101).
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/.
208
192
 
209
193
 
210
194
  h2. Mailing lists
211
195
 
212
196
  There are two Google groups, one for
213
197
  "announcements":http://groups.google.com/group/ec2-on-rails-announce
214
- and one for
198
+ (usually just new release announcements) and one for
215
199
  "discussion":http://groups.google.com/group/ec2-on-rails-discuss.
216
200
 
217
201
 
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.8.1
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dowman
@@ -9,20 +9,22 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-20 00:00:00 -04:00
12
+ date: 2008-07-01 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
20
- - - ">="
21
+ - - "="
21
22
  - !ruby/object:Gem::Version
22
- version: 2.3.0
23
+ version: 2.4.3
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: archive-tar-minitar
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
@@ -32,6 +34,7 @@ dependencies:
32
34
  version:
33
35
  - !ruby/object:Gem::Dependency
34
36
  name: optiflag
37
+ type: :runtime
35
38
  version_requirement:
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
@@ -101,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
104
  requirements: []
102
105
 
103
106
  rubyforge_project: ec2onrails
104
- rubygems_version: 1.1.0
107
+ rubygems_version: 1.2.0
105
108
  signing_key:
106
109
  specification_version: 2
107
110
  summary: Client-side libraries (Capistrano tasks) for managing and deploying to EC2 on Rails servers.