Just wanted to share a script I hacked together. Mainly from the the AWS gem docs. This script builds a new ec2 server and jumpstarts a chef server for you. You can pull it from my
Github: https://github.com/densone/chef-server-jumpstart
let the machines do the work for you
Just wanted to share a script I hacked together. Mainly from the the AWS gem docs. This script builds a new ec2 server and jumpstarts a chef server for you. You can pull it from my
Github: https://github.com/densone/chef-server-jumpstart
I recently tried to get the mysql library gem working for rails3 and taps. This would allow me to pull from heroku's postgres database and push data to my local dev mysql db.
I was getting the most annoying error:
This issue can also be seen here by a bunch of other taps users(including me):
https://github.com/ricardochimal/taps/issues#issue/47/comment/748899
Solution:
One of my New Years resolutions this year is to cook a lot more. I am so used to eating out all of the time, that I basically spend a ton of money on shitty food. This past weekend I went to Trader Joe's and Foodies, bought a bunch of random food. This is one of my dishes.
Pan Seared Chicken & Narragansett

Ingredients

Instructions
I've been using The Grinder3 to run some rails performance tests and ran into an issue where I could not parse some html to submit Ruby on Rails forms. Every form in a Ruby on Rails application has an authenticity_token. This keeps jerks from messing around.
The process:
1) Go to the sign_in page.
2) Parse the authenticity token from the response
3) Post and login to the applicaiton.
The Errors
1) The Grinder does not support the re module out of the box. Grinder uses Jython, but its slimmed down. I fixed this by downloading the latest Jython installation and dropping it in to $GRINDER_HOME/lib. Make sure to copy jython's Lib directory also. Yes that was Lib with a capital "L".
2) You need to compile your regular expression outside of the test thread. At least this was the case for me. See line 7 in the following gist.
3) You need to import the re module into each test thread along with importing re into the agent. See lines 5 and 45 of the test.
Test Away
Once you parse the authenticity_token, you will be able to load test your rails apps with the grinder. I am using devise for authentication in this sample.
Also notice I have cookies enabled in the gist.
The Gist
Links
I ran into an interesting issue with RackSpace Cloud recently. They don't have a magical firewall layer like ec2. You basically have to manage iptables with a wrapper for each machine on your network. This can be quite the pain in the ass if you have more than a few servers. In my case, I need to block the external interface on about 50 servers, so a Chef cookbook was the right approach.
This cookbook is written specifically for Ubuntu, but can be quickly ported to any Linux Distro.
This article is written for a System Engineer or Developer that knows the Chef basics. Please feel free to ask questions below in the comments section for a deeper explanation of this cookbook.
Clone My Chef Repo on GitHub:
Every code snippet in this article can be grabbed from my public git repository.
http://github.com/densone/densone-chef
Shorewall
I decided to use an iptables wrapper called Shorewall. Shorewall is not daemonized. When running shorwall restart/stop/start, you are just running scripts that update iptables.
Simple Installation
Only a single package named "shorewall" needs to be installed. Chef makes this easy with its package resource.
package "shorewall"
Shorewall Config Files
Shorewall has a handful of important config files. Proper configuration is essential for iptables to get updated properly. My chef GitHub Repo will work for RackSpace Cloud out of the box.
Let's Put the Recipe Together
So far we have talked about shorewall and its various files. Let's put it all together now in a Chef recipe.
default.rb
This cookbook only has one recipe, so we can name it default.
The preceding recipe will show you a few things.
rules.erb
This file iterates through a node attribute defined in the cookbook default.rb
Applying The Cookbook To a Role
The cookbook is ready. Now we need to create a role and setup some rules in it.
Apply The Role to an App Server, Sit Back and Let The Machine Work for You
To connect this role to an app server run the following command:
knife node run_list add <app-server-fqdn> "role[appserver]"
Light Reading
http://wiki.opscode.com - Information about Chef.
http://www.shorewall.net/ - Information about Shorline Firewall.