Published

Updated

Second Crack and Webfaction

In the process of migrating scientifics to Second Crack over the past few days, I decided that it would be useful to publish a tutorial on how to get it running on Webfaction.

While the readme comes with fairly thorough instructions, there are some differences due to how Webfaction works. If you are on another web host and are having similar issues, some of these tips may help you get things running as well.

Installing Dropbox

Dropbox is not a necessary part of Second Crack, but it makes publishing to your blog much easier. In order to get Dropbox running, log into your server via SSH and follow the instructions from Dropbox.

As noted in the instructions, when you run the app for the first time you will be prompted to authorize your account. For security, I recommend setting up a secondary account on your server and then sharing your blog source folder (I will refer to this folder as “Blog”) with that secondary account.

You will also want to upload the CLI python script to your home directory on your server (/home/username). Running the script with the command “autostart” will set up your server to automatically start Dropbox so it is always running.

python dropbox.py autostart

Installing inotify-tools

Second Crack takes advantage of inotifywait (part of inotify-tools) to update your static files whenever Dropbox is updated. This is also optional, but without inotify-tools, your static files will only be updated whenever your cron runs the update script (more on cron later).

In order for Second Crack to run on Webfaction, you also need to make a change to engine/update.sh. Find all of the php commands, and change them to /usr/local/bin/php53. This allows Second Crack to run under PHP 5.3 rather than the Webfaction default of PHP 5.2.

Move the files in the “example-templates” folder to a folder called “templates” inside your “Blog” folder in Dropbox.

Publishing in Second Crack

A few notes on the formatting: the dividing line must be the same length as your title and tags are optional.

Create a “drafts” folder in your “Blog” folder and save the post as a .md file. If everything is set up, a “_previews” folder will be created inside “drafts” containing an HTML file with a preview of your post. If you are happy with how it looks, publishing is as easy as moving the .md file to the “_publish-now” folder.

I by no means am an expert, so if you find problems with my walkthrough or don’t feel I’ve explained something enough, feel free to ping me on Twitter!