Skip to content
Snippets Groups Projects
README.md 2.66 KiB
Newer Older
Christian Pointner's avatar
Christian Pointner committed
# Import and Playlist Daemon

Tank implements an AURA import and playlist daemon. Uploads can be 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.
## Requirements

* [Go](https://golang.org/) (v1.12+ recommended)

Christian Pointner's avatar
Christian Pointner committed
## Quickstart

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

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

Create configuration file see:
https://gitlab.servus.at/autoradio/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, and a Postgres database is present and set up
according to the configuration.
And then run the `tank` binary:

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

## Development

Check out the repository and build the daemon:

```sh
Christian Pointner's avatar
Christian Pointner committed
$ git clone https://gitlab.servus.at/autoradio/tank
Christian Pointner's avatar
Christian Pointner committed
$ cd tank
$ make
### Database Setup
First, we need to start a Postgres container:
Christian Pointner's avatar
Christian Pointner committed

```sh
$ ./contrib/run_server.sh
Wait for the server to boot up and then initialize the database using a second
terminal, initialize the database:
Christian Pointner's avatar
Christian Pointner committed

```sh
$ ./contrib/run_client.sh
$$$ psql < init.sql
This command can also be used to empty the database if you want to start with a
new one.

After the daemon has applied the initial migrations you may check out the
schema of the database:
Christian Pointner's avatar
Christian Pointner committed
```sh
$$$ psql < info.sql
Once you are done with the database you can stop the server by pressing
`CTRL-C` inside the terminal of the server.

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

```sh
$ ./contrib/run.sh
This script is using `contrib/sample-cfg.yaml` and depends on a postgres server
running on localhost.
You may use the scripts inside `contrib/` to start docker containers for this purpose.

## Running behind reverse proxies
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:
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name aura.example.com;
    ssl_certificate     /path/to/certificate;
    ssl_certificate_key /path/to/private-key;
    location /tank/ {
         proxy_buffering off;
         proxy_ignore_headers "X-Accel-Buffering";
         proxy_request_buffering off;
         proxy_http_version 1.1;
         proxy_pass http://127.0.0.1:8040/;
    }
    ## ... other locations ...
}
```