{
"$type": "site.standard.document",
"canonicalUrl": "https://jack.is/posts/yet-another-octopress20-guide/",
"description": "A quick (and outdated guide) on how to use TravisCI to deploy a Octopress blog",
"path": "/posts/yet-another-octopress20-guide/",
"publishedAt": "2015-01-17T19:18:29.000Z",
"site": "at://did:plc:cwdkf4xxjpznceembuuspt3d/site.standard.publication/3mdrpafzz7c2m",
"tags": [
"Blog",
"Jekyll"
],
"textContent": "So there's only about ~~30~~ 50 thousand pages on this general topic, but I\nfound that about half of them were out of date, so I figured I should try and\ncollect all the info into one big post. I've referenced where I've found some of\nthe stuff that's harder to find from Googling using the wonders of Octopress\nfootnotes.\n\nUnfortunately, as I was finishing up this post, the post announcing Octopress\n3.0 comes out. While I had known it was coming, I wasn't expecting it to be so\nsoon. Obviously this post will be less useful, but it should still be\ninformative. I've included what I think will need to be modified to function on\n3.0 at the bottom.\n\nTable of contents\n\nMy Site Flow\n\n- Local\n- Private Github Repo\n- Built and Deployed using TravisCI to a DigitalOcean droplet\n\n<!-- more -->\n\nI've got a drafts workflow using a couple tasks I found online[^1] and then\npromptly modified:\n\nFor this to work using rake preview, you'll need to modify your preview task\nslightly, add the flag --drafts to the jekyll call.\n\nThe Build Process\n\nPersonally, I don't want to have to deal with building and uploading my site.\nInstead I use Travis-CI targeted to a specific Github repo branch, and some\nmodified rsync scripts.\n\nRsync Setup\n\n!Travis CI SSH Key location\n\nYou'll need to configure your deployment account's SSH private key in Travis-CI\nby replacing all new lines with \\n, and then escaping that to \\\\n, so that\nit ends up being one line with \\\\n in between each original line.[^2]\n\\(NOTE: Make sure the key was generated without ssh-agent running, and set a\nblank passphrase.) Next, go to your Travis-CI settings, create a new environment\nvariable, name it whatever you want, I used $DEPLOY_PRIVATE_KEY, then paste in\nyour one-line private key into the variable section. Now that it's a environment\nvariable in all Travis workers your builds will use, the before_install tasks\nwill disable strict host key checking (requires input, which Travis doesn't\nallow), and then echo the contents of DEPLOY_PRIVATE_KEY to id_rsa, then add\nthat key to the ssh-agent, in my case, allowing the worker to connect using the\nuser travis-ci to my droplet.\n\nIf the user you're connecting with in your Rakefile's settings isn't the owner\nof your specific directories on your hosting server, rsync will probably fail to\nsync properly. In that case, you'll need to add --omit-dir-times to\nrsync-args in the Rakefile.\n\nAfter all of this, you should be good to go. If you're using the master deploy\nmethod, push your site up to master, and it should build properly on Travis, and\ndeploy to your rsync destination.\n\nOctopress 3.0\n\nFor the most part, as far as I can tell, these modifications will _mostly_ still\nwork for 3.0. The drafts changes will no longer be needed anymore, as the Jekyll\ndrafts workflow is now using a separate drafts folder. The .travis.yml will\nneed to be tweaked slightly, as well as the _config.yml having an exclude\nadded to keep Jekyll running on Travis-CI from trying to build the templates in\n/vendor, but other than that, this post is mostly forwards compatible to\nOctopress 3.0.\n\n[^1]: Never Stop Building\n\n[^2]: Grosser.it",
"title": "Yet Another Octopress 2.0 and TravisCI Guide"
}