Skip to content
radio-browser API implementation in rust
Rust HTML Other
Branch: master
Clone or download
Latest commit 7aef5b2 Jan 23, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows
ansible ansible fix Jan 23, 2020
debian use different install paths Jan 14, 2020
init set log level to info by default Jan 14, 2020
src
static docs: fix Jan 23, 2020
.dockerignore added dockerignore Mar 29, 2018
.gitignore added dist file generator Jan 12, 2020
.travis.yml Create .travis.yml Apr 16, 2018
CHANGELOG.md version 0.6.8 Jan 22, 2020
Cargo.lock version 0.6.8 Jan 22, 2020
Cargo.toml version 0.6.8 Jan 22, 2020
Dockerfile run as non root user in dockerfile Jan 8, 2020
LICENSE Initial commit Jan 9, 2018
README.md version 0.6.8 Jan 22, 2020
builddist.sh added dist file generator Jan 12, 2020
docker-compose-traefik.yml version 0.6.8 Jan 22, 2020
docker-compose.yml version 0.6.8 Jan 22, 2020
init.sql added docs and changed install script Jan 14, 2019
install_from_dist.sh use different install paths Jan 14, 2020
install_from_source.sh added dist file generator Jan 12, 2020
radiobrowser-dev.toml added dist file generator Jan 12, 2020
radiobrowser.toml added simple votes sync, version 0.6.6 Jan 19, 2020
start.sh added start script Jan 9, 2018
uninstall.sh use different install paths Jan 14, 2020

README.md

radiobrowser-api-rust

This is the radio browser server part providing the API on the second level servers for http://www.radio-browser.info

The server addresses are:

The main server on http://www.radio-browser.info still has an older version running which will not be upgraded anymore.

Send me feature requests, bug reports or extend it yourself. I license it freely, you could also start your own server if you wish.

You can find the API documentation on http://www.radio-browser.info/gui/#!/api

Setup

You can do a native setup or a docker setup

easy all-in-one docker setup with automatic TLS from Let's Encrypt

install

  • This has been tested on Ubuntu 18.04
  • Automatic redirect from HTTP to HTTPS
  • Automatic generation and update of Let's Encrypt certificates
  • Automatic start on reboot
  • Automatic fetch of station changes and check information from main server
# checkout this project
git clone https://github.com/segler-alex/radiobrowser-api-rust.git
cd radiobrowser-api-rust
git checkout stable
# create database save directory
mkdir -p dbdata
# create ssl certificate cache file
touch acme.json
chmod 0600 acme.json
# install docker (ubuntu)
apt install -qy docker.io
docker swarm init
# set email and domain, they are needed for automatic certificate generation and for the reverse proxy that is included in the package
export SOURCE="my.domain.org"
export EMAIL="mymail@mail.com"
# OPTIONAL: enable checking of stations, this does check all stations once every 24 hours
export ENABLE_CHECK="true"
# deploy app stack
docker stack deploy -c docker-compose-traefik.yml rb

upgrade

# checkout this project
cd radiobrowser-api-rust
git checkout stable
git pull
# set email and domain, they are needed for automatic certificate generation and for the reverse proxy that is included in the package
export SOURCE="my.domain.org"
export EMAIL="mymail@mail.com"
# OPTIONAL: enable checking of stations, this does check all stations once every 24 hours
export ENABLE_CHECK="true"
# deploy app stack, old versions will automatically be upgraded
docker stack deploy -c docker-compose-traefik.yml rb

install from distribution package

# download distribution
mkdir -p radiobrowser
cd radiobrowser
wget https://github.com/segler-alex/radiobrowser-api-rust/releases/download/0.6.8/radiobrowser-dist.tar.gz
tar -zxf radiobrowser-dist.tar.gz

# config database
sudo apt install default-mysql-server
cat init.sql | mysql

# install
./install.sh
sudo systemctl enable radiobrowser
sudo systemctl start radiobrowser

debian/ubuntu package

wget https://github.com/segler-alex/radiobrowser-api-rust/releases/download/0.6.8/radiobrowser-api-rust_0.6.8_amd64.deb
sudo apt install default-mysql-server
sudo dpkg -i radiobrowser-api-rust_0.6.8_amd64.deb
cat /usr/share/radiobrowser/init.sql | mysql

native setup from source

Requirements:

# install packages (ubuntu 18.04)
curl https://sh.rustup.rs -sSf | sh
sudo apt install libssl-dev pkg-config gcc
sudo apt install default-mysql-server
# clone repository
git clone https://github.com/segler-alex/radiobrowser-api-rust ~/radio

# setup database, compile, install
cd ~/radio
cat init.sql | mysql
bash install_from_source.sh

# test it
xdg-open http://localhost/webservice/xml/countries
# or just open the link with your favourite browser

docker setup

# start db and api server
docker-compose up --abort-on-container-exit

SSL

Radiobrowser does not yet support connecting with https to it directly. You have to add a reverse proxy like Apache or Nginx.

Apache config

# install packages (ubuntu 18.04)
sudo apt install apache2

# enable apache modules
sudo a2enmod proxy_http
sudo systemctl restart apache2
sudo mkdir -p  /var/www/radio

Apache config file example

<VirtualHost *:80>
    ServerName my.servername.com

    ServerAdmin webmaster@programmierecke.net
    DocumentRoot /var/www/radio

    ErrorLog ${APACHE_LOG_DIR}/error.radio.log
    CustomLog ${APACHE_LOG_DIR}/access.radio.log combined

    ProxyPass "/"  "http://localhost:8080/"
    ProxyPassReverse "/"  "http://localhost:8080/"

    <Directory /var/www/radio/>
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

Follow this guide to get a free certificate https://certbot.eff.org/

Ansible role

# clone this project
git clone https://github.com/segler-alex/radiobrowser-api-rust.git
cd radiobrowser-api-rust
# checkout stable
git checkout stable
# deploy, change email adress, for ssl with certbot
ansible-playbook -e "email=test@example.com" -e "version=0.6.8" -e "ansible_python_interpreter=auto" -i "test.example.com,test2.example.com" ansible/playbook.yml

Building

Distribution tar.gz

./builddist.sh

Debian/Ubuntu package

cargo install cargo-deb
cargo deb # run this in your Cargo project directory
You can’t perform that action at this time.