> ## Documentation Index
> Fetch the complete documentation index at: https://meepa.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Deployment

> Deploy MeepaGateway to a VPS with systemd and Caddy

## Quick Install

```bash theme={null}
curl -fsSL https://meepa.ai/install-meepagateway.sh | sh
```

On first run, `meepagateway` launches an interactive setup wizard. Choose between the terminal wizard or the web-based Captain Dashboard at `http://localhost:63372`.

***

## VPS Deployment

MeepaGateway ships pre-built cloud-init scripts for one-command server provisioning.

### DigitalOcean

```bash theme={null}
IP=$(doctl compute droplet create meepagateway \
  --image ubuntu-24-04-x64 \
  --size s-1vcpu-1gb \
  --region nyc3 \
  --user-data "$(curl -fsSL https://meepa.ai/cloud-init-meepagateway.sh)" \
  --wait \
  --format PublicIPv4 --no-header)

echo "Dashboard: http://$IP:63372"
```

### Hetzner

```bash theme={null}
hcloud ssh-key list
# If empty: hcloud ssh-key create --name my-key --public-key-from-file ~/.ssh/id_ed25519.pub

IP=$(hcloud server create --name meepagateway \
  --image "$(hcloud image list -t snapshot -o columns=id,description \
    | grep meepagateway- | sort -t- -k2 -V | tail -1 | awk '{print $1}')" \
  --type cx23 --ssh-key my-key \
  --user-data "$(curl -fsSL https://meepa.ai/cloud-init-image-meepagateway.sh)" \
  -o columns=public_net --no-header | awk '{print $1}')

echo "Dashboard: http://$IP:63372"
```

### Any VPS (Linode, Vultr, AWS, GCP, etc.)

Pass the cloud-init script as user data during instance creation:

```bash theme={null}
curl -fsSL https://meepa.ai/cloud-init-meepagateway.sh
```

Or SSH into the server and run the install script manually:

```bash theme={null}
curl -fsSL https://meepa.ai/install-meepagateway.sh | sh
```

***

## systemd Service

After installing, run as a systemd service for automatic restart and boot persistence.

### Service File

Create `/etc/systemd/system/meepagateway.service`:

```ini theme={null}
[Unit]
Description=MeepaGateway
After=network.target

[Service]
Type=simple
User=meepa
EnvironmentFile=/etc/meepagateway/env
ExecStart=/usr/local/bin/meepagateway start
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
```

### Environment File

Create `/etc/meepagateway/env`:

```bash theme={null}
ANTHROPIC_API_KEY=sk-ant-...
# OPENAI_API_KEY=sk-...
# BRAVE_API_KEY=BSA...
```

### Setup and Enable

```bash theme={null}
sudo systemctl daemon-reload
sudo systemctl enable meepagateway
sudo systemctl start meepagateway
```

### Service Management

```bash theme={null}
sudo systemctl status meepagateway
sudo systemctl restart meepagateway
sudo journalctl -u meepagateway -f
```

***

## Reverse Proxy with Caddy

Expose the Captain Dashboard over HTTPS. MeepaGateway binds to `127.0.0.1:63372` by default.

### Public HTTPS

```
meepa.example.com {
    reverse_proxy localhost:63372
}
```

### Tailscale-Only Access

```
https://meepa.example.com {
    tls /etc/caddy/certs/fullchain.crt /etc/caddy/certs/privkey.key

    @tailscale remote_ip 100.64.0.0/10
    handle @tailscale {
        reverse_proxy localhost:63372
    }

    respond "Access denied" 403
}
```

```bash theme={null}
sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl reload caddy
```

***

## Health Check

```bash theme={null}
curl http://localhost:63372/health
# {"status":"ok"}
```

The `/health` endpoint returns `200 OK` when the gateway is running. Use it for load balancer health checks or uptime monitors.

***

## Updating

MeepaGateway has a built-in self-update command:

```bash theme={null}
meepagateway update
```

Or update from the Captain Dashboard: **Settings → Update**.

Other methods:

```bash theme={null}
# Re-run install script (recommended)
curl -fsSL https://meepa.ai/install-meepagateway.sh | sh

# Homebrew
brew upgrade meepagateway
```

***

## Backup

Back up these paths to preserve all agent state:

| Path                            | Contents                                                 |
| ------------------------------- | -------------------------------------------------------- |
| `config.yaml`                   | Gateway configuration                                    |
| `~/.meepagateway/agents/`       | Agent workspaces (SOUL.md, memory.db, skills, .mcp.json) |
| `~/.meepagateway/private-keys/` | Age private keys for credential store                    |

```bash theme={null}
# Simple tar backup
tar -czf meepagateway-backup-$(date +%Y%m%d).tar.gz \
  config.yaml \
  ~/.meepagateway/
```

***

## Firewall

Only the ports your connectors need must be reachable from the internet:

| Port  | Purpose                   | Required                       |
| ----- | ------------------------- | ------------------------------ |
| 63372 | Captain Dashboard / API   | Only if exposed publicly       |
| 8443  | Telegram webhook listener | Only for Telegram webhook mode |
| 8444  | WhatsApp webhook listener | Only for WhatsApp              |

MeepaGateway connectors that use outbound WebSocket (MeepaChat, Discord, Slack) require no inbound ports.

***

## Build from Source

```bash theme={null}
git clone https://github.com/bogpad/meepagateway
cd meepagateway
cargo build --release
# Binary: ./target/release/meepagateway
```

Requires Rust 1.80+ and a C linker.
