Skip to content

Commit a053ae4

Browse files
committed
Document proxy configuration and warn more explicit about the working directory issues and application.properties
1 parent cec5c6f commit a053ae4

File tree

2 files changed

+50
-7
lines changed

2 files changed

+50
-7
lines changed

docs/user-guide/src/configuration/README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ For the desktop version of ANNIS, you most probably don't need to change any of
44
If you are installing ANNIS on a server however, you might want to tweak the settings.
55
The [Java Properties](http://en.wikipedia.org/w/index.php?title=.properties&oldid=521500688), [TOML](https://toml.io/) and [JSON](http://www.json.org/) file formats are used for different kind of configuration.
66

7-
ANNIS uses the Spring Boot configuration system and thus it will search for a Java Properties based configuration file named `application.properties` in the current working directory or a `config` sub-directory of the working directory.[^working-dir]
8-
You can also use the command line argument `--spring.config.location=file:/<location-on-disk>` to specify a specific configuration file.
7+
ANNIS uses the Spring Boot configuration system and thus it will search for a Java Properties based configuration file named `application.properties` in the current working directory or a `config` sub-directory of the working directory.
8+
9+
<div class="warning">
10+
Depending on how you start ANNIS, the working directory can be different.
11+
12+
When using `java -jar /path/to/annis-server.jar`, the working directory is the same as the working directory of your current shell.
13+
If you start ANNIS by treating it like an executable file, e.g. by running `/path/to/annis-server.jar` directly, **the directory containing the jar is used as the working directory** of the application per default.
14+
</div>
15+
16+
To avoid confusion from where the file is loaded from, you can specify the configuration file location by passing the command line argument `--spring.config.location=file:/<location-on-disk>` when starting ANNIS.
17+
918
More search paths for configurations files are documented in the [Spring Boot documentation](https://docs.spring.io/spring-boot/docs/2.3.x/reference/html/spring-boot-features.html#boot-features-external-config-application-property-files).
1019

1120

@@ -46,7 +55,3 @@ spring.datasource.url=jdbc:h2:file:${user.home}/.annis/v4/frontend_data.h2
4655
```
4756

4857
Being a Spring Boot application, ANNIS configuration properties also be directly given as [command line argument](https://docs.spring.io/spring-boot/docs/2.3.x/reference/html/spring-boot-features.html#boot-features-external-config-command-line-args).
49-
50-
[^working-dir]: Depending on how you start ANNIS, the working directory can be different.
51-
When using `java -jar /path/to/annis-server.jar`, the working directory is the same as the working directory of your current shell.
52-
If you start ANNIS by treating it like an executable file, e.g. by running `/path/to/annis-server.jar` directly, the directory containing the jar is used as the working directory of the application per default.

docs/user-guide/src/installation/server.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,43 @@ This will start a REST service on port 5711 and the user interface on port 5712.
1414
The user interface service will accept requests from all IPs and the embedded REST service only from `localhost`.
1515
We recommend using a Nginx or Apache server as proxy for the user interface service for production to enable important features like HTTPS encryption.
1616

17+
## Configuring a proxy server
18+
19+
To configure a proxy that uses a different path than `/`, e.g. `https://example.com/annis`, first make sure that the context path is set in the [`application.properties` file](../configuration/).
20+
21+
```
22+
server.servlet.context-path=/annis
23+
```
24+
25+
### Nginx
26+
27+
You can configure the location to act as a proxy.
28+
The `location` must match the context path and end with an `/`.
29+
The `proxy_pass` directive does not contain the context path, but only specifies the server host and port.
30+
31+
```
32+
location /annis/ {
33+
proxy_pass http://127.0.0.1:5712;
34+
# Optimize for Web Sockets
35+
# https://www.nginx.com/blog/websocket-nginx/
36+
proxy_http_version 1.1;
37+
proxy_set_header Upgrade $http_upgrade;
38+
proxy_set_header Connection: $connection_upgrade;
39+
client_max_body_size 2G;
40+
}
41+
```
42+
43+
### Apache
44+
45+
Recent versions of Apache have support for proxying web socket connects, but the `mod_proxy` module must be enabled: <https://httpd.apache.org/docs/2.4/mod/mod_proxy.html>
46+
47+
Then add the following configuration to your site:
48+
49+
```
50+
ProxyPass /annis/ http://localhost:5712/annis/ upgrade=websocket
51+
ProxyPassReverse /annis/ http://localhost:5712/annis/
52+
```
53+
1754
## Use systemd to run ANNIS as a service
1855

1956
You can create a simple systemd configuration file with the name `annis.service` and save it under one of the valid configuration folders, e.g. `/etc/systemd/system` to register ANNIS as a system service.
@@ -24,7 +61,7 @@ Description=ANNIS corpus search and visualization
2461
2562
[Service]
2663
Type=simple
27-
ExecStart=/usr/local/bin/annis-gui-<version>-desktop.jar
64+
ExecStart=/usr/local/bin/annis-gui-<version>-desktop.jar --spring.config.location=file:/<location-on-disk>
2865
Environment=""
2966
User=annis
3067
Group=annis
@@ -35,6 +72,7 @@ WantedBy=multi-user.target
3572
```
3673

3774
This configuration assumes that there is a “annis” user and group on the server.
75+
The `WorkingDirectory` is not used to locate the `application.properties` file and thus it is best to specify its location with the `--spring.config.location` argument.
3876

3977
You can permanently enable this service by calling
4078
```bash

0 commit comments

Comments
 (0)