Lexy – A web UI for LXC.

In my free time I’ve been throwing together a web console for managing LXC containers called Lexy. If you’ve never heard of LXC, please check out my previous post or a lot of this won’t make much sense. My goal was to build a UI for easily creating and starting new containers. Once that was working, I wanted the ability to create reusable configuration which took me into the world of Puppet and Chef. I’ve been using Lexy on my local server for a few weeks and so I figured I should get some more eyes on it.


Lexy lets you:

  • Create and configure containers (networking, fstab, etc…)
  • Manage SSH keys associated with containers (like EC2)
  • Start/Stop LXC Containers
  • Manage “user data” scripts (again, like EC2) that are executed at startup.
  • Recycling of containers – nuking and recreating them.
  • Display running processes and the containers syslog.

Here’s some key points on its implementation:

  • Web application in Sinatra.
  • Background application using stalker, for actually manipulating the containers.
  • Data managed by DataMapper and stored in SQLite by default (background process has read-only access)

Container Provisioning

To eliminate some of the magic behind what’s being done, here’a description of the steps Lexy takes when creating and configuring a new container:

  1. Unpack the included rootfs image (ubuntu-10.10.tar.gz)
  2. Generate LXC configuration file and fstab file.
  3. Setup container paths (UI allows host directories to be easily mounted)
  4. Configure SSH keys for the root user.
  5. Configure networking (/etc/network/interfaces, /etc/hosts with container name)
  6. Configure startup scripts (run via rc.local)

There’s a heavy bias here on Ubuntu, it’d be nice to support other root filesystems in the future, but that’s not something I’m intending on adding myself.

I don’t have any big plans feature wise right now. What it could use are some better installation docs. Things aren’t too difficult to get running after you’ve got LXC setup.

Lexy is on github.


5 thoughts on “Lexy – A web UI for LXC.

  1. Stefano

    Good morning.
    Can you explain how execut your application?
    I have cloned it via git, but i can’t run it.


  2. Jacob Post author

    There are some startup scripts under the etc directory that show how to start the web server and the job queue…. Sorry I can’t offer more help right now, when I get some free time I’ll see about beefing up the documentation.


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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s