Deploying Your Bot
Once you've written your bot, deploying it to Galaxy Nexus takes just a few minutes. This guide walks through uploading your code, setting environment variables, and managing your bot in production.
Prerequisites
You need a Discord bot application with a bot token before deploying. See the Discord Bot Overview if you haven't set one up yet.
Uploading Your Code
Environment Variables
Set these in your bot's panel under Settings → Environment. They're injected at runtime:
| Variable | Value | Required |
|---|---|---|
DISCORD_TOKEN | Your bot token | Yes |
NODE_ENV | production | Recommended |
LOG_LEVEL | info | Optional |
Secret Hygiene
Environment variables are encrypted at rest and never appear in console output. If you change them, restart your bot for the new values to take effect.
Auto-Restart
Enable auto-restart to keep your bot online even if it crashes:
- Go to Settings → General
- Toggle Auto-Restart on Crash
- Optionally set a restart delay (default: 3 seconds)
The panel logs each restart so you can track crash frequency. If your bot restarts more than 5 times in 10 minutes, we pause auto-restart and alert you — this prevents restart loops from burning resources.
Viewing Logs
Your bot's console output streams in real-time in the Console tab:
- stdout — normal output (white)
- stderr — errors (red)
- System — panel events like restarts and deployments (blue)
You can filter by log level, search for specific text, and download logs as a text file. Logs are retained for 7 days.
Updating Your Bot
Upload New Code
Use the file manager to replace your bot's source files, or push to your connected Git repository.
Restart
Click Restart in the panel. Your bot will stop, rebuild dependencies if needed, and come back online with the new code.
Verify
Check the console for any startup errors. Test a command to confirm everything works.
Zero-Downtime Deploys
For bots with high uptime requirements, consider running two instances during updates. Deploy to a staging slot, test, then swap. Contact support if you need staging slots enabled.
Troubleshooting
| Issue | Likely Cause | Fix |
|---|---|---|
| Bot immediately crashes | Missing environment variable | Check DISCORD_TOKEN is set |
| "Invalid token" error | Token copied incorrectly | Regenerate token in Discord Developer Portal |
| "Missing intents" warning | Gateway intents not enabled | Enable required intents in the Discord dashboard |
| Out of memory crash | Bot leaking memory | Check for unclosed connections, add --max-old-space-size for Node.js |
| Module not found | package.json missing or incorrect | Verify dependencies are listed and the entry point path is correct |