Source Code Deployment
Build and deploy GPT-Load from source code, suitable for developers to customize and debug features. Provides complete control and flexibility.
Environment Requirements
Development Environment
Requires local installation of Go development environment and related toolchain
Required Software
- Go 1.23+ development environment
- Git version control tool
- Make build tool
- Database service (MySQL/PostgreSQL/SQLite)
Optional Software
- Redis cache service
- Node.js and npm (for frontend development)
- Docker (for containerized testing)
- IDE or editor (VS Code/GoLand)
Installation Steps
Clone Source Code
Clone GPT-Load source code repository from GitHub:
git clone https://github.com/tbphp/gpt-load.git
cd gpt-loadTip:If you need a specific version, use git checkout v1.x.x to switch to the corresponding version tag
Install Dependencies
Download and install Go module dependencies:
go mod tidyNote:Ensure network connection is stable, some dependencies may need to be downloaded from overseas servers
Database Configuration
Create Configuration File
cp .env.example .envCopy example configuration file and modify according to your environment
Database Connection Configuration
SQLite (recommended for development):
DATABASE_DSN=./data/gpt-load.dbMySQL:
DATABASE_DSN=root:123456@tcp(mysql:3306)/gpt-load?charset=utf8mb4&parseTime=True&loc=LocalPostgreSQL:
DATABASE_DSN=postgres://postgres:123456@postgres:5432/gpt-load?sslmode=disableBuild and Run
Build Frontend
cd web && npm install && npm run buildRun Backend Development Service
go run main.goRun Frontend Development Service
cd web && npm run devDevelopment Guide
Project Structure
Troubleshooting
Common Issues
Go version too low
Error message:go version go1.xx.x: minimum supported version is go1.23
Solution:Upgrade Go version to 1.23 or higher
Dependency download failed
Possible causes: network connection issues or proxy settings
# Set Go proxy
go env -w GOPROXY=https://goproxy.cn,directNext Steps
After source code deployment is complete, you can:
- Deeply understand code structure and customize features
- Participate in open source projects and submit Pull Requests
- Build custom Docker images
- Integrate into CI/CD pipelines