Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/DJERLO/Simple-Discord-Music-Bot-Using-Nextcord/llms.txt

Use this file to discover all available pages before exploring further.

Lavalink is a standalone Java audio server that your bot delegates all audio decoding and streaming work to. Rather than processing audio inside the Python process, the bot sends playback instructions over HTTP to Lavalink, which handles the heavy lifting independently. Docker is the recommended way to run Lavalink — you get a fully reproducible environment without installing Java, managing versions, or touching system dependencies on your host machine.
If you choose to run Lavalink without Docker, it requires Java 17 or higher. The containerised approach below avoids this requirement entirely.
Local FFmpeg is not required. Lavalink handles all audio decoding and processing internally inside its own container.

docker-compose.yml

The project ships with a ready-made docker-compose.yml that pulls the official Lavalink 4.x image and wires up everything the bot expects.
docker-compose.yml
services:
  lavalink:
    image: ghcr.io/lavalink-devs/lavalink:4.2.2 # Uses the stable v4 production release
    container_name: lavalink_node
    restart: unless-stopped
    ports:
      - "2333:2333" # Opens the port so your Python bot can talk to it
    volumes:
      - ./application.yml:/opt/Lavalink/application.yml # Passes your config into the container
    environment:
      - _JAVA_OPTIONS=-Xmx512M # Allocates max 512MB RAM (perfect for a lightweight lofi bot)
Key values to note:
FieldValuePurpose
imageghcr.io/lavalink-devs/lavalink:4.2.2Pinned stable release
container_namelavalink_nodeFriendly name for docker CLI commands
restartunless-stoppedAuto-restarts on crash; stops only on explicit docker stop
ports2333:2333Exposes Lavalink’s HTTP API to the host
_JAVA_OPTIONS-Xmx512MCaps JVM heap at 512 MB

application.yml

The volume mount injects application.yml into the container at /opt/Lavalink/application.yml. This file controls Lavalink’s server port, authentication password, enabled audio sources, and logging output.
application.yml
server:
  port: 2333
  address: 0.0.0.0

plugins:
  youtube:
      enabled: true # Enable the new plugin's configuration
      allowSearch: true
      allowDirectVideoIds: true
      allowDirectPlaylistIds: true

lavalink:
  plugins:
    - dependency: "dev.lavalink.youtube:youtube-plugin:1.18.1"
  server:
    password: "youshallnotpass"
    sources:
      youtube: false
      soundcloud: true
      scSearch: true
      local: false
      http: true # Crucial for streaming 24/7 direct audio/mp3 URLs
    bufferDurationMs: 400
    youtubePlaylistLoadLimit: 6
    gc-warnings: true

metrics:
  prometheus:
    enabled: false
    endpoint: /metrics

logging:
  file:
    path: ./logs/lavalink.log
  level:
    root: INFO
    lavalink: INFO
Notable configuration choices:
  • YouTube plugin (dev.lavalink.youtube:youtube-plugin:1.18.1) — the official plugin replaces the built-in YouTube source; allowSearch, allowDirectVideoIds, and allowDirectPlaylistIds are all enabled.
  • SoundCloud (soundcloud: true, scSearch: true) — enables SoundCloud playback and search.
  • HTTP source (http: true) — allows Lavalink to stream direct audio URLs such as .mp3 files.
  • bufferDurationMs: 400 — sets the audio buffer to 400 ms for smooth playback.
  • Logging — Lavalink writes INFO-level logs to ./logs/lavalink.log inside the container.
1

Verify Docker is running

Open a terminal and confirm the Docker daemon is active:
docker info
If Docker is not running, start Docker Desktop (macOS/Windows) or run sudo systemctl start docker (Linux).
2

Start Lavalink in the background

From the project root (the directory containing docker-compose.yml), run:
docker-compose up -d
The -d flag runs the container detached so it continues in the background after you close the terminal.
3

Verify Lavalink is running

Open http://localhost:2333 in a browser or use curl:
curl http://localhost:2333
Lavalink returns a short HTML or JSON response when it is online. Any response on port 2333 confirms it is healthy.
4

Inspect the logs (optional)

To follow Lavalink’s output in real time:
docker-compose logs lavalink
Add -f to stream logs continuously:
docker-compose logs -f lavalink
To stop and remove the container:
docker-compose down
This tears down the container but preserves your application.yml and the logs/ directory on the host.

Common Issues

Another process is bound to port 2333. Find and stop it, or change the host-side port in docker-compose.yml:
ports:
  - "2334:2333"  # host port 2334 maps to container port 2333
If you change the port, update bot.py’s on_ready handler to match the new URI (http://127.0.0.1:2334).
docker-compose up will exit immediately with a connection error if the Docker daemon is not active. Start Docker and retry.
Run docker-compose logs lavalink to read the startup output. A malformed application.yml (incorrect indentation, wrong password format) is the most common cause of an instant exit.

Build docs developers (and LLMs) love