README.md 2.3 KB
Newer Older
Christian Pointner's avatar
Christian Pointner committed
1
2
# Import and Playlist Daemon

Christian Pointner's avatar
Christian Pointner committed
3
Tank implements an AURA import and playlist daemon. Uploads can be normalized
4
5
6
based on the [loudnorm](https://k.ylo.ph/2016/04/04/loudnorm.html) Loudness
Normalization. Resulting files are served to Aura Engine via some configured
directory.
7

David Trattnig's avatar
David Trattnig committed
8
9
10
## Requirements

* [Go](https://golang.org/) (v1.12+ recommended)
11
12
* Docker (v20.10+)
* GNU Make (v4)
Christian Pointner's avatar
Christian Pointner committed
13
14
15
16
17
18

## Development

Check out the repository and build the daemon:

```sh
Christian Pointner's avatar
Christian Pointner committed
19
$ git clone https://gitlab.servus.at/autoradio/tank
Christian Pointner's avatar
Christian Pointner committed
20
21
$ cd tank
$ make
Christian Pointner's avatar
Christian Pointner committed
22
23
```

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
## Configuration

Create a configuration file, `tank.yaml`, based on:
https://gitlab.servus.at/aura/tank/-/blob/master/contrib/sample-cfg.yaml

Make sure that the directory pointed to by `store.path` exists and is writeable
for the user running the daemon.

### OIDC Client

After [Registering clients at
Steering](https://gitlab.servus.at/aura/meta/-/blob/master/docs/administration/oidc-client-config.md#registering-clients-at-steering),
update `OIDC_CLIENT_ID` and `OIDC_CLIENT_SECRET` in `contrib/run.sh` to match
your installation.

## Database Setup
Christian Pointner's avatar
Christian Pointner committed
40

41
First, we need to start a Postgres container:
Christian Pointner's avatar
Christian Pointner committed
42
43

```sh
44
$ ./contrib/run_server.sh
Christian Pointner's avatar
Christian Pointner committed
45
46
```

47
Wait for the server to boot up and then initialize the database using a second
48
terminal:
Christian Pointner's avatar
Christian Pointner committed
49
50

```sh
51
52
$ ./contrib/run_client.sh
$$$ psql < init.sql
Christian Pointner's avatar
Christian Pointner committed
53
54
```

55
Once the database is created, you can quit by pressing `CTRL-C`.
56
57

Now, you may run the daemon using the following command:
Christian Pointner's avatar
Christian Pointner committed
58
59

```sh
60
$ ./contrib/run.sh
Christian Pointner's avatar
Christian Pointner committed
61
62
```

63
This script uses `tank.yaml` and depends on the postgres server running.
64
65

## Running behind reverse proxies
Christian Pointner's avatar
Christian Pointner committed
66

67
68
69
70
71
For production environments we highly recommend running `tank` behind an
SSL-enabling reverse proxy. If the base path for the api endpoints as well as
the authentication should be hosted under a subdirectory, the reverse proxy
needs to rewrite the request to be based on `/`. For Nginx the following
configuration can be used:
Christian Pointner's avatar
Christian Pointner committed
72
73

```
74
75
76
77
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name aura.example.com;
Christian Pointner's avatar
Christian Pointner committed
78

79
80
    ssl_certificate     /path/to/certificate;
    ssl_certificate_key /path/to/private-key;
Christian Pointner's avatar
Christian Pointner committed
81

82
83
84
85
86
    location /tank/ {
         proxy_buffering off;
         proxy_ignore_headers "X-Accel-Buffering";
         proxy_request_buffering off;
         proxy_http_version 1.1;
Christian Pointner's avatar
Christian Pointner committed
87

88
89
90
91
92
         proxy_pass http://127.0.0.1:8040/;
    }
    ## ... other locations ...
}
```