Build, Run & Deployment
The dLANDiscord backend is designed for high availability and easy deployment. It features a robust self-update mechanism and a detailed startup routine.
🛠️ Building the Application
Prerequisites
- Go: 1.25.0 or later.
- Git: For code management and automated updates.
- Dependencies: Standard Go
requirepackages (seego.mod).
Commands
# Build the binary (creates dLANDiscord.exe on Windows, dLANDiscord on Linux)
go build .
# Compile check only (exits quickly without the --start flag)
go build .
🚀 Running the Application
To start the bot and all its associated services, you must use the --start flag.
Windows
./dLANDiscord.exe --start
Linux
./dLANDiscord --start
Automated Start (Windows Loop)
The startup.bat script provides a crash-recovery loop for Windows:
:loop
dLANDiscord.exe --start
goto loop
Automated Start (Linux)
The startup.sh script performs a git pull, updates tools, builds the binary, and starts the bot.
🔄 Self-Update Mechanism
The application includes a built-in self-update routine (updater/updater.go).
- Check Frequency: Every 2 minutes.
- Process: The system checks a remote version file and, if a new version is available, it performs a
git pull, re-builds the binary, and restarts the application.
📁 Key Files & Directories
main.go: The entry point and service orchestrator.assistant/: The core AI framework and session management.dwebgame/: The modular web-based game.config/: Site-specific.iniconfiguration files.scheduler.db: SQLite database for persistent scheduled tasks.observability.db: SQLite database for session tracking and analytics.logs/: Directory for system, session, and audit logs.
🚢 Deployment Best Practices
- Environment Variables: Ensure all required API keys (Discord, WhatsApp, Telegram, weather, etc.) are set in the environment or in the appropriate
.inifiles. - Port Access: The system starts several web servers (Assistant API on port
:6573, Wakeup Hub on port7142, Wiki Server on port:7779). Ensure these ports are accessible within the local network or via a secure tunnel like Twingate. - Persistence: Regularly back up the
scheduler.db,observability.db, andmemory/facts.jsonfiles to preserve system state and memory. - Logging: Monitor the
assistant/logs/botlog.logandassistant/logs/session_*.jsonlfiles for any errors or anomalies during execution.
For architectural details, see Architecture.