Devops

The merging of software development and systems administration to try and make our lives that little bit easier, and take us one step closer to automating ourselves out of a job.

Articles on Devops

Bash script to check timestamp on cron logfile

We've got a cron job that runs nightly, that broke. So time to put something in place that will check the error code and that the job has run.

Read more about checking timestamps with bash

Rails Hosting - Updated

This is just a quick note so that those subscribing to my feed or checking the site for updates are aware. I've made a series of minor changes to the rails hosting post from last month based on the feedback provided by you guys. If you've got any additional experiences with different rails hosts that you'd like to share, then please send them through. …

Read more about Rails Hosting - Updated

Ruby on Rails Hosting Round-up

UPDATE: I've extended this post based on the feedback in some of the comments. So I haven't used all of the rails hosts listed here, but I'll make it clear which those are. Working for various clients and along side various colleagues over the years, I've been witness to a whole number of hosting providers in the ruby/rails space. Some are great, others acceptable, and a few were just down right terrible. So how do you go about choosing which host is the right one for you? Read on… One…

Read more about Ruby on Rails Hosting Round-up

Nginx Intermediary SSL Certificates and Passphrases

I've had to do this 3 or 4 times in the past 12 months, and each time I waste a good chunk of time trying to re-discover how to do it. So this post is as much for my own documentation sake as it is sharing the love. If you've ever bought an SSL certificate from GoDaddy or a similar provider that provides and intermediary certificate to include, you might have run into a bit of a problem trying to work out how to include it in your nginx config. Well it's actually pretty straight-forward…

Read more about Nginx Intermediary SSL Certificates and Passphrases

The complete guide to setting up Starling

We wanted to push some long running tasks off to the background so that we didn't tie up a mongrel needlessly. I've wrestled (and won!) with backgroundrb in the past, but it just seemed like a chore. And they've since changed the API enough to mean it would be back to the drawing board, so we may as well assess some of the other options. So without too much further ado, the complete guide to installing, using, and monitoring starling. For those that haven't heard Starling is the back-end queuing system that Twitter use. And…

Read more about The complete guide to setting up Starling

Monitoring Backgroundrb with God

I mentioned yesterday that I'd elaborate on how to extend our app.god config so that god process monitoring automatically becomes aware of our changes. Well for those that can't wait, Graham who I pair with on the majority of my work beat me to the punch with with his post on Monitoring BackgroundRB with God. And at the end of the day English is his native language, so it's probably an easier read (I speak Australian). …

Read more about Monitoring Backgroundrb with God

Letting nginx automatically detect new rails apps

Following on from my post yesterday explaining how to let god automatically detect any new rails apps is few capistrano and config tweaks. This time the changes will let nginx use the same config file we created to so that setting up a new upstream and rails config is as simple as a call to deploy:setup in capistrano. These changes have a dependency on the changes from my previous post, so be sure to follow the steps on creating app.god to dynamically configure god for rails Within your deploy.rb you want to insert this snippet: I'll…

Read more about Letting nginx automatically detect new rails apps

Rails god config

If you're anything like me, you're not a big one for shelling out needless money to host the various development sites your working on. That inevitably means you'll end up with a whole host of small applications running on the one server, each needing a mongrel or two, and of course you want to make sure they are up and running. Thanks to the wonder that is ruby (and god) we can easily set it up to automatically become aware of any new apps we deploy via capistrano. Don't stress if you've never heard of…

Read more about Rails god config

Moving over to Git

So you've seen that Rails/Capistrano now natively supports Git? You've bearing hearing all the hype about it but don't really know what it is, how to use it, or how to install it. But like most, you know it was invented by that Linus guy that invented Linux, so it can't be all bad. Well then come jump on board! Git is a distributed version control system (you can skip this bit if you've used mercurial). If you can imagine SVN, but without the need to check back to…

Read more about Moving over to Git

Setting up nginx, ssl, and virtual hosts

To install nginx you have a few options depending on the flavour of operating system you are running. You can either install it via a package manager, or download the source and compile it yourself. Using the package manager will mean you will get the latest known stable version for your OS, and have to worry less about working out dependencies or conflicts. However, you may be a version or two behind the official release. If you've got a preferred package manager on your system then it should be as easy as one of the following (choose whichever…

Read more about Setting up nginx, ssl, and virtual hosts

Touched by god (process monitoring)

The tag ling from the god website simply states 'Like monit, only awesome', and having played with it for a couple of days over the break now I have to agree. Monit was very handy at the time, but I found myself growing increasingly frustrated with it when things wouldn't restart properly (stuck sockets with backgroundrb being an example), and it's lack of logging only compounded the situation. And then I found god. All blasphemy aside, this tool really is awesome. The scripts are in ruby so you can be as creative as you want, it has in…

Read more about Touched by god (process monitoring)

Engine Yard Bounty Pays Off

Engine Yard, the current big daddy of rails hosting, decided to put a bounty out to solve a problem all the newly converted rails/nginx users would have to some degree but have previously been ignoring. The load balancer in nginx works in a round robin fashion meaning that any long running request has the potential to cause another user to queue behind it, rather than getting served by one of the free and waiting mongrels. Well wait no more! Take a look at Ezra's blog for the most definitive run down on how to get it working for…

Read more about Engine Yard Bounty Pays Off

Securing SSH access

So you've got a shiny new server, it's connected to the net, and you (or your hosting company) has done the right thing by turning telnet off and forcing the much more secure option of using SSH to connect. But it doesn't end there, there are quite a few little things you can do to further tighten access and keep the boogey men at bay. First things first, lets move it off the default port 22. So many scripted and brute force attacks will try and blast at the defaults, and your memory isn't that bad…

Read more about Securing SSH access

Installing Memcached

Memcached is an alternative to database storage that is often useful for session storage and caching. It was developed by the guys at live journal to help them maintain their unwieldy sessions. Since then it's gained a lot of popularity among the PHP and Rails folk because it removes some of the burden on the typical database bottle neck, and allows things like session to be maintained across a cluster of servers. First things first, you're going to need to download and make the source for libevent, which memcached has a dependency on: Once that is done, you…

Read more about Installing Memcached

Installing Subversion and MySQL

I first got forced into using source control management (scm) systems when I first began working as part of a team of developers and there was times we'd need to edit the same parts of the system. It wasn't too long until those good habits trickled into the stuff I worked on by myself, and for good reason. It's nice to always have an undo option for those time when you go "Whoops!". Subversion (SVN to some) is the version control tool du jour for many, so lets keep it simple to begin with and start with…

Read more about Installing Subversion and MySQL

Installing Ruby, Rails, and Rubygems

Getting your first ruby on rails stack up and running can be a bit of a chore, here's a quick guide on how to do it on a linux box but the instructions should be equally good for OS X users. Now depending on your OS, you've got a few options on how to get ruby up and running. The easiest way is to use the built-in package management system. This will give you the latest known stable version of ruby for your environment, and hopefully reduce or remove any potential conflicts with other installed…

Read more about Installing Ruby, Rails, and Rubygems

Installing Apache 2.2.4

Working for various clients and deploying a full working rails stack on their hardware and environments is not always as straight-forward and easy as it should be. What distribution are they using? Which package manager? Does the package manager even currently have the right versions I need? So over the coming days I'm going to write a few tutorials on getting the latest software, from source, and compiling it. So intro today, with Apache. The only assumption I make is that gcc is available on the system so the we can compile the source into binaries. If…

Read more about Installing Apache 2.2.4

Adding yourself to the sudoers file

If you've gone at least some way to trying to make your server secure, you wont be running as root so you wont have access to many of the administration commands you'll need. It's easily resolved by adding yourself to the sudoers file, here's a quick guide on how to do it. Unless you've already got an account with sudo access, you're going to need to log in as root one last time to set one up. So do the following: And enter in the password for root…

Read more about Adding yourself to the sudoers file