0

I'm using Rasp Pi Zero 2W. I bought pi for hosting my discord bot. I had an error in Docker containers. My discord bot trying to connect lavalink server but this error appear. These code are runing my local pc and AWS EC2 servers correctly. Does anyone help me?

Info: Lavalink: Node Main had an error: connect ECONNREFUSED 127.0.0.1:6969

botconfig.js

module.exports = {
  Admins: ["x", "x"], // Admins of the bot, I don't know what this do. -Darren.
  ExpressServer: true, // If you wanted to make the website run or not
  DefaultPrefix: process.env.Prefix || "k!", // Default prefix, Server Admins can change the prefix
  Port: 3000, //Which port website gonna be hosted
  //SupportServer: "https://discord.gg/sbySMS7m3v", // Support Server Link
  Token: process.env.Token || "", // Discord Bot Token
  ClientID: process.env.Discord_ClientID || "", // Discord Client ID
  ClientSecret: process.env.Discord_ClientSecret || "", // Discord Client Secret
  Scopes: ["identify", "guilds", "applications.commands"], // Discord OAuth2 Scopes
  ServerDeafen: true, // If you want bot to stay deafened
  DefaultVolume: 100, // Sets the default volume of the bot, You can change this number anywhere from 1 to 9007199254740991 (JS Integer limit. If you do set it to that, you're a monster.)
  CallbackURL: "/api/callback", // Discord API Callback url. Do not touch it if you don't know what you are doing. All you need to change for website to work is on line 20.
  "24/7": false, // Make the bot stays in VC 24/7 (when you reboot the bot will **not** automatically rejoin.)
  CookieSecret: "31SJ62", // A cookie for you, cookie for me. make sure you change this value!
  IconURL:
    "https://raw.githubusercontent.com/SudhanPlayz/Discord-MusicBot/master/assets/logo.gif", // URL of all embed author icons | Dont edit unless you dont need that Music CD Spining
  EmbedColor: "RANDOM", // Color of most embeds | Custom Hex value are supported. I.e: "#36393F"
  Permissions: 2205281600, // Bot Inviting Permissions
  Website: process.env.Website || "http://localhost", // Website where it is hosted at includes http or https || Use "0.0.0.0" if you using Heroku || Do not include /api/callback. Just the website url. I.e. "https://foo.bar"
  // If you get invalid oauth, make sure on the discord developer page you set the oauth url to something like: https://example.com/api/callback.

Presence: { status: "online", // You can show online, idle, and dnd name: "k!help", // The message shown type: "LISTENING", // PLAYING, WATCHING, LISTENING, STREAMING },

// You need a lavalink server for this bot to work!!!! // Lavalink server; public lavalink -> https://lavalink-list.darrennathanael.com/; create one yourself -> https://darrennathanael.com/post/how-to-lavalink Lavalink: { id: "Main", //- Used for indentifier. You can set this to whatever you want. host: "localhost", //- The host name or IP of the lavalink server. port: 6969, // The port that lavalink is listening to. This must be a number! pass: "bonsoirDocker", //- The password of the lavalink server. secure: false, // Set this to true if the lavalink uses SSL. if not set it to false. retryAmount: 200, //- The amount of times to retry connecting to the node if connection got dropped. retryDelay: 40, //- Delay between reconnect attempts if connection is lost. }, // Spotify Integration, allows you to enter a spotify link. Spotify: { ClientID: process.env.Spotify_ClientID || "x", // Spotify Client ID ClientSecret: process.env.Spotify_ClientSecret || "x", // Spotify Client Secret },

};

docker-compose.yml

version: "3"

services: discord-musicbot: build: . image: discord-musicbot:latest container_name: discord-musicbot restart: unless-stopped networks: - lavalink-net depends_on: lavalink: condition: service_healthy

volumes:
  - ./botconfig.js:/usr/src/app/botconfig.js:ro

lavalink: image: fredboat/lavalink:3.7.10-alpine container_name: music-lavalink hostname: localhost healthcheck: test: "echo lavalink" interval: 10s timeout: 5s retries: 5 ports: - "6969:6969" restart: unless-stopped networks: - lavalink-net volumes: - ./docker/application.yml:/opt/Lavalink/application.yml:ro

networks: lavalink-net:

Application.yml

server: # REST and WS server
  port: 6969
  address: localhost
lavalink:
  server:
    password: "bonsoirDocker"
    sources:
      youtube: true
      bandcamp: true
      soundcloud: true
      twitch: true
      vimeo: true
      http: true
      local: false
    bufferDurationMs: 400 # The duration of the NAS buffer. Higher values fare better against longer GC pauses. Minimum of 40ms, lower values may introduce pauses.
    frameBufferDurationMs: 5000 # How many milliseconds of audio to keep buffered
    trackStuckThresholdMs: 10000 # The threshold for how long a track can be stuck. A track is stuck if does not return any audio data.
    youtubePlaylistLoadLimit: 6 # Number of pages at 100 each
    playerUpdateInterval: 5 # How frequently to send player updates to clients, in seconds
    youtubeSearchEnabled: true
    soundcloudSearchEnabled: true
    gc-warnings: true
    #ratelimit:
    #ipBlocks: ["1.0.0.0/8", "..."] # list of ip blocks
    #excludedIps: ["...", "..."] # ips which should be explicit excluded from usage by lavalink
    #strategy: "RotateOnBan" # RotateOnBan | LoadBalance | NanoSwitch | RotatingNanoSwitch
    #searchTriggersFail: true # Whether a search 429 should trigger marking the ip as failing
    retryLimit: -1 # -1 = use default lavaplayer value | 0 = infinity | >0 = retry will happen this numbers times
    #youtubeConfig: # Required for avoiding all age restrictions by YouTube, some restricted videos still can be played without.
    #email: "" # Email of Google account
    #password: "" # Password of Google account
    #httpConfig: # Useful for blocking bad-actors from ip-grabbing your music node and attacking it, this way only the http proxy will be attacked
    #proxyHost: "localhost" # Hostname of the proxy, (ip or domain)
    #proxyPort: 3128 # Proxy port, 3128 is the default for squidProxy
    #proxyUser: "" # Optional user for basic authentication fields, leave blank if you don't use basic auth
    #proxyPassword: "" # Password for basic authentication

metrics: prometheus: enabled: false endpoint: /metrics

sentry: dsn: "" environment: ""

tags:

some_key: some_value

another_key: another_value

logging: file: max-history: 30 max-size: 1GB path: ./logs/

level: root: INFO lavalink: INFO

I tried these; 1-Update Lavalink Version 2-Remove the pass of Lavalink 3-All of IP Adresses for botconfig and lavalink 4-I spent 12 hours looking a solution or trying to new method that come my mind

Kutluay
  • 1
  • 1

0 Answers0