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

3
4
Tank implements an AURA import and playlist daemon.

Christian Pointner's avatar
Christian Pointner committed
5
## Quickstart
6
7
8
9
10
11
12

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

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

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

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

19
20
21
And then run the `tank` binary:

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

25
### Problem with some versions of MariaDB
26

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

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

33
34
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.
35
36
37
38

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


Christian Pointner's avatar
Christian Pointner committed
39
40
41
42
43
## Development

Check out the repository and build the daemon:

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

You may run the daemon using the following command:

```sh
Christian Pointner's avatar
Christian Pointner committed
52
$ ./contrib/run.sh
Christian Pointner's avatar
Christian Pointner committed
53
54
```

55
56
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
57
58
59
60
61
containers for this purpose.

### mysql

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

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

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

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
73
74
After the daemon has ran the initial migrations you may check out the schema of the database:

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

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

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

### postgres

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

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

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

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
99
100
101
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
102
$$$ psql < info.sql
Christian Pointner's avatar
Christian Pointner committed
103
```
Christian Pointner's avatar
Christian Pointner committed
104

105
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
106
terminal of the server.