system administration

16 May

Three Developer-Friendly Orchestration Tools

in devops, programming, system administration

Recently I have been doing all kinds of DevOps/Orchestration work setting up in-cloud servers and services. Most of the time, what I want to be able to do is quickly and repeatably create several servers all working together. But I don't need a full orchestration system. I've found three promising solutions (in alphabetical order):

Here's a very basic overview of each of those.

14 May

Starting the Awesome window manager on Ubuntu 13.04

in system administration, ubuntu

Awesome is a window manager that you can use to replace or augment other desktop environments like Gnome Desktop and KDE. I find Awesome appealing because of the different perspective it brings to window management. Instead of windows floating free on the desktop, Awesome provides various tiled views of windows. This maximizes screen usage, and also adds some workflow. Keyboard shortcuts are plentiful and convenient (and make use of that otherwise untouched Windows key).

Installing Awesome on Ubuntu 13.04 was a piece of cake:

$ sudo apt-get install awesome awesome-extra

But from there, it got tricky. I expected to log out of my current desktop and be able to switch desktops into Awesome. But Awesome wasn't on the list of desktops. After lots of poking around, I found out why. While Awesome is configured by default, it is also disabled by default. To enable it, you ned to edit /usr/share/xsessions/awesome.desktop and set NoDisplay to false:

[Desktop Entry]
Encoding=UTF-8
Name=awesome
Comment=Highly configurable framework window manager
NoDisplay=false
TryExec=awesome
Exec=awesome
Type=Application

Once that is done, Awesome will show up on the list of desktops in LightDM when you log in. After you're logged in, you can begin to get a feel for Awesome and start tweaking it to your needs.

06 Mar

How to use Ubuntu's Upstart to Control Node.js Forever

in linux, node.js, system administration, ubuntu

Recently I needed to start a server written in Node.js. This server was deployed on Ubuntu 12.04, and I wanted it to be started using the system's init system. Yet I also wanted the safety of Forever, a script manager for Node.js.

Ubuntu still supports the classic SysV init style, but it also now supports the far more sophisticated Upstart system. It is appealing for a few reasons: One is that it feels simpler and cleaner. Another is that it is more powerful and easily more configurable. I decided to use it for my scripts.

This article explains how to use Upstart, Forever, and Node.js together to run a Node.js server as a daemon process that is automatically started at system startup, and automatically stops at shutdown or reboot.

27 Feb

Installing GlusterFS on HP Cloud

in cloud, devops, gluster, hpcloud, openstack, system administration

Gluster is a distributed filesystem that works well in the cloud. This post explains how to configure GlusterFS on an Ubuntu 12.04 image running in HP's cloud.

Using this setup, I gain all the benefits of a distributed and replicated (redundant) filesystem for my in-cloud services, and can back these servers to persistent block storage if I want. It's a great way to gain stable networked filesystems in the cloud, and reduce or eliminate single points of failure.

17 Dec

Run Node.js apps on low ports without running as root

in node.js, programming, system administration

On Linux (and UNIX), to open a port with a number less than or equal to 1024, traditionally a program must run as the root user. This impacts web applications, which use ort 80 (HTTP) and port 443 (HTTPS) to do business. Many programs (Apache being a great example) use this by running a master process as the root user, and farming work off to helper processes that run with lower privileges. But Node.js is designed to work on a single-process model. So how do you run Node.js apps on low ports without running the script as root?

I looked at a number of solutions, and one suggested by my company's security team seems to be the best solution: For operating systems that support capabilities setting (like Ubuntu 12.04 and later), you can configure the operating system to allow non-privileged apps to listen on low ports. Here I show how to do it, and then briefly explain what is going on.

14 Nov

Configure iTerm2 To Act Like Visor

in os x, system administration

iTerm as VisoriTerm as VisoriTerm2 is a replacement for the built-in Mac terminal app. It provides many terminal features you may be used to from other systems (ahem, Linux), as well as some unique features and tools.

When it comes to OS X integration, iTerm2 has some amazing capabilities. You can even configure it to emulate Visor. Here I explain how to configure iTerm2 to slide down from the top of the screen like a Quake-style Visor. You can get an idea of what this looks like from the image on the left (click on it for a full-sized version). The borderless terminal window slides down from the top when focused, and then slides back up when not used. Never again will you need to hunt through your open windows looking for the terminal.

By mapping the visor to a hotkey, it becomes easy to quickly access a shell wherever you are without even taking your hands off the keyboard. And then, just as easily, the terminal can be dismissed. This article explains how to set up a visor-like terminal and then map a hotkey.

You can set up iTerm2 to do this in only three steps.

26 Oct

Five Reasons for Doing Drupal Development on a VM

in drupal, pear, php, programming, system administration

In years past, I used to do my development on a local machine, and then push my work to a remote server for testing. About two years ago, though, I switched my environment. I began using virtual machines instead of physical servers. Configuring them for Drupal, I could do my Drupal development locally, and then do advanced testing on my virtual machine.

In this article, I give five reasons why I believe Drupal development can be enhanced through using VMs.

26 Aug

Compiling varnishstat, varnishtop, and varnishhist

in system administration, varnish

I noticed recently that on one of my Debian systems, my installation of varnish did not have any of its monitoring utilities installed. /usr/local/bin was missing varnishstat, varnishtop, varnishhist, and varnishsizes.

I re-ran configure and make a couple of times. I couldn't find any errors, yet none of these programs was ever compiled.

16 Apr

Linux/UNIX/OS X: How to find and combine multiple files

in linux, mac, os x, system administration, unix

This explains how to use a UNIX-like command line (including Linux and OS X) and the find command to search through a subdirectory and find all of the files with a certain extension, and then combine those all into one file. Surprisingly, this isn't a difficult task. It can be accomplished with one command on the command line:

$ find ./src -name '*.txt' -exec cat '{}' \; > test.txt

The above looks through everything in the ./src directory (including all subdirectories) for any files with the .txt extension. Each file it finds, it adds to test.txt. So at the end of the command's run, all of the text files will be combined together into text.txt. You can use this strategy to easily combine lots of files into one.

Using find, it's easy to customize the command above to do all kinds of things with files. I gave a few examples in an earlier post about the UNIX find command.

15 Apr

mkdir: Creating multiple subdirectories in one command

in linux, system administration

Often times, I want to create a full directory structure, and I'd like to do it with just one call to mkdir. That is, I want to create a root directory and multiple subdirectories all at once. Here's how to do this.

mkdir -p myProject/{src,doc,tools,db}

The above creates the top-level directory myProject, along with all of the subdirectories (myProject/src, myProject/doc, etc.). How does it work? There are two things of note about the command above:

  • The -p flag: This tells mkdir to create any leading directories that do not already exist. Effectively, it makes sure that myProject gets created before creating myProject/src.
  • The {} lists: The technical name for these is "brace expansion lists". Basically, the shell interprets this as a list of items that should be appended individually to the preceding path. Thus, a/{b,c} is expanded into a/b a/c.

You can nest brace expansion lists. That means you can create more complex sets of subdirectories like this:

mkdir -p myProject/{src,doc/{api,system},tools,db}

Notice that this creates two directories inside of doc/.