macOS/Linux:
sudo nano /etc/hosts
# Add the following line
127.0.0.1 gaap.localWindows:
# Run Notepad as Administrator
notepad C:\Windows\System32\drivers\etc\hosts
# Add the following line
127.0.0.1 gaap.local# 1. Clone project (including submodules)
git clone --recursive https://github.com/gin-melodic/gaap.git
cd gaap
# 2. Configure environment variables
cp .env.example .env
# Modify .env file as needed
# 3. Start all services
docker-compose -f docker-compose.dev.yml up -d
# 4. View logs
docker-compose -f docker-compose.dev.yml logs -f gaap-api
docker-compose -f docker-compose.dev.yml logs -f gaap-web
# 5. Stop services
docker-compose -f docker-compose.dev.yml down
# 6. Full cleanup (including data volumes)
docker-compose -f docker-compose.dev.yml down -vStep 1: Enable Delve Debugger
# Edit .env file
ENABLE_DELVE=true
# Restart API service
docker-compose -f docker-compose.dev.yml up -d gaap-apiStep 2: Configure VSCode
Create gaap-api/.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Connect to Docker Delve",
"type": "go",
"request": "attach",
"mode": "remote",
"remotePath": "/app",
"port": 40000,
"host": "localhost",
"showLog": true,
"trace": "verbose",
"logOutput": "rpc"
}
]
}Step 3: Start Debugging
- Open
gaap-apiproject in VSCode - Set breakpoints in code
- Press
F5or click "Run and Debug" → "Connect to Docker Delve" - Trigger API requests using browser or Postman
- Breakpoint triggers in VSCode, view variables, step through, etc.
Step 4: Debugging Tips
# Enter container to check Delve status
docker exec -it gaap-api-dev sh
ps aux | grep dlv
# View Delve logs
docker logs gaap-api-devStep 1: Create Run Configuration
- Go to Run → Edit Configurations
- Add Go Remote configuration:
- Host: localhost
- Port: 40000
- On disconnect: Stop remote Delve process
Step 2: Start Debugging
- Ensure ENABLE_DELVE=true
- Start services: docker-compose -f docker-compose.dev.yml up -d
- Click Debug icon in GoLand
Method 3: Hot Reload Debugging without Delve
If only hot reload is needed (no breakpoints), disable Delve:
# .env file
ENABLE_DELVE=false
# Restart service
docker-compose -f docker-compose.dev.yml restart gaap-apiUse Air for hot reloading, automatically recompiles after code changes.
- Frontend: https://gaap.local
- Backend API: https://gaap.local/api/v1
- RabbitMQ Management Interface: http://localhost:15672
- Caddy Admin API: http://localhost:2019
Browser will warn about untrusted certificate on first access, this is normal.
- Chrome/Edge: Click "Advanced" → "Proceed"
- Firefox: Click "Advanced" → "Accept the Risk and Continue"
# Export Caddy root certificate
docker exec gaap-caddy-dev cat /data/caddy/pki/authorities/local/root.crt > caddy-root.crt
# macOS: Add to Keychain
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain caddy-root.crt
# Linux (Ubuntu/Debian)
sudo cp caddy-root.crt /usr/local/share/ca-certificates/caddy-root.crt
sudo update-ca-certificates
# Windows: Double click caddy-root.crt → Install Certificate → Trusted Root Certification Authorities# Test API connection
curl -k https://gaap.local/api/health
# View Caddy configuration
curl http://localhost:2019/config/ | jq
# Test frontend-backend communication (no CORS issues)
curl -k https://gaap.local/api/v1/users
# Check certificate
openssl s_client -connect gaap.local:443 -servername gaap.local# Check if port is open
netstat -an | grep 40000
# Check container permissions
docker inspect gaap-api-dev | grep -A 5 CapAdd
# Ensure SYS_PTRACE permission# Check Volume mounts
docker-compose -f docker-compose.dev.yml config | grep volumes -A 5
# Manually trigger recompilation
docker exec -it gaap-api-dev air# Use Go Proxy (China Region)
docker exec -it gaap-api-dev sh
go env -w GOPROXY=https://goproxy.cn,direct# Connect to PostgreSQL
docker exec -it gaap-postgres-dev psql -U gaap_user -d gaap
# Import SQL
docker exec -i gaap-postgres-dev psql -U gaap_user -d gaap < schema_ddl.sql
# Backup Database
docker exec gaap-postgres-dev pg_dump -U gaap_user gaap > backup.sqlAccess: http://localhost:15672
- Username:
gaap_mq - Password:
RABBITMQ_PASSWORDin.env