Octopress is great until it breaks

Since using Octopress I've found it mostly to be awesome, but sometimes I encounter issues and now having used it a while and had a look around the file / folder structure I'm not entirely convinced I've got it setup correct.

I've documented my current process, in the hopes that someone who knows what they're doing can point me in the right direction and help others who might be having the same issues.

Oops

To start off I do a:

1
rake preview

Then open up my browser and go to:

1
localhost:4000

Sweet. I can now view the site locally, edit a page in Sublime Text 2 and view the changes in the browser.

Question 1

I then have to hit refresh a bunch of times, before I see the changes, I love LiveReload an app that pushes changes to the browser so you don't have to hit refresh. I'm guessing that when I edit and then save a document Octopress is rebuilding the whole site? If that's the case, is it possible when editing a post to just rebuild that page and have it automatically pushed to the browser?

Now I'm happy with the post and want to push the changes live.

So I go back to Terminal and open a new tab as the current tab is now running the preview site and throwing out:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[2013-06-12 18:51:36] regeneration: 1 files changed
[2013-06-12 18:51:51] regeneration: 1 files changed
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /blog/2012/05/28/amir-khan/ HTTP/1.1" 200 9983 0.0021
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /stylesheets/screen.css HTTP/1.1" 304 - 0.0013
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /javascripts/twitter.js HTTP/1.1" 304 - 0.0008
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /javascripts/modernizr-2.0.js HTTP/1.1" 304 - 0.0011
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /javascripts/octopress.js HTTP/1.1" 304 - 0.0008
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /javascripts/ender.js HTTP/1.1" 304 - 0.0014
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /javascripts/github.js HTTP/1.1" 304 - 0.0013
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /images/bg.png?1362690453 HTTP/1.1" 304 - 0.0010
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /images/about-me-photo.jpg HTTP/1.1" 304 - 0.0010
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /images/noise.png?1362088035 HTTP/1.1" 304 - 0.0011
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /images/rss.png?1362088035 HTTP/1.1" 304 - 0.0011
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
127.0.0.1 - - [12/Jun/2013 18:51:53] "GET /javascripts/libs/jXHR.js HTTP/1.1" 304 - 0.0010
[2013-06-12 18:51:53] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2013-06-12 19:19:36] regeneration: 1 files changed

Question 2

Is it ok to keep the preview going whilst generating, deploying, pushing? I'd like to as there's instances where I want to write multiple posts. Also are the WARN errors something to be concerned about?

Next I do:

1
git status

Now I see a list of all the public files that have changed, most of these are just minor changes to the navigation on each page.

Question 3

Is it possible to just check over the source files and auto-update the minor changes?

Next as per https://octopress.org/docs/deploying/github/ I Run:

1
2
rake generate
rake deploy

Or I found out you can run these in one go using rake gen_deploy.

Question 4

I take it rake gen_deploy does exactly the same thing as running them separately?

After running that, I get:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$ rake gen_deploy
## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /Applications/MAMP/htdocs/GitHub/simonowendesign.github.com/_config.yml
Building site: source -> public
Successfully generated site: source -> public
## Deploying branch to Github Pages
rm -rf _deploy/about
rm -rf _deploy/assets
rm -rf _deploy/atom.xml
rm -rf _deploy/blog
rm -rf _deploy/clients
rm -rf _deploy/CNAME
rm -rf _deploy/contact
rm -rf _deploy/favicon.png
rm -rf _deploy/how-to-automatically-compile-a-sass-file-refresh-your-browser-and-iphone-using-livereload-with-mamp-and-wordpress
rm -rf _deploy/images
rm -rf _deploy/index.html
rm -rf _deploy/installing-sublime-text-2-on-lxde-linux-useful-for-raspberry-pi
rm -rf _deploy/javascripts
rm -rf _deploy/mac-os-x-osx-dotfile
rm -rf _deploy/make-google-chrome-canary-default-browser
rm -rf _deploy/mother-effing-dotfiles
rm -rf _deploy/robots.txt
rm -rf _deploy/sitemap.xml
rm -rf _deploy/stylesheets
rm -rf _deploy/styling-the-chrome-dev-tools

## copying public to _deploy
cp -r public/. _deploy
cd _deploy

## Commiting: Site updated at 2013-06-12 17:57:43 UTC
[master 8a04cc7] Site updated at 2013-06-12 17:57:43 UTC
18 files changed, 49 insertions(+), 25 deletions(-)

## Pushing generated _deploy website
Counting objects: 87, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (39/39), done.
Writing objects: 100% (44/44), 3.79 KiB, done.
Total 44 (delta 23), reused 0 (delta 0)
To [email protected]:simonowendesign/simonowendesign.github.com
78289d5..8a04cc7 master -> master

## Github Pages deploy complete
cd -

All looks ok, so I go to:

/github.com/simonowendesign/simonowendesign.github.io (no longer online)

Again, all looks ok. Then check:

simonowendesign.co.uk

Everything ok, cool.

Now again as per:

https://octopress.org/docs/deploying/github/

Commit the source:

1
git add .

But now I'm getting a source.old folder with a whole bunch of stuff in.

At this point I should mention last night I ran into an issue that caused my site to go down and hence the reason for this post and further investigation. At this point I was also trying out published: false. Each post, at the top of the page has some 'yaml front matter':

1
2
3
4
5
6
7
---
layout: post
title: "Manchester forking FRED merge batman"
date: 2013-06-01 08:56
categories: mcrfred
published: false
---

Adding published: false to this allows you to preview the post locally, but it won't be deployed to live. At first I thought my site breaking might have been something to do with that so I removed the markdown file, the site worked fine locally, but not when pushed live. So then I ran the install commands again in case anything needed updating.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
$ gem install bundler
bundle install
rake install
Successfully installed bundler-1.3.5
1 gem installed
Installing ri documentation for bundler-1.3.5...
Installing RDoc documentation for bundler-1.3.5...
/Applications/MAMP/htdocs/github/simonowendesign.github.com on master
$ bundle install
Using rake (0.9.2.2)
Using RedCloth (4.2.9)
Using chunky_png (1.2.5)
Using fast-stemmer (1.0.1)
Using classifier (1.3.3)
Using fssm (0.2.9)
Using sass (3.1.20)
Using compass (0.12.2)
Using directory_watcher (1.4.1)
Using gemoji (1.4.0)
Using haml (3.1.7)
Using kramdown (0.13.8)
Using liquid (2.3.0)
Using syntax (1.0.0)
Using maruku (0.6.1)
Using posix-spawn (0.3.6)
Using yajl-ruby (1.1.0)
Using pygments.rb (0.3.4)
Using jekyll (0.12.0)
Using rack (1.4.5)
Using rack-protection (1.3.2)
Using rb-fsevent (0.9.1)
Using rdiscount (1.6.8)
Using rubypants (0.2.0)
Using tilt (1.3.3)
Using sinatra (1.3.5)
Using stringex (1.4.0)
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
/Applications/MAMP/htdocs/github/simonowendesign.github.com on master
$ rake install
A theme is already installed, proceeding will overwrite existing files. Are you sure? [y/n] n
rake aborted!
/Applications/MAMP/htdocs/github/simonowendesign.github.com on master
$ rake update_source
mkdir source.old
cp -r source/. source.old
## Copied source into source.old/
cp -r --remove-destination .themes/classic/source/. source
cp -r --remove-destination source.old/_includes/custom/. source/_includes/custom/
cp source.old/favicon.png source
## Updated source ##
/Applications/MAMP/htdocs/github/simonowendesign.github.com on master*

Question 5

What's the best practice for keeping on top of gems? e.g. should I be aware of new gems being updated and update as required, or perhaps have this automated, so if something is updated it happens on a daily basis?

After updating, I ran:

1
rake deploy

This seemed to fix the issue, but I have no idea if it was this that kicked it back into action. Whilst running those commands from https://octopress.org/docs/deploying/github/ I noticed:

1
echo 'your-domain.com' >> source/CNAME

And also noticed that my CNAME file just had:

1
simonowendesign.co.uk

So also at this point I did a commit that changed this, but then researching online found it was in fact correct to just have the domain name, so reverted and wonder also if maybe that fixed it. I also then noticed that I had more than one CNAME file and began to investigate all the files and folder structure again as I hadn't done so for a while since setting it up and everything was working.

Here's my folder structure:

Source:

Oops

Blog:

Oops

Deploy:

Oops

To add further confusion, as I knew I didn't require the source.old I moved the source.old folder to another folder outside of the repo for safe keeping and did git status again. Then git add ., then git status, everything looked ok, so did git commit -m 'Add video to post'. Then git push origin source, this again makes me wonder if I have this setup correct as I got:

1
2
3
$ git push origin source
error: src refspec source does not match any.
error: failed to push some refs to '[email protected]:simonowendesign/simonowendesign.github.com.git'

Question 6

As I understand it git push origin source would push to a branch called source? Is this something I'm doing wrong, as I only have a master branch?

Then I opted to do just git push which gave me:

1
2
3
4
5
6
7
To [email protected]:simonowendesign/simonowendesign.github.com.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:simonowendesign/simonowendesign.github.com.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Next, I did a git pull, but I now get CONFLICT / auto-merging warnings on a load of files.

Next, git add . again, then git commit -m 'merge', now try git push again, now it's pushing all the files:

1
2
3
4
5
6
7
8
$ git push
Counting objects: 11876, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6941/6941), done.
Writing objects: 100% (10438/10438), 1.84 MiB | 3.04 MiB/s, done.
Total 10438 (delta 4382), reused 1447 (delta 265)
To [email protected]:simonowendesign/simonowendesign.github.com.git
8a04cc7..7f14574 master -> master

So head back over to Github:

/github.com/simonowendesign/simonowendesign.github.io (no longer online)

Now I see all the folders and files and commit messages.

Octopress Folder Paths

Where as sometimes I only see:

Octopress Folder Paths

Question 7

After reading over this post and looking over my setup I'm thinking most of these issues are related and that it has something to do with me pushing / deploying my master branch instead of a source branch perhaps?

Finally just to top things off, when I ever successfully (in my mind) update my site I get an email saying:

GitHub Page Build Failed

Would greatly appreciate any help with this and hopefully it will help anyone else out who is having issues with Octopress.

So far I love Octopress and have a feeling that it's even more awesome but my noobness is getting in the way.

Browse by category: