Skip to content

Commit 2e046b1

Browse files
committed
Merge branch 'dev'
2 parents afce7c8 + c8160e1 commit 2e046b1

File tree

141 files changed

+24079
-14981
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+24079
-14981
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,22 @@ __pycache__/
1313
*.egg-info/
1414
*.egg
1515
*.whl
16+
prd/
17+
1618

1719
redis/tls
1820
redis/data
1921

22+
# Kubernetes deployment files
23+
k8s/00-secrets-deploy.yaml
24+
k8s/02-netpulse-deploy.yaml
25+
2026
*.pid
2127
*.lock
2228
drafts/
2329
site/
2430
docs-local/
2531
tests/
32+
site*
2633

2734

CONTRIBUTING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,36 @@ After setup, the commit message template will be automatically loaded when runni
101101

102102
Please use GitHub Issues to report bugs or request features.
103103

104+
## Version Management
105+
106+
NetPulse uses a **Single Source of Truth** approach for version management:
107+
108+
### How It Works
109+
110+
- **Version Definition**: Version numbers are defined in `pyproject.toml` (and `netpulse-client/pyproject.toml` for the client SDK)
111+
- **Automatic Reading**: Code automatically reads version from installed package metadata using `importlib.metadata`
112+
- **Development Fallback**: If package is not installed (development mode), a fallback version is used
113+
114+
### Updating Version Numbers
115+
116+
**For Production Releases** (package installed):
117+
1. Update `version = "x.y.z"` in `pyproject.toml`
118+
2. Update `version = "x.y.z"` in `netpulse-client/pyproject.toml` (if needed)
119+
3. Reinstall the package: `pip install -e .`
120+
4. Code will automatically use the new version
121+
122+
**For Development Consistency** (optional but recommended):
123+
- Also update the fallback version in `netpulse/__init__.py` and `netpulse-client/netpulse_client/__init__.py` to match
124+
125+
### Version Files
126+
127+
- `pyproject.toml` - Main project version (primary source)
128+
- `netpulse-client/pyproject.toml` - Client SDK version (primary source)
129+
- `netpulse/__init__.py` - Auto-reads from package metadata (fallback for dev mode)
130+
- `netpulse-client/netpulse_client/__init__.py` - Auto-reads from package metadata (fallback for dev mode)
131+
132+
**Note**: In most cases, you only need to update `pyproject.toml` files. The code will automatically use the correct version after package installation.
133+
104134
## Questions?
105135

106136
Feel free to open a discussion or contact the maintainers.

Makefile

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
.PHONY: help deploy build up down logs ps watch scale lint format clean clean-all restart shell stats health
2+
3+
# Default target: show help information
4+
help:
5+
@echo "NetPulse Common Operations"
6+
@echo "========================"
7+
@echo ""
8+
@echo "Docker Deployment:"
9+
@echo " make deploy - One-click Docker deployment (auto-generate env and certs)"
10+
@echo " make build - Build Docker images"
11+
@echo " make up - Start all Docker services"
12+
@echo " make down - Stop all Docker services"
13+
@echo " make restart - Restart all Docker services"
14+
@echo " make logs - View Docker service logs"
15+
@echo " make ps - Show Docker service status"
16+
@echo " make watch - Start Docker development mode (watch)"
17+
@echo " make logs controller - View logs (service or container name)"
18+
@echo " make shell controller - Open shell (service or container name)"
19+
@echo " make stats - Show Docker container resource usage"
20+
@echo " make health - Check service health status"
21+
@echo ""
22+
@echo "Scaling:"
23+
@echo " make scale NODE=2 FIFO=1 - Scale workers (default: NODE=2, FIFO=1)"
24+
@echo ""
25+
@echo "Development:"
26+
@echo " make lint - Run code linting and auto-fix issues"
27+
@echo " make format - Format code"
28+
@echo ""
29+
@echo "Cleanup:"
30+
@echo " make clean - Stop Docker services (preserves data volumes)"
31+
@echo " make clean-all - Remove Docker services and volumes (⚠️ WARNING: deletes Redis data)"
32+
@echo ""
33+
34+
# Docker deployment operations
35+
deploy:
36+
@echo "🚀 Starting one-click Docker deployment..."
37+
bash ./scripts/docker_auto_deploy.sh
38+
39+
build:
40+
@echo "🔨 Building Docker images..."
41+
docker compose build
42+
43+
up:
44+
@echo "⬆️ Starting Docker services..."
45+
docker compose up -d
46+
47+
down:
48+
@echo "⬇️ Stopping Docker services..."
49+
docker compose down
50+
51+
restart:
52+
@echo "🔄 Restarting Docker services..."
53+
docker compose restart
54+
55+
logs:
56+
@SERVICE=$$(echo "$(filter-out $@,$(MAKECMDGOALS))" | head -1); \
57+
if [ -z "$$SERVICE" ]; then \
58+
echo "📋 Viewing all Docker service logs..."; \
59+
echo "💡 Tip: Use 'make logs controller' or 'make logs netpulse-controller-1'"; \
60+
docker compose logs -f; \
61+
else \
62+
echo "📋 Viewing logs for $$SERVICE..."; \
63+
if docker ps --format "{{.Names}}" | grep -q "^$$SERVICE$$"; then \
64+
docker logs -f $$SERVICE; \
65+
else \
66+
docker compose logs -f $$SERVICE; \
67+
fi; \
68+
fi
69+
%:
70+
@:
71+
72+
ps:
73+
@echo "📊 Showing Docker service status..."
74+
docker compose ps
75+
76+
watch:
77+
@echo "👀 Starting Docker development mode (watch)..."
78+
docker compose watch
79+
80+
shell:
81+
@SERVICE=$$(echo "$(filter-out $@,$(MAKECMDGOALS))" | head -1); \
82+
if [ -z "$$SERVICE" ]; then \
83+
echo "⚠️ Usage: make shell <service-name-or-container-name>"; \
84+
echo " Examples:"; \
85+
echo " make shell controller # Service name"; \
86+
echo " make shell netpulse-controller-1 # Container name"; \
87+
echo " Use 'make ps' to see all containers"; \
88+
exit 1; \
89+
fi; \
90+
if docker ps --format "{{.Names}}" | grep -q "^$$SERVICE$$"; then \
91+
echo "🐚 Opening shell in container $$SERVICE..."; \
92+
docker exec -it $$SERVICE /bin/bash 2>/dev/null || docker exec -it $$SERVICE /bin/sh; \
93+
elif docker compose ps $$SERVICE 2>/dev/null | grep -q "Up"; then \
94+
echo "🐚 Opening shell in service $$SERVICE..."; \
95+
docker compose exec $$SERVICE /bin/bash 2>/dev/null || docker compose exec $$SERVICE /bin/sh; \
96+
else \
97+
echo "❌ Container or service '$$SERVICE' not found or not running."; \
98+
echo " Use 'make ps' to check available containers and services."; \
99+
exit 1; \
100+
fi
101+
102+
stats:
103+
@echo "📊 Showing Docker container resource usage..."
104+
docker stats --no-stream
105+
106+
health:
107+
@echo "🏥 Checking service health..."
108+
@docker compose ps --format "table {{.Name}}\t{{.Status}}\t{{.Ports}}"
109+
110+
# Scaling operations
111+
scale:
112+
@NODE_COUNT=$${NODE:-2}; \
113+
FIFO_COUNT=$${FIFO:-1}; \
114+
echo "📈 Scaling workers (NODE=$$NODE_COUNT, FIFO=$$FIFO_COUNT)..."; \
115+
docker compose up -d --scale node-worker=$$NODE_COUNT --no-deps node-worker; \
116+
docker compose up -d --scale fifo-worker=$$FIFO_COUNT --no-deps fifo-worker; \
117+
echo "✅ Workers scaled successfully (node-worker: $$NODE_COUNT, fifo-worker: $$FIFO_COUNT)"
118+
119+
# Development operations
120+
lint:
121+
@echo "🔍 Running code linting and auto-fixing..."
122+
ruff check --fix .
123+
124+
format:
125+
@echo "✨ Formatting code..."
126+
ruff format .
127+
128+
# Cleanup operations
129+
clean:
130+
@echo "🧹 Stopping Docker services (data volumes preserved)..."
131+
docker compose down
132+
@echo "✅ Services stopped"
133+
134+
clean-all:
135+
@echo "⚠️ WARNING: This will delete all Docker services and data volumes!"
136+
@echo "⚠️ This includes Redis data (task queues, job states, etc.)"
137+
@read -p "Are you sure you want to continue? [y/N] " -n 1 -r; \
138+
echo; \
139+
if [ "$$REPLY" = "y" ] || [ "$$REPLY" = "Y" ]; then \
140+
echo "🧹 Removing Docker services and volumes..."; \
141+
docker compose down -v; \
142+
docker system prune -f; \
143+
echo "✅ All services and data removed"; \
144+
else \
145+
echo "❌ Cleanup cancelled"; \
146+
fi
147+

README-zh.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ NetPulse 是一个专为现代网络自动化设计的高性能分布式网络
1111

1212
## 为什么选择 NetPulse?
1313

14-
![NetPulse 项目价值](docs/zh/assets/images/architecture/project-value-proposition.svg)
14+
![NetPulse 项目价值](docs/assets/images/architecture/project-value-proposition.svg)
1515

1616
## 系统特性
1717

@@ -23,7 +23,7 @@ NetPulse 是一个专为现代网络自动化设计的高性能分布式网络
2323

2424
### 技术架构
2525

26-
![NetPulse 系统架构](docs/zh/assets/images/architecture/workflow-overview111.svg)
26+
![NetPulse 系统架构](docs/zh/assets/images/architecture/workflow-overview.svg)
2727

2828
### 插件系统
2929

@@ -57,7 +57,7 @@ NetPulse 提供了详细的文档,包括快速入门、架构说明、API参
5757

5858
```bash
5959
# 克隆项目
60-
git clone https://github.com/netpulse/netpulse.git
60+
git clone https://github.com/scitix/netpulse.git
6161
cd netpulse
6262

6363
# 一键部署
@@ -121,7 +121,6 @@ curl -X POST http://localhost:9000/device/execute \
121121
* 📚 **[文档](https://netpulse.readthedocs.io/)** - 完整指南和API参考
122122
* 🐛 **[问题反馈](https://github.com/scitix/netpulse/issues)** - 报告bug和请求功能
123123

124-
https://github.com/scitix/netpulse
125124
## 开源协议
126125

127126
本项目采用 MIT 协议 - 详见 [LICENSE](LICENSE) 文件。

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ NetPulse is a high-performance distributed network device management API framewo
1111

1212
## Why NetPulse?
1313

14-
![NetPulse Value Proposition](docs/en/assets/images/architecture/project-value-proposition-en.svg)
14+
![NetPulse Value Proposition](docs/assets/images/architecture/project-value-proposition-en.svg)
1515

1616
## System Features
1717

@@ -57,7 +57,7 @@ NetPulse provides comprehensive documentation including quick start guides, arch
5757

5858
```bash
5959
# Clone the repository
60-
git clone https://github.com/netpulse/netpulse.git
60+
git clone https://github.com/scitix/netpulse.git
6161
cd netpulse
6262

6363
# One-click deployment

config/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ worker:
1818
redis:
1919
host: redis
2020
port: 6379
21-
password: p@$Sw0rd!
21+
password: ${NETPULSE_REDIS__PASSWORD}
2222
timeout: 30
2323
keepalive: 30
2424
tls:
@@ -31,7 +31,7 @@ redis:
3131
host: redis-sentinel
3232
port: 26379
3333
master_name: mymaster
34-
password: p@$Sw0rd!
34+
password: ${NETPULSE_REDIS__SENTINEL__PASSWORD}
3535
key:
3636
host_to_node_map: netpulse:host_to_node_map
3737
node_info_map: netpulse:node_info_map

0 commit comments

Comments
 (0)