aboutsummaryrefslogtreecommitdiff
path: root/site/contrib.html
blob: b505e2ab00a63ed0957a8915891166cdeccd02b2 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!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>