Production Deployment
35 min4.7Advanced
Deploy OpenClaw to production with Docker and monitoring
Docker Setup
Create a Dockerfile:
```dockerfile
FROM node:22-alpine
RUN npm install -g openclaw-gateway
WORKDIR /app
COPY openclaw.json .
EXPOSE 18789
CMD ["openclaw", "gateway", "start", "--host", "0.0.0.0"]
```
Docker Compose
Create docker-compose.yml:
```yaml
version: '3.8'
services:
openclaw:
build: .
ports:
- "18789:18789"
environment:
- ANTHROPIC_API_KEY=${API_KEY}
volumes:
- ./data:/app/data
restart: unless-stopped
```
Nginx Reverse Proxy
Configure Nginx:
```nginx
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:18789;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
}
}
```
Monitoring
Implement monitoring with:
- **Health Checks**: Periodic endpoint monitoring
- **Logging**: Centralized log aggregation
- **Metrics**: CPU, memory, response times
- **Alerts**: Set up notifications for failures