devops, postgresql, redis, ruby

Keeping our servers up to date

I try to keep our infrastructure fairly up to date. I like using devops best practices, so I’m using Ansible for server provisioning and upgrade. I used Chef and I played around with Puppet, but I found both too complicated for our current infrastructure. Ansible has been a pleasure to use so far.

Just this week I have updated a few of our servers. All of them feature Ubuntu Precise.

Redis

Ubuntu Precise ships with Redis version 2.2. That version is over two years old, so I can’t just rely on Precise packages. Besides, since we are using a bit of Lua scripting we need at least version 2.6 or higher. This means either compiling or getting an alternative PPA. I always prefer to avoid manual package compilation. But, luckily, Rowan’s keeps a very well maintained  PPA.

The playbook —that’s how you call recipes in Ansible— is as simple as

# Add redis repo
- apt_repository: repo='ppa:rwky/redis'
- apt: pkg=redis-server update_cache=yes state=latest

If you are using redis, don’t forget to set overcommit memory setting to 1, as stated in the documentation

- name: Set overcommit_memory to 1
sysctl: name=vm.overcommit_memory value=1 state=present

Postgres

I also updated to PostgreSQL 9.3.3, released a few weeks ago with security fixes. I had the same problem as with redis, Ubuntu ships with version 9.1. In this case there is an official postgres repository with the latest version

Here you are the Ansible playbook.

# Add postgres repo
- apt_repository: repo='deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' state=present
- apt_key: url=https://www.postgresql.org/media/keys/ACCC4CF8.asc state=present
- apt: pkg=postgresql-9.3,postgresql-contrib-9.3 update_cache=yes state=latest

Ruby

To complete the week, after a few days testing ruby 2.1.1 in our local and staging environments —and being sure the ruby 2.1.1 regression is not affecting us— I have upgraded the production servers.

To simplify installation, I am using ruby-install. I am not attaching the Ansible playbook because it is a bit long, but you can find several examples for ruby installation in Ansible Galaxy.

And that’s all. My ops tasks are done for the week and I can get back to coding.

If you have any questions about this post, just leave us a comment. In case you prefer to get in touch privately, contact us at engineering@teowaki.com

Advertisements
Standard

One thought on “Keeping our servers up to date

  1. Pingback: Announcing our engineering blog | the teowaki blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s