Hans Dulimarta

Octopress Rsync

When I first installed Octopress in May 2013 it was configured for “subdirectory deployment”: both my Octopress installation directory and HTTP publishing reside on the same server (our school server (http://www.cis.gvsu.edu).

Today, I decided to migrate the Octopress installation directory to my Mac. The easiest part of this migration is running git clone from the command line. The more challenging task is reconfiguration of the Octopress installation directory. I spent a whole evening figuring out all the details it is done correctly.

Using the instructions provided by Belyamani, I installed rvm and Ruby

rvm --create use 2.1.0@octopress
rvm use 2.1.0@octopress
cd /path/to/my/octopress/dir
gem install bundler
bundle install

Later on, I also installed POW to allow me preview the generated site locally.

Failed Reconfiguration Attempt

  • Because we run rake to do many different Octopress tasks, the first file I changed was Rakefile. Failing to understand how Compass, Jekyll, and Rackup work together, I also attempted to update value in the public_dir variabe, but later found out that Rackup was not able to render the page contents correctly.

  • I also tinkered with _config.yml and changed the settings of source and destination. Later on, after reading the Rakefile, I learned that Jekyll’s configuration settings are defined in this file. Jekyll’s reads its input from the directory given as source and generates its output into a directory given as destination

  • The next file I attempted to modify was config.rb, the configuration file for Compass (SASS to CSS compiler). At first, I did not understand the differences between the http_xxxx_path and zzzz_dir variables. Compass Style Configuration Reference helps me understand these two groups of variables.

  • The fourth file is config.ru, Rackup configuration file. I did not change anything in this file. Nevertheless, I learned that using the default setting, Rackup server will render the contents of public directory


Now I understand that Octopress relies on the following four utilities:

  1. Compass, a SASS to CSS compiler that reads its input from sass and generates stylesheets into source/stylesheets. Related config.rb variables: sass_dir and css_dir
  2. Jekyll then reads the contents of source and generates the HTML files into public. Related _config.yml variables: source and destination.
  3. Rackup renders the HTML contents locally by reading its input from public. Related config.ru variables: none. The ‘public’ directory is hardcoded into the code.
  4. When we deploy the site to the remote server, rsync transfers the contents in the public directory. Related Rakefile variables: source_dir and public_dir

During this time, I also learned the powerful feature of rake set_root_dir that allows me to switch my deployment/publishing destination from the command line.

rake set_root_dir[~dulimarh/Oktopus]
# The current URI of my local contents on POW is http://octopress.dev/~dulimarh/Oktopus
rake deploy
rake set_root_dir[/]
# The current URI of my local contents on POW is http://octopress.dev/

Summary of Changes

config.rb http_path /~dulimarh/Okto
http_images_path http_path + "images"
sass_dir sass
css_dir public/stylesheets
images_dir source/images
_config.yml root /~dulimarh/Okto
source source
destination public
Rakefile ssh_user myusername@hostname.cis.gvsu.edu
document_root ~/public_html/Okto
rsync_delete true
rsync_args --verbose --progress