Skip to content

Hosting the Discord bot

LeNDuyA edited this page Nov 19, 2025 · 3 revisions

Prerequisites

  • Docker Desktop installed and running
  • cloud
    • I'm using fly.io
    • Flyctl CLI installed
    • fly.io account created and authenticated

Jar

  1. build the fat jar locally
./gradlew :bot:discord:fatJar
  1. test the fat jar
# Test it runs (will fail on missing env vars - that's expected)
java -jar bot/discord/build/libs/discord-bot-all.jar

Docker

  1. test the Docker build locally
# Build Docker image
docker build -t discord-bot:test .

# Test run (will fail on missing env vars - that's expected)
docker run --rm discord-bot:test

# View local images
docker images

Fly.io deployment

  1. edit the fly.toml if needed
  2. set environment variables
# Set Discord bot token as secret
flyctl secrets set discordBotApiKey=YOUR_DISCORD_TOKEN

# View all secrets (values are hidden)
flyctl secrets list
  1. set up SSH access
# Check for existing SSH keys
ls ~/.ssh/id_*.pub

# If none exist, create one
ssh-keygen -t ed25519 -C "your_email@example.com"

# Add SSH key to fly.io
flyctl ssh issue --agent
  1. deploy
# Deploy the bot
flyctl deploy

# If machines exist from failed deploys, destroy them first:
flyctl machines list
flyctl machines destroy <machine-id>
  1. create the configuration
# SSH into the machine
flyctl ssh console

# Create config.json at the mounted volume location
cat > /app/res/config.json << 'EOF'
{
  "featureList": [
    {
      "name": "Infil Glossary",
      "isEnabled": true,
      "supportedGames": []
    },
    {
      "name": "Wavu Wiki",
      "isEnabled": true,
      "supportedGames": [
        "Tekken_8"
      ]
    },
    {
      "name": "SuperCombo Wiki",
      "isEnabled": true,
      "supportedGames": [
        "Street_Fighter_6"
      ]
    }
  ]
}
EOF
  1. verify
# Check app status
flyctl status

# View logs
flyctl logs

# View live logs (follow mode)
flyctl logs -f

# List machines
flyctl machines list

Useful commands

# Restart the app
flyctl apps restart fightingnerd

# SSH into machine
flyctl ssh console

# Start stopped machine
flyctl machine start <machine-id>

# Stop running machine
flyctl machine stop <machine-id>

# Destroy machine
flyctl machines destroy <machine-id>

# View app info
flyctl info

Clone this wiki locally