Hosting on AWS
Just some notes from setting up a Ruby on Rails instance on AWS EC2.
During the set up process of the instance you will be able to download a private key. Put that private key in a safe directory and chmod it to 400.
Then after completing the setup of the instance and you can see that it is running, go to your command line and enter:
ssh -i /path/to/key/[name of key].pem root@[public DNS]
That will get you logged in. You will need to go to /home/[webuser] to checkout your web project from SVN. But first you need to install SVN:
yum -y install subversion
Now you can check out:
svn checkout http://address.of.your.repository/and/path projectname
cd in to config and nano the database.yml, make the needed changes, then nano the environment.rb and edit the rails version if needed. Then make the database:
mysql
create database [whatever]
exit
Then cd into the root of the new project you just checked out:
rake db:migrate
And if you have fixtures to test with
rake db:fixtures:load
Amazon runs mogrel so to test your project you can add this shell script:
#!/bin/sh
cd /home/webuser/[project name]/log && rm mongrel.pid -f
pkill -9 mongrel_rails -u root
cd /home/webuser/[project name] && /usr/bin/mongrel_rails start -e development -p 80 -d
chmod that to 755 and run ./restart.sh
Go to the public DNS address in your browser and you should see your project.
Next, I will be attempting to run Rails through Apache on AWS with passenger instead of mongrel. For now this got my project online.