Skip to content
Snippets Groups Projects
README.md 2.51 KiB
Newer Older
  • Learn to ignore specific revisions
  • Christian Pointner's avatar
    Christian Pointner committed
    # Import and Playlist Daemon
    
    
    Tank implements an AURA import and playlist daemon.
    
    
    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 then run the `tank` binary:
    
    ```sh
    
    $ $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!
    
    
    
    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 gitlab.servus.at/autoradio/tank
    $ cd tank
    $ make
    
    Christian Pointner's avatar
    Christian Pointner committed
    ```
    
    You may run the daemon using the following command:
    
    ```sh
    
    Christian Pointner's avatar
    Christian Pointner committed
    $ ./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
    
    Christian Pointner's avatar
    Christian Pointner committed
    containers for this purpose.
    
    ### mysql
    
    ```sh
    
    Christian Pointner's avatar
    Christian Pointner committed
    $ ./contrib/mysql/run_server.sh
    
    Christian Pointner's avatar
    Christian Pointner committed
    ```
    
    Wait for the server to boot up and then initialize the database using a second terminal:
    
    ```sh
    
    Christian Pointner's avatar
    Christian Pointner committed
    $ ./contrib/mysql/run_client.sh
    mysql> source init.sql
    
    Christian Pointner's avatar
    Christian Pointner committed
    ```
    
    This command can also be used to empty the database if you want to start with a new one.
    
    After the daemon has ran the initial migrations you may check out the schema of the database:
    
    
    Christian Pointner's avatar
    Christian Pointner committed
    ```sh
    mysql> source info.sql
    
    Christian Pointner's avatar
    Christian Pointner committed
    
    Once you are done with the database you can stop the server using:
    
    ```sh
    
    Christian Pointner's avatar
    Christian Pointner committed
    $ ./contrib/mysql/stop_server.sh
    
    Christian Pointner's avatar
    Christian Pointner committed
    ```
    
    ### postgres
    
    ```sh
    
    Christian Pointner's avatar
    Christian Pointner committed
    $ ./contrib/postgres/run_server.sh
    
    Christian Pointner's avatar
    Christian Pointner committed
    ```
    
    Wait for the server to boot up and then initialize the database using a second terminal:
    
    ```sh
    
    Christian Pointner's avatar
    Christian Pointner committed
    $ ./contrib/postgres/run_client.sh
    
    $$$ psql < init.sql
    
    Christian Pointner's avatar
    Christian Pointner committed
    ```
    
    This command can also be used to empty the database if you want to start with a new one.
    
    After the daemon has ran the initial migrations you may check out the schema of the database:
    
    ```sh
    
    $$$ psql < info.sql
    
    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
    terminal of the server.