Archiv für den Monat: September 2014

Automate all the things!!!

Recently, I have been doing a lot of work a server administrator would normally do. I set up a continuous integration system and played around with virtualization at work and deployed a couple of python apps for a side project. Being a software developer, this has been both a challenging and fun experience. It also got me thinking about all the buzz about dev-ops you read nowadays. Dev-ops (development and operations) refers to a company structure where the development and server administration teams work very closely together or even without a clear distinction between the two fields. I am very much in favor of close collaboration, but the approach also has its caveats.

As a developer, my main responsibility is to create and maintain good software and although I know the basic concepts I am not trained in systems administration. Yes, I can install a server and get my application running. I will also go ahead and disable root login via ssh to prove my security lectures were not a complete waste of time. But without following the subject closely and practice and improve my skills on a day-to-day basis, like a full-time sys-admin would, it is very hard to bring a system in a state where security best practices are followed, redundancy is properly implemented and good sleep can be found at night.

A picture of me while installing Buildbot on a Vagrant machine.

For this reason it is the least we can do as developers dropped into the engine room to document very carefully what we do. Because what will happen is, we will get it to work, walk away and forget about it. Then a week later something will break and we’ll have to put on the old sys-admin gloves once more only to redo the whole research and learning process again. Or maybe somebody asks you how you set up the external juggly-tubes on that one server. „The what? Gee, I don’t remember.“ A good documentation – a recipe on how to get a specific job done – can save the day.

And the best documentation when it comes to server administration is automation.

Automation comes in many shapes and forms depending on the job and the personal preferences of the people involved. It can be an elaborate shell script or a complex automation tool. In any case you’ll end up with something that describes the task you were trying to complete and it also does complete the task. Perfect.  Next time somebody calls you to tell you the fancy new app on the virtual cloud docker thing has crashed you can just press a button and automagically re-deploy the thing.

So, please don’t have any machines in an undocumented state running in your production or development environments and best make sure everything is properly automated and the process is reviewed every now and then.

Installing VirtualBox GuestAdditions on CentOS 7

I recently needed to create a new CentOS 7 base box for Vagrant using VirtualBox. Since I ran into some road bumps, here is a short list of them and how I managed to overcome them:

It is recommended to install dkms before installing the VB GuestAdditions to avoid having to recompile after a kernel update. dkms is not in the centos repos, but can be found in the rpmforge repositories. However there is no rpmforge for CentOS7. I used EPEL instead, which has a repo for CentOS7 and also contains dkms.

I use Linux Mint 17 as the Host, which currently has VirtualBox version 4.3.12 in the repo. I create a fresh machine and installed CentoOS 7 from the Minimal ISO. When I tried to install the Virtualbox Guest additions (which are required for Vagrant) I got the following error:

Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.12 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules           [  OK  ]
Removing existing VirtualBox non-DKMS kernel modules       [  OK  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module                   [FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions              [  OK  ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.

After some research I found this thread on the virtualbox forums, which recommended using a newer version of the GuestAdditions ISO. I downloaded version  4.3.14_RC1 and it installed just fine.

When starting the box in Vagrant I got :

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p /vagrant

Stdout from the command:

Stderr from the command:

sudo: sorry, you must have a tty to run sudo

Turns out I had to comment out requiretty and !visiblepw in the /etc/sudoers
file. (See this issue for details)