Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lavalink connection issues? #1328

Open
IngwiePhoenix opened this issue Nov 2, 2024 · 0 comments
Open

Lavalink connection issues? #1328

IngwiePhoenix opened this issue Nov 2, 2024 · 0 comments
Labels
type: bug Seems like this is a bug

Comments

@IngwiePhoenix
Copy link

Please describe the problem you are having in as much detail as possible:

I just spent a good while to write a small deployment for Kubernetes (k3s) and I have gotten both services to start.
However, I see an absolute flood of this:

[2:10:2024 - 21:17] | Node: Main Node | Lavalink node has an error: Unexpected server response: 200.
[2:10:2024 - 21:17] | Node: Main Node | Lavalink node is disconnected.
[2:10:2024 - 21:17] | Node: Main Node | Lavalink node is reconnecting.

The LavaLink version I am running is 4.0.8 as those seemed like the latest currently supported container images.

Include a reproducible code sample here, if possible:

kubectl apply -f this, after changing the -creds secrets appropriately.

Kubernetes Deployment
apiVersion: v1
kind: Namespace
metadata:
  name: musicbot
---
apiVersion: v1
kind: Secret
metadata:
  name: dc-music-bot-creds
  namespace: musicbot
type: Opaque
stringData:
  DISCORD_API_OAUTH2_TOKEN: 
  DISCORD_API_OAUTH2_CLIENT_ID: 
  DISCORD_BOT_TOKEN: 
  DISCORD_APP_ID: 
---
apiVersion: v1
kind: Secret
metadata:
  name: lavalink-creds
  namespace: musicbot
type: Opaque
stringData:
  LAVALINK_SERVER_PASSWORD: 
  PLUGINS_YOUTUBE_OAUTH_REFRESHTOKEN: 
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: lavalink-cm
  namespace: musicbot
data:
  #/opt/Lavalink/application.yml
  application.yaml: |-
    server: # REST and WS server
      port: 2333
      address: 0.0.0.0
    plugins:
      youtube:
        enabled: true
        allowSearch: true
        allowDirectVideoIds: true
        allowDirectPlaylistIds: true
        clients:
          - MUSIC
          - ANDROID_VR
          - WEB
          - WEBEMBEDDED
        oauth:
          enabled: true
          #skipInitialization: true
    lavalink:
      plugins:
        - dependency: "dev.lavalink.youtube:youtube-plugin:1.8.3"
          repository: "https://maven.lavalink.dev/releases"
      pluginsDir: "./plugins"
      server:
        sources:
          youtube: false
          bandcamp: true
          soundcloud: true
          twitch: true
          vimeo: true
          http: true
          local: false
        filters: # All filters are enabled by default
          volume: true
          equalizer: true
          karaoke: true
          timescale: true
          tremolo: true
          vibrato: true
          distortion: true
          rotation: true
          channelMix: true
          lowPass: true
        bufferDurationMs: 400 
        frameBufferDurationMs: 5000 
        opusEncodingQuality: 10 
        resamplingQuality: LOW
        trackStuckThresholdMs: 10000 
        useSeekGhosting: true 
        youtubePlaylistLoadLimit: 3 
        playerUpdateInterval: 1 
        youtubeSearchEnabled: true
        soundcloudSearchEnabled: true
        gc-warnings: true
        #ratelimit: # unused
          #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: 
          #email: ""
          #password: ""
        #httpConfig: 
          #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: ""
    logging:
      file:
        path: ./logs/
      level:
        root: INFO
        lavalink: INFO
        "dev.lavalink.youtube.http.YoutubeOauth2Handler": INFO
      request:
        enabled: true
        includeClientInfo: true
        includeHeaders: false
        includeQueryString: true
        includePayload: true
        maxPayloadLength: 10000
      logback:
        rollingpolicy:
          max-file-size: 1GB
          max-history: 30
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: dc-music-bot-cm
  namespace: musicbot
data:
  startup.sh: |-
    #!/bin/sh -ex

    #DMC_VERSION=v4.1.2
    #DMC_URL=https://github.com/SudhanPlayz/Discord-MusicBot/archive/refs/tags/$DMC_VERSION.tar.gz
    #curl -L $DMC_URL | tar xvfz - --strip-components=1

    apk add -U nodejs npm curl git
    mkdir -p /usr/src
    git clone -b v5 --depth 1 https://github.com/SudhanPlayz/Discord-MusicBot.git /usr/src
    cd /usr/src
    cp /opt/config.js /usr/src/config.js

    npm install
    npm run deploy

    node index.js

  #/usr/src/app/config.js
  #->/opt/config.js
  config.js: |-
    module.exports = {
      helpCmdPerPage: 10, //- Number of commands per page of help command
      lyricsMaxResults: 5, //- Number of results for lyrics command (Do not touch this value if you don't know what you are doing)
      adminId: "472415352513626113", //- Replace UserId with the Discord ID of the admin of the bot
      token: process.env.DISCORD_BOT_TOKEN, //- Bot's Token
      clientId: process.env.DISCORD_APP_ID, //- ID of the bot
      clientSecret: process.env.DISCORD_API_OAUTH2_TOKEN, //- Client Secret of the bot
      port: 4200, //- Port of the API and Dashboard
      scopes: ["identify", "guilds", "applications.commands"], //- Discord OAuth2 Scopes
      inviteScopes: ["bot", "applications.commands"], // Invite link 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 100
      supportServer: "https://discord.gg/sbySMS7m3v", //- Support Server Link
      Issues: "https://github.com/SudhanPlayz/Discord-MusicBot/issues", //- Bug Report Link
      permissions: 277083450689, //- Bot Inviting Permissions
      disconnectTime: 30000, //- How long should the bot wait before disconnecting from the voice channel (in miliseconds). Set to 1 for instant disconnect.
      twentyFourSeven: false, //- When set to true, the bot will never disconnect from the voice channel
      autoQueue: false, //- When set to true, related songs will automatically be added to the queue
      autoPause: true, //- When set to true, music will automatically be paused if everyone leaves the voice channel
      autoLeave: true, //- When set to true, the bot will automatically leave when no one is in the voice channel (can be combined with 24/7 to always be in voice channel until everyone leaves; if 24/7 is on disconnectTime will add a disconnect delay after everyone leaves.)
      debug: false, //- Debug mode
      cookieSecret: "<snip>", //- Cookie Secret
      website: "<snip>", //- without the / at the end
      // 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
      nodes: [
        {
          identifier: "Main Node", //- Used for indentifier in stats commands.
          host: process.env.LAVALINK_SVC_SERVICE_HOST, //- The host name or IP of the lavalink server.
          port: process.env.LAVALINK_SVC_SERVICE_PORT, // The port that lavalink is listening to. This must be a number!
          password: process.env.LAVALINK_SERVER_PASSWORD, //- The password of the lavalink server.
          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.
          secure: false, //- Can be either true or false. Only use true if ssl is enabled!
        },
      ],
      embedColor: "#2f3136", //- Color of the embeds, hex supported
      presence: {
        // PresenceData object | https://discord.js.org/#/docs/main/stable/typedef/PresenceData
        status: "online", //- You can have online, idle, dnd and invisible (Note: invisible makes people think the bot is offline)
        activities: [
          {
            name: "Music", //- Status Text
            type: "LISTENING", //- PLAYING, WATCHING, LISTENING, STREAMING
          },
        ],
      },
      iconURL: "https://cdn.discordapp.com/avatars/889127775154339870/7852461e5c26db68e13476b344bb9c2f", //- This icon will be in every embed's author field
    };
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: lavalink-app
  namespace: musicbot
  labels:
    app: lavalink
spec:
  replicas: 1
  selector:
    matchLabels:
      app: lavalink
  template:
    metadata:
      labels:
        app: lavalink
    spec:
      volumes:
        - name: config-vol
          configMap:
            name: lavalink-cm
      containers:
        - name: app
          image: fredboat/lavalink:4.0.8-alpine
          envFrom:
            - secretRef:
                name: lavalink-creds
          volumeMounts:
            - name: config-vol
              mountPath: /opt/Lavalink/application.yaml
              subPath: application.yaml
          ports:
            - containerPort: 2333
              name: api
---
apiVersion: v1
kind: Service
metadata:
  name: lavalink-svc
  namespace: musicbot
spec:
  type: ClusterIP
  selector:
    app: lavalink
  ports:
    - targetPort: api
      name: api
      port: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: dc-music-bot-app
  namespace: musicbot
  labels:
    app: dc-music-bot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: dc-music-bot
  template:
    metadata:
      labels:
        app: dc-music-bot
    spec:
      volumes:
        - name: config-vol
          configMap:
            name: dc-music-bot-cm
      initContainers:
        - name: wait-for-lavalink
          image: cgr.dev/chainguard/wait-for-it:latest
          args:
            - "-h"
            - "${LAVALINK_SVC_SERVICE_HOST}"
            - "-p"
            - "${LAVALINK_SVC_SERVICE_PORT}"
            - "-t"
            - "60"
      containers:
        - name: app
          image: alpine:3
          command: ["/bin/sh"]
          args: ["-ex", "/opt/startup.sh"]
          envFrom:
            - secretRef:
                name: dc-music-bot-creds
            - secretRef:
                name: lavalink-creds
          volumeMounts:
            - name: config-vol
              mountPath: /opt
          ports:
            - containerPort: 4200
              name: http
---
apiVersion: v1
kind: Service
metadata:
  name: dc-music-bot-svc
  namespace: musicbot
spec:
  type: ClusterIP
  selector:
    app: dc-music-bot
  ports:
    - targetPort: http
      name: http
      port: 80
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: dc-music-bot-tr
  namespace: musicbot
spec:
  entryPoints:
    - websecure
  routes:
    # Edit this to put your domain here
    - match: Host(`musicbot.somehost.tld`)
      kind: Rule
      services:
        - name: dc-music-bot-svc
          port: http
          passHostHeader: true
          scheme: http

Login succeeds, but right after, these events occur nonstop.

Further details:

  • discord.js version: Same as seen from the projects' package.json
  • Node.js version: Latest as per Alpine 3.20: v20.15.1
  • Operating system: Linux, aarch64
  • Priority this issue should have – please be realistic and elaborate if possible: Low

Relevant client options:

  • partials: none
  • gateway intents: none
  • other: none
@IngwiePhoenix IngwiePhoenix added the type: bug Seems like this is a bug label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Seems like this is a bug
Projects
None yet
Development

No branches or pull requests

1 participant