Production Deployment
Architecture
Section titled “Architecture”Internet │ ▼Nginx (443/80) ├─ HTTP → Gunicorn (unix socket) → Django └─ WS → Daphne (port 8001) → Django Channels │PostgreSQL ◄────────────────────────────────┤Redis ◄────────────────────────────────┤Celery Worker ◄─────────────────────────────┘Celery Beat ◄──────────────────────────────┘Server Requirements
Section titled “Server Requirements”| Component | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPU | 4 vCPU |
| RAM | 4 GB | 8 GB |
| Disk | 20 GB | 50 GB SSD |
| OS | Ubuntu 22.04 LTS | Ubuntu 24.04 LTS |
| Python | 3.12 | 3.13 |
| PostgreSQL | 14 | 15+ |
| Redis | 7 | 7+ |
-
Install system dependencies
Terminal window sudo apt update && sudo apt install -y \python3.12 python3.12-venv python3.12-dev \postgresql-15 postgresql-client-15 \redis-server nginx certbot python3-certbot-nginx \build-essential libpq-dev libjpeg-dev zlib1g-dev -
Create application user
Terminal window sudo useradd -m -s /bin/bash jcusersudo su - jcuser -
Clone and configure
Terminal window git clone https://github.com/JINA-CODE-SYSTEMS/jina-connect-unified-cpaas.git ~/appcd ~/apppython3.12 -m venv venvsource venv/bin/activatepip install -r requirements.txtcp .env.example .env# Edit .env with production values -
Set up PostgreSQL
Terminal window sudo -u postgres createuser jcusersudo -u postgres createdb jc6 -O jcusersudo -u postgres psql -c "ALTER USER jcuser PASSWORD 'secure-password';" -
Run migrations and collect static
Terminal window python manage.py migratepython manage.py collectstatic --noinputpython manage.py createsuperuser -
Configure systemd services
Create the following service files in
/etc/systemd/system/:
Gunicorn Service
Section titled “Gunicorn Service”[Unit]Description=Jina Connect GunicornAfter=network.target postgresql.service redis.service
[Service]User=jcuserGroup=jcuserWorkingDirectory=/home/jcuser/appExecStart=/home/jcuser/app/venv/bin/gunicorn \ --workers 4 \ --bind unix:/run/jina-connect/gunicorn.sock \ --timeout 120 \ jina_connect.wsgi:applicationRuntimeDirectory=jina-connect
[Install]WantedBy=multi-user.targetDaphne Service (WebSocket)
Section titled “Daphne Service (WebSocket)”[Unit]Description=Jina Connect Daphne (WebSocket)After=network.target postgresql.service redis.service
[Service]User=jcuserGroup=jcuserWorkingDirectory=/home/jcuser/appExecStart=/home/jcuser/app/venv/bin/daphne \ -b 127.0.0.1 -p 8001 \ jina_connect.asgi:application
[Install]WantedBy=multi-user.targetCelery Worker
Section titled “Celery Worker”[Unit]Description=Jina Connect Celery WorkerAfter=network.target redis.service
[Service]User=jcuserGroup=jcuserWorkingDirectory=/home/jcuser/appExecStart=/home/jcuser/app/venv/bin/celery \ -A jina_connect worker \ -l info --concurrency=4
[Install]WantedBy=multi-user.targetCelery Beat
Section titled “Celery Beat”[Unit]Description=Jina Connect Celery BeatAfter=network.target redis.service
[Service]User=jcuserGroup=jcuserWorkingDirectory=/home/jcuser/appExecStart=/home/jcuser/app/venv/bin/celery \ -A jina_connect beat -l info
[Install]WantedBy=multi-user.targetEnable and Start
Section titled “Enable and Start”sudo systemctl daemon-reloadsudo systemctl enable --now jina-connect jina-connect-daphne jina-connect-celery jina-connect-beatNginx Configuration
Section titled “Nginx Configuration”server { listen 80; server_name your-domain.com; return 301 https://$server_name$request_uri;}
server { listen 443 ssl; server_name your-domain.com;
ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
client_max_body_size 100M;
# Static files location /static/ { alias /home/jcuser/app/staticfiles/; }
# Media files location /media/ { alias /home/jcuser/app/media/; }
# WebSocket location /ws/ { proxy_pass http://127.0.0.1:8001; 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; proxy_read_timeout 86400; }
# API and Admin location / { proxy_pass http://unix:/run/jina-connect/gunicorn.sock; 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; }}sudo ln -s /etc/nginx/sites-available/jina-connect /etc/nginx/sites-enabled/sudo nginx -tsudo systemctl reload nginxSSL Certificate
Section titled “SSL Certificate”sudo certbot --nginx -d your-domain.comProduction .env Checklist
Section titled “Production .env Checklist”DEBUG=FalseSECRET_KEY=<random-64-char-string>FIELD_ENCRYPTION_KEY=<fernet-key>BASE_URL=https://your-domain.comSITE_URL=https://your-domain.com
DB_NAME=jc6DB_USER=jcuserDB_PASSWORD=<secure-password>DB_HOST=localhost
CELERY_BROKER_URL=redis://localhost:6379/0REDIS_URL=redis://localhost:6379/0
WEBSOCKET_ACCEPT_ALL=FalseMonitoring
Section titled “Monitoring”# Check service statussudo systemctl status jina-connect jina-connect-daphne jina-connect-celery jina-connect-beat
# View logssudo journalctl -u jina-connect -fsudo journalctl -u jina-connect-daphne -fsudo journalctl -u jina-connect-celery -f
# Quick health checkcurl -s https://your-domain.com/version/