Installing Second Crack on RHEL 6
31 May 2017∞
I recently set up Marco Arment’s Second Crack blogging platform on my RHEL 6 server. I had been using Wordpress for awhile, but got frustrated with its dynamic rendering strategy. I want a blogging engine that scales easily and plays nicely with nginx, not something that has to parse code and query databases just to get the content. Here’s how I did it.
Firstly, per Marco’s advice, I installed both the command-line interface to Dropbox and the inotifytools
package from the EPEL repo. This allows me to write and edit blog posts from anywhere I have access to Dropbox and have my changes applied instantly. It’s really amazing to be able to edit blog posts in plaintext using Markdown syntax from my iPad mini. I cannot understate this.
I’m very minimalist when it comes to installing packages on my server. I generally start with the absolute Minimal distribution and only install packages as needed. There is no reason for a webserver to have Xorg, after all. This methodology presented a problem with Dropbox at first. The Dropbox for Linux page only lists packages for Ubuntu and Fedora (with an option to build from source). These packages, however, are for the desktop interface of Dropbox — which is not needed. Instead, I found a link to a simple dropbox.py utility which keeps everything in sync and only requires Python 2.6. Best of all, the installer and corresponding daemon run as an unprivileged user. Simply download the script and run the install command:
$ python dropbox.py start -i
After it finishes the download and install, it should prompt you to visit a URL to link the system to your Dropbox account. The installer will download the necessary libraries and runtime data into ~/.dropbox-dist/
and put the configuration stuff into ~/.dropbox/
. By default it will create ~/Dropbox/
to hold the items you want synced. The only caveat to the Dropbox install is that the process will need to be relaunched after each reboot: python ~/dropbox.py start
Installing Second Crack is basically as straight-forward as he lays it out in the included README.md. Just pull down the repository, make the changes to the configuration file (blog name, URL, etc.), configure the crontab, and start designing your template (that’s where I spent the vast amount of my time).
By default, Second Crack will install a simple .htaccess file to perform the slug line URL redirects. Unfortunately, .htaccess files don’t translate directly to nginx, but in this case the needed configuration is incredibly easy:
index index.html
location ~ ^/blog/. {
default_type text/html;
try_files $uri $uri.html;
}
To stop Second Crack from automatically reinstalling the .htaccess file, simply comment out the line in {SECOND_CRACK}/engine/Updater.php
, line 438 — but it really doesn’t matter:
//if (! file_exists(self::$dest_path . '/.htaccess')) copy(dirname(__FILE__) . '/default.htaccess', self::$dest_path . '/.htaccess');
If you’ve more or less followed along, you should be pretty much good-to-go. For going mobile, I literally searched the App Store for “text editor dropbox” and bought the first one: PlainText by Hog Bay Software. There are several things I absolutely love about this app:
- Ad-free upgrade ($1.99)
- Syncs with Dropbox
- Let’s you specify the root-folder (e.g. /SecondCrack/site.com/)
- iPhone and iPad compatible
- Clean interface
Happy blogging!