Blob


1 <!doctype html>
2 <html lang="en">
3 <head>
4 <title>gmid | contrib</title>
5 <meta charset="utf8" />
6 <meta name="viewport" content="width=device-width, initial-scale=1" />
7 <style>
8 body {
9 font-family: monospace;
10 font-size: 14px;
11 max-width: 780px;
12 margin: 0 auto;
13 padding: 20px;
14 padding-bottom: 80px;
15 }
17 h1::before {
18 content: "# ";
19 }
21 h2 {
22 margin-top: 40px;
23 }
25 h2::before {
26 content: "## ";
27 }
29 h3::before {
30 content: "### ";
31 }
33 blockquote {
34 margin: 0;
35 padding: 0;
36 }
38 blockquote::before {
39 content: "> ";
40 }
42 blockquote p {
43 font-style: italic;
44 display: inline;
45 }
47 p.link::before {
48 content: "→ ";
49 }
51 strong::before { content: "*" }
52 strong::after { content: "*" }
54 hr {
55 border: 0;
56 height: 1px;
57 background-color: #222;
58 width: 100%;
59 display: block;
60 margin: 2em auto;
61 }
63 img {
64 border-radius: 5px;
65 }
67 pre {
68 overflow: auto;
69 padding: 1rem;
70 background-color: #f0f0f0;
71 border-radius: 3px;
72 }
74 pre.banner {
75 display: flex;
76 flex-direction: row;
77 justify-content: center;
78 }
80 code, kbd {
81 color: #9d109d;
82 }
84 img {
85 display: block;
86 margin: 0 auto;
87 max-width: 100%;
88 }
90 @media (prefers-color-scheme: dark) {
91 body {
92 background-color: #222;
93 color: white;
94 }
96 a {
97 color: aqua;
98 }
100 hr {
101 background-color: #ddd;
104 pre {
105 background-color: #353535;
108 code, kbd {
109 color: #ff4cff;
113 @media (max-width: 400px) {
114 pre.banner { font-size: 9px; }
117 @media (max-width: 500px) {
118 pre.banner { font-size: 10px; }
120 </style>
121 </head>
122 <body>
123 <header>
124 <nav>
125 <a href="index.html">Home</a> |
126 contrib |
127 <a href="quickstart.html">Quickstart</a> |
128 <a href="gmid.1.html">docs</a>
129 </nav>
130 </header>
131 <h1>contrib</h1>
132 <p>
133 This directory is for additional contributed files which may be
134 useful.
135 </p>
136 <p>Contents:</p>
137 <ul>
138 <li><a href="#dockerfile">Dockerfile</a></li>
139 <li><a href="#gencert">gencert</a></li>
140 <li><a href="#openbsd-rc">OpenBSD rc file</a></li>
141 <li><a href="#systemd-unit-file">Systemd unit file</a></li>
142 <li><a href="#renew-certs">renew certificates automatically</a></li>
143 <li><a href="#vim-syntax-files">Vim syntax files</a></li>
144 </ul>
145 <hr />
146 <h2 id="dockerfile">Dockerfile</h2>
147 <p>
148 <a href="https://git.omarpolo.com/gmid/tree/contrib/Dockerfile">contrib/Dockerfile</a>
149 is a simple Dockerfile. The resulting image is a classic alpine
150 linux image with a statically linked gmid installed as
151 <code>/bin/gmid</code>.
152 </p>
153 <p>To build the image:</p>
154 <pre># docker build -f contrib/Dockerfile -t gmid .</pre>
155 <p>and then run it with something along the lines of:</p>
156 <pre># docker run --rm -it -p 1965:1965 \
157 -v gmid.conf:/etc/gmid.conf:ro \
158 -v path/to/keys:/tls:ro \
159 -v /var/gemini:/var/gemini:ro \
160 gmid -c /etc/gmid.conf</pre>
161 <h2 id="gencert">gencert</h2>
162 <p>
163 <a href="https://git.omarpolo.com/gmid/tree/contrib/gencert">contrib/gencert</a>
164 is a simple script to generate self-signed certificates.
165 </p>
166 <h2 id="openbsd-rc">OpenBSD rc file</h2>
167 <p>
168 <a href="https://git.omarpolo.com/gmid/tree/contrib/gmid">contrib/gmid</a>
169 is a sample service file for OpenBSD <code>rc(8)</code>.
170 To install it:
171 </p>
172 <pre># cp contrib/gmid /etc/rc.d</pre>
173 <p>
174 then the usual
175 <code>rcctl [start|stop|enable|restart] gmid</code>
176 are available.
177 </p>
178 <h2 id="systemd-unit-file">Systemd unit file</h2>
179 <p>
180 <a href="https://git.omarpolo.com/gmid/tree/contrib/gmid.service">contrib/gmid.service</a>
181 is a simple service file for
182 systemd. To install it:
183 </p>
184 <pre># cp contrib/gmid.service /lib/systemd/system/gmid.service</pre>
185 <p>
186 then the usual
187 <code>systemctl [status|start|enable|stop] gmid</code>
188 commands can be used to manage the server.
189 </p>
190 <p>Some things to keep in mind:</p>
191 <ul>
192 <li>
193 the <code>ExecStart</code> path may depend on the installation.
194 </li>
195 <li>
196 a <code>gmid</code> user needs to be created for e.g. with:
197 <pre># useradd --system --no-create-home -s /bin/nologin -c "gmid Gemini server" gmid</pre>
198 </li>
199 <li>
200 logs can be inspected with <code>journalctl(1)</code>:
201 <pre># journalctl -t gmid</pre>
202 </li>
203 </ul>
204 <h2 id="renew-certs">renew certificates automatically</h2>
205 <p>
206 <strong>NB:</strong> this script requires features that are
207 currently available only in the master branch.
208 </p>
209 <p>
210 <a href="https://git.omarpolo.com/gmid/tree/contrib/renew-certs">contrib/renew-certs</a>
211 is a script meant to be run in a crontab that watch for
212 certificate expiration. It can optionally renew the certs and
213 restart gmid too.
214 </p>
215 <p>Read the documentation with: <code>perldoc renew-certs</code>.</p>
216 <h2 id="vim-syntax-files">Vim syntax files</h2>
217 <p>
218 <a href="https://git.omarpolo.com/gmid/tree/contrib/vim">contrib/vim</a>
219 contains a syntax highlighting for vim. To install it, just
220 copy the files to <code>~/.vim</code>
221 or <code>/usr/share/vim/vimfiles</code>, e.g.
222 </p>
223 <pre>$ mkdir -p ~/.vim
224 $ cp -R contrib/vim/* ~/.vim/</pre>
225 <p>To enable Syntastic checker, add to your vimrc:</p>
226 <pre>let g:syntastic_gmid_checkers = ['gmid']</pre>
227 <p>The end result is something like this:</p>
228 <a href="vim-screenshot.png">
229 <img src="vim-screenshot.png" alt="Screenshot of vim editing gmid.conf with syntax highlighting" />
230 </a>
231 </body>
232 </html>