Tag Archives | linux

Daemon-ize your processes on the cheap!

Or, Death to /etc/rc.local!

TL;DR, or The Executive Summary: Init scripts are hard. Here’s a bunch of UNIX background backing up an argument for using stand-alone Process Supervisors whenever you need a new instance of a custom daemon spun up.

The setup

Picture. if you will, a pile of code.

Yeah, that’s good. The software equivalent of THAT mess.

If you write software, good odds that you’ve written at least one of these steaming sadness piles. If you work in operations, there’s better odds that you’ve been handed at least one failure-pile (this week). You or someone a lot like you needed a message consumer, some new hotness message bus, a stand-alone process that just listens for specific connections and commands on some random port or socket, or just some long-running process that runs non-interactively in the background (this being the very definition of daemon, by the way) and now this thing needs to run in production. In the wild. In the world at large, with other, nicer or bigger daemons grinding up page-to-page with it.

Invariably, the communication or documentation attached to this pig-pile of meadow-muffin-code almost always looks like this:

“Oh, just execute this and Bob’s Your Uncle, we’re all set! Just stick it in /etc/rc.local!”

    LD_LIBRARY_PATH=/some/crazy/nonstandard/path \
    /path/to/some/executable \
      OPTION OPTION OPTION OPTION OPTION >> /dev/null 2>&1 &
Say whaaaaaaaaaat?

Yeah… we’re not doing that. Why? For so, so many good reasons — redefining global variable scope, no PID tracking, no management, it gives me hives, because I said so, etc. ad infinitum.

Continue Reading →

Hosting control panels

For about 6 years I’ve pondered the nature of web hosting control panels.
When I ran a web host, I played with CPanel, Plesk, and DirectAdmin. I’ve since dabbled in the open source waters of Webmin and Usermin, and of late I’ve even poked at VHCS and OpenPanel. I have, to date, not seen a single control panel that is precisely what I want (with DirectAdmin coming closest, and almost being a winner if not for its tiered reseller model aaaaannnd price tag). The real sticking points come down to the fact that I want:

  • The control panel to write human-readable, reasonable configuration files: This is where Webmin falls down on the job. The config files are valid, but god are they awful to read.
  • No mention or hint of reseller anything: I just want administrative accounts running the show and hosted accounts with domains linked to them. Maybe some way for the hosted to monkey with the non-essentials of their own accounts. So on the grounds of overkill, pretty much every commercial panel fails my simple needs.

  • Email support for something that’s not antiquated: some panels use qmail (or some version therein, which hasn’t had a proper update in years), some use sendmail (which is older than dirt and half as secure), and some use whatever the flavor of the month is (read: whatever ships on the supported OS distro). Me? I’m a postfix guy. I’m not wedded to it per se, but it’s updated, feature packed, works well and its configuration is only modestly arcane (qmail, by the way, fails due to having an arcane configuration file structure that doesn’t plug into antivirus or spam very easily).

    Regarding IMAP and POP support, I find that these panels often use their own “questionable” clients, or rely on courier. There isn’t really anything wrong with that, I just like dovecot more (to be fair, DirectAdmin supports dovecot last I checked).

    I don’t want to even get started with authorized SMTP support from these packages. God, the horror.

  • No byzantine dependencies: Don’t tell me that I need some god awful fossilized encryption library or ldap to make this system work.

    “Listen here, Mr. Control Panel, I don’t use LDAP, and unless that is what
    you’re using as a backing store for your hosting information, neither should you.”

To that end, I’ve begun playing with Ruby and Thor to whip up some simple add/delete scripts (with initial success!), and the biggest stumbling block I’ve encountered so far is just parsing out the accounts that exist.

The Apache configuration file format is… archaic in its own right, being neither XML nor attribute: value pairs. It’s readable, but there is a reason that an entire perl package (HTTPD::Config, which may or may not exist anymore) was produced just to scrape httpd.conf files.

I fear that without stepping back a little and engineering a proper solution I’m just going to wind up reimplementing what I encountered when I did overnight support for Reality Check Networks (no link provided, because, well, you know. Those dudes…).