segler-alex / radiobrowser-api-rust

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

fix: thread 'main' panicked at 'config could not be loaded' src/main.rs:215:14 #185

Closed tomassasovsky closed 1 year ago

tomassasovsky commented 1 year ago

I'm trying to get this to run in a Docker Compose file:

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:
      DATABASE_URL: mysql://radiouser:password@dbserver/radio
      HOST: "0.0.0.0"
    ports:
      - "8080:8080"
    networks:
      - rbnet
    command: radiobrowser-api-rust -vvv

networks:
  rbnet:

This is the error I get:

2023-03-18 21:39:26 thread 'main' panicked at 'config could not be loaded', src/main.rs:215:14
2023-03-18 21:39:26 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
tomassasovsky commented 1 year ago

Got this working by adding the files from https://github.com/segler-alex/radiobrowser-api-rust/tree/master/etc into my project, including them as a volume for the radiobrowserapi container, and then adding the CONFIG_FILE variable:

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: