Prerequisites
Before setting up Template Worker, ensure you have the following:- PostgreSQL 12 or later
- Rust 1.92 or later (for building from source)
- Discord Bot Token and application credentials
- Object Storage (S3-compatible or local filesystem)
- Sandwich Gateway for Discord gateway connections
- Nirn Proxy for Discord REST API requests
Installation
Using Docker
The recommended way to run Template Worker is using Docker with the provideddocker-compose.yml:
Building from Source
- Clone the repository and install dependencies:
- Build the project:
- The binary will be available at
target/release/template-worker
Configuration File
Template Worker requires aconfig.yaml file in the working directory. The application will fail to start if this file is missing.
Configuration Structure
The configuration file uses YAML format with the following top-level sections:Discord Authentication
Discord bot token for authentication
Discord application client ID
Discord OAuth2 client secret
List of Discord user IDs with root access to internal APIs
Whitelist of allowed OAuth2 redirect URLs
Object Storage Configuration
Storage backend type. Options:
s3-like: S3-compatible storage (e.g., SeaweedFS, MinIO, AWS S3)local: Local filesystem storage
For S3-like: bucket name. For local: filesystem path
S3 endpoint URL (required for s3-like type)
Use HTTPS for S3 endpoint connections
CDN endpoint for serving objects (required for s3-like type)
Use HTTPS for CDN endpoint
S3 access key (required for s3-like type)
S3 secret key (required for s3-like type)
Service Addresses
Bind address for the Template Worker HTTP API serverDefault:
0.0.0.0:60000Bind address for the Mesophyll IPC server (process pool mode)Default:
0.0.0.0:60001Next Steps
- Configure environment variables for runtime settings
- Set up database and run migrations
- Choose a worker type (process pool or thread pool) for your deployment