Blame
|
1 | # Configuration |
||||||
| 2 | ||||||||
|
3 | The [[Installation Guide|Installation]] can be found [[here|Installation]]. |
||||||
| 4 | ||||||||
|
5 | An Otter Wiki is configured in the application via the <i class="fas fa-cogs"></i> |
||||||
|
6 | **Settings** interface as admin user. Alternatively you configure the variables via the |
||||||
| 7 | `settings.cfg` or via environment variables. |
|||||||
| 8 | ||||||||
| 9 | *Please note:* What is set in the config file `settings.cfg` will be overwritten first |
|||||||
| 10 | by the environment variables if they are set and second by the settings configured |
|||||||
| 11 | via the settings interface, which are stored in the database. In brief: `Settings Interface > Environment Variables > settings.cfg`. |
|||||||
|
12 | |||||||
|
13 | ### Application Preferences |
||||||
|
14 | |||||||
|
15 | | Variable | Example | Description | |
||||||
| 16 | |--------------------|-----------------|----------------------------------------------| |
|||||||
| 17 | | `SITE_NAME` | `'Otterwiki'` | The `SITE_NAME` displayed on every page and email | |
|||||||
| 18 | | `SITE_LOGO` | `'/Home/a/logo.png'` | Customize navbar logo url (can be a page attachment) | |
|||||||
|
19 | | `SITE_DESCRIPTION` | `'A minimalistic wiki powered by python, markdown and git.'` | The default description used in `<meta>` tags | |
||||||
|
20 | | `SITE_ICON` | `'/Home/a/favicon-32x32.png'` | Configure via an url to the image that is displayed as favicon (tab icon, URL icon, bookmark icon). This can be an attachment | |
||||||
| 21 | | `SITE_LANG` | `'en'` | Configures the lang attribute of the `<html>` lang used in the wiki | |
|||||||
| 22 | | `ROBOTS_TXT` | `'allow'` | Configures how the wiki indicates to visiting robots whether they are allowed to crawl the content, could be `allow` or `disallow` | |
|||||||
| 23 | | `HOME_PAGE` | `'My/Page'` | Configures which page is displayed when visiting the root URL (`/`), leave empty for default (`Home`) or define any page path, including special pages that start with `/-/` | |
|||||||
| 24 | | `HIDE_LOGO` | `False` | Hides or shows An Otter Wiki logo in the sidebar | |
|||||||
|
25 | |||||||
| 26 | ### Permission configuration |
|||||||
| 27 | ||||||||
| 28 | | Variable | Example | Description | |
|||||||
| 29 | |------------------|-----------------|----------------------------------------------| |
|||||||
| 30 | | `READ_ACCESS` | `'ANONYMOUS'` | Read access to wiki pages and attachments | |
|||||||
| 31 | | `WRITE_ACCESS` | `'REGISTERED'` | Write access to wiki pages | |
|||||||
| 32 | | `ATTACHMENT_ACCESS` | `'APPROVED'` | Write acccess to attachments | |
|||||||
|
33 | | `DISABLE_REGISTRATION` | `False` | With `DISABLE_REGISTRATION=True` new users can not sign-up for a new account | |
||||||
|
34 | | `AUTO_APPROVAL` | `False` | With `AUTO_APPROVAL=True` users are approved on registration | |
||||||
| 35 | | `EMAIL_NEEDS_CONFIRMATION` | `True` | With `EMAIL_NEEDS_CONFIRMATION=True` users have to confirm their email address | |
|||||||
| 36 | | `NOTIFY_ADMINS_ON_REGISTER` | `True` | Notify admins if a new user is registered | |
|||||||
| 37 | ||||||||
| 38 | There are four types of users in the Otterwiki: `ANONYMOUS` are non logged in users. |
|||||||
| 39 | Users that registered via email and are logged in are `REGISTERED`, users approved via |
|||||||
| 40 | the settings menu by an admin are `APPROVED`. In addition to the `APPROVED` flag the `ADMIN` |
|||||||
| 41 | flag can be set. Users with the `ADMIN` flag can edit (and approve) other users. The first registered user is flagged as admin. |
|||||||
| 42 | ||||||||
|
43 | |||||||
| 44 | ### Sidebar Preferences |
|||||||
| 45 | ||||||||
| 46 | | Variable | Example | Description | |
|||||||
| 47 | | ----------------------- | ---------- | -------------- | |
|||||||
| 48 | | `SIDEBAR_MENUTREE_MODE` | `'SORTED'` | Mode of the sidebar, see below. | |
|||||||
| 49 | | `SIDEBAR_MENUTREE_MAXDEPTH` | `unlimited` | Limit the depth of the pages displayed by any number. | |
|||||||
| 50 | ||||||||
| 51 | For `SIDEBAR_MENUTREE_MODE` pick one of |
|||||||
| 52 | ||||||||
| 53 | - `NONE` (or empty) no sidebar displayed |
|||||||
| 54 | - `SORTED` Directories and pages, sorted |
|||||||
| 55 | - `DIRECTORIES_GROUPED` Directories and pages, with directories grouped first |
|||||||
| 56 | - `DIRECTORIES_ONLY`List directories only. |
|||||||
| 57 | ||||||||
| 58 | ### Content and Editing Preferences |
|||||||
| 59 | ||||||||
| 60 | | Variable | Example | Description | |
|||||||
| 61 | | ----------------------- | ---------- | -------------- | |
|||||||
|
62 | | `COMMIT_MESSAGE` | `'REQUIRED'` | Set to `'OPTIONAL'` if commit messages should be optional | |
||||||
| 63 | | `RETAIN_PAGE_NAME_CASE` | `False` | Set to `True` to retain case of the page name in the filename used for storing the page | |
|||||||
| 64 | | `TREAT_UNDERSCORE_AS_SPACE_FOR_TITLES` | `False` | Set to `True` to replace underscores (`_`) with spaces in page titles, breadcrumbs, and page index | |
|||||||
| 65 | | `WIKILINK_STYLE` | `'LINKTITLE'` | Set to `'LINKTITLE'` for `[[WikiPage|Text to display]]` format, leave empty for `[[Text to display|WikiPage]]` format (default) | |
|||||||
|
66 | | `MAX_FORM_MEMORY_SIZE` | `1000000` | The the maximum size of a submitted form, see the [Flask documentation](https://flask.palletsprojects.com/en/stable/config/#MAX_FORM_MEMORY_SIZE). Increase this if you have really large pages to edit and save. | |
||||||
|
67 | |||||||
|
68 | ### Repository Management |
||||||
| 69 | ||||||||
|
70 | For a detailed guide on **Repository Management** settings, please follow this link: [[Repository Management|Configuration/Repository Management]] |
||||||
| 71 | ||||||||
|
72 | | Variable | Example | Description | |
||||||
| 73 | | ---------------- | ---------- | -------------- | |
|||||||
| 74 | | `GIT_WEB_SERVER` | `False` | Set to to `True` to allow cloning the wiki via git+http(s) | |
|||||||
| 75 | ||||||||
|
76 | ### Mail configuration |
||||||
| 77 | ||||||||
|
78 | An Otter Wiki is using [Flask-Mail](https://flask-mail.readthedocs.io/en/latest/). |
||||||
|
79 | |||||||
| 80 | | Variable | Example | Description | |
|||||||
| 81 | |------------------|-----------------|----------------------------------------------| |
|||||||
| 82 | | `MAIL_DEFAULT_SENDER` | `'otterwiki@example.com'` | The sender address of all mails | |
|||||||
| 83 | | `MAIL_SERVER` | `'smtp.googlemail.com'` | The smtp server address | |
|||||||
| 84 | | `MAIL_PORT` | `465` | The smtp server port | |
|||||||
| 85 | | `MAIL_USERNAME` | `'USERNAME'` | Username for the mail account | |
|||||||
| 86 | | `MAIL_PASSWORD` | `'PASSWORD'` | Password for the mail account | |
|||||||
| 87 | | `MAIL_USE_TLS` | `False` | Use TLS encrytion | |
|||||||
| 88 | | `MAIL_USE_SSL` | `True` | Use SSL encryption | |
|||||||
| 89 | ||||||||
|
90 | ### Authentication configuration |
||||||
| 91 | ||||||||
| 92 | | Variable | Example | Description | |
|||||||
| 93 | |------------------|-----------------|----------------------------------------------| |
|||||||
| 94 | | `AUTH_METHOD` | `'SIMPLE'` | See below. | |
|||||||
| 95 | ||||||||
| 96 | Per default an Otter Wiki uses a local database for storing authentication information. |
|||||||
| 97 | ||||||||
| 98 | #### Authentication with `PROXY_HEADER`s |
|||||||
| 99 | ||||||||
| 100 | With `AUTH_METHOD='PROXY_HEADER'` an Otter Wiki expects the headers |
|||||||
| 101 | ||||||||
| 102 | - `x-otterwiki-name` |
|||||||
| 103 | - `x-otterwiki-email` |
|||||||
| 104 | - `x-otterwiki-permissions` |
|||||||
| 105 | ||||||||
| 106 | to be set by the proxy service using forward authentication. |
|||||||
| 107 | ||||||||
| 108 | The headers `x-otterwiki-name`and `x-otterwiki-email` are used for receiving author information and `x-otterwiki-permissions` a comma seperated list of permissions `READ`, `WRITE`, `UPLOAD` and `ADMIN`. |
|||||||
| 109 | ||||||||
| 110 | A simplified proof of concept can be found on github: [otterwiki/docs/auth_examples/header-auth](https://github.com/redimp/otterwiki/tree/main/docs/auth_examples/header-auth). |
|||||||
| 111 | ||||||||
|
112 | ### Advanced configuration |
||||||
| 113 | ||||||||
| 114 | This applies only when you create the `settings.cfg` manually. Create your |
|||||||
| 115 | `settings.cfg` based upon the `settings.cfg.skeleton` and set the |
|||||||
| 116 | variables fitting to your environment. |
|||||||
| 117 | ||||||||
| 118 | | Variable | Example | Description | |
|||||||
| 119 | |------------------|-----------------|----------------------------------------------| |
|||||||
| 120 | | `SECRET_KEY` | `'CHANGE ME'` | Choose a random string that is used to encrypt user session data | |
|||||||
| 121 | | `REPOSITORY` | `'/path/to/the/repository/root'` | The absolute path to the repository storing the wiki pages | |
|||||||
| 122 | | `SQLALCHEMY_DATABASE_URI` | `'sqlite:////path/to/the/sqlite/file'` | The absolute path to the database storing the user credentials | |
|||||||
|
123 | | `LOG_LEVEL`. | `'DEBUG'` | Set the log level to one of `'DEBUG'`, `'INFO'`, `'WARNING'`, `'ERROR'`. | |
||||||
|
124 | |||||||
| 125 | For the `SQLALCHEMY_DATABASE_URI` see <https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/#connection-uri-format>. |
|||||||
| 126 | ||||||||
|
127 | #### User UID running docker process |
||||||
| 128 | ||||||||
| 129 | Per default in both the default and the `-slim` image the process running An Otter Wiki (and accessing the files in repository) is running with `uid=33`. |
|||||||
| 130 | ||||||||
| 131 | ##### UID in the default image |
|||||||
| 132 | ||||||||
| 133 | To change this when using the default image, please configure the environment variables `PUID` and `PGID`. For example to run as user with `uid=1000 gid=1000` use this `compose.yaml`: |
|||||||
| 134 | ||||||||
| 135 | ```yaml |
|||||||
| 136 | services: |
|||||||
| 137 | otterwiki: |
|||||||
| 138 | image: redimp/otterwiki:2 |
|||||||
| 139 | restart: unless-stopped |
|||||||
|
140 | environment: |
||||||
|
141 | PUID: 1000 |
||||||
|
142 | PGID: 1000 |
||||||
|
143 | ports: |
||||||
| 144 | - 8080:80 |
|||||||
| 145 | volumes: |
|||||||
| 146 | - ./app-data:/app-data |
|||||||
| 147 | ``` |
|||||||
| 148 | ||||||||
| 149 | ##### USER in the `-slim` image |
|||||||
| 150 | ||||||||
| 151 | The `-slim` image is running as unpriviliged user must therefore be configured differently: In the way docker intended, with configuring the [user](https://docs.docker.com/reference/compose-file/services/#user). For example to run as user with `uid=1000 gid=1000` use this `compose.yaml`: |
|||||||
| 152 | ||||||||
| 153 | ```yaml |
|||||||
| 154 | services: |
|||||||
| 155 | otterwiki: |
|||||||
| 156 | image: redimp/otterwiki:2-slim |
|||||||
| 157 | restart: unless-stopped |
|||||||
| 158 | user: 1000:1000 |
|||||||
| 159 | ports: |
|||||||
| 160 | - 8080:8080 |
|||||||
| 161 | volumes: |
|||||||
| 162 | - ./app-data:/app-data |
|||||||
| 163 | ``` |
|||||||
| 164 | ||||||||
| 165 | Make sure that the configured `uid:gid` has read- and write permissions to volume mounted as `/app-data`. |
|||||||
| 166 | ||||||||
|
167 | ### Reverse Proxy and IPs |
||||||
| 168 | ||||||||
|
169 | Running the docker container behind a reverse proxy will show only the IP of the reverse proxy in the log files. With setting `REAL_IP_FROM` to the ip address or network of the reverse proxy, the IPs of the connection clients will be logged. |
||||||
|
170 | |||||||
|
171 | | Variable | Example | Description | |
||||||
| 172 | |------------------|-------------------|----------------------------------------------| |
|||||||
| 173 | | `REAL_IP_FROM` | `'172.20.0.0/24'` | Configure wiki to respect `X-Real-IP` header in the requests coming from this IP or network. | |
|||||||
