This repo contains rake tasks to automate some of our DevOps needs. It makes use of [Fog] fog github and Chef chef to create and configureservers in the cloud.
Openstack compatability is broken at this time.
- installs chef clients on the web servers
- installs and configures rbenv, nginx, git, etc
- delpoys a sinatra web app
- launches and configures load balancer
- configures dns for the app
creates ec2 xmpp servers
- installs chef clients on the xmpp servers
- installs and configures git, java, tigase
cd ~
git clone [email protected]:splap/fogdemo.git
cd fogdemo
bundle installCreate a free hosted chef account at [OpsCode] chef signup and save your private key as fogdemo.pem and set permissions
chmod og-r ~/.ssh/fogdemo/fogdemo.pemInstall knife and create a Chef Client for our new hosted chef account.
cd ~/fogdemo/chef
sudo gem install chef --no-ri --no-rdoc
knife client create fogclient -a -f "~/ssh/fogdemo/validator.pem"
# see the new client
knife client listFetch cookbook declarations from OpsCode
cd ~/fogdemo/chef
librarian-chef install --clean --verboseUpload roles and cookbooks to hosted chef server
rake push_chef_updatesFog creates a server, and bootstraps chef. chef installs rbenv, git, nginx, logrotate, etc. It then pulls a sinatra app, installs required gems, and starts up puma.
rake create_webConnect to or create a load balancer and tell it which web instance to use
rake lbConfigure DNS. Points an alias A record at the load balancer
rake dnsUpdate all webservers. This will apply chef configuration changes and update the sinatra app. This would not work in a zero downtime deploy strategy without more effort.
rake update_webGet an overview of the app's cloud deployment (default rake task)
rakeStop and destroy a web server
rake destroy_server['server_id']Stop and abandon all existing servers
rake destroy_allUpload xmpp role on the hosted chef server
knife role from file roles/xmppserver.rbCreate a new xmpp server - installs chef client and runs xmpp role, installing java, tigase, derby db, etc.
rake create_xmppUpdate all xmpp servers
rake update_xmpp