Production Deployment

This guide covers deploying Botmarley to a production server.

Download the Release

Download the latest ARM64 release from GitHub:

curl -LO https://github.com/mi4uu/botmarley/releases/latest/download/botmarley-arm64.tar.gz

For x86_64 servers, use botmarley-amd64.tar.gz instead.

Extract and Install

# Extract the archive
tar -xzf botmarley-arm64.tar.gz

# Create installation directory
sudo mkdir -p /opt/botmarley

# Copy files
sudo cp server /opt/botmarley/
sudo cp -r templates/ /opt/botmarley/
sudo cp -r static/ /opt/botmarley/
sudo cp -r strats/ /opt/botmarley/

Required Files

These files must be present in the installation directory:

PathPurpose
serverServer binary
templates/Web interface templates
static/CSS, JS, static assets
strats/Strategy TOML files

PostgreSQL Setup

Install PostgreSQL 17 on your server:

# Ubuntu/Debian
sudo apt install postgresql-17

# Create database and user
sudo -u postgres psql -c "CREATE USER botmarley_prod WITH PASSWORD 'your-secure-password';"
sudo -u postgres psql -c "CREATE DATABASE botmarley_prod OWNER botmarley_prod;"

systemd Service

Create a systemd unit file at /etc/systemd/system/botmarley.service:

[Unit]
Description=Botmarley Trading Bot
After=network.target postgresql.service
Wants=postgresql.service

[Service]
Type=simple
User=botmarley
Group=botmarley
WorkingDirectory=/opt/botmarley
ExecStart=/opt/botmarley/server
Restart=always
RestartSec=5

# Environment
Environment=DATABASE_URL=postgresql://botmarley_prod:your-secure-password@127.0.0.1:5432/botmarley_prod
Environment=HOST=0.0.0.0
Environment=PORT=3000
Environment=RUST_LOG=info

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable botmarley
sudo systemctl start botmarley

Reverse Proxy (HTTPS)

For HTTPS, use Caddy as a reverse proxy:

# /etc/caddy/Caddyfile
your-domain.com {
    reverse_proxy localhost:3000
}
sudo systemctl restart caddy

Caddy automatically obtains and renews TLS certificates via Let's Encrypt.

Tip

Always enable password protection when exposing Botmarley to the internet.

Monitoring

Check Status

sudo systemctl status botmarley

View Logs

sudo journalctl -u botmarley -f

Health Check

curl http://localhost:3000/

Updating

To update Botmarley to a new release:

# 1. Download the latest release
curl -LO https://github.com/mi4uu/botmarley/releases/latest/download/botmarley-arm64.tar.gz

# 2. Extract
tar -xzf botmarley-arm64.tar.gz

# 3. Copy new files to production
sudo cp server /opt/botmarley/
sudo cp -r templates/ /opt/botmarley/
sudo cp -r static/ /opt/botmarley/

# 4. Restart the service
sudo systemctl restart botmarley

Warning

Active trading sessions are automatically recovered after a restart. The server records a server_restart event and re-spawns all running/paused sessions. There may be a brief gap in candle data during the restart window.