summaryrefslogtreecommitdiff
path: root/cork/index.html
blob: 95c80a89eb2701a4d9fac9b98264197b19547f06 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="/style.css">
<style>
main img {
	border:	0.2em	solid	black;
	padding:	0.2em;
}
</style>
  <title>Cork</title>
</head>
<body>
  <header>
    <h1>Cork</h1>
    <blockquote>Small, Fast, Performant</blockquote>
    <img src="/img/ornament.svg" type="svg" id="ornament"/>
  <header>

  <main>
    <section id="projects">
      <div class="project">
	<p><em>Author: <a href=//c.bauherren.ovh>Christos</a></em></p>
	<br>
        <h3>What is Cork?</h3>
	<p>Cork is a fast and performant static-site generator written in RC shell, leveraging Plan9's simple core-utils. Originally, just a fork of <a href="//werc.cat-v.org/"><i>werc</i></a>, Cork has become my software philosophy put into practice (more on that further down)
	<br><br>
        <h3>Why fork werc?</h3>
	<p>I assume many people have never heard of werc. Werc power's sites such as <a href=http://cat-v.org>cat-v</a>, <a href=https://git.suckless.org/swerc/>suckless</a> and <a href=http://9front.org>9front</a> to name a few.
	<p>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
	<p>However during the honeymoon period some creaks had started to show, due to werc's generous list of things it can support (<a href=https://werc.cat-v.org/apps/>apps</a>, 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.
	<p>Werc rightfully so can boast of having a <b>core</b> that is only 150 sloc, whereas the <b>entirety</b> of cork is under 70 sloc and base cork is under 50.
	<p>I respectfully believe werc provides features that 90 percent of users would never need
	<br><br>
	<h3>What isn't cork</h3>
	<p>Cork is not a markdown to html converter.
	<p>You can use any md2html program
	<p>Some popular ones (that I know of are)
	<ul><li>smu<li>discount</ul>md2html.awk
<br>
	<h3>Why Cork?</h3>
	<p>Ability to use shell to script custom functions
	<p>A scriptable static sidebar listing directory contents.
	<br><br>
	<center>
<p><img src="//c.bauherren.ovh/pix/cork-demo1.png" style="width: 300px;">
	<p><img src="//c.bauherren.ovh/pix/cork-demo2.png" style="width: 350px;">
	<p><img src="//c.bauherren.ovh/pix/cork-demo3.png" style="width:350px;">
	</center>
	<br><br>
        <h3>Installation</h3>
	<p>Cork has only been tested with OpenBSD's webserver `httpd`,
	<p>First you must install the Plan9 core-utils
	<p>plan9port or 9base can be used (if you don't want a full-blown 9 install)
	<p>For <a href=//0x19.org/posts/2021-11-28.php>plan9port</a> installation, Download <a href=//tools.suckless.org/9base/>9base</a>
	<p>Now, <a href=https://c.bauherren.ovh/src/run/c.txt>download</a> and save the entire cork script one directory outside where you plan to keep your site
	<p>Add the following to `/etc/httpd.conf`
	<p>This is a 'sane' template, which I'll get to why it is later
	<pre>

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"
		}
	}
}
	</pre>
	<p><pre>httpd</pre> searches in <pre>/var/www</pre> so create a directory with your site's name, cd into it and create two more directories.
	<p>One called home (this is where you're .md content will go) and one called pix/
	<p>Run `rcctl start httpd slowcgi</pre>
	<h3>Post installation tips</h3>
	<p>As stated earlier, cork strides to reduce system calls. This is very inline with it's author's software philosophy
	<p>I do not like invoking <pre>sed or its UNIX buddies</pre> many times, so as to not oncur their wrath please practice a form of file hygiene
	<p>The following are things I don't like you keeping public
	<ul>
		<li>dot files
		<li>filenames with spaces
		<li>executables
	</ul>
	<p>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.
	<br><br>
	<h3>Issues</h3>
	<p>I'm currently writing the script for a full Cork demo and setup walkthrough, so I hope that will cover any foreseeable issues.
	<p>My <a href=mailto:christos@bauherren.ovh>email</a> is always open
      </div>
    </section>
</main><footer><a href=/><img src="/img/footer.svg" type="svg" width="25%;"/></a></footer></body></html>