Skip to content

Commit 8622d75

Browse files
authored
Dev to master
* docs: update README docs * feat: add webhook testing prg * fix: correct API key authentication config * feat: add GitHub commit message convention * refactor: script reengineering
1 parent 0403461 commit 8622d75

22 files changed

+542
-160
lines changed

.gitmessage

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# <type>: <description>
2+
#
3+
# Types:
4+
# feat : New feature
5+
# fix : Bug fix
6+
# docs : Documentation changes
7+
# style : Code style changes
8+
# refactor : Code refactoring
9+
# test : Test related changes
10+
# chore : Other changes
11+
#
12+
# Examples:
13+
# feat: Add xxx functionality
14+
# fix: Fix API response error
15+
# docs: Update xxx documentation
16+
# style: Adjust code formatting
17+
# refactor: Refactor xxx module
18+
# test: Add xxx functionality tests
19+
# chore: Update dependency versions

AUTHORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- GitHub: [@tkspuk](https://github.com/tkspuk)
66
- Email: tkspuk@gmail.com
7-
- Role: Project Owner, Product Lead & Contributing Developer
7+
- Role: Creator & Contributing Developer
88
- Bio: Senior network engineer specializing in AI infrastructure and system architecture. Responsible for product vision, planning, and partial implementation of key features.
99

1010
---

CONTRIBUTING.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cd netpulse
1515

1616
```bash
1717
# Generate environment variables
18-
bash ./scripts/check_env.sh generate
18+
bash ./scripts/setup_env.sh generate
1919

2020
# Start development services
2121
docker compose up -d
@@ -51,6 +51,52 @@ black --check .
5151
- Use Ruff for linting
5252
- Add type hints where appropriate
5353

54+
## Git Commit Guidelines
55+
56+
We use a simple commit message format to maintain clear code history.
57+
58+
### Commit Message Format
59+
60+
```
61+
<type>: <description>
62+
```
63+
64+
### Types
65+
66+
- **feat**: New feature
67+
- **fix**: Bug fix
68+
- **docs**: Documentation changes
69+
- **style**: Code style changes (formatting, etc.)
70+
- **refactor**: Code refactoring
71+
- **test**: Test related changes
72+
- **chore**: Other changes
73+
74+
### Examples
75+
76+
```
77+
feat: Add user login functionality
78+
fix: Fix API response error
79+
docs: Update README installation guide
80+
style: Adjust code formatting
81+
refactor: Refactor user authentication module
82+
test: Add login functionality tests
83+
chore: Update dependency versions
84+
```
85+
86+
### Pre-commit Checklist
87+
88+
- Code passes all tests
89+
- Code passes linting checks
90+
- New features include corresponding tests
91+
92+
### Setup Git Commit Template (Optional)
93+
94+
```bash
95+
bash ./scripts/setup_git_template.sh
96+
```
97+
98+
After setup, the commit message template will be automatically loaded when running `git commit`.
99+
54100
## Reporting Issues
55101

56102
Please use GitHub Issues to report bugs or request features.

README-zh.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
[![Docker](https://img.shields.io/badge/Docker-Ready-blue?logo=docker)](https://hub.docker.com)
44
[![Python](https://img.shields.io/badge/Python-3.12+-green?logo=python)](https://python.org)
55
[![License](https://img.shields.io/badge/License-MIT-blue)](LICENSE)
6+
[![Documentation](https://img.shields.io/badge/Docs-ReadTheDocs-blue)](https://netpulse.readthedocs.io/)
67

78
简体中文 | [English](README.md)
89

9-
NetPulse 是一个高性能的分布式网络设备管理 API 框架。它通过创新的长连接技术提供统一接口,并通过插件机制无缝集成 Netmiko、NAPALM 等主流开源工具和厂商 API,让网络设备管理变得简单、高效、可靠。
10+
NetPulse 是一个专为现代网络自动化设计的高性能分布式网络设备管理API框架。它通过长连接技术提供统一接口,并通过插件机制无缝集成Netmiko、NAPALM等主流开源工具和PyEAPI等厂商API,让网络设备管理变得简单、高效、可靠。
1011

1112
## 为什么选择 NetPulse?
1213

@@ -44,13 +45,13 @@ NetPulse 提供了强大的插件系统,支持多种功能扩展:
4445

4546
## 快速开始
4647

47-
NetPulse 提供了详细的文档,包括快速入门、架构说明、API参考和最佳实践等。完整文档即将发布到 readthedocs,目前您可以查看以下内容
48+
NetPulse 提供了详细的文档,包括快速入门、架构说明、API参考和最佳实践等。访问我们的文档站点获取完整指南
4849

49-
* [快速入门](docs/zh/getting-started/quick-start.md) - 5分钟上手指南
50-
* [架构设计](docs/zh/architecture/overview.md) - 系统架构说明
51-
* [API 参考](docs/zh/guides/api/README.md) - 完整的 API 文档
52-
* [插件开发](docs/zh/development/README.md) - 插件开发指南
53-
* [部署指南](docs/zh/getting-started/deployment.md) - 详细的部署文档
50+
* [📖 快速入门](https://netpulse.readthedocs.io/zh/latest/getting-started/quick-start.html) - 5分钟快速上手
51+
* [🏗️ 架构设计](https://netpulse.readthedocs.io/zh/latest/architecture/overview.html) - 系统架构概览
52+
* [🔌 API 参考](https://netpulse.readthedocs.io/zh/latest/guides/api.html) - 完整的 RESTful API 文档
53+
* [⚙️ 插件开发](https://netpulse.readthedocs.io/zh/latest/development/index.html) - 构建自定义驱动和插件
54+
* [🚀 部署指南](https://netpulse.readthedocs.io/zh/latest/getting-started/deployment.html) - 生产环境部署说明
5455

5556
### Docker 一键部署
5657

@@ -60,14 +61,14 @@ git clone https://github.com/netpulse/netpulse.git
6061
cd netpulse
6162

6263
# 一键部署
63-
bash ./scripts/docker_deploy.sh
64+
bash ./scripts/docker_auto_deploy.sh
6465
```
6566

6667
### 手动配置部署
6768

6869
```bash
6970
# 1. 生成环境配置
70-
bash ./scripts/check_env.sh generate
71+
bash ./scripts/setup_env.sh generate
7172

7273
# 2. 配置必要的环境变量
7374
cat << EOF > .env
@@ -78,6 +79,29 @@ EOF
7879

7980
# 3. 启动服务
8081
docker compose up -d
82+
83+
### 快速API测试
84+
85+
部署完成后,使用简单的健康检查测试API:
86+
87+
```bash
88+
# 测试健康检查端点
89+
curl -H "X-API-KEY: your_secure_api_key" http://localhost:9000/health
90+
91+
# 测试设备命令(请替换为您的设备详情)
92+
curl -X POST http://localhost:9000/device/execute \
93+
-H "X-API-KEY: your_secure_api_key" \
94+
-H "Content-Type: application/json" \
95+
-d '{
96+
"driver": "netmiko",
97+
"connection_args": {
98+
"device_type": "cisco_ios",
99+
"host": "192.168.1.1",
100+
"username": "admin",
101+
"password": "admin123"
102+
},
103+
"command": "show version"
104+
}'
81105
```
82106

83107
## 参与贡献
@@ -92,13 +116,19 @@ docker compose up -d
92116

93117
详细信息请参考 [贡献指南](CONTRIBUTING.md)。
94118

119+
## 社区与支持
120+
121+
* 📚 **[文档](https://netpulse.readthedocs.io/)** - 完整指南和API参考
122+
* 🐛 **[问题反馈](https://github.com/scitix/netpulse/issues)** - 报告bug和请求功能
123+
124+
https://github.com/scitix/netpulse
95125
## 开源协议
96126

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

99129
## 作者
100130

101-
* **Locus Li**项目负责人
131+
* **Locus Li**项目发起人 & 维护者
102132
* **Yongkun Li** – 首席开发者
103133

104134
查看 [AUTHORS.md](AUTHORS.md) 了解所有贡献者信息。

README.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
[![Docker](https://img.shields.io/badge/Docker-Ready-blue?logo=docker)](https://hub.docker.com)
44
[![Python](https://img.shields.io/badge/Python-3.12+-green?logo=python)](https://python.org)
55
[![License](https://img.shields.io/badge/License-MIT-blue)](LICENSE)
6+
[![Documentation](https://img.shields.io/badge/Docs-ReadTheDocs-blue)](https://netpulse.readthedocs.io/)
67

78
[简体中文](README-zh.md) | English
89

9-
NetPulse is a high-performance distributed network device management API framework. Through innovative persistent connection technology and unified interfaces, it seamlessly integrates with mainstream tools like Netmiko, NAPALM, and vendor APIs to make network device management simple, efficient, and reliable.
10+
NetPulse is a high-performance distributed network device management API framework designed for modern network automation. It provides unified interfaces through persistent connection technology and seamlessly integrates with mainstream open-source tools like Netmiko, NAPALM, and vendor APIs like PyEAPI, making network device management simple, efficient, and reliable.
1011

1112
## Why NetPulse?
1213

@@ -44,13 +45,13 @@ NetPulse offers a powerful plugin system supporting various functional extension
4445

4546
## Quick Start
4647

47-
NetPulse provides comprehensive documentation including quick start guides, architecture explanations, API references, and best practices. The complete documentation will be available on readthedocs soon. Currently, you can refer to:
48+
NetPulse provides comprehensive documentation including quick start guides, architecture explanations, API references, and best practices. Visit our documentation site for complete guides:
4849

49-
* [Quick Start](docs/en/getting-started/quick-start.md) - 5-minute guide
50-
* [Architecture](docs/en/architecture/overview.md) - System architecture
51-
* [API Reference](docs/en/guides/api/README.md) - Complete API documentation
52-
* [Plugin Development](docs/en/development/README.md) - Development guide
53-
* [Deployment Guide](docs/en/getting-started/deployment.md) - Detailed deployment instructions
50+
* [📖 Quick Start](https://netpulse.readthedocs.io/en/latest/getting-started/quick-start.html) - Get started in 5 minutes
51+
* [🏗️ Architecture](https://netpulse.readthedocs.io/en/latest/architecture/overview.html) - System architecture overview
52+
* [🔌 API Reference](https://netpulse.readthedocs.io/en/latest/guides/api.html) - Complete RESTful API documentation
53+
* [⚙️ Plugin Development](https://netpulse.readthedocs.io/en/latest/development/index.html) - Build custom drivers and plugins
54+
* [🚀 Deployment Guide](https://netpulse.readthedocs.io/en/latest/getting-started/deployment.html) - Production deployment instructions
5455

5556
### Docker Quick Deploy
5657

@@ -60,14 +61,14 @@ git clone https://github.com/netpulse/netpulse.git
6061
cd netpulse
6162

6263
# One-click deployment
63-
bash ./scripts/docker_deploy.sh
64+
bash ./scripts/docker_auto_deploy.sh
6465
```
6566

6667
### Manual Configuration
6768

6869
```bash
6970
# 1. Generate environment configuration
70-
bash ./scripts/check_env.sh generate
71+
bash ./scripts/setup_env.sh generate
7172

7273
# 2. Configure essential environment variables
7374
cat << EOF > .env
@@ -78,6 +79,29 @@ EOF
7879

7980
# 3. Start the service
8081
docker compose up -d
82+
83+
### Quick API Test
84+
85+
After deployment, test the API with a simple health check:
86+
87+
```bash
88+
# Test health endpoint
89+
curl -H "X-API-KEY: your_secure_api_key" http://localhost:9000/health
90+
91+
# Test device command (replace with your device details)
92+
curl -X POST http://localhost:9000/device/execute \
93+
-H "X-API-KEY: your_secure_api_key" \
94+
-H "Content-Type: application/json" \
95+
-d '{
96+
"driver": "netmiko",
97+
"connection_args": {
98+
"device_type": "cisco_ios",
99+
"host": "192.168.1.1",
100+
"username": "admin",
101+
"password": "admin123"
102+
},
103+
"command": "show version"
104+
}'
81105
```
82106

83107
## Contributing
@@ -92,13 +116,18 @@ We welcome all forms of contributions! Here's how you can contribute:
92116
93117
For more details, please refer to our [Contributing Guide](CONTRIBUTING.md).
94118
119+
## Community & Support
120+
121+
* 📚 **[Documentation](https://netpulse.readthedocs.io/)** - Complete guides and API reference
122+
* 🐛 **[Issues](https://github.com/scitix/netpulse/issues)** - Report bugs and request features
123+
95124
## License
96125
97126
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
98127
99128
## Authors
100129
101-
* **Locus Li**Project Owner
130+
* **Locus Li** – Creator & Maintainer
102131
* **Yongkun Li** – Lead Developer
103132
104133
See [AUTHORS.md](AUTHORS.md) for a full list of contributors.

config/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
server:
22
host: 0.0.0.0
33
port: 9000
4-
api_key: SOME-API-KEY
4+
api_key: ${NETPULSE_SERVER__API_KEY}
55
api_key_name: X-API-KEY
66
gunicorn_worker: 4
77

docs/en/getting-started/deployment.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The fastest way with minimal user interaction.
4545

4646
```bash
4747
# One-click deployment script
48-
bash ./scripts/docker_deploy.sh
48+
bash ./scripts/docker_auto_deploy.sh
4949
```
5050

5151
This script will automatically complete:
@@ -85,7 +85,7 @@ More control while automating tedious parts.
8585
8686
```bash
8787
# Automatically generate secure environment variables
88-
bash ./scripts/check_env.sh generate
88+
bash ./scripts/setup_env.sh generate
8989
```
9090

9191
#### Step 2: Review and Customize (Optional)
@@ -225,7 +225,7 @@ docker compose exec redis redis-cli --tls \
225225
-p 6379 -a "$NETPULSE_REDIS__PASSWORD" ping
226226

227227
# Test API health endpoint
228-
curl -H "Authorization: Bearer $NETPULSE_SERVER__API_KEY" \
228+
curl -H "X-API-KEY: $NETPULSE_SERVER__API_KEY" \
229229
http://localhost:9000/health
230230

231231
# Expected response: {"code": 0, "message": "success", "data": "ok"}
@@ -390,7 +390,7 @@ Deploying Nginx Ingress can achieve load balancing and HTTPS access.
390390
391391
Make sure you have created the `.env` file:
392392
```bash
393-
bash ./scripts/check_env.sh generate
393+
bash ./scripts/setup_env.sh generate
394394
```
395395
396396
2. **Redis connection failed**
@@ -412,7 +412,7 @@ Deploying Nginx Ingress can achieve load balancing and HTTPS access.
412412
### Getting Help
413413
414414
- Check logs: `docker compose logs -f`
415-
- Verify environment: `bash ./scripts/check_env.sh check`
415+
- Verify environment: `bash ./scripts/setup_env.sh check`
416416
- Review [Configuration Guide](../guides/configuration.md)
417417
418418
---

docs/en/getting-started/first-steps.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ Before starting, please ensure:
2121

2222
## API Authentication
2323

24-
NetPulse uses Bearer Token authentication:
24+
NetPulse uses API Key authentication. All endpoints require authentication:
2525

2626
```bash
27-
# API key format
28-
Authorization: Bearer YOUR_API_KEY
27+
# API key format (Header)
28+
X-API-KEY: YOUR_API_KEY
2929

30-
# Example
31-
curl -H "Authorization: Bearer sk-1234567890abcdef" \
30+
# Example using header
31+
curl -H "X-API-KEY: your_api_key_here" \
3232
http://localhost:9000/health
33+
34+
# Alternative using query parameter
35+
curl "http://localhost:9000/health?X-API-KEY=your_api_key_here"
3336
```
3437

3538
## Basic API Calls
@@ -39,7 +42,7 @@ curl -H "Authorization: Bearer sk-1234567890abcdef" \
3942
First, test if the API service is running normally:
4043

4144
```bash
42-
curl -H "Authorization: Bearer YOUR_API_KEY" \
45+
curl -H "X-API-KEY: YOUR_API_KEY" \
4346
http://localhost:9000/health
4447
```
4548

@@ -58,7 +61,7 @@ curl -H "Authorization: Bearer YOUR_API_KEY" \
5861
View API version and feature information:
5962

6063
```bash
61-
curl -H "Authorization: Bearer YOUR_API_KEY" \
64+
curl -H "X-API-KEY: YOUR_API_KEY" \
6265
http://localhost:9000/
6366
```
6467

0 commit comments

Comments
 (0)