Skip to main content

Web-based development tool for managing and editing Nodes and Dataflows in the MoFA framework

Project description

MoFA_Stage

English | ไธญๆ–‡

MoFA_Stage is a web-based development tool for managing and editing Nodes and Dataflows in the MoFA framework.

Features

  • Agent Management

    • Browse Agent list
    • Create and copy Agents
    • Edit Agent files
    • Run and stop Agents
    • View execution logs
  • Terminal Access

    • Web terminal
    • SSH connections
    • ttyd integration
  • Code Editing

    • Text editor
    • File browser
    • VSCode Server integration (optional)

Technology Stack

Backend

  • Python + Flask
  • WebSocket support
  • SSH terminal integration
  • RESTful API

Frontend

  • Vue 3 + Element Plus
  • Monaco editor

Third-party Services

  • ttyd (recommended)
  • code-server (optional)

Quick Start

Environment Requirements

System Support

  • Linux (supports apt-get and yum package managers)
  • macOS
  • Windows is not currently supported, WSL (Windows Subsystem for Linux) is recommended

Software Requirements

  • Python 3.8 or higher
  • Node.js 14 or higher
  • MoFA framework installed

Installation and Run Scripts

The project provides two scripts:

  • install: One-click installation of all dependencies

    chmod +x install
    ./install
    

    Automatically installs backend/frontend dependencies with options for Docker or traditional installation. After installation, it will prompt whether to run, selecting yes will execute the run script. For local deployment, choose non-docker deployment.

  • run: One-click service startup

    chmod +x run
    ./run
    

    Supports both Docker and traditional deployment modes. For local deployment, choose non-docker deployment.

Docker Deployment (Recommended)
Using Docker avoids all environment issues for the fastest deployment:
# Simply run the installation script to choose docker deployment
./install
./run

# Or configure separately:

# One-line frontend deployment
docker run -d -p 3000:80 liyao1119/mofa-stage-frontend

# Start backend
cd backend && python app.py

๐Ÿš€ Quick Start (30-second deployment)

Method 1: Using Official Image (Recommended)

# 1. Pull and start frontend
docker run -d -p 3000:80 --name mofa-frontend \
  --add-host=host.docker.internal:host-gateway \
  liyao1119/mofa-stage-frontend:latest

# 2. Clone repository and start backend
git clone https://github.com/mofa-org/mofa-stage.git
cd mofa-stage/backend
pip install -r requirements.txt
python app.py

# 3. Access system
# Open browser: http://localhost:3000

Method 2: Local Build

# 1. Clone code
git clone https://github.com/mofa-org/mofa-stage.git
cd mofa-stage

# 2. Use installation script (supports Docker mode selection)
./install

# 3. Start services
./run

๐Ÿ“‹ System Requirements

  • Docker Desktop (Download)
  • Python 3.8+ (backend only)
  • 4GB available memory

Development Mode (Manual Startup)

  1. Start the backend
cd backend
python app.py
  1. Start the frontend (development mode)
cd frontend
npm run dev

Access http://localhost:3000.

Production Deployment

  1. Build the frontend
cd frontend
npm run build  # Generates in the dist directory
  1. Deployment methods (choose one)

Using Nginx

server {
    listen 80;
    
    # Static files
    location / {
        root /path/to/mofa_stage/frontend/dist;
        try_files $uri $uri/ /index.html;
    }
    
    # API forwarding
    location /api {
        proxy_pass http://localhost:5002;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
    
    # WebSocket
    location /api/webssh {
        proxy_pass http://localhost:5001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Simple Deployment

Using Python's built-in HTTP server:

cd frontend/dist
python -m http.server 3000

Start the backend:

cd backend
python app.py

Common Issues

Port Occupation

If you encounter port occupation issues, you can use this command to release ports:

for port in 3000 5001 5002 7681; do
    pid=$(lsof -t -i:$port)
    if [ -n "$pid" ]; then
        kill -9 $pid
        echo "Released port $port"
    fi
done

Port Description

Service Port Description
Frontend 3000 Web interface
Backend API 5002 Flask service
WebSSH 5001 SSH terminal
ttyd 7681 Web terminal
VS Code 8080 Code editor

ttyd Installation Failure

If ttyd automatic installation fails, you can refer to the ttyd GitHub page for manual installation.

Docker-Specific Issues

Q: Port already in use?

# Check process using port 3000
lsof -i :3000
# Or change port mapping
docker run -d -p 8000:80 ...

Q: Container cannot connect to backend? Make sure backend service is running:

cd backend && python app.py

Q: How to update to latest version?

docker pull liyao1119/mofa-stage-frontend:latest
docker stop mofa-frontend
docker rm mofa-frontend
# Re-run docker run command

Q: How to view container logs?

docker logs mofa-frontend

Docker Advanced Configuration

Custom Build

cd frontend
# Build after modifying configuration
docker build -t my-mofa-frontend .
docker run -d -p 3000:80 my-mofa-frontend

Troubleshooting

  1. Check if Docker is running properly

    docker ps
    
  2. Check network connections

    curl http://localhost:3000
    curl http://localhost:5002/api/settings
    
  3. Restart container

    docker restart mofa-frontend
    

Directory Structure

mofa-stage/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ app.py              # Main application
โ”‚   โ”œโ”€โ”€ config.py           # Configuration
โ”‚   โ”œโ”€โ”€ routes/             # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ agents.py       # Agent management
โ”‚   โ”‚   โ”œโ”€โ”€ terminal.py     # Terminal features
โ”‚   โ”‚   โ”œโ”€โ”€ webssh.py       # SSH connections
โ”‚   โ”‚   โ”œโ”€โ”€ vscode.py       # VSCode integration
โ”‚   โ”‚   โ”œโ”€โ”€ settings.py     # Settings management
โ”‚   โ”‚   โ”œโ”€โ”€ ttyd.py         # ttyd integration
โ”‚   โ”‚   โ””โ”€โ”€ mermaid.py      # Chart rendering
โ”‚   โ”œโ”€โ”€ utils/              # Utility modules
โ”‚   โ”‚   โ”œโ”€โ”€ mofa_cli.py     # MoFA command wrapper
โ”‚   โ”‚   โ”œโ”€โ”€ file_ops.py     # File operations
โ”‚   โ”‚   โ””โ”€โ”€ ttyd_manager.py # ttyd management
โ”‚   โ””โ”€โ”€ requirements.txt    # Python dependencies
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ views/          # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ components/     # UI components
โ”‚   โ”‚   โ”œโ”€โ”€ api/            # API calls
โ”‚   โ”‚   โ”œโ”€โ”€ store/          # State management
โ”‚   โ”‚   โ””โ”€โ”€ router/         # Routing
โ”‚   โ””โ”€โ”€ package.json        # Node.js dependencies
โ”œโ”€โ”€ install.sh              # Installation script
โ””โ”€โ”€ run.sh                  # Startup script

User Journey

image
graph TD
    A[๐Ÿ”ง Environment Setup] --> B[โš™๏ธ System Configuration]
    B --> C[๐Ÿค– Agent Development]
    C --> D[๐Ÿ”„ Dataflow Orchestration]
    D --> E[๐Ÿ” Debugging & Optimization]
    
    A --> A1[Install MoFA Framework]
    A --> A2[Launch MoFA Stage]
    A --> A3[Access Web Interface]
    
    B --> B1[Configure MoFA Path]
    B --> B2[Select Terminal Mode]
    B --> B3[Test Connections]
    
    C --> C1[Browse Agent List]
    C --> C2[Create New Agent]
    C --> C3[Edit Agent Code]
    C --> C4[Test Agent]
    
    D --> D1[Create Dataflow]
    D --> D2[Connect Agents]
    D --> D3[Set Parameters]
    D --> D4[Run Dataflow]
    
    E --> E1[View Execution Logs]
    E --> E2[Use Terminal Debugging]
    E --> E3[Performance Monitoring]
    E --> E4[Version Management]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mofa_stage-0.5.0-py3-none-any.whl (32.1 MB view details)

Uploaded Python 3

File details

Details for the file mofa_stage-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: mofa_stage-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 32.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for mofa_stage-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f04b13e7995f64028dc8bc6176aaa5cd1352fa6d47dcd394e00377fa019bd41
MD5 c53baf98eb4ff58b4fb6022855aea0ad
BLAKE2b-256 fcc661be59c68e0ea1f3720e5080b07f8e9d1fabd1afcf2eb6ccc8550245c7f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page