Skip to content

home / selfhost / install / first-run

First Run Instructions

Start Tux for the first time and verify everything works.

Prerequisites Checklist

Before starting Tux, ensure you have:

  • Discord bot token obtained
  • PostgreSQL database created
  • .env file configured
  • Config file created (optional)
  • Dependencies installed (if not using Docker)

Starting Tux

Docker Compose

Bash
# Start all services
docker compose up -d

# View logs
docker compose logs -f tux

Local/VPS

Bash
# Ensure dependencies are installed
uv sync

# Run migrations
uv run db push

# Start bot
uv run tux start

What to Expect

Startup Sequence

  1. Configuration Loading
Text Only
Loading configuration...
✓ Environment variables loaded
✓ Config file loaded
  1. Database Connection
Text Only
Connecting to database...
✓ Database connected
✓ Running migrations...
  1. Bot Initialization
Text Only
Initializing bot...
✓ Loading cogs...
✓ Syncing commands...
  1. Discord Connection
Text Only
Connecting to Discord...
✓ Logged in as Tux#1234
✓ Ready!

Success Indicators

Bot is ready log message
✅ Bot shows as online in Discord
✅ No error messages in logs
✅ Commands respond (/ping works)

Initial Configuration

1. Verify Bot is Online

In Discord, check:

  • Bot appears in member list
  • Green online status
  • No error badge

2. Test Basic Command

Text Only
/ping

Should respond with latency and uptime.

3. Run Setup Wizard

Text Only
/config wizard

Interactive setup for:

  • Moderation channels
  • Jail system
  • Starboard
  • XP roles
  • Basic settings

4. Set Up Permissions

Text Only
/config rank init
/config role assign 3 @Moderators
/config role assign 5 @Admins

5. Test Moderation

Text Only
/warn @TestUser Test warning
/cases

Verify case system works.

Troubleshooting First Run

Bot Won't Start

Check logs for specific error:

Bash
# Docker
docker compose logs tux

# Systemd
sudo journalctl -u tux -f

# Local
# Error appears in terminal

Common causes:

"Invalid Token" Error

Text Only
discord.errors.LoginFailure: Improper token has been passed

Solution:

  • Verify BOT_TOKEN in .env is correct
  • No extra spaces or quotes
  • Token is from Bot tab, not OAuth2 secret
  • Reset token if unsure

"Database Connection Failed"

Text Only
asyncpg.exceptions.InvalidCatalogNameError: database "tuxdb" does not exist

Solution:

  • Create database: createdb tuxdb
  • Check POSTGRES_* variables in .env
  • Verify PostgreSQL is running
  • Test connection: psql -h localhost -U tuxuser -d tuxdb

"Permission Denied" (Database)

Text Only
asyncpg.exceptions.InsufficientPrivilegeError

Solution:

Bash
sudo -u postgres psql << EOF
GRANT ALL PRIVILEGES ON DATABASE tuxdb TO tuxuser;
\c tuxdb
GRANT ALL ON SCHEMA public TO tuxuser;
EOF

"Missing Intents"

Text Only
Privileged intent ... is not enabled

Solution:

  • Go to Discord Developer Portal
  • Bot tab → Enable "Server Members Intent"
  • Bot tab → Enable "Message Content Intent"
  • Restart bot

Bot Starts But Shows Offline

Causes:

  • Token is invalid
  • Network connectivity issues
  • Discord API issues

Solutions:

  1. Check token is correct
  2. Verify internet connection
  3. Check Discord API status: status.discord.com
  4. Review bot logs for connection errors

Commands Don't Work

Test slash commands:

Text Only
/ping
/help

If not working:

  1. Wait 1-2 minutes (Discord sync delay)
  2. Check bot has applications.commands scope
  3. Run /dev sync_tree (if you have permission)
  4. Re-invite bot with correct scopes

Test prefix commands:

Text Only
$ping
$help

If not working:

  1. Check prefix is correct ($ by default)
  2. Verify Message Content Intent is enabled
  3. Check bot has Read Messages permission

Migration Errors

Text Only
alembic.util.exc.CommandError

Solutions:

Bash
# Check migration status
uv run db status

# Apply migrations
uv run db push

# If corrupted, reset and retry
uv run db reset

Post-Startup Checks

Verify Core Features

Bash
# 1. Bot responding
/ping                               # ✓ Should respond

# 2. Database working
/snippet test_snippet               # Create test snippet first

# 3. Permissions working
/config rank                        # ✓ Should show ranks

# 4. Moderation working
/warn @TestUser Test                # ✓ Creates case

# 5. Check cases
/cases                              # ✓ Shows test case

Check Logs

Look for warnings or errors:

Bash
# Docker
docker compose logs tux | grep -E "ERROR|WARNING"

# Systemd
sudo journalctl -u tux | grep -E "ERROR|WARNING"

Monitor Resources

Bash
# Docker
docker stats tux

# System
htop
free -h
df -h

Configuration Verification

Check Loaded Config

Bot logs show loaded configuration on startup:

Text Only
Configuration loaded from:
  - .env file
  - config.toml
  - Defaults

Verify Settings

Text Only
/config                             # View current config

Should show your configured settings.

Next Steps

After successful first run:

  1. Configure Features - Enable/disable features
  2. Set Up Backups - Protect your data
  3. Configure Monitoring - Watch for issues

Running in Background

Background with Docker Compose

Already runs in background with -d flag:

Bash
docker compose up -d

Background with Systemd

Bash
sudo systemctl enable tux           # Start on boot
sudo systemctl start tux            # Start now

For temporary deployments only:

Bash
# Screen
screen -S tux
uv run tux start
# Ctrl+A, D to detach

# Tmux
tmux new -s tux
uv run tux start
# Ctrl+B, D to detach

Use systemd instead for production!

Logs Location

Docker

Bash
docker compose logs tux             # View logs

Systemd

Bash
journalctl -u tux -f                # Follow logs

Local Development

Logs output to stdout/stderr and optionally to files in logs/.

Need Help?

Common Issues

Community Support


Congratulations! Tux is now running. Head to Configuration to customize your instance.