Choose the hosting layout
A common production layout is:- VPS for the bot — runs
bot.py, reads.env, and connects to Lavalink. - Lavalink server — hosted on a separate machine or managed service, exposes port
2333, and receives playback requests from the bot. - Discord application — keeps the bot token and permissions separated from the server runtime.
1. Prepare the VPS
Use a small server with at least:- 2 vCPUs
- 2 GB RAM
- 20 GB SSD
- Ubuntu 22.04 or 24.04
uv:
uv python install 3.13 before running uv sync.
If you prefer a manual environment on the VPS, create a virtual environment and install the compatibility requirements file:
.env file with your bot settings:
bot.py, make sure the URI and password match the Lavalink node you rent or deploy.
2. Rent or deploy the Lavalink server
You can rent a dedicated Lavalink server from a hosting provider, or run the included Docker stack from this repository on another machine. Recommended requirements for the Lavalink host:- Public IPv4 address
- Port
2333open in the firewall - Java 17 or newer if you run it directly, or Docker if you use the repository setup
docker-compose.yml and application.yml files are enough to start the node on the remote server:
application.ymlon the Lavalink host- the
LAVALINK_PASSWORDvalue in your bot.env
3. Run the bot as a service
For production, start the bot withsystemd so it recovers after reboots.
Create a service file:
4. Keep the bot stable
A few production checks help prevent downtime:- Keep the VPS and Lavalink host on the same network or use a stable public address for the node.
- Open only the ports you need, especially
2333for Lavalink. - Rotate your Discord bot token if it is ever exposed.
- Use a strong Lavalink password and keep the two values in sync.
- Monitor the bot logs with
journalctl -u testbot -f.
5. TOS and compliance notes
When you host a music bot, you are responsible for using the service in line with platform rules.YouTube
- Use only content you are allowed to stream.
- Do not rely on workarounds or unofficial scraping methods that violate YouTube’s Terms of Service.
- Respect copyright, privacy, and platform rate limits.
Discord
- Keep your bot token private.
- Use only the permissions your bot actually needs.
- Avoid spammy or abusive command behavior in servers.
- Follow Discord’s Developer Terms and the platform rules for bots and slash commands.
Hosting provider
- Use a provider that allows the kind of bot and audio traffic you plan to run.
- Confirm that your chosen VPS or Lavalink plan does not prohibit automated audio or bot services.
If you are unsure whether a source or provider is allowed, review the platform terms directly before you deploy. The bot code itself does not override or bypass platform restrictions.
Related Topics
Lavalink Setup
Run the audio backend that your VPS deployment depends on.
Bot Setup
Register the Discord application and invite link for the production bot.
Environment Variables
Confirm the .env values the bot reads at startup.
Quickstart
Revisit the local setup path before you move to a VPS deployment.