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

David Trattnig's avatar
David Trattnig committed
3
4
5
Tank implements an AURA import and playlist daemon. Uploads are normalized
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.
6

Christian Pointner's avatar
Christian Pointner committed
7
## Quickstart
8
9
10
11
12
13
14

To install tank, use the `go get` command:

```sh
$ go get gitlab.servus.at/autoradio/tank/...
```

15
Create configuration file see:
Christian Pointner's avatar
Christian Pointner committed
16
  https://gitlab.servus.at/autoradio/tank/blob/master/contrib/sample-cfg.yaml
17

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

21
22
23
And then run the `tank` binary:

```sh
24
$ $GOPATH/bin/tank --config config.yaml run --listen localhost:8040
25
```
Christian Pointner's avatar
Christian Pointner committed
26

27
### Problem with some versions of MariaDB
28

29
If you start `tank` for the first time using MariaDB you may get the following error message:
30
31
32
33
34

```
running database migrations failed: Error 1071: Specified key was too long; max key length is 767 bytes
```

35
36
This most likely means you are using an older version of MariaDB with the default character-set set to
`utf8mb4`. Please read [contrib/mariadb-stretch-err1071.md](/contrib/mariadb-stretch-err1071.md) for help.
37
38
39
40

If you encouter this problem on any other platform please let us know!


Christian Pointner's avatar
Christian Pointner committed
41
42
43
44
45
## Development

Check out the repository and build the daemon:

```sh
Christian Pointner's avatar
Christian Pointner committed
46
$ git clone https://gitlab.servus.at/autoradio/tank
Christian Pointner's avatar
Christian Pointner committed
47
48
$ cd tank
$ make
Christian Pointner's avatar
Christian Pointner committed
49
50
51
52
53
```

You may run the daemon using the following command:

```sh
Christian Pointner's avatar
Christian Pointner committed
54
$ ./contrib/run.sh
Christian Pointner's avatar
Christian Pointner committed
55
56
```

57
58
This is using `contrib/sample-cfg.yaml` and depends on a mysql or postgres server
running on localhost. You may use the scripts inside `contrib/` to start docker
Christian Pointner's avatar
Christian Pointner committed
59
60
61
62
63
containers for this purpose.

### mysql

```sh
Christian Pointner's avatar
Christian Pointner committed
64
$ ./contrib/mysql/run_server.sh
Christian Pointner's avatar
Christian Pointner committed
65
66
67
68
69
```

Wait for the server to boot up and then initialize the database using a second terminal:

```sh
Christian Pointner's avatar
Christian Pointner committed
70
71
$ ./contrib/mysql/run_client.sh
mysql> source init.sql
Christian Pointner's avatar
Christian Pointner committed
72
73
74
```

This command can also be used to empty the database if you want to start with a new one.
Christian Pointner's avatar
Christian Pointner committed
75
76
After the daemon has ran the initial migrations you may check out the schema of the database:

Christian Pointner's avatar
Christian Pointner committed
77
78
```sh
mysql> source info.sql
Christian Pointner's avatar
Christian Pointner committed
79
```
Christian Pointner's avatar
Christian Pointner committed
80
81
82
83

Once you are done with the database you can stop the server using:

```sh
Christian Pointner's avatar
Christian Pointner committed
84
$ ./contrib/mysql/stop_server.sh
Christian Pointner's avatar
Christian Pointner committed
85
86
87
88
89
```

### postgres

```sh
Christian Pointner's avatar
Christian Pointner committed
90
$ ./contrib/postgres/run_server.sh
Christian Pointner's avatar
Christian Pointner committed
91
92
93
94
95
```

Wait for the server to boot up and then initialize the database using a second terminal:

```sh
Christian Pointner's avatar
Christian Pointner committed
96
$ ./contrib/postgres/run_client.sh
Christian Pointner's avatar
Christian Pointner committed
97
$$$ psql < init.sql
Christian Pointner's avatar
Christian Pointner committed
98
99
100
```

This command can also be used to empty the database if you want to start with a new one.
Christian Pointner's avatar
Christian Pointner committed
101
102
103
After the daemon has ran the initial migrations you may check out the schema of the database:

```sh
Christian Pointner's avatar
Christian Pointner committed
104
$$$ psql < info.sql
Christian Pointner's avatar
Christian Pointner committed
105
```
Christian Pointner's avatar
Christian Pointner committed
106

107
Once you are done with the database you can stop the server by pressing `CTRL-C` inside the
Christian Pointner's avatar
Christian Pointner committed
108
terminal of the server.