Blame

f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
1
# Installation
2
bb20b4 Ralph Thesen 2024-05-05 09:06:07
fixed link
3
The recommend way of running An Otter Wiki is via [[docker compose|Installation#using-docker-compose]]. For deploying in kubernetes via [[Helm|Installation#kubernetes]].
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
4
5
## Requirements
6
7
The **CPU** requirements are pretty low, you can run it on a Raspberry Pi 1 A (ARMv6). The **RAM** required is around 100MiB (according to `docker stats`). The required disk **storage** depends on the content, please keep in mind, that the backend is a git repository that never forgets: Deleting a page or an attachment does not free up any space. The wiki needs no internet access. Clients using the wiki need only access to the server running the wiki, so it can run in an environment which is _isolated_ from the internet.
8
9
As URLs as dedicated domain (e.g. `wiki.domain.tld`) is required, it can not be mapped into a subfolder.
10
f7923b Ralph Thesen 2023-12-06 16:58:57
Update requirements: Clients need javascript
11
Client requirement: Javascript must be activated in your browser to use the wiki.
12
ab255a Ralph Thesen 2023-11-26 13:35:43
Updated docker cli command
13
## Using docker cli
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
14
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
15
An Otter Wiki is published as a Docker image on Docker hub as [`redimp/otterwiki`](https://hub.docker.com/r/redimp/otterwiki). The stable images are build for the plattforms `amd64`, `arm64`, `armv7` and `armv6`.
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
16
17
Make sure you have [docker](https://docs.docker.com/engine/install/) installed.
18
ab255a Ralph Thesen 2023-11-26 13:35:43
Updated docker cli command
19
To run an otter wiki via docker cli, listening on port 8080 and using a local directory for data persistency, use the following command:
20
```bash
21
docker run --name otterwiki \
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
22
-p 8080:80 \
ab255a Ralph Thesen 2023-11-26 13:35:43
Updated docker cli command
23
-v $PWD/app-data:/app-data \
14546e Ralph Thesen 2024-01-03 11:15:44
use image tag :2 instead of :2.0
24
redimp/otterwiki:2
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
25
```
26
Open the wiki via http://127.0.0.1:8080 if you are running the docker command on your machine.
27
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
28
You can configure the application with environment variables e.g.
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
29
```
30
-e SITE_NAME="My Wiki" -e SITE_DESCRIPTION="An otter wiki run via docker"
31
```
32
For all configuration options please see [[Configuration]].
33
34
## Using docker compose
35
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
36
The recommended way of running An Otter Wiki is via `docker compose`.
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
37
38
1. Create a `docker-compose.yaml` file
39
40
```yaml
41
version: '3'
42
services:
43
otterwiki:
14546e Ralph Thesen 2024-01-03 11:15:44
use image tag :2 instead of :2.0
44
image: redimp/otterwiki:2
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
45
restart: unless-stopped
46
ports:
47
- 8080:80
48
volumes:
49
- ./app-data:/app-data
50
```
51
52
2. Run `docker compose up -d`
53
3. Access the wiki via http://127.0.0.1:8080 if run on your machine.
54
4. Register your account. The first account is an admin-account with access to the application settings. The first accounts email address doesn't need to be confirmed nor has the account to be activated.
55
5. Customize the settings to your liking.
56
6. It's highly recommended to use a webserver as reverse proxy to connect to the docker process, see [Reverse Proxy](#reverse-proxy) below.
57
58
Alternativly you can configure the application using environment variables, for example:
59
60
```yaml
61
version: '3'
62
services:
63
otterwiki:
14546e Ralph Thesen 2024-01-03 11:15:44
use image tag :2 instead of :2.0
64
image: redimp/otterwiki:2
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
65
restart: unless-stopped
66
ports:
67
- 8080:80
68
volumes:
69
- ./app-data:/app-data
70
environemnt:
71
MAIL_DEFAULT_SENDER: no-reply@example.com
72
MAIL_SERVER: smtp.server.tld
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
73
MAIL_PORT: 465
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
74
MAIL_USERNAME: otterwiki@example.com
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
75
MAIL_PASSWORD: somepassword
76
MAIL_USE_SSL: True
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
77
```
78
79
For all configuration options please see [[Configuration]].
80
81
## podman and podman-compose
82
83
An Otter Wiki can be run with `podman` and `podman-compose` in the same way as with` docker` and `docker compose` please see above.
84
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
85
## Kubernetes
86
87
An Otter Wiki can be conveniently deployed on kubernetes using the official Helm Chart.
88
For example you can create a new deployment with an ingress on `otterwiki.example.com` with
89
90
```bash
91
helm install otterwiki-example \
92
--set config.SITE_DESCRIPTION="An Otter Wiki deployed with Helm" \
93
--set ingress.enabled=true \
94
--set ingress.hosts[0].host="otterwiki.example.com" \
95
oci://registry-1.docker.io/redimp/otterwiki
96
```
97
98
Please refer to the [chart](https://github.com/redimp/otterwiki/tree/main/helm) for
99
a detailed README with instructions, more examples and informations about the default values
100
of the chart.
101
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
102
## From source as WSGI application with uwsgi
103
104
1. Install the prerequisites
105
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
106
i. Debian / Ubuntu
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
107
```
108
apt install git build-essential python3-dev python3-venv
109
```
110
ii. RHEL8 / Fedora / CentOS8 / Rocky Linux 8
111
```
112
yum install make python3-devel
113
```
114
2. Clone the otterwiki repository and enter the directory
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
115
```
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
116
git clone https://github.com/redimp/otterwiki.git
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
117
cd otterwiki
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
118
```
119
3. Create and initialize the repository where the otterwiki data lives
120
```bash
121
mkdir -p app-data/repository
122
# initialize the empty repository
123
git init app-data/repository
124
```
125
4. Create a minimal `settings.cfg` e.g. via
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
126
```bash
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
127
echo "REPOSITORY='${PWD}/app-data/repository'" >> settings.cfg
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
128
echo "SQLALCHEMY_DATABASE_URI='sqlite:///${PWD}/app-data/db.sqlite'" >> settings.cfg
129
echo "SECRET_KEY='$(echo $RANDOM | md5sum | head -c 16)'" >> settings.cfg
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
130
```
131
5. Create a virtual environment and install An Otter Wiki
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
132
```
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
133
python3 -m venv venv
134
./venv/bin/pip install -U pip uwsgi
135
./venv/bin/pip install .
136
```
137
6. Run uwsgi listening on the localhost port 8080
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
138
```bash
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
139
export OTTERWIKI_SETTINGS=$PWD/settings.cfg
140
./venv/bin/uwsgi --http 127.0.0.1:8080 --master -enable-threads --die-on-term -w otterwiki.server:app
141
```
142
7. Open http://127.0.0.1:8080 in your browser.
143
8. Register your account. The first account is an admin-account with access to the application settings.
144
9. Alternatively can you configure the application using the `settings.cfg`. For all configuration options please see [[Configuration]].
145
10. Create a service file e.g. `/etc/systemd/system/otterwiki.service`
146
147
```systemd
148
[Unit]
149
Description=uWSGI server for An Otter Wiki
150
151
[Service]
152
User=www-data
153
Group=www-data
154
WorkingDirectory=/path/to/an/otterwiki
155
ExecStart=/path/to/an/otterwiki/env/bin/uwsgi --http 127.0.0.1:8080 -enable-threads --die-on-term -w otterwiki.server:app
156
SyslogIdentifier=otterwiki
157
158
[Install]
159
WantedBy=multi-user.target
160
```
161
162
It's highly recommended to use a webserver as reverse proxy to connect to uwsgi, see [Reverse Proxy](#reverse-proxy) below.
163
164
# Reverse Proxy
165
166
A reverse proxy is a server that sits in front of web servers and forwards
167
client (e.g. web browser) requests to those web servers. They are useful
168
when hosting multiple services on a host and make it much easier to configure
169
https. Neither An Otter Wiki itself nor the in the docker image provides https.
170
171
Mini how-tos for configuring Apache, NGINX and Caddy are provided below. For complete documention please check the corresponding software documention.
172
173
## NGINX
174
175
This is a minimal example of a config that configures NGINX as a reverse proxy. The full documentation about NGINX as reverse proxy can be found [here](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/).
176
177
It's assumed that An Otter Wiki is running either in a docker container or as a uwsgi process and listening on port 8080.
178
179
```nginx
180
server {
181
server_name wiki.domain.tld;
182
listen 80;
183
location / {
291014 Ralph Thesen 2024-06-08 23:49:27
Bump up the client_max_body_size up to 64MB to allow using attachments.
184
proxy_set_header Host $http_host;
185
proxy_set_header X-Real-IP $remote_addr;
186
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
187
proxy_set_header X-Forwarded-Host $http_host;
188
proxy_pass http://127.0.0.1:8080;
189
client_max_body_size 64M; # for attachments of a size up to 64 Mb
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
190
}
191
}
192
```
193
194
### NGINX on Debian, Ubuntu and derivates
195
196
- Install nginx via `apt install -y nginx`
197
- Create the `otterwiki.conf` in `/etc/nginx/sites-enabled/`
198
- Check the syntax via `nginx -t`
199
- Restart nginx via `systemctl restart nginx`
200
- Open <http://wiki.domain.tld> in your browser
201
- Check `journalctl -xeu nginx` and `/var/log/nginx/error.log` for errors.
202
203
### NGINX on RHEL, CentOS, Rocky and derivates
204
205
- Install nginx via `dnf install nginx`
206
- Start NGINX and enable at boot: `sudo systemctl enable --now nginx`
207
- With SELinux enabled, make sure httpd can connect using `setsebool -P httpd_can_network_connect on`
208
- Create the `otterwiki.conf` in `/etc/nginx/conf.d/`
209
- Check the syntax via `nginx -t`
210
- Restart nginx via `systemctl restart nginx`
211
- Open <http://wiki.domain.tld> in your browser
212
- Check `journalctl -xeu nginx` and `/var/log/nginx/error.log` for errors.
213
214
See <https://www.redhat.com/sysadmin/setting-reverse-proxies-nginx> for a complete guide.
215
216
## Apache
217
218
This is a minimal example how to configure Apache as reverse proxy. Please see the [Apache documentation](https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html) for complete details.
219
220
It's assumed that An Otter Wiki is running either in a docker container or as a uwsgi process and listening on port 8080.
221
222
```
223
<VirtualHost *:*>
224
ServerName wiki.domain.tld
225
ProxyPreserveHost On
226
ProxyPass / http://0.0.0.0:8080/
227
ProxyPassReverse / http://0.0.0.0:8080/
228
</VirtualHost>
229
```
230
231
### Apache on Debian, Ubuntu and derivates
232
233
- Install apache2 via `apt install -y apache2`
234
- Enable proxy modules via `a2enmod proxy proxy_http`
235
- Create the `otterwiki.conf` config file in `/etc/apache2/site-available/`
236
- Enable the site via `a2ensite otterwiki`
237
- Restart apache2 `systemctl restart apache2`
238
- Open <http://wiki.domain.tld> in your browser
239
- Check `journalctl -xeu apache2.service` and `/var/log/apache2/error.log` for error messages.
240
241
### Apache on RHEL, CentOS, Rocky and derivates
242
243
- Install apache2 via `dnf install httpd`
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
244
- Start apache2 and enable at boot: `sudo systemctl enable --now httpd`
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
245
- Create the `otterwiki.conf` config file in `/etc/httpd/conf.d/`
246
- With SELinux enabled, make sure httpd can connect using `setsebool -P httpd_can_network_connect on`
247
- Restart apache2 via `systemctl restart httpd`
248
- Open <http://wiki.domain.tld> in your browser
249
- Check `journalctl -xeu httpd.service` and `/var/log/httpd/error_log` for error messages.
250
251
## Caddy
252
253
[Caddy](https://caddyserver.com/) is an open source webserver with a very light configuration that makes a fine reverse proxy.
254
255
After [installing](https://caddyserver.com/docs/install) caddy, configure `/etc/caddy/Caddyfile` with e.g.
256
257
```
258
domain.tld {
679b7f Ralph Thesen 2024-05-05 09:04:15
added: helm chart example and link. fixed: Typos, tabs, trailing whitespaces.
259
reverse_proxy localhost:8080
f1509e Ralph Thesen 2023-11-18 14:39:06
Added documentation for installing An Otter Wiki
260
}
261
```
262
263
With a server accessible from the internet, `domain.tld` beeing a proper domain name with A/AAAA DNS records pointing to the server, caddy will [automatically](https://caddyserver.com/docs/automatic-https) serve HTTPS.