Moving the OrientalBirdImages.org web site
By Abhijit Menon-Sen <email@example.com>
I just moved the OBI web
site to my new hosted server at
Hetzner and—because I couldn't retain my old /29 netblock—to a new
IP address as well. Here are a few notes about the migration, including
the stupid (but harmless) mistake I made.
The first thing I should have done was to lower the TTL on the A records
for orientalbirdimages.org and www.orientalbirdimages.org. I thought I
had set them to 1 hour, but they were actually set to 172000s (~2 days).
This meant I had to wait much longer before I could be sure the move was
complete; see below for more.
The web site comprises some HTML and PHP files, a small MySQL database,
and a couple of gigabytes of uploaded images. I started by copying the
Apache VirtualHost definition and all the files to the new server. Then
I disabled the old site and replaced it with an "OBI will be back soon"
message (to prevent changes to the database as it was being copied). I
copied the MySQL database and recreated it on the new server. All that
remained was to change the DNS to point to the new server's address.
At this point, if I had been more clever, the old TTL on the A records
would have expired, and I could be sure that caches would see the new
address relatively soon. But I had discovered by then that this happy
state of affairs was still two days in the future, and I didn't want
to postpone everything for that long. So I changed the IP address of
orientalbirdimages.org (preferred) and www.orientalbirdimages.org
(tolerated) to 188.8.131.52 immediately.
From past experience, I knew that some people would continue to see the
old IP address for a long time, even if I hadn't forgotten to lower the
TTLs. In order to avoid inconveniencing these people, I had to make the
new site accessible to them somehow. (I didn't want to leave the old
site running and try to synchronise the two databases later.) So I
created munin.orientalbirdimages.org with the new IP address, and
configured the old server's Apache to redirect to it.
RedirectTemp / http://munin.orientalbirdimages.org/
CustomLog /var/log/apache2/obi-redirects.log combined
On the new server, adding "ServerAlias munin.orientalbirdimages.org" to
my VirtualHost definition was all that I needed to make this work. Since
munin.orientalbirdimages.org did not exist before, I could be sure that
caches wouldn't serve a stale address for it. Only the most observant of
the affected users would notice the new name in their browser's location
bar, and the site would work fine. Once requests stopped showing up in
the log file, I could be reasonably sure that caches had caught up.
(Update: three days later, it's mostly only Googlebot that is
still hitting the old server.)
If I had remembered to lower the TTLs, munin.orientalbirdimages.org
would have been no more than the short-lived hack it was meant to be.
Since it was alive for two days, however, there's a small chance that
someone bookmarked it or linked to it. Since I already redirect from
www.orientalbirdimages.org to orientalbirdimages.org, I'll just do the
same for munin once the caches have updated:
Redirect permanent / http://orientalbirdimages.org/
The site is now working fine in its new home.