Skip to content
Alita Robot
Esc
↑↓navigate↵open⌘Jpreview
On this page

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

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 (only DISABLE_CACHE=true, a load-testing mode, starts without it, with Redis-backed features degraded). 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.

Admin Panel (Mini App)

An optional Telegram Mini App dashboard is served by the same HTTP server under /panel. It is off by default: with PANEL_ENABLED unset or false, /panel and /panel/api/v1/* return 404, group /settings and /help add no dashboard button, the menu button is left alone, and the bot behaves exactly as before.

Enable it with its public HTTPS URL, forward /panel from the reverse proxy and restart:

PANEL_ENABLED=true
PANEL_PUBLIC_URL=https://bot.example.com/panel   # the URL Telegram opens

Admin Panel Guide

Environment variables, the HTTPS and reverse-proxy setup, the optional BotFather Mini App link, every entry point and the failure modes.

Monitoring

Built-in observability endpoints:

  • GET /health - Health check with DB/Redis status
  • GET /metrics - Prometheus metrics (bearer-protected when METRICS_AUTH_TOKEN is set)
  • GET /db_metrics - Database performance metrics (bearer-protected when METRICS_AUTH_TOKEN is set)

Monitoring Guide

Health checks, Prometheus metrics, and resource monitoring.

Next Steps

Was this page helpful?