Skip to content

Workflow Manager Deployment

Deployment guide for CampaignBrain Workflow Manager at workflow.nominate.ai.

Overview

Component Port Service
API (FastAPI) 8234 cbworkflow-api.service
App (Starlette) 8239 cbworkflow-app.service
NGINX 80 Routes to API/App

Architecture

                     workflow.nominate.ai
                         NGINX:80
              ┌─────────────┴─────────────┐
              │                           │
         /api/*                      /* (all else)
              │                           │
              ▼                           ▼
      ┌───────────────┐          ┌───────────────┐
      │  FastAPI API  │          │ Starlette App │
      │   Port 8234   │          │   Port 8239   │
      └───────────────┘          └───────────────┘
      ┌───────────────┐
      │  JSON Storage │
      │    ./data/    │
      └───────────────┘

Prerequisites

  • Python 3.11+ (pyenv: nominates)
  • NGINX installed
  • Systemd (Linux)

Installation

1. Clone & Install Dependencies

cd /home/bisenbek/projects/nominate/cbworkflow
source ~/.pyenv/versions/nominates/bin/activate
pip install -e ".[dev]"

2. Deploy Systemd Services

# Copy service files
sudo cp deploy/cbworkflow-api.service /etc/systemd/system/
sudo cp deploy/cbworkflow-app.service /etc/systemd/system/

# Reload and enable
sudo systemctl daemon-reload
sudo systemctl enable cbworkflow-api cbworkflow-app

# Start services
sudo systemctl start cbworkflow-api cbworkflow-app

# Verify
sudo systemctl status cbworkflow-api cbworkflow-app

3. Deploy NGINX Config

# Copy config
sudo cp deploy/nginx-workflow.nominate.ai.conf \
    /etc/nginx/sites-available/workflow.nominate.ai

# Enable site
sudo ln -sf /etc/nginx/sites-available/workflow.nominate.ai \
    /etc/nginx/sites-enabled/

# Test and reload
sudo nginx -t
sudo systemctl reload nginx

4. Verify Deployment

# Direct service checks
curl http://localhost:8234/health    # API
curl http://localhost:8239/health    # App

# Via NGINX
curl http://workflow.nominate.ai/health
curl http://workflow.nominate.ai/api/health

Service Management

# Start/Stop/Restart
sudo systemctl start cbworkflow-api cbworkflow-app
sudo systemctl stop cbworkflow-api cbworkflow-app
sudo systemctl restart cbworkflow-api cbworkflow-app

# View logs
sudo journalctl -u cbworkflow-api -f
sudo journalctl -u cbworkflow-app -f

# Both services
sudo journalctl -u cbworkflow-api -u cbworkflow-app -f --since "10 minutes ago"

URLs

URL Description
http://workflow.nominate.ai/ Dashboard
http://workflow.nominate.ai/workflows Workflow templates
http://workflow.nominate.ai/instances Running instances
http://workflow.nominate.ai/connectors Connector status
http://workflow.nominate.ai/api/docs Swagger API docs
http://workflow.nominate.ai/api/redoc ReDoc API docs

Configuration Files

File Location
API Service /etc/systemd/system/cbworkflow-api.service
App Service /etc/systemd/system/cbworkflow-app.service
NGINX /etc/nginx/sites-available/workflow.nominate.ai
Source deploy/ directory in repo

Data Storage

  • Location: /home/bisenbek/projects/nominate/cbworkflow/data/
  • Format: JSON files
  • Backup: Copy the data/ directory

Troubleshooting

Services won't start

# Check logs
sudo journalctl -u cbworkflow-api -n 50 --no-pager

# Check port usage
sudo ss -tlnp | grep -E '8234|8239'

# Check permissions
ls -la /home/bisenbek/projects/nominate/cbworkflow/data/

NGINX 502 Bad Gateway

# Verify backends are running
curl http://localhost:8234/health
curl http://localhost:8239/health

# Check NGINX logs
sudo tail -f /var/log/nginx/workflow.nominate.ai.error.log

Permission Denied

sudo chown -R bisenbek:bisenbek /home/bisenbek/projects/nominate/cbworkflow/data

Development Mode

Run without systemd for development:

# Terminal 1 - API
./start.sh

# Terminal 2 - Frontend
python run_workflow_frontend.py --reload

Access at: - API: http://localhost:8234 - App: http://localhost:8239