The Deployment Challenge
Every DeFiKit Bot Maker user eventually faces the same wall: you've built a sophisticated Telegram trading bot with limit orders, stop-losses, and multi-wallet support, but getting it running on a VPS feels like debugging a distributed system. Python version conflicts, missing system dependencies, Redis connection errors, and environment drift between your laptop and production — these aren't trading problems, they're DevOps problems.
Docker eliminates this entire category of frustration. With DeFiKit's pre-built Docker image on Docker Hub and a single `docker-compose.yml`, you go from `git clone` to a live, production-ready trading bot in under 15 minutes. No manual dependency resolution, no "it works on my machine" surprises, no late-night SSH sessions hunting for missing shared objects.
Architecture Overview
DeFiKit Bot Maker ships as a multi-service Docker Compose stack. Here is the architecture at a glance:
| Service | Image | Role | Port |
|---|---|---|---|
| **bot** | `defikit/bot-maker:latest` | Core Telegram trading bot (Python 3.11) | — (outbound only) |
| **db** | `postgres:16-alpine` | Persistent trade history, user configs, P&L data | 5432 |
| **redis** | `redis:7-alpine` | Session state, rate-limit counters, ephemeral caches | 6379 |
| **nginx** | `nginx:alpine` | Reverse-proxy for health checks and webhook termination | 80/443 |
The bot container runs the DeFiKit engine — order execution, Telegram command parsing, market-data polling — and connects to PostgreSQL for durable storage and Redis for low-latency session state. Nginx sits in front solely to terminate TLS for webhooks (Telegram requires HTTPS) and to expose a `/health` endpoint for monitoring.
Step 1: Prerequisites
You need a VPS with at least **2 GB RAM** and **20 GB SSD**. DeFiKit runs comfortably on a \$6–\$12/mo instance from providers like Hetzner, DigitalOcean, or Vultr. Ubuntu 22.04 or 24.04 LTS is recommended.
First, install Docker and Docker Compose if they aren't already present:
```bash
Install Docker (Ubuntu)
curl -fsSL https://get.docker.com | sudo sh
Add your user to the docker group (log out & back in after)
sudo usermod -aG docker $USER
Verify
docker --version
docker compose version
```
That is the entire prerequisite step. One script, two commands, done.
Step 2: Configuration
Clone the DeFiKit deployment repository and create your environment file:
```bash
git clone https://github.com/defikit/bot-maker-deploy.git
cd bot-maker-deploy
cp .env.example .env
```
Edit `.env` with your Telegram credentials and trading parameters:
```env
Required — get these from @BotFather on Telegram
TELEGRAM_BOT_TOKEN=1234567890:ABCdefGHIjklmNOPqrStuVWXyz
TELEGRAM_CHAT_ID=-1001234567890
PostgreSQL (change these before going live)
POSTGRES_PASSWORD=changeme_secure_random_32_chars
Redis (single-node, no password needed behind Docker network)
REDIS_HOST=redis
REDIS_PORT=6379
Bot trading config
INITIAL_BALANCE_USD=100.0
MAX_SLIPPAGE_PERCENT=0.5
RATE_LIMIT_CALLS=30
RATE_LIMIT_PERIOD=60
```
The `TELEGRAM_BOT_TOKEN` is the only truly non-negotiable value. Everything else has sensible defaults, though you should always rotate the PostgreSQL password before connecting to the public internet.
Step 3: Launch
With configuration in place, start the stack:
```bash
docker compose up -d
```
That is the complete deploy command. Docker pulls the `defikit/bot-maker:latest` image, creates an isolated bridge network, mounts persistent volumes for PostgreSQL and Redis, and starts all four containers in dependency order (database first, then cache, then the bot, then nginx).
Verify everything is running:
```bash
docker compose ps
Watch the bot's startup logs
docker compose logs bot --tail=50
```
You should see output similar to:
```
bot | [INFO] DeFiKit Bot Maker v2.4.1 starting...
bot | [INFO] PostgreSQL connection established
bot | [INFO] Redis connection established
bot | [INFO] Telegram bot started — listening for commands
```
If you see connection errors, double-check your `.env` variables. The most common mistake is a mistyped `TELEGRAM_BOT_TOKEN` or a PostgreSQL password that contains special characters that weren't quoted.
Deployment Checklist
A production bot needs more than `docker compose up`. Here is the operational checklist:
Health Checks
Docker Compose supports native health checks. Add this to your `docker-compose.yml` bot service:
```yaml
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
```
DeFiKit's bot image includes a built-in `/health` endpoint that returns HTTP 200 when all three backend connections (Telegram API, PostgreSQL, Redis) are live.
Monitoring with Uptime Kuma
Deploy Uptime Kuma on the same VPS or a separate monitoring box:
```bash
docker run -d --name uptime-kuma -p 3001:3001 louislam/uptime-kuma:latest
```
Point a monitor at `http://your-vps-ip:8080/health` with a 60-second check interval. Uptime Kuma will alert you via Telegram, email, or push notification the instant the health check fails.
Daily Backups
Automate PostgreSQL dumps with a cron job on the host:
```bash
Add to crontab (runs daily at 3 AM)
0 3 * * * docker exec defikit-postgres pg_dump -U defikit defikit > /backups/daily/defikit_$(date +\%F).sql
```
For off-site redundancy, pipe the dump to rclone (configured with S3 or Backblaze B2):
```bash
0 4 * * * rclone copy /backups/daily/defikit_$(date +\%F).sql b2:defikit-backups/
```
Keep 7 days of local backups and 30 days on remote storage. This gives you point-in-time recovery without filling your VPS disk.
Zero-Downtime Updates
When a new DeFiKit image is published:
```bash
docker compose pull bot
docker compose up -d --no-deps bot
```
The `--no-deps` flag restarts only the bot service without touching the database or cache. Your trading engine is back online in under 10 seconds.
Results
The Docker-first approach delivers measurable improvements over bare-metal deployment:
| Metric | Bare Metal | Docker |
|---|---|---|
| First deploy time | 45–90 minutes | **8–12 minutes** |
| Update time | 10–20 minutes | **< 10 seconds** |
| Environment drift incidents | Frequent | **Zero** |
| Rollback time | 15–30 minutes | **< 5 seconds** |
| New VPS setup | Manual, error-prone | **Identical every time** |
These numbers come from internal testing across 12 different VPS configurations (different providers, OS versions, and regions). The 8–12 minute range accounts for DNS propagation and image pull time on slower links.
Key Takeaways
1. **Docker eliminates environment variability.** Your bot runs in the exact same container on your laptop, a \$6 VPS, or a bare-metal server. The `docker-compose.yml` is the single source of truth for the runtime environment.
2. **DeFiKit's pre-built image cuts deploy time by 80%.** The `defikit/bot-maker` image on Docker Hub includes all Python dependencies, system libraries (secp256k1, OpenSSL, libsodium for Solana/BNB chain signing), and the health check server — no pip install, no apt-get, no compilation.
3. **The stack is production-ready out of the box.** PostgreSQL for persistence, Redis for session caching, Nginx for TLS termination, health checks, and a documented backup strategy. You aren't cobbling together a prototype — you are deploying a system designed to run 24/7.
4. **Operational overhead is near zero.** Updates are a single command, rollbacks are an image tag change, and monitoring requires exactly one Uptime Kuma URL. The time you used to spend fighting servers now goes into improving your trading strategies.
Get your bot live today. Clone the repo, fill in your Telegram token, run `docker compose up -d`, and watch DeFiKit start executing trades in the time it takes to make coffee.