Backing Up a Hosted Pelican Site
There are two different ways I maintain complete local backups of this site. One uses a web application integrated with Dropbox and SFTP and the other uses Transmit on my Mac. Being a static Pelican blog, a backup means that I just grab copies of the files, so it is fairly easy to automate and schedule.
Backup Box
I’ve written about Backup Box before. It’s similar to IFTTT but is focused specifically on moving large numbers of files around the Internet. I’ve used it in the past to backup my WordPress DB. It’s pretty expensive in my opinion but it does what it promises. A free account has a maximum of 1GB per sync and a max of 10 syncs per month. $20 per month gives unlimited syncs and a max of 25GB of transfers per month.
With Backup Box, just about any source and be made to sync with Dropbox. It’s easy to configure an SFTP source to be backed up to Dropbox or even another FTP server. It is simple to setup and works quickly, if not real time.1
It’s tempting but I’m not ready to spend $250/year to backup this site automatically everyday. Instead, I used Backup Box to do a monthly archive and my Mac to do the daily backups.
Transmit
Transmit is the premier Mac FTP client. Transmit is a great adhoc FTP tool but much of its convenience is derived from saved favorites and droplets. I configure several favorites that connect to my host machine at the various Pelican directories I care about (Pelican config, raw posts, image uploads and Pelican themes). Four locations on my web host I want to backup, means I create four Transmit favorites.
I like to define the remote and local paths in my Transmit favorites. It allows me sync files between the two.
I also use the built in Sync capabilities of Transmit. It’s a one way sync, from my remote server to my Mac.
I can manually trigger a backup through Transmit, but that is tedious and unreliable. It’s much better to schedule the syncs. That’s where Automator comes in.
There’s a very good tutorial for this setup at TheOSQuest but I’ll give a quick overview.
Transmit provides excellent integration with Apple’s Automator though custom actions.
Create a new Automator Application and add the Synchronize action. Choose a Transmit favorite as the “Connect To” source. From my experiments the Automator action only respects the connection credentials of the stored favorite and not the sync setting or paths. The syncing behavior must be defined in the action setup.
I set the “Sync Direction” to Download using Modification Dates to determine new files.
Save the Automator application and go over to iCal (or BusyCal in my case) and create a calendar entry for the scheduled sync. I don’t want to see any alerts for the calendar event. Instead, I set the alarm to “Custom” and configure the “Alarm Type” to open the Automator application I just created.
Now I end up with a repeating alarm event every day at 3am that downloads all of my Pelican content for safe keeping.
I recommend spacing the scheduled downloads out by a few minutes to avoid trying to run them all at the same time.
Of course, this solution requires an always-on-Mac to perform the download and a persistent Internet connection. My only complaint is that I wanted the Transmit Automator action to generate a list of files synced so that I could write it to a log. There’s no obvious way to do that.
This works great for a static blog setup. Everything I need to restore the site from scratch can be downloaded with ease. Migration to a new host would only require uploading my backups and installing Pelican.
-
Transfers are put into a queue and occur at some point in the near future. ↩︎