Production Deployment
Deploy Teleton Agent in a production environment with systemd, monitoring, and best practices.
Requirements
- VPS with 2GB+ RAM (4GB recommended)
- Ubuntu 22.04+ or Debian 12+
- Node.js 20+ (via nvm or nodesource)
- Domain name (optional, for WebUI)
Systemd Service
/etc/systemd/system/teleton.service
[Unit]
Description=Teleton Agent
After=network.target
[Service]
Type=simple
User=teleton
WorkingDirectory=/opt/teleton
ExecStart=/usr/bin/node dist/index.js
Restart=always
RestartSec=10
Environment=NODE_ENV=production
EnvironmentFile=/opt/teleton/.env
[Install]
WantedBy=multi-user.targetTerminal
# Create user
sudo useradd -r -s /bin/false teleton
# Setup directory
sudo mkdir -p /opt/teleton
sudo chown teleton:teleton /opt/teleton
# Enable and start
sudo systemctl daemon-reload
sudo systemctl enable teleton
sudo systemctl start teleton
# View logs
sudo journalctl -u teleton -fNginx Reverse Proxy
For WebUI access with HTTPS:
/etc/nginx/sites-available/teleton
server {
listen 80;
server_name teleton.yourdomain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name teleton.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/teleton.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/teleton.yourdomain.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache_bypass $http_upgrade;
}
}Monitoring
Basic health monitoring with cron:
/opt/teleton/health-check.sh
#!/bin/bash
if ! systemctl is-active --quiet teleton; then
echo "Teleton down, restarting..."
systemctl restart teleton
# Optional: send alert via curl to webhook
ficrontab
*/5 * * * * /opt/teleton/health-check.shBackup Strategy
/opt/teleton/backup.sh
#!/bin/bash
BACKUP_DIR="/var/backups/teleton"
DATE=$(date +%Y%m%d)
mkdir -p $BACKUP_DIR
# Backup critical files
tar -czf $BACKUP_DIR/teleton-$DATE.tar.gz \
/opt/teleton/.teleton/wallet.json \
/opt/teleton/.teleton/session.json \
/opt/teleton/.teleton/memory.db \
/opt/teleton/.teleton/config.yaml
# Keep only last 7 days
find $BACKUP_DIR -mtime +7 -deleteSecurity Checklist
- Use environment variables for all secrets
- Enable firewall (ufw) - only allow 22, 80, 443
- Set up fail2ban for SSH protection
- Use strong passwords and SSH keys
- Keep system and Node.js updated
- Restrict WebUI to VPN or IP whitelist
- Regular backups stored off-server