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)
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:
- Unpack the included rootfs image (ubuntu-10.10.tar.gz)
- Generate LXC configuration file and fstab file.
- Setup container paths (UI allows host directories to be easily mounted)
- Configure SSH keys for the root user.
- Configure networking (/etc/network/interfaces, /etc/hosts with container name)
- 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.