Prerequisites
- Linux, macOS, or Windows Server
- PostgreSQL 13 or later installed and running
- 512MB RAM minimum
- Stable internet connection
Install Rust Toolchain
Download and install Rust
On Linux/macOS:On Windows, download and run rustup-init.exeWhen prompted, choose the
stable toolchain.Build the Bot
Build release version
The first build may take 5-15 minutes as Cargo downloads and compiles all dependencies.
Configuration
Configure bot settings
Edit
config.json with your Discord server details. See the Docker Deployment guide for configuration examples.Set up the database
Install PostgreSQL 13 and initialize the database:See the Database Setup guide for detailed instructions.
Process Manager Setup
Keep the bot running continuously using a process manager.systemd (Recommended for Linux)
systemd is the standard init system for most modern Linux distributions.systemd Management Commands
OpenRC (Alpine Linux, Gentoo)
For systems using OpenRC as the init system.OpenRC Management Commands
PM2 (Cross-platform)
PM2 is a process manager for Node.js applications but works great with any executable.PM2 Management Commands
Windows Deployment
Build the bot
Open PowerShell and navigate to the project directory:The executable will be at
target\release\faculty_manager.exeTroubleshooting
Build fails with linking errors
Build fails with linking errors
Symptoms: Compilation fails during linking phaseSolutions:
- Install required build dependencies:
- Clear build cache and retry:
cargo clean && cargo build --release
Bot fails to start with database errors
Bot fails to start with database errors
Symptoms: Connection refused or authentication failed errorsSolutions:
- Verify PostgreSQL is running:
sudo systemctl status postgresql - Test connection manually:
psql -U faculty_manager -d faculty_manager - Check
DATABASE_URLformat in.env - Ensure database migrations have been run
- Check PostgreSQL logs:
sudo tail -f /var/log/postgresql/postgresql-13-main.log
Permission denied errors
Permission denied errors
Symptoms: Cannot read config files or write to directoriesSolutions:
- Ensure the bot user has appropriate permissions:
- If using systemd, verify the
UserandGroupin the service file
Service won't start automatically on boot
Service won't start automatically on boot
Symptoms: Bot doesn’t start after system rebootSolutions:
- For systemd:
sudo systemctl enable faculty_manager - For OpenRC:
sudo rc-update add faculty_manager default - For PM2:
pm2 startup && pm2 save - Check service logs for startup errors
High memory usage
High memory usage
Symptoms: Bot consuming excessive RAMSolutions:
- Reduce logging verbosity:
RUST_LOG=warnin.env - Set memory limits in service file (systemd example):
- Monitor with:
systemctl status faculty_managerorpm2 monit
Updating the Bot
Security Best Practices
- Run the bot as a dedicated non-root user
- Set restrictive file permissions on
.envandconfig.json - Use firewall rules to restrict database access
- Enable systemd security features (see service file example)
- Keep Rust toolchain and dependencies updated
- Regularly backup your database and configuration
- Use environment-specific Discord tokens (dev/prod)
- Enable audit logging for administrative commands
Performance Optimization
Compile with Additional Optimizations
Enable CPU-specific Optimizations
Next Steps
Database Setup
Configure PostgreSQL and run migrations
Configuration
Set up bot features and integrations