Install Marco Arment’s Second Crack in a few simple steps.
I’ve been interested in Second Crack ever
since I heard Marco Arment
discuss it on Build and
Analyze. After writing more frequently both here and at Hack/Make, I became frustrated with the
workflow of writing in Byword or BBEdit then having to copy and paste
into Tumblr. I was a little hesitant getting into hosting my own
blogging engine since my sysadmin skills aren’t great but I was familiar
enough with it that I thought I’d give it a shot. When I set out to
implement Second Crack, I wanted to do it in a way that could be
replicated so that other who aren’t total neck-beard Unix nerds could
roll out Second Crack on their own and benefit from it’s simple
publishing without struggling with the worst parts of server
administration. What I came out with, after a weekend wrestling with
shell scripts, folder permissions, and Dropbox daemons, is
deploysecondcrack—a simple four step process that anyone
who can copy and paste can use to roll out Second Crack on their own
If you’re familiar with servers, jump straight to
deploysecondcrack is optimized to run on
CentOS 6. I chose this since Marco is running CentOS and will probably
provide the best long-term compatibility.
If you’re not familiar with servers, let’s go through the set up
process in a little more detail than what’s in the
1. Get a cloud server account
Second Crack is self-hosted so you’ll need your own server. For this, I suggest Rackspace Cloud. A Rackspace account is free and you pay for servers by the hour. The smallest CentOS instance on Rackspace (which is likely enough for most low-traffic blogs is $0.015/hour. This adds up to about $10 a month. They provide amazing support, which is a great thing to have if you aren’t very comfortable with servers. Amazon Web Services would work fine and prices are generally comparable but Rackspace’s fanatical support is a great thing to have.
2. Create a second Dropbox account (optional)
I have about 40GB of data in Dropbox that I don’t want syncing to my server. I created a second Dropbox account specifically for my blog and shared the folder that will be created automatically later in the process with the other Dropbox account I use. Now’s a good time to create this account before we get too deep into the server stuff.
3. Launch a cloud instance
Once you’ve created your account and it’s been verified over the phone by a cheery Rackspace employee, you can go into your control panel and in Hosting > Cloud Servers, add a new server. Here, choose CentOS 6 then name your server and chose a size. Pick a server based on your needs and how much you want to spend but a 256MB or 512MB box will probably be enough. Second Crack serves cached static HTML files which doesn’t require a lot of memory to be quick and handle a decent amount of traffic. When you click “Create Server” it’ll start spinning up a cloud instance and then email you with and IP address and password for you to SSH into your shiny new server when it’s done building. If you’re unsure whether you want to commit to using Second Crack, you can spin up a server with very little commitment since you’re billed by the hour. If you can’t get things running or get it going but don’t like it, just delete the server and you’ll only be out a few cents.
4. SSH into your server
Once you have the IP address and password for your server, we can
access it from the command line to install Second Crack. Open up
Terminal (or PuTTY if you’re still on Windows) and SSH into your
server with the command
ssh email@example.com using your IP
yes when prompted to add your RSA and then
the password you were emailed. When you see the
[root@servername ~]# prompt, we’re ready to go.
5. Deploy Second Crack
Head to the Github page for
deploysecondcrack where you’ll find the steps to
install and configure the server environment, all dependancies, Dropbox,
and Second Crack. These steps are mostly copy and paste, but there are a
couple places you’ll need to use the command line text editor Vim.
There’re a few basic commands you’ll need to know to use it. You can
look at the full Vim cheat sheet
if you need, but you’ll be able to get the job done with a few commands.
You can move around the file using the arrow keys. To edit the file,
i key to enter into
Make any changes you need the press
esc to leave insert
mode. You can jump to certain line numbers by typing
and pressing enter to jump that that line. You can search by pressing
/ and then typing in your term and pressing enter.
n will jump to the next result. Once you’re done editing a
esc to get to the command mode and you
:wq to save and exit the file. If you screw up and want to
:q! will close the file without saving. You
shouldn’t need it in the standard set up, but a few basic commands if
you run into troubles and need to troubleshoot:
working directory) will show you the path of your current location,
cd /path/to/folder will change the directory you’re into
the one you specify. If something happens and you aren’t give the
command prompt (the
$), hitting ctrl-c should usually get
you there. When you’re done with the steps on Github, come back here to
finish things off.
6. Configure your DNS
You’ll need to set up the DNS for your domain name to the IP address of your server. If you don’t have a domain, use a service like Namecheap to register one. To point your domain to the server, add an A RECORD that points to your IP address and wait a few minutes. You should be able to then access your new blog from your domain.
7. Post something
Posting is really easy with Second Crack and the main reason I moved
it it. All you need to do is save a markdown file in your Dropbox in the
_publish-now folder with the formatting as specified in the
Second Crack documentation
8. Add some styling
deploysecondcrack includes a very basic stylesheet to
get you started. There’s enough there to dive into and start styling
your blog. If you don’t know CSS, now’s a great time to learn.
- I’ve tested this fairly thoroughly and I’m hoping it will work for you but I can’t guarantee it. If you need some help, let me know on Twitter but there’s no promises I’ll be able to help.
- As outlined in the Github README, this install does not include any security or firewall. Be aware of this.