gmid/site/contrib.html

233 lines
5.9 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<title>gmid | contrib</title>
<meta charset="utf8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body {
font-family: monospace;
font-size: 14px;
max-width: 780px;
margin: 0 auto;
padding: 20px;
padding-bottom: 80px;
}
h1::before {
content: "# ";
}
h2 {
margin-top: 40px;
}
h2::before {
content: "## ";
}
h3::before {
content: "### ";
}
blockquote {
margin: 0;
padding: 0;
}
blockquote::before {
content: "> ";
}
blockquote p {
font-style: italic;
display: inline;
}
p.link::before {
content: "→ ";
}
strong::before { content: "*" }
strong::after { content: "*" }
hr {
border: 0;
height: 1px;
background-color: #222;
width: 100%;
display: block;
margin: 2em auto;
}
img {
border-radius: 5px;
}
pre {
overflow: auto;
padding: 1rem;
background-color: #f0f0f0;
border-radius: 3px;
}
pre.banner {
display: flex;
flex-direction: row;
justify-content: center;
}
code, kbd {
color: #9d109d;
}
img {
display: block;
margin: 0 auto;
max-width: 100%;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #222;
color: white;
}
a {
color: aqua;
}
hr {
background-color: #ddd;
}
pre {
background-color: #353535;
}
code, kbd {
color: #ff4cff;
}
}
@media (max-width: 400px) {
pre.banner { font-size: 9px; }
}
@media (max-width: 500px) {
pre.banner { font-size: 10px; }
}
</style>
</head>
<body>
<header>
<nav>
<a href="index.html">Home</a> |
contrib |
<a href="quickstart.html">Quickstart</a> |
<a href="gmid.1.html">docs</a>
</nav>
</header>
<h1>contrib</h1>
<p>
This directory is for additional contributed files which may be
useful.
</p>
<p>Contents:</p>
<ul>
<li><a href="#dockerfile">Dockerfile</a></li>
<li><a href="#gencert">gencert</a></li>
<li><a href="#openbsd-rc">OpenBSD rc file</a></li>
<li><a href="#systemd-unit-file">Systemd unit file</a></li>
<li><a href="#renew-certs">renew certificates automatically</a></li>
<li><a href="#vim-syntax-files">Vim syntax files</a></li>
</ul>
<hr />
<h2 id="dockerfile">Dockerfile</h2>
<p>
<a href="https://git.omarpolo.com/gmid/tree/contrib/Dockerfile">contrib/Dockerfile</a>
is a simple Dockerfile. The resulting image is a classic alpine
linux image with a statically linked gmid installed as
<code>/bin/gmid</code>.
</p>
<p>To build the image:</p>
<pre># docker build -f contrib/Dockerfile -t gmid .</pre>
<p>and then run it with something along the lines of:</p>
<pre># docker run --rm -it -p 1965:1965 \
-v gmid.conf:/etc/gmid.conf:ro \
-v path/to/keys:/tls:ro \
-v /var/gemini:/var/gemini:ro \
gmid -c /etc/gmid.conf</pre>
<h2 id="gencert">gencert</h2>
<p>
<a href="https://git.omarpolo.com/gmid/tree/contrib/gencert">contrib/gencert</a>
is a simple script to generate self-signed certificates.
</p>
<h2 id="openbsd-rc">OpenBSD rc file</h2>
<p>
<a href="https://git.omarpolo.com/gmid/tree/contrib/gmid">contrib/gmid</a>
is a sample service file for OpenBSD <code>rc(8)</code>.
To install it:
</p>
<pre># cp contrib/gmid /etc/rc.d</pre>
<p>
then the usual
<code>rcctl [start|stop|enable|restart] gmid</code>
are available.
</p>
<h2 id="systemd-unit-file">Systemd unit file</h2>
<p>
<a href="https://git.omarpolo.com/gmid/tree/contrib/gmid.service">contrib/gmid.service</a>
is a simple service file for
systemd. To install it:
</p>
<pre># cp contrib/gmid.service /lib/systemd/system/gmid.service</pre>
<p>
then the usual
<code>systemctl [status|start|enable|stop] gmid</code>
commands can be used to manage the server.
</p>
<p>Some things to keep in mind:</p>
<ul>
<li>
the <code>ExecStart</code> path may depend on the installation.
</li>
<li>
a <code>gmid</code> user needs to be created for e.g. with:
<pre># useradd --system --no-create-home -s /bin/nologin -c "gmid Gemini server" gmid</pre>
</li>
<li>
logs can be inspected with <code>journalctl(1)</code>:
<pre># journalctl -t gmid</pre>
</li>
</ul>
<h2 id="renew-certs">renew certificates automatically</h2>
<p>
<strong>NB:</strong> this script requires features that are
currently available only in the master branch.
</p>
<p>
<a href="https://git.omarpolo.com/gmid/tree/contrib/renew-certs">contrib/renew-certs</a>
is a script meant to be run in a crontab that watch for
certificate expiration. It can optionally renew the certs and
restart gmid too.
</p>
<p>Read the documentation with: <code>perldoc renew-certs</code>.</p>
<h2 id="vim-syntax-files">Vim syntax files</h2>
<p>
<a href="https://git.omarpolo.com/gmid/tree/contrib/vim">contrib/vim</a>
contains a syntax highlighting for vim. To install it, just
copy the files to <code>~/.vim</code>
or <code>/usr/share/vim/vimfiles</code>, e.g.
</p>
<pre>$ mkdir -p ~/.vim
$ cp -R contrib/vim/* ~/.vim/</pre>
<p>To enable Syntastic checker, add to your vimrc:</p>
<pre>let g:syntastic_gmid_checkers = ['gmid']</pre>
<p>The end result is something like this:</p>
<a href="vim-screenshot.png">
<img src="vim-screenshot.png" alt="Screenshot of vim editing gmid.conf with syntax highlighting" />
</a>
</body>
</html>