6.8 KiB
Deployment Plan Reference
Method 1: Quick Deployment with Docker
The Docker image supports x86 and ARM64 architectures and can run on domestic operating systems.
1. Install Docker
If Docker is not installed on your computer, follow this tutorial: Docker Installation Guide.
If Docker is already installed, you can:
- Use the 1.1 Convenience Script to automatically download required files and configurations.
- Deploy manually with Docker 1.2 Manual Deployment.
1.1 Convenience Script
Run the following command to download and execute the deployment script:
(Ensure your environment can access GitHub, or the script won't download.)
curl -L -o docker-setup.sh https://raw.githubusercontent.com/xinnan-tech/xiaozhi-esp32-server/main/docker-setup.sh
For Windows users:
Run in Git Bash, WSL, PowerShell, or CMD:
# Git Bash or WSL
sh docker-setup.sh
# PowerShell or CMD
.\docker-setup.sh
For Linux/macOS users:
Run in the terminal:
chmod +x docker-setup.sh
./docker-setup.sh
The script will automatically:
- Create necessary directory structures.
- Download the speech recognition model.
- Download configuration files.
- Verify file integrity.
After completion, follow the prompts to configure the API key.
Once done, proceed to Configure Project Files.
1.2 Manual Deployment
If the convenience script fails, follow this section for manual deployment.
1.2.1 Create Directories
Choose a directory for the project (e.g., xiaozhi-server). Inside it, create:
datafoldermodelsfolder → Inside, createSenseVoiceSmall.
Final directory structure:
xiaozhi-server
├─ data
├─ models
├─ SenseVoiceSmall
1.2.2 Download Speech Recognition Model
The default speech recognition uses an offline model. Download it here:
Jump to Model Download
After downloading, return to this guide.
1.2.3 Download Configuration Files
Download two files: docker-compose.yaml and config.yaml from the project repository.
1.2.3.1 Download docker-compose.yaml
Open this link.
Click the RAW button → Download → Save to xiaozhi-server.
1.2.3.2 Download config.yaml
Open this link.
Click RAW → Download → Save to xiaozhi-server/data and rename to .config.yaml.
Verify the final structure:
xiaozhi-server
├─ docker-compose.yml
├─ data
├─ .config.yaml
├─ models
├─ SenseVoiceSmall
├─ model.pt
If correct, proceed.
3. Configure Project Files
Before running, configure the model settings:
Jump to Configuration Guide
After configuration, return here.
4. Run Docker
Open a terminal in xiaozhi-server and run:
docker-compose up -d
Check logs:
docker logs -f xiaozhi-esp32-server
Verify success: Jump to Status Check
5. Version Upgrade
To upgrade later:
- Back up
.config.yaml(copy key settings manually). - Run:
docker stop xiaozhi-esp32-server
docker rm xiaozhi-esp32-server
docker rmi ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:server_latest
- Redeploy using Docker.
Method 2: Deployment Using Docker Environment
For developers avoiding conda, use this method.
1. Clone the Project
2. Download Model Files
3. Configure Project
4. Run Docker
In main/xiaozhi-server, execute:
docker run -it --name xiaozhi-env --restart always --security-opt seccomp:unconfined \
-p 8000:8000 \
-p 8002:8002 \
-v ./:/app \
kalicyh/python:xiaozhi
5. Install Dependencies
pip install -r requirements.txt
6. Run the Project
python app.py
Method 3: Local Source Code Deployment
1. Set Up Base Environment
Uses conda. Windows users: Install Anaconda → Open Anaconda Prompt (Admin).
Run:
conda remove -n xiaozhi-esp32-server --all -y
conda create -n xiaozhi-esp32-server python=3.10 -y
conda activate xiaozhi-esp32-server
# Add Tsinghua mirror
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda install libopus -y
conda install ffmpeg -y
2. Install Dependencies
Download the project (ZIP or git clone). Navigate to main/xiaozhi-server and run:
conda activate xiaozhi-esp32-server
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip install -r requirements.txt
3. Download Model
4. Configure Project
5. Run
conda activate xiaozhi-esp32-server
python app.py
Check logs for success: Status Check
Configuration Guide
If data/.config.yaml doesn’t exist, copy config.yaml and rename it.
Key settings:
selected_module:
VAD: SileroVAD
ASR: FunASR
LLM: ChatGLMLLM
TTS: EdgeTTS
Memory: nomem # Disabled by default
Intent: nointent # Disabled by default
To switch models (e.g., LLM options: DeepSeekLLM, ChatGLMLLM, DifyLLM), modify selected_module.
Model Files
Default speech model: SenseVoiceSmall. Download and place model.pt in models/SenseVoiceSmall/.
Download options:
- Option 1: SenseVoiceSmall (ModelScope)
- Option 2: Baidu Netdisk (Code:
qvna)
Status Check
Successful logs will show:
25-02-23 12:01:09[core.websocket_server] - INFO - Server is running at ws://xxx.xx.xx.xx:8000
For Docker deployments, replace xxx.xx.xx.xx with your local IP (e.g., 192.168.1.25).
Next: Compile ESP32 Firmware.
