Remote API, and apache server.

I’m growing more and more inclined to formally write a webmin module (or virtualmin module?) that handles not just local Apache, but apache across several physical systems.

I might have time to start on this today, but I have some questions (of course!).

  1. The webmin/virtualmin remote API - is it fully aware of Apache’s configuration? IE, is there anything in place to push config changes to remote boxes?

  2. Is this something that is already being worked on that I could lend a hand on rather than starting a new one?

My intention is to set the module up where a prerequisite is that the boxes have some form of shared storage (smb/nfs/afs/etc) that allows them to access the hosted files at the same filepath, and that they have the same apache build and config. Webmin simply updates the configs on the fly, keeps track of stop, start, and restart status.

The upshot of this is that there needs to be a load balancer in front of these boxes. I was going to write a wrapper script for ifconfig to handle this, that updates my load balancer, and maybe have webmin updating dummy0. haven’t decided yet. Thoughts?


This sounds very interesting, ive got a few questions (excuse my newbie ignorance if ive missed something entirely):

  • Is the intention here for redundancy? Or are u intending to simply create a managed network?
  • If redundancy have you looked into clustering? I.e.
  • Some detail on the application would be helpful.

Im very interested in developing a clustered environment similiar to this for my business, which would have multiple, concurrent instances of client accounts.



I didn’t have time to get on this today as I’d hoped, but I’ll answer your questions regardless. :slight_smile:

This could be used either for fault tolerance or “clustering” (I prefer the term farm, as these aren’t acting as a single cpu instance, but the term cluster gets used so much these days…). In fact, it would be able to do both.

In my situation, I have a couple of load balancers in deployment already. These are fault-tolerant, and I can assign a pool of port 80 systems to forward requests to, the only requirement is that the systems can all respond to those requests more or less identically. The module I’m looking to create allows you to do that from Webmin/Virtualmin.

My question was basically whether I could use the extant API’s to handle application state (ie, is the remote apache running? stopped?) and whether there was an extant way to send over updated configs for apache (I’m thinking not).

In the case that there is no way to push configs, I’m thinking of creative rsync use. Haven’t decided how to go about that exactly yet.

Hey Tony,

I think you’ll be pleasantly surprised by how much of this stuff is available in the API (primarily the Webmin API), and how tightly you can integrate it into the Virtualmin interface.

Here’s what I would do, were I embarking on this job:

Create a Virtualmin plugin (Cluster Web Service, or something). A Virtualmin plugin is just a special case of Webmin module…it has a couple of extra hooks, and doesn’t have to have a GUI. The extra hooks allow you to add a checkbox on the Create/Edit Virtual Server page, which you could label “Add to web server cluster”.

That’s the easy part.

Now, to get the other stuff, you’ll want to use Webmin RPC to call out to one or more remote servers to add the new domain to the Apache on those systems (every function in can be called remotely, so you could mirror the Virtualmin steps on the remote machines). This bit is easy on creation, but gets more difficult on changes (like installing scripts or whatever, where Virtualmin makes changes to the httpd.conf on the master…). Actually, it may be necessary, or at least easier, to make the changes in the core code, now that I think of it, since you’ll have roughly identical activity on each machine.

It sounds like you’ve abstracted away some of the details that make your case a special case that might be easier, so you might use the Cluster Copy Files module to ship off the updated configuration files after any changes and RPC calls to restart Apache. If you don’t have to deal with a different IP on each machine, then a simple copy will do the trick. I think, for a general solution, we’ll have to address the different IP problem–so the above direct Apache configuration stuff will have to happen.

Hi Tony,

I second Joe’s suggestion about doing this as a Virtualmin plugin. Basically, it could be done by writing a plugin that adds a new feature, which when enabled would copy the Apache config for the virtual server to all hosts in the cluster.

This copy could be done with scp, or with Webmin’s RPC call feature to the Apache module on the remote systems. You can find documentation on writing a plugin at … for your case, you would only need to implement the feature_name, feature_label, feature_setup, feature_delete and feature_modify functions.

Let me know if you have any questions about plugin development…

Thank you for the replies. This is likely to be simpler than I thought, thankfully. If all I have to deal with is replicating the configs using the built-in API, then it should be dead simple. The problem I foresee arising is the fact that Virtualmin pretty much insists on creating virtual interfaces locally, or that an IP address that’s used in a virtual host actually exist (which usually makes sense, but here not so much).

Not sure how to get over that hurdle, unless, as I said, I create an ifconfig wrapper script that basically lies to Webmin. :stuck_out_tongue:

Oh, and to deal with the “on change” situation, Joe, if I were to use rsync, I could just rsync the config files on apply, or on change, couldn’t I?

There is actually an option on the Module Config page that tells Virtualmin not to check or create interfaces itself - instead, it will assume that you are going to set them up manually. It is called ‘Bring up virtual interfaces?’ under the ‘Other server settings’ section…

Ah, thanks for that. Somehow I’d overlooked it!

(Now the problem is that I need them created, just no locally…but that can be handled from the module!)

Also, we both really ought to learn to stop working. :wink:

Webmin CGIs generally don’t work too well when run from the command line … you should try it from the web instead.

Okay. :slight_smile:

Error - Missing Content-Type Header

Thus the reason I ran it from the command line. :smiley:

Now what?

Hmm … I presume this module is in a sub-directory under /usr/libexec/webmin (a real directory, not a symlink to elsewhere) ?

Yeah. Really confused. : usually I can run from the command line to find the error, but in this case, it more or less is telling me that init_config isn’t available. Any way to get to spit out some useful logging?

I found miniserv.error in /var/webmin, which is nice and all, but um…

[[19/Apr/2007:19:04:24 -0500]] Reloading configuration
[[19/Apr/2007:19:04:31 -0500]] [[]] /apache-cluster/ : Missing Content-Type Header
[[19/Apr/2007:19:06:04 -0500]] [[]] /apache-cluster/ : Missing Content-Type Header
[[19/Apr/2007:19:07:13 -0500]] [[]] /apache-cluster/ : Missing Content-Type Header
[[19/Apr/2007:19:07:16 -0500]] [[]] /apache-cluster/ : Missing Content-Type Header
[[19/Apr/2007:19:14:24 -0500]] [[]] /apache-cluster/ : Missing Content-Type Header

That’s not useful. I already knew that. :slight_smile:

Ugh, nevermind.

I didn’t have +x on the files in that directory. Don’t know why I didn’t think of that before. :frowning:

Sorry for being a pest tonight, one last question -

I’m looking at the cluster file copy module, and wondering whether it would be wiser to somehow use Webmin’s API and instruct the system to “do the copy right now”, or use another method, as I need to somehow delegate replica systems from non-replica systems.

I’m open to ideas. The other thought I had was polling interest from the community here and if there’s significant interest in having this done a certain way, open a bounty on it so I dedicate additional labor hours to doing it the way the community would be happy with (as I’m seeing webmin can actually manage user permissions as well, it would actually be possible for webmin to handle the whole thing, presuming that a webmin box were the load balancer too…not my configuration, but certainly feasible).

For the copy, have a look at how the cluster copy module does it - basically, it uses the remote_write function, which can transfer a file from one Webmin server to another via an RCP-over-HTTP request. Of course, this would only work if you have each domain’s Apache config in a separate file, which is the default for most Linux distros …

Actually, it isn’t default on FreeBSD, but then I reconfigured it to be that way. :slight_smile:

I guess I should put a check for that - or httpd.conf would get transferred every time.

I think I’d prefer to keep the number of bundled modules / scripts in Webmin low for now… Unless there end up being many many modules using them.

Perhaps a better solution would be for this .js files to be packaged in a Perl module, that can be installed on systems running your Webmin module. That said, the overhead of a few .js files in minimal.

That’s okay, I came up with another solution - I made a Scriptaculous module. :slight_smile:

I’d post it, but can’t find the instructions for bundling a .wbm. :slight_smile: