Back to Astron Agent

astronAgent Complete Deployment Guide

docs/DEPLOYMENT_GUIDE.md

1.0.911.7 KB
Original Source

astronAgent Complete Deployment Guide

This guide will help you start all components of the astronAgent project in the correct order, including authentication, knowledge base, and core services.

๐Ÿ“‹ Project Architecture Overview

The astronAgent project consists of the following three main components:

  1. Casdoor - Identity authentication and single sign-on service (required component, provides SSO functionality)
  2. RagFlow - Knowledge base and document retrieval service (optional component, deploy as needed)
  3. astronAgent - Core business service cluster (required component)

๐Ÿš€ Deployment Steps

Prerequisites

Agent System Requirements

  • CPU >= 2 Core
  • RAM >= 4 GiB
  • Disk >= 50 GB

RAGFlow Requirements

  • CPU >= 4 Core
  • RAM >= 16 GB
  • Disk >= 50 GB

Step 1: Start Casdoor Identity Authentication Service

Casdoor is an open-source identity and access management platform that provides support for multiple authentication protocols including OAuth 2.0, OIDC, and SAML.

To start the Casdoor service, run our docker-compose-with-auth.yaml file. Before running the installation commands, please ensure that Docker and Docker Compose are installed on your machine.

bash
# Navigate to astronAgent directory
cd docker/astronAgent

# Start Casdoor service
docker compose -f docker-compose-auth.yml up -d

Service Information:

  • Access Address: http://localhost:8000
  • Container Name: casdoor
  • Default Configuration: Production mode (GIN_MODE=release)

Step 2: Start RagFlow Knowledge Base Service (Optional)

RagFlow is an open-source RAG (Retrieval-Augmented Generation) engine that provides accurate question-answering services using deep document understanding technology.

To start the RagFlow service, run our docker-compose.yml file or docker-compose-macos.yml. Before running the installation commands, please ensure that Docker and Docker Compose are installed on your machine.

bash
# Navigate to RagFlow directory
cd docker/ragflow

# Add executable permissions to all sh files
chmod +x *.sh

# Start RagFlow service (including all dependencies)
docker compose up -d

Access Address:

Model Configuration Steps:

  1. Click on your avatar to enter the Model Providers page, select Add Model, fill in the corresponding API address and API Key, and add both Chat model and Embedding model respectively.
  2. In the upper right corner of the same page, click Set Default Models to set the Chat model and Embedding model added in the first step as defaults.

Important Configuration Notes:

  • Elasticsearch is used by default. To use opensearch or infinity, modify the DOC_ENGINE configuration in .env
  • GPU acceleration is supported, start with docker-compose-gpu.yml

Step 3: Integrate Casdoor and Basic Environment Configuration (Configure as needed)

Before starting astronAgent services, configure Casdoor, access addresses, and other infrastructure connection information.

bash
# Navigate to astronAgent directory
cd docker/astronAgent

# Copy environment variable configuration
cp .env.example .env

The .env file is only used for startup, access addresses, authentication, database, Redis, object storage, and other infrastructure settings. Business capability accounts such as RAGFlow, iFLYTEK Open Platform, AI Ability Chat, Virtual Man, and Spark Knowledge Base are no longer configured in .env. Configure them in Platform Account Management after astronAgent starts.

3.1 Configure Service Host Address

bash
# Navigate to astronAgent directory
cd docker/astronAgent

# Edit environment variable configuration
vim .env

Configure the astronAgent service host address:

env
HOST_BASE_ADDRESS=http://localhost

Notes:

  • If you use a domain name for access, replace localhost with your domain name
  • Ensure nginx and minio ports are properly exposed

3.2 Configure Casdoor Authentication Integration (Required)

Edit the docker/astronAgent/.env file to configure Casdoor connection information:

Key Configuration Items:

env
# Casdoor Configuration
CONSOLE_CASDOOR_URL=http://your-casdoor-server:8000
CONSOLE_CASDOOR_ID=your-casdoor-client-id
CONSOLE_CASDOOR_APP=your-casdoor-app-name
CONSOLE_CASDOOR_ORG=your-casdoor-org-name

Obtaining Casdoor Configuration Information:

  1. Visit the Casdoor management console: http://localhost:8000

  2. Log in with the default administrator account: admin / 123

  3. Create Organization Go to the http://localhost:8000/organizations page, click "Add", fill in the organization name, save and exit.

  4. Create Application and Bind Organization Go to the http://localhost:8000/applications page, click "Add".

    When creating the application, fill in the following information:

    • Name: Custom application name, e.g., agent
    • Redirect URL: Set to the project's callback address. If the Nginx exposed port is 80, use http://your-local-ip/callback; if it's another port (e.g., 888), use http://your-local-ip:888/callback
    • Organization: Select the organization name you just created
  5. After saving the application, record the following information and map it to the project configuration items:

Casdoor Information ItemExample ValueCorresponding .env Configuration Item
Casdoor Service Address (URL)http://localhost:8000CONSOLE_CASDOOR_URL=http://localhost:8000
Client IDyour-casdoor-client-idCONSOLE_CASDOOR_ID=your-casdoor-client-id
Application Name (Name)your-casdoor-app-nameCONSOLE_CASDOOR_APP=your-casdoor-app-name
Organization Name (Organization)your-casdoor-org-nameCONSOLE_CASDOOR_ORG=your-casdoor-org-name
  1. Fill in the above configuration information into the project's environment variable file:
bash
# Navigate to astronAgent directory
cd docker/astronAgent

# Edit environment variable configuration
vim .env

Step 4: Start astronAgent Core Services (Required Deployment Step)

4.1 Start astronAgent Services

To start astronAgent services, run our docker-compose.yaml file. Before running the installation commands, please ensure that Docker and Docker Compose are installed on your machine.

bash
# Navigate to astronAgent directory
cd docker/astronAgent

# Start all services
docker compose up -d

4.2 Configure Platform Account Management (Optional, configure business capabilities as needed)

After astronAgent starts, access the console and log in. Open Platform Account Management from the left menu. Platform Account Management is at the same menu level as Application Management and Resource Management, and contains the following four configuration cards. After saving, the configuration takes effect globally immediately. The system automatically refreshes the cache, and containers do not need to be restarted. If a feature depends on a capability that has not been configured, the system prompts the user to configure it in Platform Account Management and does not block system startup.

iFLYTEK Open Platform (used by built-in Spark model, real-time speech recognition, image generation, and related capabilities):

For documentation, see: https://www.xfyun.cn/doc/platform/quickguide.html

After creating your application, you may need to purchase or claim API authorization service quotas for the corresponding capabilities:

Prepare and fill in the following fields under Platform Account Management - iFLYTEK Open Platform:

  • PLATFORM_APP_ID
  • PLATFORM_API_KEY
  • PLATFORM_API_SECRET
  • SPARK_API_PASSWORD
  • SPARK_RTASR_API_KEY

AI Ability Chat (used by platform AI generation capabilities, compatible with OpenAI protocols, such as prompt optimization and one-sentence agent creation):

  • AI_ABILITY_CHAT_BASE_URL
  • AI_ABILITY_CHAT_MODEL
  • AI_ABILITY_CHAT_API_KEY

Virtual Man capability:

  • SPARK_VIRTUAL_MAN_APP_ID
  • SPARK_VIRTUAL_MAN_API_KEY
  • SPARK_VIRTUAL_MAN_API_SECRET

Knowledge Base Platform:

  • RAGFlow: RAGFLOW_BASE_URL, RAGFLOW_API_TOKEN, RAGFLOW_TIMEOUT, RAGFLOW_DEFAULT_GROUP
  • Spark Knowledge Base: XINGHUO_DATASET_ID

When creating a knowledge base, users choose RAGFlow or Spark Knowledge Base. Only the platform actually used needs to be configured.

Obtaining RagFlow API Token:

  1. Visit RagFlow Web Interface: http://localhost:18080
  2. Log in and click on your avatar to enter user settings
  3. Click API to generate an API KEY
  4. Fill it in as RAGFLOW_API_TOKEN under Platform Account Management - Knowledge Base Platform

Obtaining Spark Knowledge Base Dataset ID:

Spark RAG cloud service provides two usage methods:

Method 1: Obtain from the Web Interface
  1. Use the APP_ID and API_SECRET created on the iFLYTEK Open Platform
  2. Directly obtain the Spark dataset ID from the web interface, see: xinghuo_rag_tool.html
Method 2: Using cURL Command Line

If you prefer using command-line tools, you can create a dataset with the following cURL command:

bash
# Create Spark RAG dataset
curl -X PUT 'https://chatdoc.xfyun.cn/openapi/v1/dataset/create' \
    -H "Accept: application/json" \
    -H "appId: your_app_id" \
    -H "timestamp: $(date +%s)" \
    -H "signature: $(echo -n "$(echo -n "your_app_id$(date +%s)" | md5sum | awk '{print $1}')" | openssl dgst -sha1 -hmac 'your_api_secret' -binary | base64)" \
    -F "name=ๆˆ‘็š„ๆ•ฐๆฎ้›†"

Notes:

  • Please replace your_app_id with your actual APP ID
  • Please replace your_api_secret with your actual API Secret

After obtaining the dataset ID, fill it in as XINGHUO_DATASET_ID under Platform Account Management - Knowledge Base Platform.

๐Ÿ“Š Service Access Addresses

After startup, you can access the services at the following addresses:

Authentication Service

Knowledge Base Service

AstronAgent Core Services

๐Ÿ“š Additional Resources

๐Ÿค Technical Support

If you encounter issues, please:

  1. Check the log files of related services
  2. Review the official documentation and troubleshooting guides
  3. Submit an Issue on the project's GitHub repository
  4. Contact the technical support team

Note: For first-time deployment, it is recommended to verify all functionalities in a test environment before deploying to production.