Self-Hosting
Host your own instance of Alita Robot.
This guide covers everything you need to deploy your own instance of Alita Robot.
Prerequisites
Before you begin, ensure you have:
| Component | Minimum Version | Purpose |
|---|---|---|
| PostgreSQL | 16+ | Primary database |
| Redis | 7+ | Caching layer |
| Docker (recommended) | 20.10+ | Container deployment |
For building from source:
- Go 1.26+
Deployment Options
Docker Compose
Recommended The easiest way to deploy Alita. Includes PostgreSQL and Redis out of the box.
git clone https://github.com/divkix/Alita_Robot.git
cd Alita_Robot
cp sample.env .env
# Edit .env with your configuration
docker compose up -dBinary Deployment
Download pre-built binaries for your platform:
- Linux (amd64, arm64)
- macOS (amd64, arm64)
- Windows (amd64)
Build from Source
Compile the bot yourself for development or customization:
git clone https://github.com/divkix/Alita_Robot.git
cd Alita_Robot
go build -o alita_robot .Essential Configuration
At minimum, you need these environment variables:
BOT_TOKEN=your_bot_token_from_botfather
OWNER_ID=your_telegram_user_id
MESSAGE_DUMP=-100xxxxxxxxxx # Log channel ID
DATABASE_URL=postgresql://alita:change-me@localhost:5432/alita
Redis itself is also required at runtime. No Redis endpoint variable is needed
when it is available at the default localhost:6379; otherwise set either
REDIS_ADDRESS=host:port or a full REDIS_URL.
Full Environment Reference
Complete list of all environment variables and their descriptions.
Webhook vs Polling
| Mode | Use Case | Setup Complexity |
|---|---|---|
| Webhook | Production | Requires HTTPS domain |
| Polling | Development | Simple, works anywhere |
Webhook Setup
Configure webhooks for production deployments.
Database Setup
Alita uses PostgreSQL with automatic migrations:
# Enable auto-migration
AUTO_MIGRATE=true
# Or run manually (requires PSQL_DB_* env vars to be set)
make psql-migrate
Database Guide
Database setup, migrations, connection pooling, and schema design.
Monitoring
Built-in observability endpoints:
GET /health- Health check with DB/Redis statusGET /metrics- Prometheus metricsGET /db_metrics- Database performance metrics
Monitoring Guide
Health checks, Prometheus metrics, and resource monitoring.