- Nginx
- Mongo
- Unicorn (+ upstart script)
- Capistrano deploy.rb ready to use
NOTE: We'll assume you're creating an application called awesomeapp
on the awesomeapp.com
for this README, adjust accordingly.
- Launch a new server (only Ubuntu 10.04 LTS has been tested)
- Run
curl https://raw.github.com/gist/b398348e220b4e3ca000/bootstrap.sh | sh
- Run
ssh [email protected]
- Copy the chef cookbook to the server using
rsync -r . [email protected]:chef-solo
- Copy
~/chef-solo/node.json.sample
to~/chef-solo/node.json
and make any changes needed - Run
chef-solo -c ~/chef-solo/solo.rb
Let's assume you create a new rails application with these defaults:
{
"user": {
"name":"deployer"
},
"rails_app":{
"name":"awesomeapp",
"database_password":"secret"
},
"run_list":["recipe[main]"]
}
- The
deployer
user would be created. Ifauthorized_keys_url
is specified those public keys will be added to/home/deployer/.ssh/authorized_keys
. /var/www/awesomeapp
will be setup to store the Rails application./var/www/awesomeapp/shared/config/mongoid.yml
will be created. Theawesomeapp_production
Mongo database will be accessible by theawesomeapp
user./home/deployer/deploy/awesomeapp.rb
will be created. This is a functional Capistranodeploy.rb
file that can be copied down to the application folder. It makes use of theUSR2
signal for zero-downtime deployments./etc/init/unicorn_awesomeapp
will be created to automatically launch your Unicorn application on boot. This will be run as thedeployer
user so that Capistrano script can reboot the script as necessary.
If you want to login to the server as the deployer
user you could add the following to your ~/.ssh/config
file:
Host awesomeapp
HostName awesomeapp.com
User deployer
Now you can run ssh awesome
and it will do ssh [email protected]
in the background, neat-o!