I figured it out. In the spirit of "light a candle instead of cursing
the darkness" I heavily cribbed and edited Paul D's README file to
create what I think is a detailed and accurate set of steps about how
to set up ec2onrails to work right with mysql permissions:
1. Install the gem
# sudo gem install ec2onrails
2. Add the config files to your Rails app
You will need to place Capfile in the root of your rails folder, and
put deploy.rb and s3.yml in the config folder. Within your rails
directory, run:
wget -q -O Capfile
http://github.com/pauldowman/ec2onrails/raw/master/examples/Capfile
wget -q -O config/deploy.rb
http://github.com/pauldowman/ec2onrails/raw/master/examples/deploy.rb
wget -q -O config/s3.yml
http://github.com/pauldowman/ec2onrails/raw/master/examples/s3.yml
Be sure to customize those files and read the comments before going to
the next step.
3. Edit database.yml
In your database.yml file, add host: db_primary to the host of the the
environment you want to run on the instance, usually "production".
Also, make sure you choose a new username and password for that same
environment. Ec2OnRails will use whatever username and password you
put there to make mysql user permissions for accessing the database on
the instance. Important: Do not use "root" for the username or you
will mess everything up.
4. Start up one or more instances of the image.
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 long time on your first try.
For the AMI id’s of the current images do cap ec2onrails:ami_ids from
within the app that you configured in the previous step (they’re also
listed earlier on this page).
NOTE: Only use the images that match the current version of the gem.
5. Setup server roles
Run:
# cap ec2onrails:server:set_roles
6. Copy your public key from the server to keep Capistrano happy
This is a workaround for a quirk in Capistrano. From within the root
of your rails app do:
cap ec2onrails:get_public_key_from_server
Note, this will only work if you have an external ssh command in the
path, it won’t work for most Windows users.
7. Do NOT run cap ec2onrails:db:set_root_password!
If you run it now, before cap ec2onrails:setup, you will basically
f*** the mysql config on the instance. To be safe, comment out the
line in the deploy.rb that says :mysql_root_password.
8. Deploy the app with Capistrano
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.
cap ec2onrails:setup
cap deploy:migrations
Then, it's all cap deploy from here going forward.
I hope this helps someone. Thanks again to Paul for all his hard work
and help to the Rails community.
-Jason