# Rdio Scanner Docker image

- Maintained by:<br>[chuot](https://github.com/chuot), the author of Rdio Scanner

- Where to get help:<br>[Docker Community Forums](https://forums.docker.com/), [Rdio Scanner discussions](https://github.com/chuot/rdio-scanner/discussions)

- Where to file issues:<br>[Rdio Scanner issues](https://github.com/chuot/rdio-scanner/issues)

- Supported architectures:<br>amd64, arm64, arm

# Supported tags and Containerfile link

- [latest](https://github.com/chuot/rdio-scanner/blob/master/Containerfile)


# Rdio Scanner

Rdio Scanner is an open source software that ingest and distribute audio files generated by various software-defined radio recorders. Its interface tries to reproduce the user experience of a real police scanner, while adding its own touch.

You can listen to Rdio Scanner on any modern browsers using the integrated web app.

![Rdio Scanner](https://github.com/chuot/rdio-scanner/raw/master/docs/images/rdio-scanner.png)

# How to use this image

Before going any further, make sure you have enough knowledge about using Docker. For those new to Docker, I recommend reading at least the [Docker Overview](https://docs.docker.com/get-started/overview/).

## 1. Pull the docker image

Do `docker pull chuot/rdio-scanner:latest` like this:

```bash
$ docker pull chuot/rdio-scanner:latest
latest: Pulling from chuot/rdio-scanner
c6556b3b6858: Pull complete 
d7254f9b5d27: Pull complete 
0658b5542036: Pull complete 
Digest: sha256:f265cb0c94c45b18b847ea3c65c69d1788e0a3eb50870f585db6793c7d96047b
Status: Downloaded newer image for chuot/rdio-scanner:latest
docker.io/chuot/rdio-scanner:latest
```

## 2. Start Rdio Scanner

By default, Rdio Scanner runs on port 3000. It is recommended to configure a **SSL certificate** and then to map port 3000 to port 443 using the `--publish 3000:443` option.

We will however stick to port 3000 in this example.

> Note that it is important to make sure the data folder already exists on the Docker host the very first time you run the Docker container (`~/.rdio-scanner` in this example) or it will be created by the Docker daemon with the wrong owner. In other words, the volume you mount on `/app/data` must be owned by the same user as specified by the `--user` option.

```bash
$ docker run --detach --env TZ=America/Toronto --name rdio-scanner --publish 3000:3000 --restart always --user $(id -u):$(id -g) --volume ~/.rdio-scanner:/app/data chuot/rdio-scanner:latest
520cdbf51fca11d8bacea12d81245f1cb4d984f80d2be2e3039727b59533a6a9

$ docker logs rdio-scanner
<<<<<<< HEAD
Rdio Scanner v7.0.0
----------------------------------
2022/12/19 08:57:23 server started
2022/12/19 08:57:23 base folder is /app/data
2022/12/19 08:57:23 main interface at http://6d87e8dc37a0:3000
2022/12/19 08:57:23 admin interface at http://6d87e8dc37a0:3000/admin
=======
Rdio Scanner v6.6.3
----------------------------------
2022/11/25 08:57:23 server started
2022/11/25 08:57:23 base folder is /app/data
2022/11/25 08:57:23 main interface at http://6d87e8dc37a0:3000
2022/11/25 08:57:23 admin interface at http://6d87e8dc37a0:3000/admin
>>>>>>> main
```

You can also use docker-compose to start the server with this simple `docker-compose.yml`:

```yaml
version: "3"

services:
  server: 
    environment: 
      - TZ=America/Toronto
    image: docker.io/chuot/rdio-scanner:latest
    ports:
      - "3000:3000"
    volumes:
      - /home/radio/rdio-scanner:/app/data:z
```

Then run it with `docker-compose`:

```bash
$ docker-compose -p rdio-scanner run -d --service-ports server
Creating network "rdio-scanner_default" with the default driver
Creating rdio-scanner_server_run ... done
rdio-scanner_server_run_3e00e8f8446f
```

## 3. Configure Rdio Scanner

Access the administrative dashboard to finalize the configuration.

> _Note that the default password is **rdio-scanner**_

![admin dashboard login](https://github.com/chuot/rdio-scanner/raw/master/docs/images/admin-login.png)

![admin dashboard todos](https://github.com/chuot/rdio-scanner/raw/master/docs/images/admin-todos.png)

## 4. Advanced customizations

To get the whole list of arguments you can pass to Rdio Scanner, simply pass the argument **-h**.

> Remember to always restart you Rdio Scanner if any changes have been applied to the file `rdio-scanner.ini` with the options `-config_save`.

```
$ docker run -it --rm chuot/rdio-scanner -h
Usage of ./rdio-scanner:
    -admin_password string
        change admin password
    -base_dir string
        base directory where all data will be written
    -cmd string
        advanced administrative tasks (use -cmd help for usage)
    -config string
        server config file (default "rdio-scanner.ini")
    -config_save
        save configuration to rdio-scanner.ini
    -db_file string
        sqlite database file (default "rdio-scanner.db")
    -db_host string
        database host ip or hostname (default "localhost")
    -db_name string
        database name
    -db_pass string
        database password
    -db_port uint
        database host port (default 3306)
    -db_type string
        database type, one of sqlite, mariadb, mysql (default "sqlite")
    -db_user string
        database user name
    -listen string
        listening address (default ":3000")
    -service string
        service command, one of start, stop, restart, install, uninstall
    -ssl_auto_cert string
        domain name for Let's Encrypt automatic certificate
    -ssl_cert_file string
        ssl PEM formated certificate
    -ssl_create
        create self-signed certificates
    -ssl_key_file string
        ssl PEM formated key
    -ssl_listen string
        listening address for ssl
    -version
        show application version
```

## 5. Update Rdio Scanner

If a newer version of [Rdio Scanner Docker Image](https://hub.docker.com/r/chuot/rdio-scanner) is released, you can easily update it like this:

```bash
$ docker pull chuot/rdio-scanner:latest
...

$ docker stop rdio-scanner
rdio-scanner

$ docker rm rdio-scanner
rdio-scanner

$ docker run ... // see section 2 above
```

You can also put these commands in a shell script to simplify future updates.

# Limitation

Rdio Scanner's `dirwatch` functionality does not work with its Docker flavor due to technical difficulties in regards to file polling on mounted drives. The feature has been disabled on the Docker image.

**Happy Rdio scanning !**