Getting Started With Blogging

Sun Dec 2, 2012

These are roughly 1000 words, you could read this in about 5 minutes.

Blogging is hard work, huh?

Now that the blog is up and running it seems like a good idea to document how the system works. Since the blogs’ system and ReMarkable are supposedly designed to let one focus on publishing content instead of system maintenance – I call it the WordPress tax – it should be provable if there is truth to that.

Getting it

This sites’ code is available freely on github. There is no specific license attached, so just go ahead and use what you like for your own!

If you use a Mac, grab github for Mac, for Windows there is github for Windows – which also works fine, and feel like you’re running Windows 8, and finally for our friends of Eclipse, there is github for eclipse, too.

For those running Linux, or any other system where git is available on the command line, you can simply execute

$ git clone git://github.com/danielsreichenbach/marenkay.com.git yourdomain.com $ cd yourdomain.com $ git submodule init $ git submodule update

This will pull in a clone of the sites’ source code, and update the git submodule which contains the ReMarkable parser to the latest version.

Configuration

You will need to have a few items prepared prior to configuring your new site:

Once you have everything prepared, we can configure our site. First, have a look at the configuration example in .system/config.php.dist:

File: config.php

Should you prefer to skip google analytics just leave the define empty, and there will be no analytics snippet added to your site.

Also note that for now, setting DEVELOPMENT to true will disable any features with external calls, allowing you to run the site e.g. on a local server. Also, generated Markup will not be cached.

Now save the file to .system/config.php to make your site use it. Upon deployment Capistrano will over to deploy this file, too.

To configure Capistrano deployment, you will need your web servers access data, and path information – aka. where your sites’ files will be stored.

Edit the Capistrano configuration in .system/deploy.rb.dist:

File: deploy.rb
# the source control ssh user set :git_user, "git" # the source control host set :git_host, "github.com" # the source control user id set :git_account, "your-github-ccount" # the source control repository name set :git_repository, "your-domain.com" # the git-clone url for your repository set :repository, "#{git_user}@#{git_host}:#{git_account}/#{git_repository}.git" # the branch you want to clone (default is master) set :branch, "master" # tell capistrano to init and update submodules set :git_enable_submodules, 1

These settings control from which git repository your site will be pulled and also if any specific branch shall be used. E.g. if you use a git plugin like git-flow, you might be deploying from a release branch.

Once done, the next section covers your target server. There may – and surely will be differences per provider.

File: deploy.rb
# The name of the application. set :application, "sUSERID.gridserver.com" # The name of the user to use when logging into the remote host(s). set :user, "your-domain.com" # the user id of your (mt) account set :mt_id, "USERID" # The root of the directory tree on the remote host(s) that the # application should be deployed to set :deploy_to, "/home/#{mt_id}/domains/#{git_repository}" # The directory under deploy_to that should contain each deployed revision. set :version_dir, "releases" # The name to use (relative to deploy_to) for the symlink that points at # the current release set :current_dir, "html"

The above example is tailored to hosting at media temple but should be easily change for other hosting providers.

One interesting bit here is the current_dir setting, as providers usually chose to use different names for the DOCUMENT_ROOT in the dozens.

Since Capistrano has no real document root, but rather symlinks the document root to your last working deployment, take extra care here.

Crafting content

Try out Sublime Text for editing, BTW. It is awesome and available for Windows, Linux, and Mac OS.

Crafting Content in Sublime Text 2

As of now there is only ReMarkable syntax which you should master. It’s not too much if you are already using Markdown.

Since the structure is pretty natural, and does only include semantic elements, all you have to worry about is your creativity. Relax, and let the words flow. Once you feel like an article is done, add and commit it, and push it into your repository.

Publishing content

Get Ruby, RubyGems, and deploy your site with Capistrano.

In order to prepare deployment with Capistrano you have to tell Capistrano to prepare you target server. You do so by executing

$ cap deploy:setup

This will make sure, the required directory structure is present on your target server, and enable subsequent deploys, rollbacks, etc.

Once this has run, you can deploy the site by executing

$ cap deploy

Congratulations. You now have a working blog site, powered by ReMarkable!

BTW: looking for awesome git recipes? Try out git immersion!

Personally I write, git add, write, and git add until I am satisfied with an article, and then I just commit, push and execute cap deploy to push an article life. Just like I did with this one.

Feel free to contact me in case of questions!

Tagged with: how-to

All code snippets in this post are made available to use under the MIT Licence.

Comments

comments powered by Disqus