Blame


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