<?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>Death of a Gremmie &#187; ftplib</title>
	<atom:link href="http://deathofagremmie.com/tag/ftplib/feed/" rel="self" type="application/rss+xml" />
	<link>http://deathofagremmie.com</link>
	<description>by Brian Neal</description>
	<lastBuildDate>Wed, 14 Jul 2010 02:31:19 +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>Server Migration: After Action Report</title>
		<link>http://deathofagremmie.com/2009/05/28/server-migration-after-action-report/</link>
		<comments>http://deathofagremmie.com/2009/05/28/server-migration-after-action-report/#comments</comments>
		<pubDate>Fri, 29 May 2009 00:55:29 +0000</pubDate>
		<dc:creator>gremmie</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[ftplib]]></category>
		<category><![CDATA[logrotate]]></category>
		<category><![CDATA[migration]]></category>

		<guid isPermaLink="false">http://deathofagremmie.com/?p=267</guid>
		<description><![CDATA[Well the dust has settled and everything has been migrated to the new server. The last big thing to move was surfguitar101.com. I started the DNS change Monday morning, and it was only a few hours later that it had propagated to my house, so I was able to switch on the new site. However, [...]]]></description>
			<content:encoded><![CDATA[<p>Well the dust has settled and everything has been migrated to the new server. The last big thing to move was <a href="http://surfguitar101.com">surfguitar101.com</a>. I started the DNS change Monday morning, and it was only a few hours later that it had propagated to my house, so I was able to switch on the new site. However, I made a typo in the ServerAlias line in the Apache configuration file, and the alias <a href="http://www.surfguitar101.com">www.surfguitar101.com</a> wasn&#8217;t working (I really wish people wouldn&#8217;t use that). I started hearing reports that people still couldn&#8217;t get into the site after 8 or 10 hours, but I just figured DNS hadn&#8217;t propagated to them yet. This seemed reasonable at the time, because irc.surfguitar101.com took nearly 20 hours to switch for me. But after a day and a half I checked my configuration, and sure enough, oops, a typo. A quick edit and a restart of Apache and everyone was good.</p>
<p>Things over all went very well. I&#8217;m just glad I several good books on Apache, DNS and bind, and the Postfix mail transfer agent. And again, it was a great decision to get a second server to migrate to instead of thinking I could just reimage the existing server and get everything back in a few hours.</p>
<p>Since I got everything running I&#8217;ve been tinkering around, trying to do a better job of admining this new server. I had a cron job that backed up my databases and SVN repository nightly, but the backups still got stored on the same machine. So I finally broke down and wrote a cool Python script that cron kicks off nightly to transfer the backups to the backup server my host provides. Python is so awesome. I used the Python <a href="http://docs.python.org/library/ftplib.html">ftplib</a> to accomplish this.  It&#8217;s a very useful library, but I thought the interface was kind of odd. You actually have to issue FTP protocol commands as strings, e.g.  &#8220;STOR.&#8221; I think I would have tried to abstract the underlying protocol a bit, but I suppose you get maximum flexibility this way.</p>
<p>I also worked on understanding the System V style startup sequence a bit better. I have several programs that I want to execute as daemons whenever the server is restarted: IRC, my IRC bot, and Teamspeak to name a few. The builtin start-stop-daemon was very useful for this, as well as the script update-rc.d. For my IRC bot, which is written in Python, I found some great code to daemonize it <a href="http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/">here</a> (thanks Sander!).</p>
<p>And finally, now that I have 3 virtual domains running on the server, I got concerned about all the Apache log files. Each website has both an access log and an error log. On the old server, Plesk had some scheme to rotate these logs. I&#8217;m on my own now. But some simple research revealed the already builtin logrotate program. Wow is this useful. I created a simple configuration file and now my logs are getting rotated and compressed weekly. I won&#8217;t have to worry about running out of disk space (under normal load anyway).</p>
<p>So with the server situation largely under control, I can finally start working on Django again and getting a beta test site going. More to come.</p>
]]></content:encoded>
			<wfw:commentRss>http://deathofagremmie.com/2009/05/28/server-migration-after-action-report/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
