Commit cc0c4565 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

Updated and cleaned-up the instructions

parent fa1a5d8b
# Import and Playlist Daemon # Import and Playlist Daemon
Tank implements an AURA import and playlist daemon. Uploads can be normalized 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. based on the [loudnorm](https://k.ylo.ph/2016/04/04/loudnorm.html) Loudness
Resulting files are served to Aura Engine via some configured directory. Normalization. Resulting files are served to Aura Engine via some configured
directory.
## Requirements ## Requirements
...@@ -17,10 +18,11 @@ $ go get gitlab.servus.at/autoradio/tank/... ...@@ -17,10 +18,11 @@ $ go get gitlab.servus.at/autoradio/tank/...
``` ```
Create configuration file see: Create configuration file see:
https://gitlab.servus.at/autoradio/tank/blob/master/contrib/sample-cfg.yaml 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 Make sure that the directory pointed to by `store.path` exists and is writeable
for the user running the daemon 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: And then run the `tank` binary:
...@@ -28,52 +30,6 @@ And then run the `tank` binary: ...@@ -28,52 +30,6 @@ And then run the `tank` binary:
$ $GOPATH/bin/tank --config config.yaml run --listen localhost:8040 $ $GOPATH/bin/tank --config config.yaml run --listen localhost:8040
``` ```
### Problem with some versions of MariaDB
If you start `tank` for the first time using MariaDB you may get the following error message:
```
running database migrations failed: Error 1071: Specified key was too long; max key length is 767 bytes
```
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.
If you encouter this problem on any other platform please let us know!
## Running behind reverse proxies
For production environments we highly recommend to run `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 sub-directory,
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 ...
}
```
Please mind that the built-in web UI does not work when the base-path is not `/`. Please see !2 for more
details about this.
## Development ## Development
Check out the repository and build the daemon: Check out the repository and build the daemon:
...@@ -84,61 +40,71 @@ $ cd tank ...@@ -84,61 +40,71 @@ $ cd tank
$ make $ make
``` ```
You may run the daemon using the following command: ### Database Setup
```sh First, we need to start a Postgres container:
$ ./contrib/run.sh
```
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
containers for this purpose.
### mysql
```sh ```sh
$ ./contrib/mysql/run_server.sh $ ./contrib/run_server.sh
``` ```
Wait for the server to boot up and then initialize the database using a second terminal: Wait for the server to boot up and then initialize the database using a second
terminal, initialize the database:
```sh ```sh
$ ./contrib/mysql/run_client.sh $ ./contrib/run_client.sh
mysql> source init.sql $$$ psql < init.sql
``` ```
This command can also be used to empty the database if you want to start with a new one. This command can also be used to empty the database if you want to start with a
After the daemon has ran the initial migrations you may check out the schema of the database: new one.
After the daemon has applied the initial migrations you may check out the
schema of the database:
```sh ```sh
mysql> source info.sql $$$ psql < info.sql
``` ```
Once you are done with the database you can stop the server using: 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:
```sh ```sh
$ ./contrib/mysql/stop_server.sh $ ./contrib/run.sh
``` ```
### postgres This script is using `contrib/sample-cfg.yaml` and depends on a postgres server
running on localhost.
```sh You may use the scripts inside `contrib/` to start docker containers for this purpose.
$ ./contrib/postgres/run_server.sh
``` ## Running behind reverse proxies
Wait for the server to boot up and then initialize the database using a second terminal: 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:
```sh
$ ./contrib/postgres/run_client.sh
$$$ psql < init.sql
``` ```
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name aura.example.com;
This command can also be used to empty the database if you want to start with a new one. ssl_certificate /path/to/certificate;
After the daemon has ran the initial migrations you may check out the schema of the database: ssl_certificate_key /path/to/private-key;
```sh location /tank/ {
$$$ psql < info.sql proxy_buffering off;
``` proxy_ignore_headers "X-Accel-Buffering";
proxy_request_buffering off;
proxy_http_version 1.1;
Once you are done with the database you can stop the server by pressing `CTRL-C` inside the proxy_pass http://127.0.0.1:8040/;
terminal of the server. }
## ... other locations ...
}
```
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment