Gentoo Archives: gentoo-dev

From: Stuart Herbert <stuart@g.o>
To: "Robin H.Johnson" <robbat2@g.o>, gentoo-dev@g.o
Cc: Donny Davies <woodchip@g.o>
Subject: Re: [gentoo-dev] [GLEP] Web Application Installation. Plotting a VHOST config tool.
Date: Wed, 06 Aug 2003 12:50:55
In Reply to: Re: [gentoo-dev] [GLEP] Web Application Installation. Plotting a VHOST config tool. by "Robin H.Johnson"
1 On Wednesday 06 August 2003 5:37 am, Robin H.Johnson wrote:
2 > Ok, so if -vhosts, we install to /usr/share/webapp/(whatever) and
3 > automatically run the webapp-config tool ?
5 Yeah, I think that'd be good, especially if we bring in the move to
6 /var/www/localhost as the new default location for -vhosts systems.
8 > if +vhosts, we install to /usr/share/webapp/(whatever) and the
9 > administrator is left to run the rest himself.
11 Definitely.
13 > As part of the planning, and a good first step
14 > I'm plotting out a config tool for adding vhosts. All comments welcome
15 > as this is intended to be a good outline of what the tool must do etc
16 > before I write it (borrowing heavily from my exist custom scripts for
17 > the purpose).
19 Off the top of my head, here's a partial wish-list:
21 * add new vhost
22 * destroy existing vhost
23 * suspend vhost, but do not destroy
24 * add <webapp> to <location> inside <vhost>
25 * upgrade <webapp> at <location> inside <vhost>
26 * remove <webapp> at <location> inside <vhost>
28 The config tools are going to need to emulate CONFIG_PROTECT behaviour; either
29 that, or we'll need some improvements to be made to Portage.
31 For now, I suggest we treat database creation/upgrades/etc as out-of-scope,
32 unless someone wishes to step forth from the shadows with a plan for this?
34 > Stuart: once before you asked why I didn't use dynamic vhosts.
35 > Two reasons behind it. Firstly, I want seperate log files for each
36 > vhost,
38 Excellent point.
40 > and secondly I have a lot of apache configuration directives that
41 > vary per server (funky mod_rewrite stuff mainly to make variable
42 > handling in php interesting).
44 Grin.
46 > Based on this, I strongly believe that
47 > 'simple' vhosts are the best way to go in general.
49 Then let's do it.
51 > I feel the name 'htdocs' belies the meaning of the directory more
52 > accurately, but I'm looking for input on that item.
54 +1 for htdocs.
56 > Rough outline of tool:
57 >
58 > vhost-config must do three things:
59 > - creates directories (copies a skeleton directory for the most part).
60 > - create apache vhost config files.
61 > - HUP apache so it reads in the new config without stopping.
62 >
63 > Proposed rough usage:
64 > vhost-config [opts]
66 [snip]
68 The options look good. The only additional behaviour I'd suggest is to create
69 symlinks from ~<user>/vhosts/<FQDM> to /var/www/<FQDM>, to make it easier for
70 people with shell accounts on the box to find their own domains.
72 How about making /var/www/<FQDM> chmod'd 750 by default, and owned by the
73 apache group by default? On shared boxes with shell accounts, this'd mean
74 that apache can serve the files, but other shell accounts can't take a peak.
76 > /etc/vhost-skel/ might contain:
77 > htdocs/ = maybe a simple index.html ?
79 Yes. I'd go further and make it a symlink to a default index.html page, so
80 that changes to a master copy are automatically picked up for domains that
81 have been created but left unused.
83 > conf/ = [treated specially] ${server}.conf that is used for creating the
84 > initial config, templates of some sort (I'm leaning to M4 as all my
85 > existing stuff is in it, and it's good for templating like this).
87 /me hates m4 ;-)
89 What are you going to write the tools in? Python, bash, PHP, or something
90 else?
92 > After vhost-config has generated all of the nessicary stuff, it should
93 > HUP the apache server if everything is in order.
95 Yup.
97 > There is one check that is outside the scope of the tool, namely the
98 > existance of DNS for the specified hostname. If the admin creates a
99 > vhost that does not yet have DNS or name resolution relative to the
100 > system, we should display a warning.
102 I like this. Maybe the default behaviour could be to throw an error, and
103 supply a '--force' option to downgrade to a warning?
105 > I'd repeat again for good measure, this email is strongly based off the
106 > present capabilites of my private vhost setup scripts, plus the features
107 > I as a developer, sysadmin and user want in a new revision. However I
108 > strongly feel that more input is needed as well.
110 Well, you've got mine now ;-)
112 Webapps aren't the only type of application that can take advantage of a
113 vhosts solution. Games servers such as the Half-Life Dedicated Server (HLDS)
114 can also benefit from being deployed into a vhosts-type scenario.
116 Obviously, there are important differences, which means that the exact same
117 tool can't be used to manage both. But, if we can identify and extract out
118 common elements so that they can be re-used by different scripts, that might
119 help validate both the design and the implementation.
121 Take care,
122 Stu
123 --
124 Stuart Herbert stuart@g.o
125 Gentoo Developer
126 Beta packages for download
128 GnuGP key id# F9AFC57C available from
129 Key fingerprint = 31FB 50D4 1F88 E227 F319 C549 0C2F 80BA F9AF C57C
130 --