Deploy Lavalink | (Just Updated) Discord Music Node Whose YouTube Actually Plays
Discord audio node with a working YouTube source and a real password.
lavalink
Just deployed
Deploy and Host Lavalink on Railway
Lavalink is a standalone audio-sending node for Discord bots: your bot asks it to load and play a track, and it does all the fetching, decoding and opus encoding, so the bot process never blocks on audio. This template runs Lavalink 4.2.2 as a single service with a working YouTube source, a password that is generated for you, and a heap sized to whatever plan you deploy it on.
About Hosting Lavalink
Lavalink is a JVM service that holds a WebSocket connection to your bot and a UDP voice connection to Discord for every playing guild, so it wants steady CPU and RAM rather than disk. It keeps no state on disk — sessions and players live in memory — which is why this template ships no volume and no database.
Three things usually go wrong when it is hosted from a generic template, and this one fixes all three before you see it:
- The password. Lavalink accepts an empty
lavalink.server.password, and an empty password is not "auth off" in a way you would notice: a request with noAuthorizationheader gets401, but a request whoseAuthorizationheader is empty gets200— the node is open, and anybody who finds the URL can stream audio on your bill. Here the password is generated at deploy time, and the container refuses to start if it is blank. - YouTube. The built-in YouTube source is deprecated and the plugin has to be current;
on the version most templates pin, every YouTube lookup returns
"Something went wrong while looking up the track."This image bakes youtube-plugin 1.18.2 in, with an explicit client list, and no jar is downloaded at boot. - Memory. A hardcoded
-Xmx768mapplies whether you run 1 GB or 32 GB. The entrypoint reads the container's cgroup limit and gives the JVM 70% of it.
Common Use Cases
- Discord music bots, including sharded bots served by one node
- 24/7 radio, playlist or lofi-stream playback
- Multiple bots sharing a single audio node
- Audio filtering (equalizer, timescale, karaoke, rotation) offloaded from the bot process
Dependencies for Lavalink Hosting
- A Discord bot that speaks the Lavalink v4 protocol (Lavalink4NET, lavalink-client, Lavalink.py, Riffy, Shoukaku, …)
Deployment Dependencies
- Lavalink: https://lavalink.dev
- Lavalink source: https://github.com/lavalink-devs/Lavalink
- youtube-source plugin: https://github.com/lavalink-devs/youtube-source
- Template image source: https://github.com/bon5co/lavalink-railway
Why Deploy Lavalink on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Lavalink on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
After deploying
- Copy
LAVALINK_SERVER_PASSWORDfrom the service's Variables tab. - Point your bot at the public domain: host = your
*.up.railway.appdomain, port443, secure/TLS on, password = the value above. - Check it:
curl -H "Authorization: " https:///v4/info.
Sources, filters, buffer sizes and YouTube clients are baked into the image, so the deploy
form asks for nothing. Any of them can still be overridden with the usual
LAVALINK_SERVER_* environment variables.
Template Content
