ChocoMeow / Vocard

Vocard is a simple music bot. It leads to a comfortable experience which is user-friendly, It supports Youtube, Soundcloud, Spotify, Twitch and more!
MIT License
109 stars 38 forks source link

Docker Compose Fails when trying to get connection to node 'DEFAULT' #25

Closed moodzunl closed 2 months ago

moodzunl commented 2 months ago

Trying to set up the bot with docker compose up. But this fails.

2024-06-26 21:55:39 Your bot is up-to-date! - v2.6.8
2024-06-26 21:55:40 Successfully connected to MongoDB!
2024-06-26 21:55:40 Loaded effect
2024-06-26 21:55:41 Loaded basic
2024-06-26 21:55:41 Loaded listeners
2024-06-26 21:55:41 Loaded settings
2024-06-26 21:55:41 Loaded playlist
2024-06-26 21:55:41 Loaded task
2024-06-26 21:55:41 Loaded Translator
2024-06-26 21:55:44 ------------------
2024-06-26 21:55:44 Logging As <My_Bot_Number>
2024-06-26 21:55:44 Bot ID: <My_Bot_ID>
2024-06-26 21:55:44 ------------------
2024-06-26 21:55:44 Discord Version: 2.3.2
2024-06-26 21:55:44 Python Version: 3.12.4 (main, Jun 27 2024, 00:07:37) [GCC 12.2.0]
2024-06-26 21:55:44 ------------------

After setting everything up - and waiting for lavalink successfull response this pops up:

Node DEFAULT is not able to connect! - Reason: The connection to node 'DEFAULT' failed.

I tried re-running the vocard container after seeing in logs from lavalink showing up that it was ready for receiving collections, but still nothing.

Running this in a windows enviroment with docker desktop with latest version.

ChocoMeow commented 2 months ago

make sure your lavalink info is correct in your settings.json

moodzunl commented 2 months ago

I'm using the default values for lavalink provided from the docker-compose file and from the settings.json and these seems good, should these be different?

ChocoMeow commented 2 months ago

I think you have to change the lavalink host from 127.0.0.1 to local in settings.json, which is the network name in docker compose

Azarath7 commented 2 months ago

Can you share your docker-compose.yml? Lavalink and Vocard containers should be working in the same virtual network.

moodzunl commented 2 months ago

This is how my docker-compose.yml looks like:


version: "3.8"

services:
    lavalink:
        image: ghcr.io/lavalink-devs/lavalink:latest
        container_name: lavalink
        restart: unless-stopped
        environment:
            - _JAVA_OPTIONS=-Xmx1G
            - SERVER_PORT=2333
        volumes:
            - ./application.yml:/opt/Lavalink/application.yml
        networks:
            - local
        expose:
            - "2333"

    # mongo:
    #     image: mongo:latest
    #     container_name: mongo
    #     restart: unless-stopped
    #     volumes:
    #         - ./data/mongo/db:/data/db
    #         - ./data/mongo/conf:/data/configdb
    #     environment:
    #         - MONGO_INITDB_ROOT_USERNAME=admin
    #         - MONGO_INITDB_ROOT_PASSWORD=admin
    #     expose:
    #         - "27017"
    #     networks:
    #         - local
    #     command: ["mongod", "--oplogSize=1024", "--wiredTigerCacheSizeGB=1", "--auth", "--noscripting"]

    vocard:
        image: vocard
        container_name: vocard
        build:
            dockerfile: ./Dockerfile
        volumes:
            - ./settings.json:/app/settings.json
            - ./.env:/app/.env
        depends_on:
            lavalink:
                condition: service_started
            # mongo:
            #     condition: service_started
        networks:
            - local

networks:
    local:
        name: local

Same configs as default values, could this be because I don't have the GENIUS_TOKEN available?

moodzunl commented 2 months ago

Tried with 127.0.0.1 and local as host value in settings.json, same output. Docker compose up connects to MongoDB succesfully and connects to discord API correctly but it's still unable to find Nodes.

Also tried setting enviroment variables as this:

        environment:
            - TOKEN=...
            - CLIENT_ID=...
            - CLIENT_SECRET_ID=...
            - SERCET_KEY=...
            - BUG_REPORT_CHANNEL_ID=...
            - SPOTIFY_CLIENT_ID=...
            - SPOTIFY_CLIENT_SECRET=...
            - GENIUS_TOKEN=...
            - MONGODB_URL=...
            - MONGODB_NAME=...

But still unable to run it.

ChocoMeow commented 2 months ago

Tried with 127.0.0.1 and local as host value in settings.json, same output. Docker compose up connects to MongoDB succesfully and connects to discord API correctly but it's still unable to find Nodes.

Also tried setting enviroment variables as this:

        environment:
            - TOKEN=...
            - CLIENT_ID=...
            - CLIENT_SECRET_ID=...
            - SERCET_KEY=...
            - BUG_REPORT_CHANNEL_ID=...
            - SPOTIFY_CLIENT_ID=...
            - SPOTIFY_CLIENT_SECRET=...
            - GENIUS_TOKEN=...
            - MONGODB_URL=...
            - MONGODB_NAME=...

But still unable to run it.

Sorry my bad, try change the Lavalink host from 127.0.0.1 to lavalink in settings.json

moodzunl commented 2 months ago

Thanks, I was just doing that and I got a new error and I was finally able to establish connection with the server. About to publish it as an alternative. I got this as an output Node DEFAULT is not able to connect! - Reason: The password for node 'DEFAULT' is invalid.

Used the default pass youshallnotpass as password inside the settings.json, but still the same error.

However after searching in Lavalink Docs I could see there's a LAVALINK_SERVER_PASSWORD env var. Trying to use this and replacing the password in the settings.json to see if this finally fixes it.

Changes looks like this:

# docker-compose.yml
lavalink:
        image: ghcr.io/lavalink-devs/lavalink:latest
        container_name: lavalink
        restart: unless-stopped
        environment:
            - _JAVA_OPTIONS=-Xmx1G
            - SERVER_PORT=2333
            - LAVALINK_SERVER_PASSWORD=youshallnotpass
        volumes:
            - ./application.yml:/opt/Lavalink/application.yml
        networks:
            - local
        expose:
            - "2333"
// settings.json
"nodes": {
        "DEFAULT": {
            "host": "lavalink",
            "port": 2333,
            "password": "youshallnotpass",
            "secure": false,
            "identifier": "DEFAULT"
        }
    },

(This might take time, I've doing docker pull lavalink image for the past 15 mins)

ChocoMeow commented 2 months ago

you have to create a application.yml file in the vocard root directory.

moodzunl commented 2 months ago

Application.yml is not necessary if we define the: - LAVALINK_SERVER_PASSWORD=youshallnotpass

Bot succesfully deployed now, maybe you can integrate that for making it more simpler and only running docker compose up.

Thanks!

ChocoMeow commented 2 months ago

yea, thank you for your advice.

iammonsterbunny commented 2 months ago

This is something I was looking for before but found it today 🥲