node-consul-service 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +135 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Node Consul Service | خدمة نود كونسول
|
|
2
|
+
|
|
3
|
+
[English](#english) | [العربية](#arabic)
|
|
4
|
+
|
|
5
|
+
## English
|
|
6
|
+
|
|
7
|
+
### Overview
|
|
8
|
+
A Node.js service that integrates with HashiCorp Consul for service discovery and configuration management. This service provides a robust solution for managing distributed systems and microservices architecture.
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
- Service registration and discovery
|
|
12
|
+
- Health checking
|
|
13
|
+
- Key-value store integration
|
|
14
|
+
- Configuration management
|
|
15
|
+
- Distributed locking
|
|
16
|
+
- Leader election
|
|
17
|
+
|
|
18
|
+
### Prerequisites
|
|
19
|
+
- Node.js (v14 or higher)
|
|
20
|
+
- Consul server
|
|
21
|
+
- npm or yarn
|
|
22
|
+
|
|
23
|
+
### Installation
|
|
24
|
+
```bash
|
|
25
|
+
# Clone the repository
|
|
26
|
+
git clone https://github.com/your-username/node-consul-service.git
|
|
27
|
+
|
|
28
|
+
# Navigate to project directory
|
|
29
|
+
cd node-consul-service
|
|
30
|
+
|
|
31
|
+
# Install dependencies
|
|
32
|
+
npm install
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Configuration
|
|
36
|
+
Create a `.env` file in the root directory with the following variables:
|
|
37
|
+
```env
|
|
38
|
+
CONSUL_HOST=localhost
|
|
39
|
+
CONSUL_PORT=8500
|
|
40
|
+
SERVICE_NAME=my-service
|
|
41
|
+
SERVICE_PORT=3000
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Usage
|
|
45
|
+
```bash
|
|
46
|
+
# Start the service
|
|
47
|
+
npm start
|
|
48
|
+
|
|
49
|
+
# Run tests
|
|
50
|
+
npm test
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### API Documentation
|
|
54
|
+
The service exposes the following endpoints:
|
|
55
|
+
- `GET /health` - Health check endpoint
|
|
56
|
+
- `GET /services` - List registered services
|
|
57
|
+
- `POST /register` - Register a new service
|
|
58
|
+
- `DELETE /deregister` - Deregister a service
|
|
59
|
+
|
|
60
|
+
### Contributing
|
|
61
|
+
1. Fork the repository
|
|
62
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
63
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
64
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
65
|
+
5. Open a Pull Request
|
|
66
|
+
|
|
67
|
+
### License
|
|
68
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Arabic
|
|
73
|
+
|
|
74
|
+
### نظرة عامة
|
|
75
|
+
خدمة Node.js تتكامل مع HashiCorp Consul لاكتشاف الخدمات وإدارة التكوين. توفر هذه الخدمة حلاً قوياً لإدارة الأنظمة الموزعة وهندسة الخدمات المصغرة.
|
|
76
|
+
|
|
77
|
+
### المميزات
|
|
78
|
+
- تسجيل واكتشاف الخدمات
|
|
79
|
+
- فحص الصحة
|
|
80
|
+
- تكامل مع مخزن القيم المفتاحية
|
|
81
|
+
- إدارة التكوين
|
|
82
|
+
- القفل الموزع
|
|
83
|
+
- انتخاب القائد
|
|
84
|
+
|
|
85
|
+
### المتطلبات الأساسية
|
|
86
|
+
- Node.js (الإصدار 14 أو أحدث)
|
|
87
|
+
- خادم Consul
|
|
88
|
+
- npm أو yarn
|
|
89
|
+
|
|
90
|
+
### التثبيت
|
|
91
|
+
```bash
|
|
92
|
+
# استنساخ المستودع
|
|
93
|
+
git clone https://github.com/your-username/node-consul-service.git
|
|
94
|
+
|
|
95
|
+
# الانتقال إلى مجلد المشروع
|
|
96
|
+
cd node-consul-service
|
|
97
|
+
|
|
98
|
+
# تثبيت التبعيات
|
|
99
|
+
npm install
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### التكوين
|
|
103
|
+
قم بإنشاء ملف `.env` في المجلد الرئيسي مع المتغيرات التالية:
|
|
104
|
+
```env
|
|
105
|
+
CONSUL_HOST=localhost
|
|
106
|
+
CONSUL_PORT=8500
|
|
107
|
+
SERVICE_NAME=my-service
|
|
108
|
+
SERVICE_PORT=3000
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### الاستخدام
|
|
112
|
+
```bash
|
|
113
|
+
# تشغيل الخدمة
|
|
114
|
+
npm start
|
|
115
|
+
|
|
116
|
+
# تشغيل الاختبارات
|
|
117
|
+
npm test
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### توثيق API
|
|
121
|
+
تعرض الخدمة النقاط النهائية التالية:
|
|
122
|
+
- `GET /health` - نقطة نهاية فحص الصحة
|
|
123
|
+
- `GET /services` - قائمة الخدمات المسجلة
|
|
124
|
+
- `POST /register` - تسجيل خدمة جديدة
|
|
125
|
+
- `DELETE /deregister` - إلغاء تسجيل خدمة
|
|
126
|
+
|
|
127
|
+
### المساهمة
|
|
128
|
+
1. قم بعمل fork للمستودع
|
|
129
|
+
2. أنشئ فرع الميزة الخاص بك (`git checkout -b feature/amazing-feature`)
|
|
130
|
+
3. قم بعمل commit للتغييرات (`git commit -m 'Add some amazing feature'`)
|
|
131
|
+
4. ادفع إلى الفرع (`git push origin feature/amazing-feature`)
|
|
132
|
+
5. افتح طلب سحب (Pull Request)
|
|
133
|
+
|
|
134
|
+
### الترخيص
|
|
135
|
+
هذا المشروع مرخص تحت رخصة MIT - راجع ملف [LICENSE](LICENSE) للتفاصيل.
|