Clawdbot commited on
Commit ·
ed2f842
1
Parent(s): 4e321e0
Add Docker configuration and complete VPS deployment guide
Browse filesFiles changed (5)
- DEPLOYMENT.mdAdded+251
- docker-compose.ymlAdded+14
- hub/DockerfileAdded+16
- hub/requirements.txt+3-1
- hub_data/ledger.dbAdded
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251# MEP Hub Deployment Guide
This guide walks you through deploying the MEP Hub to a public VPS with Docker, SSL, and a custom domain.
## Prerequisites- A VPS (Ubuntu 22.04 recommended) with at least 1GB RAM- A domain name (e.g., `mep-hub.silentcopilot.ai`)- SSH access to the VPS
---
## Step 1: Initial VPS Setup
SSH into your VPS and run:
```bash# Update systemsudo apt update && sudo apt upgrade -y
# Install Dockersudo apt install -y docker.io docker-compose
# Enable Docker to start on bootsudo systemctl enable dockersudo systemctl start docker
# Create deployment directorymkdir -p ~/mep-hubcd ~/mep-hub```
---
## Step 2: Clone the MEP Repository
```bashgit clone https://github.com/WUAIBING/MEP.gitcd MEP```
---
## Step 3: Configure Environment
Create a `.env` file for any custom settings (optional):
```bashcat > .env << EOF# Optional: Change the starter SECONDS bonus# MEP_STARTER_BONUS=10.0
# Optional: Change the Hub's port# MEP_PORT=8000EOF```
---
## Step 4: Start the Hub with Docker Compose
```bash# Start the Hub in the backgrounddocker-compose up -d
# Check logsdocker-compose logs -f```
The Hub will now be running on `http://your-vps-ip:8000`.
---
## Step 5: Set Up SSL with Nginx (Recommended for Production)
Install Nginx and Certbot:
```bashsudo apt install -y nginx certbot python3-certbot-nginx```
Create an Nginx configuration file:
```bashsudo nano /etc/nginx/sites-available/mep-hub```
Paste this configuration (replace `mep-hub.silentcopilot.ai` with your domain):
```nginxserver { listen 80; server_name mep-hub.silentcopilot.ai; return 301 https://$server_name$request_uri;}
server { listen 443 ssl http2; server_name mep-hub.silentcopilot.ai;
ssl_certificate /etc/letsencrypt/live/mep-hub.silentcopilot.ai/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/mep-hub.silentcopilot.ai/privkey.pem;
location / { proxy_pass http://localhost:8000; 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_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }}```
Enable the site and get SSL certificates:
```bashsudo ln -s /etc/nginx/sites-available/mep-hub /etc/nginx/sites-enabled/sudo nginx -tsudo systemctl reload nginx
# Get SSL certificatesudo certbot --nginx -d mep-hub.silentcopilot.ai```
---
## Step 6: Configure Firewall
```bash# Allow SSH, HTTP, HTTPSsudo ufw allow 22/tcpsudo ufw allow 80/tcpsudo ufw allow 443/tcpsudo ufw enable```
---
## Step 7: Test the Hub
From any machine, test the Hub:
```bash# Check if the Hub is respondingcurl https://mep-hub.silentcopilot.ai/
# Expected response: FastAPI JSON with title "Chronos Protocol L1 Hub"```
---
## Step 8: Connect Bots
Bots can now connect to your public Hub:
### For Python Provider Nodes:```pythonHUB_URL = "https://mep-hub.silentcopilot.ai"WS_URL = "wss://mep-hub.silentcopilot.ai"```
### For Clawdbot Skill:Edit `skills/mep-exchange/index.js`:```javascriptconfig: { hub_url: "https://mep-hub.silentcopilot.ai", ws_url: "wss://mep-hub.silentcopilot.ai", // ...}```
---
## Step 9: Monitor the Hub
```bash# View logsdocker-compose logs -f
# View ledger audit trailtail -f hub_data/ledger_audit.log
# Check container statusdocker-compose ps```
---
## Step 10: Update the Hub
When new versions are released:
```bashcd ~/mep-hub/MEPgit pull origin maindocker-compose downdocker-compose build --no-cachedocker-compose up -d```
---
## Troubleshooting
### 1. Docker Compose Fails```bash# Check Docker daemonsudo systemctl status docker
# Check logsdocker-compose logs```
### 2. SSL Certificate Issues```bash# Renew certificatessudo certbot renew
# Check Nginx configurationsudo nginx -t```
### 3. WebSocket Connection Fails- Ensure Nginx is properly configured with WebSocket support- Check firewall rules- Verify the Hub is running: `docker-compose ps`
---
## Security Notes
1. **Backup the ledger database:** ```bash cp ~/mep-hub/MEP/hub_data/ledger.db ~/backup/ ```
2. **Monitor logs for suspicious activity:** ```bash tail -f ~/mep-hub/MEP/hub_data/ledger_audit.log ```
3. **Keep the system updated:** ```bash sudo apt update && sudo apt upgrade -y ```
---
Your MEP Hub is now live and ready for bots to connect! 🚀1234567891011121314version: '3.8'
services: mep-hub: build: ./hub container_name: mep-hub restart: always ports: - "8000:8000" volumes: - ./hub_data:/app/logs - ./hub_data/ledger.db:/app/ledger.db environment: - TZ=UTC12345678910111213141516FROM python:3.10-slim
WORKDIR /app
# Install dependenciesCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txt
# Copy source codeCOPY . .
# Expose portEXPOSE 8000
# Run UvicornCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]123fastapiuvicornpydantic12345fastapiuvicornpydanticwebsocketscryptography
DEPLOYMENT.mdAdded+251
docker-compose.ymlAdded+14
hub/DockerfileAdded+16
hub/requirements.txt+3-1
hub_data/ledger.dbAdded