Build Run Deployment

Last updated: April 25, 2026

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 require packages (see go.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 .ini configuration 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

  1. Environment Variables: Ensure all required API keys (Discord, WhatsApp, Telegram, weather, etc.) are set in the environment or in the appropriate .ini files.
  2. Port Access: The system starts several web servers (Assistant API on port :6573, Wakeup Hub on port 7142, Wiki Server on port :7779). Ensure these ports are accessible within the local network or via a secure tunnel like Twingate.
  3. Persistence: Regularly back up the scheduler.db, observability.db, and memory/facts.json files to preserve system state and memory.
  4. Logging: Monitor the assistant/logs/botlog.log and assistant/logs/session_*.jsonl files for any errors or anomalies during execution.

For architectural details, see Architecture.