segler-alex / radiobrowser-api-rust

radio-browser API implementation in rust
GNU Affero General Public License v3.0
227 stars 97 forks source link

fix: docker compose database connection error #186

Closed tomassasovsky closed 10 months ago

tomassasovsky commented 1 year ago

I'm getting this error in the log of the radiobrowserapi container:

2023-03-18 22:05:10 2023-03-18T21:05:10,787858806 ERROR radiobrowser_api_rust DB connection error: DriverError { Could not connect to addressdbserver:3306': Connection refused (os error 111) }`

This is my current config:

version: '3.9'
services:
  radio_garden:
    build:
      context: .
      args:
          dart_entryfile: radio_garden_development.dart
    container_name: radio_garden
    expose:
      - 8081
    env_file:
     - .env/.env.development
    links:
      - lavalink
    depends_on:
      - lavalink

  lavalink:
    image: fredboat/lavalink:master
    container_name: lavalink
    restart: always
    expose:
      - 2333
    volumes:
     - ./lavalink.yml:/opt/Lavalink/application.yml

  dbserver:
    image: mariadb
    container_name: dbserver
    environment:
      MYSQL_DATABASE: radio
      MYSQL_USER: radiouser
      MYSQL_PASSWORD: password
      MYSQL_RANDOM_ROOT_PASSWORD: "true"
    ports:
      - "3306:3306"
    networks:
      - rbnet
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

  radiobrowserapi:
    image: segleralex/radiobrowser-api-rust:latest
    container_name: radiobrowserapi
    environment:
      - CONFIG_FILE=/app/radiobrowser_config/config.toml
    ports:
      - "8080:8080"
    volumes:
      - ./radiobrowser_config:/app/radiobrowser_config
    networks:
      - rbnet
    command: radiobrowser-api-rust -vvv

networks:
  rbnet:
## API
## ===
## Directory for static and template files
static-files-dir = "/usr/share/radiobrowser"
## Log file path
listen-host = "127.0.0.1"
log-dir = "/var/log/radiobrowser/"
## Listening port
listen-port = 8080
## How many concurrent threads used by socket
threads = 5
## Documentation url to be used if automatic way is not working (HTTP/1.0)
server-url = "https://de1.api.radio-browser.info"

## Database
## ========
## database connection string (mysql, mariadb)
database = "mysql://radiouser:password@dbserver/radio"
## Ignore errors on database migration scripts
## ONLY use this if you know what you are doing
ignore-migration-errors = false
## Allow database to downgrade if you start an older version
## of the radio browser binary
allow-database-downgrade = false

## Prometheus exporter
## ===================
## This will enable the prometheus compatible exporter on the main listening port
## You can reach it by doing a "GET /metrics"
prometheus-exporter = true
## Prefix for all exported keys
prometheus-exporter-prefix = "radio_browser"

## Stream check
## ============
## Enable the checking of stations
enable-check = true
## Concurrent checks
concurrency = 10
## Batchsize of stations to get from the database at a time
stations = 100
## Enable delete logic for stations
delete = true
## Interval in seconds to wait after every batch of checks
pause = "60secs"
## Timeout for tcp connections
tcp-timeout = "10secs"
## Recursive depth for real stream link resolution
max-depth = 5
## Retries for each station check until marked as broken
retries = 5

## Check server infos if server supports it (icecast)
server-info-check = false
## Chunksize for checking servers
server-info-check-chunksize = 100

# Check if current favicon in database still works, and remove them if not
recheck-existing-favicon = false
## Try to extract favicon from website for empty favicons
enable-extract-favicon = false
## Minimum (width or height) of favicons extracted
favicon-size-min = 32
## Maximum (width or height) of favicons extracted
favicon-size-max = 256
## Optimum size of favicons extracted
favicon-size-optimum = 128

## File path to CSV for replacing languages (local path or http/https)
replace-language-file = "/app/radiobrowser_config/language-replace.csv"
## File path to CSV for mapping language to code (local path or http/https)
language-to-code-file = "/app/radiobrowser_config/language-to-code.csv"
## File path to CSV for replacing tags (local path or http/https)
replace-tag-file = "/app/radiobrowser_config/tag-replace.csv"

## Caches
## ======
## Update caches at an interval
update-caches-interval = "5mins"

## Cleanup
## =======
## Cleanup worker startup interval
cleanup-interval = "1hour"
## The same ip cannot do clicks for the same stream in this timespan
click-valid-timeout = "1day"
## Broken streams are removed after this timespan, if they have never worked.
broken-stations-never-working-timeout = "3days"
## Broken streams are removed after this timespan.
broken-stations-timeout = "30days"
## Checks are removed after this timespan.
checks-timeout = "30days"
## Checks are removed after this timespan.
clicks-timeout = "30days"
## reload / redownload some config files
refresh-config-interval = "1day"

## Mirroring
## =========
## Mirror pull interval in seconds
mirror-pull-interval = "5mins"
## How many changes should be pulled in a chunk while pulling
chunk-size-changes = 10000
## How many checks should be pulled in a chunk while pulling
chunk-size-checks = 10000