Source Deployment
This page explains how to build and deploy TGO from source code, suitable for customization or development debugging.
Difference from Image Deployment
| Method | Description | Use Case |
|---|---|---|
| Image Deployment (default) | Uses pre-built Docker images | Production, quick deployment |
| Source Deployment | Builds images from local source | Development, customization |
Source Deployment Steps
1. Clone Repository
git clone https://github.com/tgoai/tgo.git
cd tgo
For users in China:
git clone https://gitee.com/tgoai/tgo.git
cd tgo
2. Initialize Submodules
TGO service source code is managed as Git submodules in the repos/ directory:
git submodule update --init --recursive
3. Run Source Installation
Use the --source parameter for source deployment:
./tgo.sh install --source
For users in China, add --cn for mirrors:
./tgo.sh install --source --cn
Source Directory Structure
tgo/
└── repos/
├── tgo-api/ # Backend API service
├── tgo-ai/ # AI inference service
├── tgo-rag/ # RAG service
├── tgo-platform/ # Platform management service
├── tgo-web/ # Web console
└── tgo-widget/ # Widget component
Build Specific Services
If you only modified one service, rebuild it individually:
# Build specific service
./tgo.sh build api # Build tgo-api
./tgo.sh build ai # Build tgo-ai
./tgo.sh build rag # Build tgo-rag
./tgo.sh build platform # Build tgo-platform
./tgo.sh build web # Build tgo-web
./tgo.sh build widget # Build tgo-widget
# Build all services
./tgo.sh build all
Restart services after building:
./tgo.sh down
./tgo.sh up --source
Development Workflow
Modify Code
-
Enter the service directory:
cd repos/tgo-api -
Make your changes
-
Rebuild and restart:
cd ../..
./tgo.sh build api
./tgo.sh down
./tgo.sh up --source
View Logs
# View all logs
docker compose logs -f
# View specific service logs
docker compose logs -f tgo-api
Enter Container for Debugging
docker compose exec tgo-api bash
Notes
-
First build takes longer: Source build requires downloading dependencies and compiling, may take 10-30 minutes initially
-
Disk Space: Source deployment requires more disk space for source code and build cache
-
Network Requirements: Build process needs to download dependency packages, ensure network connectivity
-
Branch Sync: If main repo is updated, remember to sync submodules:
git pull
git submodule update --recursive