Skip to main content

Installation & Setup

This guide covers everything you need to install and configure PFP Checker, from development environments to production deployments.

System Requirements

  • Docker: Version 20.10 or higher
  • Docker Compose: Version 2.0 or higher
  • Storage: Minimum 500MB for images and database
  • Memory: 256MB RAM minimum (512MB recommended)

Manual Installation

  • Rust: Version 1.86 or newer
  • SQLite: Version 3.35 or higher
  • Operating System: Linux, macOS, or Windows
  • Storage: Minimum 500MB for images and database
  • Memory: 256MB RAM minimum (512MB recommended)

Required API Keys

Before installation, obtain these credentials:
1

Discord Bot Token

  1. Go to the Discord Developer Portal
  2. Create a new application or select an existing one
  3. Navigate to the Bot section
  4. Click Reset Token and copy the token
Keep your Discord token secret! Never commit it to version control or share it publicly.
2

ImgBB API Key

  1. Visit ImgBB API
  2. Sign up or log in to your account
  3. Copy your API key from the dashboard
ImgBB offers a free tier with 150 uploads per hour, which is sufficient for most use cases.

Installation Methods

Environment Variables

PFP Checker uses three environment variables for configuration:
VariableRequiredDescriptionExample
DISCORD_TOKENYesYour Discord bot token from the Developer PortalMTIzNDU2Nzg5MDEyMzQ1Njc4OTAuGxY...
IMGBB_KEYYesYour ImgBB API key for image hostinga1b2c3d4e5f6g7h8i9j0
DATABASE_URLYesSQLite database file pathsqlite:database.sqlite
All three environment variables are required. The bot will fail to start if any are missing.

Database Setup

PFP Checker uses SQLite with automatic schema migrations managed by SQLx.

Automatic Migrations

On startup, the bot automatically:
  1. Creates the database file if it doesn’t exist (specified in DATABASE_URL)
  2. Runs all pending migrations from the migrations/ directory
  3. Creates the necessary tables:
    • User - Stores monitored users and tracking start dates
    • ProfilePicture - Archives profile pictures with checksums and ImgBB links
    • UsernameChange - Records username changes with timestamps
    • Server - Stores monitored servers
    • ServerPicture - Archives server icon changes

Database Location

By default, the database is stored as database.sqlite in the project root. To change this:
.env
# Store in a different location
DATABASE_URL=sqlite:/var/lib/pfp-checker/database.sqlite

# Or use a relative path
DATABASE_URL=sqlite:data/pfp-checker.db
Ensure the directory exists and the bot has write permissions to the database file location.

Database Backups

Regularly backup your database to prevent data loss:
# Simple copy backup
cp database.sqlite database.backup.sqlite

# With timestamp
cp database.sqlite "database.backup.$(date +%Y%m%d-%H%M%S).sqlite"

# Automated daily backup (cron)
0 2 * * * cp /path/to/database.sqlite /backups/pfp-checker-$(date +\%Y\%m\%d).sqlite

Discord Bot Configuration

Required Bot Permissions

When inviting the bot to your server, it only needs:
  • View Channels: To receive commands
  • Use Application Commands: To register and respond to slash commands
The bot does NOT require:
  • Message Content Intent
  • Server Members Intent
  • Presence Intent

Generating Invite URL

  1. Go to Discord Developer Portal
  2. Select your application
  3. Navigate to OAuth2URL Generator
  4. Select scopes: bot and applications.commands
  5. Select bot permissions: View Channels
  6. Copy the generated URL
The bot automatically registers all slash commands globally when it starts. There’s no need to manually register commands.

Verification Steps

After installation, verify everything works correctly:
1

Check Bot Status

Verify the bot appears online in your Discord server’s member list.
2

Test Ping Command

Run /ping to ensure the bot responds with latency information.
3

Test Monitoring

Run /monitor @user on yourself or another user.You should receive a confirmation message.
4

Verify Database Creation

Check that database.sqlite exists in your project directory (or the path specified in DATABASE_URL).
5

Check Logs

Review logs for any errors:
docker-compose logs -f
6

Wait for First Update

After 30 minutes, run /pfphistory @user on a monitored user.You should see at least one profile picture entry.

Troubleshooting

Bot doesn’t start

Check environment variables:
# Verify .env file exists and has correct values
cat .env
Common issues:
  • Missing DISCORD_TOKEN or IMGBB_KEY
  • Invalid Discord token (reset it in Developer Portal)
  • Database file location not writable

Commands not appearing

Wait 1-5 minutes after starting the bot for Discord to register global commands. If commands still don’t appear:
  1. Remove and re-invite the bot with the correct OAuth2 URL
  2. Ensure you selected both bot and applications.commands scopes
  3. Restart the bot

Database migration errors

# Check database file permissions
ls -la database.sqlite

# Ensure the directory exists
mkdir -p $(dirname database.sqlite)

Image upload failures

Verify ImgBB API key:
  • Check that IMGBB_KEY in .env is correct
  • Verify you haven’t exceeded ImgBB rate limits (150 uploads/hour)
  • Test your API key: curl "https://api.imgbb.com/1/upload?key=YOUR_KEY"

High memory usage

PFP Checker is designed to be lightweight, but if you experience high memory usage:
  1. Check how many users/servers you’re monitoring
  2. Review log files for errors or excessive logging
  3. Restart the bot to clear any memory leaks

Production Deployment

For production environments, consider:

Docker Compose with Auto-Updates

The project includes a production Docker Compose configuration with Watchtower for automatic updates:
docker-compose -f docker-compose.production.yml up -d

Security Best Practices

  • Store .env outside the project directory with restricted permissions:
    chmod 600 /etc/pfp-checker/.env
    
  • Use environment-specific .env files (development, production)
  • Regularly update dependencies: cargo update
  • Monitor logs for suspicious activity
  • Implement database backup automation

Monitoring

Set up monitoring to ensure your bot stays healthy:
# Health check script
#!/bin/bash
if ! docker-compose ps | grep -q "Up"; then
    docker-compose up -d
    echo "Bot restarted at $(date)" >> /var/log/pfp-checker-restarts.log
fi
Run via cron every 5 minutes:
*/5 * * * * /path/to/health-check.sh

Next Steps

User Tracking Guide

Learn how to use user monitoring commands

Server Tracking Guide

Track server icon changes

Build docs developers (and LLMs) love