2026-04-06 08:55:27 +08:00
|
|
|
# Tianpu Daxing Park EMS (tp-ems)
|
|
|
|
|
|
|
|
|
|
> Tianpu Daxing Zero-Carbon Park Smart Energy Management System
|
|
|
|
|
|
|
|
|
|
**Current Version: 1.2.0** | Core: 1.1.0 | See `VERSIONS.json`
|
|
|
|
|
|
|
|
|
|
Customer project for Tianpu Daxing Zero-Carbon Park, built on [ems-core](http://100.69.143.96:3300/tianpu/ems-core).
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Directory Structure
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
tp-ems/
|
|
|
|
|
+-- core/ # EMS core (git subtree, DO NOT modify directly)
|
|
|
|
|
+-- frontend/ # Customer frontend (React/TypeScript)
|
|
|
|
|
| +-- src/ # React source code
|
|
|
|
|
| +-- Dockerfile # Frontend container
|
|
|
|
|
| +-- package.json
|
|
|
|
|
| +-- vite.config.ts
|
|
|
|
|
+-- customers/tianpu/ # Customer configuration
|
|
|
|
|
| +-- config.yaml # Branding and feature flags
|
|
|
|
|
| +-- devices.json # Device inventory
|
|
|
|
|
| +-- pricing.json # Electricity pricing
|
|
|
|
|
| +-- hooks/ # Customer hooks plugin
|
|
|
|
|
+-- backend/ # Backend customer overrides
|
|
|
|
|
+-- scripts/ # Data seeding scripts
|
|
|
|
|
| +-- seed_data.py # Tianpu seed data
|
|
|
|
|
+-- docker-compose.override.yml # Customer Docker overrides
|
|
|
|
|
+-- docker-compose.ports.yml # Port configuration
|
|
|
|
|
+-- VERSIONS.json # Version tracking
|
|
|
|
|
+-- .env.example # Environment variables template
|
2026-04-04 18:18:48 +08:00
|
|
|
```
|
2026-04-06 08:55:27 +08:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Quick Start (Docker)
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Configure environment
|
|
|
|
|
cp .env.example .env
|
|
|
|
|
# Edit .env with your settings
|
|
|
|
|
|
|
|
|
|
# Start all services
|
|
|
|
|
docker compose -f core/docker-compose.yml -f docker-compose.override.yml up -d
|
|
|
|
|
|
|
|
|
|
# Seed data
|
|
|
|
|
docker compose -f core/docker-compose.yml -f docker-compose.override.yml exec backend python scripts/seed_data.py
|
2026-04-04 18:18:48 +08:00
|
|
|
```
|
|
|
|
|
|
2026-04-06 08:55:27 +08:00
|
|
|
### Access
|
|
|
|
|
|
|
|
|
|
| Service | URL |
|
|
|
|
|
|---------|-----|
|
|
|
|
|
| Frontend | http://localhost:3000 |
|
|
|
|
|
| Backend API | http://localhost:8000 |
|
|
|
|
|
| API Docs | http://localhost:8000/docs |
|
|
|
|
|
|
|
|
|
|
### Default Login
|
|
|
|
|
|
|
|
|
|
| Role | Username | Password |
|
|
|
|
|
|------|----------|----------|
|
|
|
|
|
| Admin | admin | admin123 |
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Local Development
|
|
|
|
|
|
|
|
|
|
### Backend
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cd core/backend
|
|
|
|
|
python -m venv venv
|
|
|
|
|
source venv/bin/activate # Windows: venv\Scripts\activate
|
|
|
|
|
pip install -r requirements.txt
|
|
|
|
|
python -m alembic upgrade head
|
|
|
|
|
uvicorn app.main:app --port 8000 --reload
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Frontend
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cd frontend
|
|
|
|
|
npm install
|
|
|
|
|
npm run dev
|
|
|
|
|
# Opens at http://localhost:3000, proxies /api to localhost:8000
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Updating Core
|
|
|
|
|
|
|
|
|
|
When ems-core releases a new version:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git subtree pull --prefix=core ems-core main --squash
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Make sure the `ems-core` remote is configured:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git remote add ems-core http://100.69.143.96:3300/tianpu/ems-core.git
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
After pulling, update `core_version` in `VERSIONS.json`.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-04-06 09:08:19 +08:00
|
|
|
## Version Management
|
|
|
|
|
|
|
|
|
|
### Releasing a New Version
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# 1. Update VERSIONS.json (project_version, last_updated, notes)
|
|
|
|
|
# 2. Commit
|
|
|
|
|
git add VERSIONS.json
|
|
|
|
|
git commit -m "chore: bump version to vX.Y.Z"
|
|
|
|
|
|
|
|
|
|
# 3. Tag (MUST be after VERSIONS.json update)
|
|
|
|
|
git tag -a vX.Y.Z -m "vX.Y.Z: release description"
|
|
|
|
|
|
|
|
|
|
# 4. Push commit + tag
|
|
|
|
|
git push origin main
|
|
|
|
|
git push origin vX.Y.Z
|
|
|
|
|
|
|
|
|
|
# 5. Update Gitea description (Settings page or API)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Version must match in all three places: `VERSIONS.json`, git tag, and Gitea description.
|
|
|
|
|
|
|
|
|
|
### Download / Switch to an Older Version
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# List all versions
|
|
|
|
|
git tag -l
|
|
|
|
|
|
|
|
|
|
# Switch to a specific version
|
|
|
|
|
git checkout v1.1.0
|
|
|
|
|
|
|
|
|
|
# Compare versions
|
|
|
|
|
git diff v1.1.0 v1.2.0
|
|
|
|
|
|
|
|
|
|
# Download as zip (no clone needed)
|
|
|
|
|
curl -o tp-ems-v1.1.0.zip \
|
|
|
|
|
"http://100.69.143.96:3300/tianpu/tp-ems/archive/v1.1.0.zip"
|
|
|
|
|
|
|
|
|
|
# Go back to latest
|
|
|
|
|
git checkout main
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
See [ems-core README](http://100.69.143.96:3300/tianpu/ems-core) for the full version management guide.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-04-06 08:55:27 +08:00
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
Copyright 2026. All rights reserved.
|