Files
tianpu-ems/scripts/gitea-migration/02_setup_labmac3.sh
Du Wenbo 02c4698b59 feat: multi-customer architecture + Z-Park support + Gitea migration scripts
Multi-customer config system:
- CUSTOMER env var selects customer (tianpu/zpark)
- customers/tianpu/config.yaml — Tianpu branding, collectors, features
- customers/zpark/config.yaml — Z-Park branding, Sungrow collector
- GET /api/v1/branding endpoint for customer-specific branding
- main.py loads customer config for app title, CORS, logging
- Collector manager filters by customer's enabled collectors

Z-Park (中关村医疗器械园) support:
- Sungrow iSolarCloud API collector (sungrow_collector.py)
- Z-Park device definitions (10 inverters, 8 combiner boxes, 22+ buildings)
- Z-Park TOU pricing config (Beijing 2026 rates)
- Z-Park seed script (seed_zpark.py)

Gitea migration scripts (Mac Studio → labmac3):
- 5 migration scripts + README in scripts/gitea-migration/
- Creates 3-repo structure: ems-core, tp-ems, zpark-ems

Version: v1.0.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 16:23:33 +08:00

45 lines
1.1 KiB
Bash

#!/bin/bash
# Run this ON labmac3 (SSH into 192.168.1.77 first)
# Usage: ssh duwenbo@192.168.1.77 'bash -s' < 02_setup_labmac3.sh
echo "=== Setting up Gitea on labmac3 ==="
# Create directories
sudo mkdir -p /opt/gitea/data
sudo chown -R $(whoami):$(id -gn) /opt/gitea
# Create docker-compose.yml
cat > /opt/gitea/docker-compose.yml << 'COMPOSE'
version: '3'
services:
gitea:
image: gitea/gitea:latest
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=sqlite3
- GITEA__server__ROOT_URL=http://192.168.1.77:3300/
- GITEA__server__HTTP_PORT=3000
ports:
- "3300:3000"
- "2222:22"
volumes:
- ./data:/data
restart: unless-stopped
COMPOSE
echo "=== Docker Compose file created ==="
cat /opt/gitea/docker-compose.yml
echo ""
echo "Next steps:"
echo "1. If restoring from Mac Studio backup:"
echo " cp -r /opt/gitea-backup/gitea-data/* /opt/gitea/data/"
echo ""
echo "2. Start Gitea:"
echo " cd /opt/gitea && docker compose up -d"
echo ""
echo "3. Verify:"
echo " curl http://localhost:3300/api/v1/version"