<?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>Oremj's Blog &#187; System Administration</title>
	<atom:link href="http://blog.mozilla.com/oremj/category/system-administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.com/oremj</link>
	<description>Just another Blog.mozilla.com weblog</description>
	<lastBuildDate>Tue, 27 Oct 2009 19:12:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordpressMU: changing domain names.</title>
		<link>http://blog.mozilla.com/oremj/2009/10/27/wordpressmu-changing-domain-names/</link>
		<comments>http://blog.mozilla.com/oremj/2009/10/27/wordpressmu-changing-domain-names/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 19:12:51 +0000</pubDate>
		<dc:creator>oremj</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.mozilla.com/oremj/?p=45</guid>
		<description><![CDATA[Unfortunately, changing domain names in WordpressMU is a manual process. It&#8217;s something I&#8217;ve come across often and have to look it up each time. Here&#8217;s what I did, so I don&#8217;t have to look it up again. Original idea from Boris Masis.
1. Drop and run this script in the root wpmu directory:
&#60;?php
define('WP_INSTALLING', true);
require_once('wp-load.php');

$old_domain = 'olddomain.com';
$new_domain [...]]]></description>
			<content:encoded><![CDATA[<p>Unfortunately, changing domain names in WordpressMU is a manual process. It&#8217;s something I&#8217;ve come across often and have to look it up each time. Here&#8217;s what I did, so I don&#8217;t have to look it up again. Original idea from <a href="http://www.borism.net/2008/12/02/changing-domainsenvironments-in-wordpress-mu/" class="extlink">Boris Masis.</a></p>
<p>1. Drop and run this script in the root wpmu directory:</p>
<pre>&lt;?php
define('WP_INSTALLING', true);
require_once('wp-load.php');

$old_domain = 'olddomain.com';
$new_domain = 'newdomain.com';

$query = "UPDATE wp_site SET domain = '$new_domain' where domain = '$old_domain'";
$wpdb-&gt;query($query);

$query = "UPDATE wp_blogs SET domain = REPLACE(domain, '$old_domain', '$new_domain')";
$wpdb-&gt;query($query);

$querystr ="SHOW TABLES LIKE 'wp_%_options'";

$tables = $wpdb-&gt;get_results($querystr, ARRAY_N);

echo count($tables);
$query = "";
if ($tables){
  foreach ($tables as $table){
    $query = 'UPDATE '.$table[0]." SET option_value = REPLACE(option_value,'$old_domain','$new_domain')";
    $wpdb-&gt;query($query);
  }
}
?&gt;
</pre>
<p>2. Edit wp-config.php and set &#8220;DOMAIN_CURRENT_SITE&#8221; to the appropriate domain.</p>
<p>That&#8217;s it, everything should work properly.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.mozilla.com/oremj/2009/10/27/wordpressmu-changing-domain-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Operations Status Dashboard</title>
		<link>http://blog.mozilla.com/oremj/2009/09/21/operations-status-dashboard/</link>
		<comments>http://blog.mozilla.com/oremj/2009/09/21/operations-status-dashboard/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 17:37:05 +0000</pubDate>
		<dc:creator>oremj</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">http://blog.mozilla.com/oremj/?p=38</guid>
		<description><![CDATA[Often when we have an operational issue or outage confusion occurs. We are taking a step to resolve this confusion by creating a status dashboard similar to Google and Twitter. It is mostly a prototype at this point. How can we make this service more useful? Feedback is greatly appreciated.]]></description>
			<content:encoded><![CDATA[<p>Often when we have an operational issue or outage confusion occurs. We are taking a step to resolve this confusion by creating a <a href="http://appstatus.mozilla.com/">status dashboard</a> similar to <a href="http://www.google.com/appsstatus" class="extlink">Google</a> and <a href="http://status.twitter.com/" class="extlink">Twitter</a>. It is mostly a prototype at this point. How can we make this service more useful? Feedback is greatly appreciated.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.mozilla.com/oremj/2009/09/21/operations-status-dashboard/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Efficiently Updating Web Sites on Web Clusters</title>
		<link>http://blog.mozilla.com/oremj/2008/03/14/efficiently-updating-web-sites-on-web-clusters/</link>
		<comments>http://blog.mozilla.com/oremj/2008/03/14/efficiently-updating-web-sites-on-web-clusters/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 17:29:00 +0000</pubDate>
		<dc:creator>oremj</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">http://blog.mozilla.com/oremj/2008/03/14/efficiently-updating-web-sites-on-web-clusters/</guid>
		<description><![CDATA[Recently, we ran in to a problem with our web content sync setup.
Old Setup:

Host all web bits on two admin servers
Pull via rsync  from admin01 server to the apache servers on 5 min staggered cron

That setup worked fairly well for us for quite a long time, but it doesn&#8217;t scale.  At about 18 [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, we ran in to a problem with our web content sync setup.</p>
<p><strong>Old Setup</strong>:</p>
<ul>
<li>Host all web bits on two admin servers</li>
<li>Pull via rsync  from admin01 server to the apache servers on 5 min staggered cron</li>
</ul>
<p>That setup worked fairly well for us for quite a long time, but <strong>it doesn&#8217;t scale</strong>.  At about 18 or 20 apache servers pulling at 5 min intervals the admin server was constantly pegged from all the rsync processes scanning the file system.</p>
<p>We needed something with state, but something that was simple.  Revision control has state, but would the operations be quick enough to be useful?  It turns out <a href="http://git.or.cz/" class="extlink">Git</a> was pretty well suited for the task.</p>
<p><strong>New setup</strong>:</p>
<ul>
<li>Host all bits on admin servers</li>
<li>Commit bits on admin01 on a 5 minute cron in to git</li>
<li>Pull commits via Git to apache servers</li>
</ul>
<p>This new setup scales very well, because we only need one file system scan per 5 minutes instead of 20+.  The Git fetches are very fast.</p>
<p><strong>Initial installation</strong>:</p>
<p><strong>admin01:/etc/xinetd.d/git-daemon</strong>:<br />
<code><br />
service git<br />
{<br />
disable = no<br />
type            = UNLISTED<br />
port            = 9418<br />
socket_type     = stream<br />
wait            = no<br />
user            = nobody<br />
server          = /usr/bin/git-daemon<br />
server_args     = --inetd --export-all --verbose /www<br />
log_on_failure  += USERID<br />
}<br />
</code></p>
<p><strong>Admin01: Import /www</strong>:<br />
<code><br />
cd /www<br />
git-init<br />
git-add .<br />
git-commit -m 'Initial Import'<br />
</code></p>
<p><strong>Apache Servers initial setup</strong>:<br />
<code><br />
git-clone git://admin01/www<br />
</code></p>
<p><strong>Commit Cron on admin01</strong> (add any new files and delete any removed files from the repo):<br />
<code><br />
#!/bin/bash<br />
lockfile="/tmp/git.lock"<br />
if [ -f $lockfile ]; then<br />
if kill -0 $(cat $lockfile); then<br />
echo "$0 appears to be already running."<br />
exit 1<br />
fi<br />
fi<br />
echo $$ &gt; $lockfile<br />
cd /www<br />
/usr/bin/git-add .<br />
/usr/bin/git-commit -a -m "AUTO COMMIT: `date +%FT%T`"<br />
rm -f $lockfile<br />
</code><br />
<strong>Fetch Cron on the apache servers</strong> (fetches origin and then resets the /www to origin):</p>
<p><code><br />
#!/bin/bash<br />
cd /www;<br />
/usr/bin/git-fetch &amp;&amp; /usr/bin/git-reset --hard origin;<br />
</code></p>]]></content:encoded>
			<wfw:commentRss>http://blog.mozilla.com/oremj/2008/03/14/efficiently-updating-web-sites-on-web-clusters/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
