Documentation Index
Fetch the complete documentation index at: https://mintlify.com/avikekk/JackettSearchBot/llms.txt
Use this file to discover all available pages before exploring further.
Starting the Bot
Once you’ve installed and configured JackettSearchBot, you can start it with:Using
uv run ensures the correct virtual environment is used without manual activation.Startup Process
When the bot starts, it goes through several initialization steps:Initialize logging
The bot sets up logging with rotating file handler and console output.Log files are created at the path specified in
LOG_FILE_PATH (default: logs/jackett_bot.log).Initialize services
The bot initializes internal services:
- AuthorizationService - Manages user access control
- JackettService - Handles Jackett API communication
- PTPService - Checks PassThePopcorn availability
Register handlers
Command handlers are registered for Telegram commands:
/start,/help/release,/r(with alias/relase)/check/auth,/unauth,/unauthall
app.py:56-87Successful Startup
When the bot starts successfully, you’ll see log output like:Stopping the Bot
To stop the bot gracefully:- Press
Ctrl+Cin the terminal - The bot will catch the interrupt signal and shut down cleanly
app.py:89-113, the shutdown process:
The bot closes all HTTP clients and cleans up resources during shutdown.
Running in Production
For production deployments, you should run the bot as a service that automatically restarts on failure.Option 1: systemd (Linux)
Create a systemd service file at/etc/systemd/system/jackett-bot.service:
Option 2: Docker
Create aDockerfile:
docker-compose.yml:
Option 3: PM2 (Node.js Process Manager)
Install PM2 globally:ecosystem.config.js:
Monitoring and Logs
Log Files
The bot writes detailed logs to the file specified inLOG_FILE_PATH. Logs use a rotating file handler:
- Max file size: 10 MB
- Backup files: 5
- Total storage: Up to 60 MB
app.py:135-140:
Log Format
Console logs (simpler format):Viewing Logs
Troubleshooting
Bot Won’t Start
Symptom: Bot exits immediately after starting Solution: Check for configuration errors:Database Locked Error
Symptom: Error message about database being lockedapp.py:95-104, this happens when another instance is running:
-
Check for other running instances:
-
Stop the other instance:
-
If the issue persists, remove stale session files:
The bot uses
in_memory=True for sessions (from app.py:40-46) to avoid persistent session locks, but this error can still occur if multiple instances start simultaneously.Connection Errors
Symptom: Cannot connect to Telegram or Jackett Solutions:-
Check network connectivity:
-
Verify Jackett URL in
config.envis correct and reachable - Check firewall rules allow outbound connections
- Verify API credentials are correct and not expired
Bot Crashes or Restarts
Symptom: Bot stops unexpectedly Solution:-
Check the log file for error messages:
- Look for patterns before crashes (specific commands, high load, etc.)
- Ensure system has sufficient resources (memory, disk space)
-
Update dependencies:
High Memory Usage
Symptom: Bot uses excessive memory Solutions:-
Reduce MAX_RESULTS in
config.envto show fewer results per page - Decrease REDACT_AFTER_SECONDS to free message data sooner
-
Monitor with system tools:
Health Checks
You can verify the bot is running and responsive:Manual Check
Send/start to the bot on Telegram. You should receive a response confirming access.
Process Check
Log Check
Recent log activity indicates the bot is running:Performance Tips
- Use tgcrypto - Automatically installed on Python < 3.13 for better performance
- Optimize MAX_RESULTS - Balance between usability and performance (recommended: 10-15)
- Monitor logs - Use INFO level for console, DEBUG for files
- Regular restarts - If running 24/7, restart weekly to clear accumulated state
- Resource limits - Set appropriate limits in systemd or Docker to prevent resource exhaustion
Best Practices
Use a process manager
Always run the bot with a process manager (systemd, Docker, PM2) in production to ensure automatic restarts.
Keep backups
While the bot doesn’t store persistent data, keep backups of:
config.env(securely)- Custom modifications to the code
Next Steps
Now that your bot is running:- Learn Bot Commands - Understand how to use the bot
- Project Structure - Explore the codebase structure
- Best Practices - Production deployment tips