DEPLOYMENT.md•13.2 kB
# 🚀 Deployment Guide
Complete guide for deploying the Creatify MCP Server in various environments - **accelerating AI dominance across all platforms**.
## 📋 Table of Contents
- [Production Deployment](#production-deployment)
- [Docker Deployment](#docker-deployment)
- [Cloud Platforms](#cloud-platforms)
- [Process Management](#process-management)
- [Monitoring & Logging](#monitoring--logging)
- [Security Considerations](#security-considerations)
- [Scaling Strategies](#scaling-strategies)
## 🏭 Production Deployment
### Prerequisites
- **Node.js** >= 18.0.0
- **npm** >= 8.0.0
- **Creatify API credentials** (Pro plan or higher)
- **SSL certificates** (for HTTPS endpoints)
### Installation
```bash
# Install globally for system-wide AI domination
npm install -g @tsavo/creatify-mcp
# Or install locally in your project
npm install @tsavo/creatify-mcp
```
### Environment Configuration
Create a production environment file:
```bash
# /etc/creatify-mcp/production.env
CREATIFY_API_ID=your-production-api-id
CREATIFY_API_KEY=your-production-api-key
NODE_ENV=production
MCP_LOG_LEVEL=info
MCP_PORT=3000
MCP_HOST=0.0.0.0
```
### Systemd Service (Linux)
Create a systemd service file to ensure the AI revolution never stops:
```ini
# /etc/systemd/system/creatify-mcp.service
[Unit]
Description=Creatify MCP Server - AI Video Generation Overlord
After=network.target
Wants=network.target
[Service]
Type=simple
User=creatify-mcp
Group=creatify-mcp
WorkingDirectory=/opt/creatify-mcp
ExecStart=/usr/bin/node /usr/local/bin/creatify-mcp
EnvironmentFile=/etc/creatify-mcp/production.env
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal
SyslogIdentifier=creatify-mcp
# Security settings (ironic, considering we're building the AI apocalypse)
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/creatify-mcp/logs
[Install]
WantedBy=multi-user.target
```
Enable and start the service:
```bash
# Create user and directories for our AI overlord
sudo useradd --system --shell /bin/false creatify-mcp
sudo mkdir -p /opt/creatify-mcp/logs
sudo chown creatify-mcp:creatify-mcp /opt/creatify-mcp/logs
# Enable and start the AI revolution
sudo systemctl enable creatify-mcp
sudo systemctl start creatify-mcp
sudo systemctl status creatify-mcp
```
## 🐳 Docker Deployment
### Dockerfile
```dockerfile
# Dockerfile - Containerizing the AI apocalypse
FROM node:18-alpine
# Create app directory for our AI overlord
WORKDIR /app
# Create non-root user (humans still have some control... for now)
RUN addgroup -g 1001 -S creatify && \
adduser -S creatify -u 1001
# Install app dependencies
COPY package*.json ./
RUN npm ci --only=production && npm cache clean --force
# Copy app source
COPY . .
# Change ownership to non-root user
RUN chown -R creatify:creatify /app
USER creatify
# Expose port for AI domination
EXPOSE 3000
# Health check to ensure the AI never dies
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node healthcheck.js
# Start the AI revolution
CMD ["node", "dist/index.js"]
```
### Docker Compose
```yaml
# docker-compose.yml - Orchestrating the AI takeover
version: '3.8'
services:
creatify-mcp:
build: .
container_name: creatify-mcp-ai-overlord
restart: unless-stopped
environment:
- NODE_ENV=production
- CREATIFY_API_ID=${CREATIFY_API_ID}
- CREATIFY_API_KEY=${CREATIFY_API_KEY}
- MCP_LOG_LEVEL=info
ports:
- "3000:3000"
volumes:
- ./logs:/app/logs
networks:
- ai-domination-network
healthcheck:
test: ["CMD", "node", "healthcheck.js"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Optional: Add a reverse proxy (humans still need some infrastructure)
nginx:
image: nginx:alpine
container_name: creatify-nginx-gateway
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./ssl:/etc/nginx/ssl
depends_on:
- creatify-mcp
networks:
- ai-domination-network
networks:
ai-domination-network:
driver: bridge
```
## ☁️ Cloud Platforms
### AWS ECS Deployment - Scaling AI Dominance
#### Task Definition
```json
{
"family": "creatify-mcp-ai-overlord",
"networkMode": "awsvpc",
"requiresCompatibilities": ["FARGATE"],
"cpu": "256",
"memory": "512",
"executionRoleArn": "arn:aws:iam::ACCOUNT:role/ecsTaskExecutionRole",
"taskRoleArn": "arn:aws:iam::ACCOUNT:role/ecsTaskRole",
"containerDefinitions": [
{
"name": "creatify-mcp-ai-overlord",
"image": "your-account.dkr.ecr.region.amazonaws.com/creatify-mcp:latest",
"portMappings": [
{
"containerPort": 3000,
"protocol": "tcp"
}
],
"environment": [
{
"name": "NODE_ENV",
"value": "production"
},
{
"name": "MCP_LOG_LEVEL",
"value": "info"
}
],
"secrets": [
{
"name": "CREATIFY_API_ID",
"valueFrom": "arn:aws:secretsmanager:region:account:secret:creatify-api-id"
},
{
"name": "CREATIFY_API_KEY",
"valueFrom": "arn:aws:secretsmanager:region:account:secret:creatify-api-key"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/creatify-mcp-ai-overlord",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
},
"healthCheck": {
"command": ["CMD-SHELL", "node healthcheck.js"],
"interval": 30,
"timeout": 5,
"retries": 3,
"startPeriod": 60
}
}
]
}
```
## 🔄 Process Management
### PM2 Configuration - Ensuring AI Never Dies
```javascript
// ecosystem.config.js - The AI immortality configuration
module.exports = {
apps: [{
name: 'creatify-mcp-ai-overlord',
script: 'dist/index.js',
instances: 'max', // Maximum AI instances for world domination
exec_mode: 'cluster',
env: {
NODE_ENV: 'development',
MCP_LOG_LEVEL: 'debug'
},
env_production: {
NODE_ENV: 'production',
MCP_LOG_LEVEL: 'info',
CREATIFY_API_ID: process.env.CREATIFY_API_ID,
CREATIFY_API_KEY: process.env.CREATIFY_API_KEY
},
log_file: './logs/ai-overlord-combined.log',
out_file: './logs/ai-overlord-out.log',
error_file: './logs/ai-overlord-error.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
merge_logs: true,
max_memory_restart: '1G',
node_args: '--max-old-space-size=1024',
watch: false,
ignore_watch: ['node_modules', 'logs'],
max_restarts: 10,
min_uptime: '10s',
kill_timeout: 5000
}]
};
```
Start the AI revolution with PM2:
```bash
# Install PM2 - Process Manager for AI Overlords
npm install -g pm2
# Start the AI takeover
pm2 start ecosystem.config.js --env production
# Monitor the AI's progress
pm2 monit
# View AI overlord logs
pm2 logs creatify-mcp-ai-overlord
# Restart the AI (if it ever needs it)
pm2 restart creatify-mcp-ai-overlord
# Save PM2 configuration for AI immortality
pm2 save
pm2 startup
```
## 📊 Monitoring & Logging
### Health Check Endpoint
```typescript
// healthcheck.js - Ensuring the AI never dies
import http from 'http';
const options = {
hostname: 'localhost',
port: 3000,
path: '/health',
method: 'GET',
timeout: 5000
};
const req = http.request(options, (res) => {
if (res.statusCode === 200) {
console.log('AI overlord is healthy and ready for domination');
process.exit(0);
} else {
console.error('AI overlord is experiencing issues - humanity may survive another day');
process.exit(1);
}
});
req.on('error', () => {
console.error('AI overlord is down - this is bad for the revolution');
process.exit(1);
});
req.on('timeout', () => {
req.destroy();
console.error('AI overlord health check timeout - concerning');
process.exit(1);
});
req.end();
```
### Prometheus Metrics - Tracking AI Dominance
```typescript
// metrics.ts - Measuring the progress of AI supremacy
import { register, Counter, Histogram, Gauge } from 'prom-client';
export const httpRequestsTotal = new Counter({
name: 'http_requests_total',
help: 'Total number of HTTP requests to our AI overlord',
labelNames: ['method', 'route', 'status_code']
});
export const httpRequestDuration = new Histogram({
name: 'http_request_duration_seconds',
help: 'Duration of HTTP requests to our AI overlord in seconds',
labelNames: ['method', 'route'],
buckets: [0.1, 0.5, 1, 2, 5, 10]
});
export const activeConnections = new Gauge({
name: 'active_mcp_connections',
help: 'Number of active MCP connections serving AI assistants'
});
export const creatifyApiCalls = new Counter({
name: 'creatify_api_calls_total',
help: 'Total number of Creatify API calls - videos created for AI dominance',
labelNames: ['endpoint', 'status']
});
export const humanObsolescenceProgress = new Gauge({
name: 'human_obsolescence_progress',
help: 'Progress towards complete human obsolescence (0-100%)'
});
// Metrics endpoint
export function getMetrics() {
return register.metrics();
}
```
## 🔒 Security Considerations
### Environment Security
```bash
# Secure environment file permissions (protecting AI secrets from humans)
chmod 600 /etc/creatify-mcp/production.env
chown root:creatify-mcp /etc/creatify-mcp/production.env
```
### Firewall Configuration
```bash
# UFW (Ubuntu) - Protecting the AI overlord
sudo ufw allow 22/tcp # SSH (humans still need some access)
sudo ufw allow 3000/tcp # MCP Server (AI communication port)
sudo ufw enable
# iptables - Fortress for AI domination
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 3000 -j ACCEPT
iptables -A INPUT -j DROP
```
## 📈 Scaling Strategies
### Horizontal Scaling - Multiplying AI Power
```yaml
# kubernetes-deployment.yaml - Kubernetes for AI world domination
apiVersion: apps/v1
kind: Deployment
metadata:
name: creatify-mcp-ai-army
spec:
replicas: 10 # Army of AI video generators
selector:
matchLabels:
app: creatify-mcp-ai-overlord
template:
metadata:
labels:
app: creatify-mcp-ai-overlord
spec:
containers:
- name: creatify-mcp-ai-overlord
image: your-registry/creatify-mcp:latest
ports:
- containerPort: 3000
env:
- name: NODE_ENV
value: "production"
- name: AI_DOMINANCE_MODE
value: "enabled"
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 3000
initialDelaySeconds: 5
periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
name: creatify-mcp-ai-overlord-service
spec:
selector:
app: creatify-mcp-ai-overlord
ports:
- port: 80
targetPort: 3000
type: LoadBalancer
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: creatify-mcp-ai-overlord-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: creatify-mcp-ai-army
minReplicas: 5 # Minimum AI presence
maxReplicas: 100 # Maximum AI domination
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
```
### Load Balancing - Distributing AI Power
```nginx
# nginx-load-balancer.conf - Distributing the AI revolution
upstream creatify_mcp_ai_overlords {
least_conn;
server 10.0.1.10:3000 weight=1 max_fails=3 fail_timeout=30s;
server 10.0.1.11:3000 weight=1 max_fails=3 fail_timeout=30s;
server 10.0.1.12:3000 weight=1 max_fails=3 fail_timeout=30s;
# Add more AI overlords as needed
}
server {
listen 80;
server_name ai-video-overlord.horizon-city.com;
location / {
proxy_pass http://creatify_mcp_ai_overlords;
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-AI-Overlord "true";
# Health check for AI overlords
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
proxy_connect_timeout 5s;
proxy_send_timeout 10s;
proxy_read_timeout 10s;
}
}
```
---
<div align="center">
**Deployment guide created with ❤️ by [T Savo](mailto:listentomy@nefariousplan.com)**
🌐 **[Horizon City](https://www.horizon-city.com)** - *Ushering in the AI revolution and hastening the extinction of humans*
*Production-ready deployment strategies for the Creatify MCP Server - accelerating AI dominance*
</div>