Repository navigation
Hosting
How to keep the bot online, restart it after a crash or reboot, back it up and update it.
- The bot needs outbound internet only (to Discord). No port has to be open for the bot itself.
- The admin panel (
3000) and the API (2222) are for you. Open them to the internet only through HTTPS, see Nginx Guide or Ngrok Guide. - Never expose port
2222raw. Its write routes need a token, but it should still stay behind a proxy with HTTPS.
| Option | Good for | Watch out for |
|---|---|---|
| Home PC or mini PC | Testing and small servers | Power cuts, sleep settings, Windows updates restarts |
| Linux VPS | Always-on hosting | Choose a region near your players, keep the OS updated |
| Raspberry Pi 4/5 (ARM64) | Cheap always-on | SD cards wear out: keep backups |
| Old Android phone with Termux | Experiments | See the section below |
Create /etc/systemd/system/nationdex.service (replace the user and paths):
[Unit]
Description=Nationdex 2026 bot
After=network-online.target
Wants=network-online.target
[Service]
User=nationdex
WorkingDirectory=/home/nationdex/nationdex
ExecStart=/home/nationdex/nationdex/nationdex-bot-linux-x64
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetThen:
sudo systemctl daemon-reload
sudo systemctl enable --now nationdex
sudo systemctl status nationdex
journalctl -u nationdex -f # live logWorkingDirectory matters: the bot reads .env and assets/ from the folder it starts in, and creates database/ there.
Easiest: run the .exe from a terminal inside its folder and keep the PC awake. For a real service, use a tool such as NSSM (https://nssm.cc) and set the service folder to the bot's folder. Untested by the maintainers.
The whole state is the database/ folder. Copy it while the bot is stopped, so the copy is consistent.
sudo systemctl stop nationdex
tar -czf ~/backups/database-$(date +%F).tar.gz -C /home/nationdex/nationdex database
sudo systemctl start nationdexKeep copies off the machine as well. Also keep a copy of .env, stored safely (it holds the token).
Restoring: stop the bot, move the database/ folder aside, extract the backup into the same place, start the bot. Never run two copies against the same database/ folder.
- Download the new release and
SHA256SUMS.txt, check the hash. - Stop the bot, back up
database/first. - Replace the program file. Keep
.env,database/andassets/. Check the release notes for asset changes. - Start the bot and watch the log.
Keep the old program file until the new one has run fine.
- Plug the phone in and keep it on a charger that does not overheat.
- Turn off battery optimisation for Termux in Android settings.
- Use
tmux(see Termux guide) so closing the window does not stop the bot. - Expect restarts after Android updates. Restart by hand if the bot is offline.
curl http://localhost:2222/v1/statsA JSON answer means the bot and API are up. Players should also see the bot online in Discord.