<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Errata &#187; Debian</title>
	<atom:link href="http://taz.net.au/blog/category/geek/debian-geek/feed/" rel="self" type="application/rss+xml" />
	<link>http://taz.net.au/blog</link>
	<description>Tech Notes And Miscellaneous Thoughts</description>
	<lastBuildDate>Thu, 03 Jul 2008 11:14:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>poll: package my vhosting system for debian?</title>
		<link>http://taz.net.au/blog/2008/04/29/poll-package-my-vhosting-system-for-debian/</link>
		<comments>http://taz.net.au/blog/2008/04/29/poll-package-my-vhosting-system-for-debian/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 10:46:11 +0000</pubDate>
		<dc:creator>cas</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://taz.net.au/blog/?p=8</guid>
		<description><![CDATA[There was a discussion today on the LUV-main mailing list about apache virtual hosting. Someone suggested mod_vhost_alias which is OK for a simple solution, but pretty limited. IMO, there are much better ways of doing it. Specifically, generating config fragments for each virtual host. I wrote such a system years ago, and have always thought [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>There was a discussion today on the <a href="http://lists.luv.asn.au/wws/arc/luv-main"> LUV-main </a> mailing list about apache virtual hosting. Someone suggested mod_vhost_alias which is OK for a simple solution, but pretty limited.</p>
<p>IMO, there are much better ways of doing it.  Specifically, generating config fragments for each virtual host.</p>
<p>I wrote such a system years ago, and have always thought &#8220;I should package it up for debian&#8221;. There&#8217;s a moderate amount of work involved in doing so, and probably an even larger amount of support work afterwards.  Worst of all, I&#8217;d have to write &#8211; or con someone else into writing &#8211; documentation for it (it&#8217;s easy enough to use that you can be SHOWN how to use it in 10 minutes, but that isn&#8217;t good enough for a distributed package).</p>
<p>I guess the point of this blog post is to <b>find out if there&#8217;s sufficient interest to make it worth the effort</b>.  Feel free to comment or email me about it.</p>
<p><span id="more-8"></span></p>
<p>If anyone wants to look at the code, i can tar it up easily enough, and even write some simple/minimalist instructions.</p>
<p>anyway, here&#8217;s (a slightly edited version of) what i posted to LUV-main:</p>
<h3> Preamble </h3>
<p>I looked into apache&#8217;s mod_vhost stuff years ago, but IMO it&#8217;s just too inflexible and limited to be of much use. It&#8217;s fine if ALL your vhosts are identical&#8230;but not if you need different settings on some or all of them. As soon as you need a custom setting for one vhost, you have to step outside mod_vhost_alias and roll-your-own anyway. which means you now have two different methods of configuring your vhosts.</p>
<p>Instead, I&#8217;ve used my own vhosting system for years (long before mod_vhost), on dozens of servers&#8230;the largest of which had over 500 vhosts on it &#8211; the biggest problem was the enormous number of file handles the apache processes needed for log files.</p>
</p>
<p>After tweaking the kernel file-max etc limits, it actually worked without problem but I always intended to rewrite that bit of it to use a log splitter daemon, perhaps vlogger or similar.  Unfortunately, I a) left that job before I had time to implement it, and b) never did figure out a good way to handle the error logs because apache doesn&#8217;t prefix the vhost name to ErrorLog output like it does for CustomLog outout (best compromise was to just have one combined error log rather than one per vhost&#8230;.most web programmers/website operators never look at the error logs anyway. Personally, I find it invaluable, most people don&#8217;t even seem to think of looking at it)</p>
<h3> Synopsis of Operation </h3>
<p>1. Creating a new vhost is a 3-step operation:</p>
<ol>
<li>create a user (with adduser), optionally with a postgres or mysql account of the same name.</li>
<li>edit /etc/virtuals/virtual-hosts.conf, copy/paste/edit one line</li>
<li>run &#8220;make&#8221;</li>
</ol>
<p>In step 2, hardly anything needs to be changed from one vhost to another &#8211; in the most common case, just the account&#8217;s login name, and the domain name.  There are a number of different &#8220;flags&#8221; that can be set for each vhost in this file &#8211; ssl, cgi, mason, htdig, webcheck, aliases, group, samba, canonify (use mod_rewrite to redirect back to the site&#8217;s canonical name), and more.</p>
<p>The Makefile runs perl scripts to generate the apache config fragment (and other config fragments &#8211; e.g. for htdig and samba), add/remove any IP addresses if needed (usually not, with name-based vhosts), set up the home directory structure, copy in any sample files (e.g. html forms and images for htdig), and reloads apache. It also checks in any changes to svn (or RCS.  easily modified to use other revision control systems).</p>
<p>On machines which are part of a load-balanced setup, it even ssh-es into other machines in the array, runs &#8220;svn update&#8221; and &#8220;make&#8221; to ensure that the vhost is operational on the other machines too.</p>
<p>Finally, it concatenates all the active config fragments into one large file because apache reloads a LOT faster if it doesn&#8217;t have to load hundreds of little config files.</p>
<p>2. Removing a vhost is as simple as editing virtual-hosts.conf and commenting out or deleting the line, then running make again.</p>
<h3> virtual-hosts.conf </h3>
<p>The virtual-hosts.conf file is extremely useful. It gives me a single authoritative source of all the relevant details about EVERY vhost running on a machine. These details can be used by other scripts (e.g.  cron jobs to run webalizer, analog, htdig indexing, webcheck, etc; cgi scripts to display a list of vhosts on the machine with clickable links, and more).</p>
<p>This single config file makes the whole system easily extensible: write a new script to parse the config file, and loop through each entry, performing some relevant operation. e.g. run webalizer for every vhost, dumping the output under ~/public_html/LOGS/ (with optional .htaccess file to control access).  Adding optional generation of samba shares for each vhost was quite easy.</p>
<p>In theory, it wouldn&#8217;t be hard to put a GUI or web front-end on to it. Oddly enough, i&#8217;ve never bothered.  And I&#8217;m not inclined to bother now (but wouldn&#8217;t object if anyone else did)</p>
<h3> Database? no, thanks </h3>
<p>I&#8217;ve occasionally thought about putting this config data into a database, but the benefits just aren&#8217;t anywhere near good enough to outweigh vi and all the benefits of text file configuration (especially comments!)</p>
<h3> Packaging? </h3>
<p>And, of course, one of these days, i should package it all up for debian.  I&#8217;ve been saying that for years, and just haven&#8217;t got around to it. It wouldn&#8217;t take a huge amount of work to do so, there are only a few small things i need to do to automate the installation, things that i just do by hand in a few minutes when installing on a new box.</p>
<p>Before packaging it, I also want to automate the adduser part of the process, as well as creation of postgres or mysql accounts.  Most importantly, I ought to separate the code from the templates in the config fragment generator scripts, so that the local sysadmin can edit them without having to edit the scripts&#8230;.OK, all up not a tiny job but not particularly big either&#8230;.just big enough to be ignored on my TODO list for years.</p>
<p>I&#8217;d definitely have to change the config file format from the current one-line (colon separated fields) to using a .ini style file.  I&#8217;ve wanted to do that for a while but have inertially-resisted it so far because the one-line format is so convenient&#8230;unfortunately, I&#8217;ve added so many flags and features over the years that it&#8217;s seriously ugly &#8211; probably scary to someone who doesn&#8217;t know it already (i.e. anyone outside of the set of &#8220;me + a handful of other people&#8221;).  I estimate this would take about a days worth of hacking</p>
<p>I&#8217;d also take the opportunity to clean up some of the cruft :-)</p>
<h3> Essential Design Criteria </h3>
<p>BTW, one crucial design criteria for my system is that it should *NEVER* under any circumstances overwrite any hand-edited changes.</p>
<p>This is implemented in a number of ways. First, it takes an md5sum of each vhost&#8217;s config fragment when it generates it. If/when the script is run again, it only re-generates the config fragment if the md5sum hasn&#8217;t changed. If it has changed, it generates the updated fragment as &#8220;.new&#8221; for manual merging if required. Secondly, when generating conf fragments it looks for specially named files in a directory for extra stuff to add before the &lt;VirtualHost&gt; line, between the &lt;VirtualHost&gt;&#8230;&lt;/VirtualHost&gt; lines, and/or after the &lt;/VirtualHost&gt; line. This is to provide another location to put custom changes for each vhost while still retaining the ability to have improvements/new features to the script automatically applied to existing vhosts.</p>
<p>The reason for this is that I utterly loathe and despise allegedly &#8220;easy&#8221; configuration tools that blow away custom hand-edited changes.  I hate them so much that this was THE major incentive for developing my own vhosting system.</p>
<h3> In Use </h3>
<p>I&#8217;ve been using my system for over 10 years now. It grew out of earlier bits and pieces, but the current incarnation has been working since 1999, with the occasional new feature or update (e.g. to add support for apache2 as well as apache1, and minor changes to adapt to changes in debian&#8217;s apache packaging).</p>
<p>There are also a handful of ISPs and several small businesses around Australia running it because they&#8217;ve hired me to set up their web servers.</p>
<h3> Finally&#8230; </h3>
<p>My vhosting system isn&#8217;t a system for people who are scared of or dislike command-lines or text-file configs.  It&#8217;s a system for people who love them, but want an easy way to automate a dull, repetitive task.  Such automation is easy for CLI tools, and next to impossible for web/GUI tools.</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://taz.net.au/blog/2008/04/29/poll-package-my-vhosting-system-for-debian/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Keeping apt archives empty&#8230;or not.</title>
		<link>http://taz.net.au/blog/2008/04/26/keeping-varcacheaptarchives-empty/</link>
		<comments>http://taz.net.au/blog/2008/04/26/keeping-varcacheaptarchives-empty/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 06:34:03 +0000</pubDate>
		<dc:creator>cas</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://taz.net.au/blog/?p=5</guid>
		<description><![CDATA[In this post, Steven Hanley wonders how to keep /var/cache/apt/archives empty on a machine that has a full mirror of debian on it. That&#8217;s actually the wrong question. The right question is &#8216;Why is /var/cache/apt/archives even relevant on a machine with a full mirror of debian?&#8217; /etc/apt/sources.list has always supported file:/ URLs. for example, sources.list [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://svana.org/sjh/diary/2008/04/23#2008-04-23_01">this post</a>, Steven Hanley wonders how to keep /var/cache/apt/archives empty on a machine that has a full mirror of debian on it.</p>
<p>That&#8217;s actually the wrong question.</p>
<p>The right question is &#8216;Why is /var/cache/apt/archives even relevant on a machine with a full mirror of debian?&#8217;</p>
<p>/etc/apt/sources.list has always supported file:/ URLs.  for example, sources.list on my local debian mirror looks like this:</p>
<pre>
deb file:/home/ftp/debian unstable main contrib non-free
deb file:/home/ftp/debian-multimedia/ unstable main
</pre>
<p>With a file URL, apt-get doesn&#8217;t need to download any packages, and thus doesn&#8217;t need to cache anything in /var/cache/apt/archives.  No need to keep it empty, it just is empty.</p>
<p></p>
<p>In a <a href="http://blog.andrew.net.au/2008/04/22#not_caching_acquired_debs">related post</a>, Andrew Pollock suggests adding <i>DPkg::Post-Invoke { &#8220;apt-get clean&#8221;; };</i> to /etc/apt/apt.conf.</p>
<p>That would be fine if you <b>ONLY</b> ever ran &#8220;apt-get update ; apt-get dist-upgrade&#8221;.</p>
<p>It&#8217;s not fine if you run &#8220;apt-get -d&#8221; to  download packages first, then install a few packages with &#8220;apt-get install package&#8221;, and then run &#8220;apt-get dist-upgrade&#8221;.  </p>
<p>If you try that, then the DPKG::Post-Invoke rule will clean out /var/cache/apt/archives when you install the individual package(s).  When you then run the dist-upgrade, apt-get will have to download all the packages again.</p>
<p>Better just to get into the habit of running apt-get clean or autoclean occasionally when you want to reclaim some disk space.</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://taz.net.au/blog/2008/04/26/keeping-varcacheaptarchives-empty/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
