Cork

Small, Fast, Performant

Author: Christos


What is Cork?

Cork is a fast and performant static-site generator written in RC shell, leveraging Plan9's simple core-utils. Originally, just a fork of werc, Cork has become my software philosophy put into practice (more on that further down)

Why fork werc?

I assume many people have never heard of werc. Werc power's sites such as cat-v, suckless and 9front to name a few.

I fell in love with werc because of it's design simplicity and how easy it was to deploy to manage multiple subdomains and sites

However during the honeymoon period some creaks had started to show, due to werc's generous list of things it can support (apps, caching etc.) it made changing fundemental scripting behaviour a lot more difficult. Moreover, said support meant a lot more system calls, system calls for features I would never have a need for.

Werc rightfully so can boast of having a core that is only 150 sloc, whereas the entirety of cork is under 70 sloc and base cork is under 50.

I respectfully believe werc provides features that 90 percent of users would never need

What isn't cork

Cork is not a markdown to html converter.

You can use any md2html program

Some popular ones (that I know of are)

  • smu
  • discount
md2html.awk

Why Cork?

Ability to use shell to script custom functions

A scriptable static sidebar listing directory contents.



Installation

Cork has only been tested with OpenBSD's webserver `httpd`,

First you must install the Plan9 core-utils

plan9port or 9base can be used (if you don't want a full-blown 9 install)

For plan9port installation, Download 9base

Now, download and save the entire cork script one directory outside where you plan to keep your site

Add the following to `/etc/httpd.conf`

This is a 'sane' template, which I'll get to why it is later


server "c.bauherren.ovh" {
	listen on * port 80
	connection request timeout 4
	location "/pix/*" {
		root "/example.org"
	}
	location found "/*" {
		root "/example.org/home"
	}
	location not found "/*" {
		root "/"
		fastcgi {
			param PATH "/bin"
			param PLAN9 "/usr/local/plan9"
			param SCRIPT_FILENAME "/example.org/cork"
			socket "/run/slowcgi.sock"
		}
	}
}
	

httpd
searches in
/var/www
so create a directory with your site's name, cd into it and create two more directories.

One called home (this is where you're .md content will go) and one called pix/

Run `rcctl start httpd slowcgi

Post installation tips

As stated earlier, cork strides to reduce system calls. This is very inline with it's author's software philosophy

I do not like invoking

sed or its UNIX buddies
many times, so as to not oncur their wrath please practice a form of file hygiene

The following are things I don't like you keeping public

  • dot files
  • filenames with spaces
  • executables

You can keep pictures public but they'll be indexed in the sidebar, if they're directory is visible. That might be something you want.

Issues

I'm currently writing the script for a full Cork demo and setup walkthrough, so I hope that will cover any foreseeable issues.

My email is always open