Docker Compose Deployment
This guide introduces how to use Docker Compose for one-click deployment of the complete Hagicode system. This is the recommended deployment method, suitable for most users, especially for development, testing, and production environments.
Video Tutorial
Section titled “Video Tutorial”To help you better understand the Docker Compose deployment process, we provide a detailed video tutorial:
Watch the video tutorial on Bilibili
Video Content Includes:
- Complete demonstration of Docker Compose deployment process
- Configuration file generation and modification instructions
- Service startup and verification steps
- Common issues and solutions
Video duration: approximately 15 minutes
Prerequisites
Section titled “Prerequisites”Before starting, ensure your system has Docker and Docker Compose installed.
Install Docker
Section titled “Install Docker”Windows
Section titled “Windows”Download and install Docker Desktop for Windows
After installation, ensure Docker Desktop is running.
Download and install Docker Desktop for Mac
After installation, ensure Docker Desktop is running.
Install Docker using your package manager:
sudo apt-get updatesudo apt-get install docker.io docker-compose-pluginAfter installation, start Docker service:
sudo systemctl start dockersudo systemctl enable dockerVerify Installation
Section titled “Verify Installation”After installation, run the following commands to verify Docker and Docker Compose are installed correctly:
docker --versiondocker compose versionQuick Start
Section titled “Quick Start”1. Generate Docker Compose Configuration File
Section titled “1. Generate Docker Compose Configuration File”- Open Docker Compose Builder (standalone site)
- Fill in the configuration according to your needs:
- Select API provider (Zhipu AI, Anthropic Official, or Custom API)
- Configure ports, database, working directory, and other options
- Select Image Source: Choose the appropriate image source based on your network environment
- Click the generate button to get the
docker-compose.ymlconfiguration - Save the generated configuration as a
docker-compose.ymlfile - If needed, create a
.envfile to configure sensitive information
Image Source Selection
Section titled “Image Source Selection”The generator supports three image source options:
Docker Hub
- Image Address:
newbe36524/hagicode:{tag} - Applicable Scenarios: Suitable for users with Docker Hub mirror acceleration
- Advantages: Official image source, timely updates, stable access
- Notes: Mirror acceleration may need to be configured in some regions
Azure Container Registry (ACR)
- Image Address:
hagicode.azurecr.io/hagicode:{tag} - Applicable Scenarios: Suitable for users unable to access Docker Hub locally
- Advantages: Provides alternative image source, resolves network access issues
- Notes: Images stay synchronized with Docker Hub, but may have brief delays
Alibaba Cloud Container Registry (ACR)
- Image Address:
registry.cn-hangzhou.aliyuncs.com/hagicode/hagicode:{tag} - Applicable Scenarios: Suitable for domestic users, stable and fast network access
- Advantages: Alibaba Cloud domestic nodes, fast access speed, high stability
- Notes: Alibaba ACR images stay synchronized with Docker Hub, usually within 30 minutes
2. Start Services
Section titled “2. Start Services”Execute the following command in the directory where your docker-compose.yml is located:
docker compose up -dThis command will:
- Download and start the PostgreSQL container
- Download and start the Hagicode application container
- Create and configure the network
- Initialize the database connection
3. Verify Service Status
Section titled “3. Verify Service Status”Check if containers are running:
docker compose psYou should see both containers in “running” status.
View Service Logs
Section titled “View Service Logs”To view all service logs:
# View all service logsdocker compose logs
# View Hagicode service logsdocker compose logs hagicode
# Real-time log followingdocker compose logs -f hagicodeConfiguration Instructions
Section titled “Configuration Instructions”If you need to modify the configuration (such as changing ports, switching API provider, etc.), you can:
- Regenerate new configuration using Docker Compose Builder (standalone site)
- Manually edit
docker-compose.ymland.envfiles - Restart services to make configuration take effect:
docker compose restartAccess Application
Section titled “Access Application”Web Interface
Section titled “Web Interface”After successful service startup, access through your browser:
http://localhost:45000Database Connection
Section titled “Database Connection”If you need to connect directly to the PostgreSQL database, you can use the docker exec command to enter the container:
# Enter PostgreSQL container and connect to databasedocker exec -it hagicode-postgres psql -U postgres -d hagicodeContainer Connection Information:
- Host:
localhostor127.0.0.1(inside container) - Port:
5432(PostgreSQL default port) - Username:
postgres - Password:
postgres - Database:
hagicode
Next Steps
Section titled “Next Steps”Now you have successfully deployed Hagicode, please continue Create Your First Project to start using.
If you prefer the desktop application deployment method, please refer to Desktop Installation Guide.