update(readme)
This commit is contained in:
1 parent
a54239f971
commit
4a779eef9f
5 files changed
+46
-37
No files matched your search
@@ -19,7 +19,8 @@ yum install ispctl
|
|||||||
gateHost: 127.0.0.1:0000
|
gateHost: 127.0.0.1:0000
|
||||||
instanceUuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
instanceUuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||||
```
|
```
|
||||||
|
* `gateHost` - адрес любого isp-convert-service в кластере
|
||||||
|
* `instanceUuid` - UUID - идентификатор экземпляра приложений
|
||||||
|
|
||||||
## Использование
|
## Использование
|
||||||
```bash
|
```bash
|
||||||
@@ -49,14 +50,14 @@ ispctl delete [flag...] module_name property_path
|
|||||||
|-----------------|---------------------------------------------------------------------------------------------------|
|
|-----------------|---------------------------------------------------------------------------------------------------|
|
||||||
| `module_name` | Модуль с которым происходит взаимодействие |
|
| `module_name` | Модуль с которым происходит взаимодействие |
|
||||||
| `proprtry_path` | Путь к объекту конфигурации, при значении `.` работа происходит со всей конфигурацией модуля |
|
| `proprtry_path` | Путь к объекту конфигурации, при значении `.` работа происходит со всей конфигурацией модуля |
|
||||||
| `new_object` | Новый объект, должен быть экранирован с помощью `' '`, при отсутствии будет инициализирован ввод |
|
| `new_object` | Новый объект, должен быть экранирован с помощью `' '`, при отсутсвии ожидается ввод из stdin |
|
||||||
| | |
|
| | |
|
||||||
|
|
||||||
|
|
||||||
## Пример
|
## Пример
|
||||||
### ispctl status
|
### ispctl status
|
||||||
`ispctl status [flag...]`
|
`ispctl status [flag...]`
|
||||||
________
|
|
||||||
Запрос
|
Запрос
|
||||||
```bash
|
```bash
|
||||||
ispctl status
|
ispctl status
|
||||||
@@ -71,15 +72,14 @@ ispctl status
|
|||||||
converter | CONNECTED | 127.0.0.1
|
converter | CONNECTED | 127.0.0.1
|
||||||
journal | NOT_CONNECTED |
|
journal | NOT_CONNECTED |
|
||||||
```
|
```
|
||||||
____________
|
|
||||||
### ispctl get
|
### ispctl get
|
||||||
`ispctl get [flag...] module_name property_path`
|
`ispctl get [flag...] module_name property_path`
|
||||||
___________
|
|
||||||
* Получение полной конфигурации
|
* Получение полной конфигурации
|
||||||
|
|
||||||
Запрос
|
Запрос
|
||||||
```bash
|
```bash
|
||||||
ispctl get mdm-elect-voter .
|
ispctl get example .
|
||||||
```
|
```
|
||||||
Ответ
|
Ответ
|
||||||
```bash
|
```bash
|
||||||
@@ -89,7 +89,7 @@ ispctl get mdm-elect-voter .
|
|||||||
"compress": true,
|
"compress": true,
|
||||||
"enable": false,
|
"enable": false,
|
||||||
"enableRemoteTransfer": true,
|
"enableRemoteTransfer": true,
|
||||||
"filename": "/var/log/mdm-elect-voter-service/runtime.log",
|
"filename": "/var/log/example-service/runtime.log",
|
||||||
"maxSizeMb": 512,
|
"maxSizeMb": 512,
|
||||||
"rotateTimeoutMs": 86400000
|
"rotateTimeoutMs": 86400000
|
||||||
},
|
},
|
||||||
@@ -104,12 +104,12 @@ ispctl get mdm-elect-voter .
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
__________________
|
|
||||||
* Получение конкретного объекта конфигурации
|
* Получение конкретного объекта конфигурации
|
||||||
|
|
||||||
Запрос
|
Запрос
|
||||||
```bash
|
```bash
|
||||||
ispctl get mdm-elect-voter .metrics.address
|
ispctl get example .metrics.address
|
||||||
```
|
```
|
||||||
Ответ
|
Ответ
|
||||||
```bash
|
```bash
|
||||||
@@ -119,17 +119,17 @@ ispctl get mdm-elect-voter .metrics.address
|
|||||||
"port": 1
|
"port": 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
_________________
|
|
||||||
### ispctl set
|
### ispctl set
|
||||||
`ispctl set [flag...] module_name property_path [new_object]`
|
`ispctl set [flag...] module_name property_path [new_object]`
|
||||||
|
|
||||||
При указании `new_object` необходимо его экранировать
|
При указании `new_object` необходимо его экранировать. При его отсутсвии ожидается ввод из stdin
|
||||||
________________
|
|
||||||
* Вставка нового поля в объект конфигурации
|
* Вставка нового поля в объект конфигурации
|
||||||
|
|
||||||
Запрос
|
Запрос
|
||||||
```bash
|
```bash
|
||||||
ispctl set mdm-elect-voter .motrics.newField '"1000"'
|
ispctl set example .metrics.newField '"1000"'
|
||||||
```
|
```
|
||||||
Ответ
|
Ответ
|
||||||
```bash
|
```bash
|
||||||
@@ -139,7 +139,7 @@ ispctl set mdm-elect-voter .motrics.newField '"1000"'
|
|||||||
"compress": true,
|
"compress": true,
|
||||||
"enable": false,
|
"enable": false,
|
||||||
"enableRemoteTransfer": true,
|
"enableRemoteTransfer": true,
|
||||||
"filename": "/var/log/mdm-elect-voter-service/runtime.log",
|
"filename": "/var/log/example-service/runtime.log",
|
||||||
"maxSizeMb": 512,
|
"maxSizeMb": 512,
|
||||||
"rotateTimeoutMs": 86400000
|
"rotateTimeoutMs": 86400000
|
||||||
},
|
},
|
||||||
@@ -155,12 +155,11 @@ ispctl set mdm-elect-voter .motrics.newField '"1000"'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
_____________________
|
|
||||||
* Изменение объекта конфигурации
|
* Изменение объекта конфигурации
|
||||||
|
|
||||||
Запрос
|
Запрос
|
||||||
```bash
|
```bash
|
||||||
ispctl set mdm-elect-voter .metrics '{"address":{"ip":"198.0.0.1","newField":"100","port":1},"gc":1,"memory":false}'
|
ispctl set example .metrics '{"address":{"ip":"198.0.0.1","newField":"100","port":1},"gc":1,"memory":false}'
|
||||||
```
|
```
|
||||||
Ответ
|
Ответ
|
||||||
```bash
|
```bash
|
||||||
@@ -170,7 +169,7 @@ ispctl set mdm-elect-voter .metrics '{"address":{"ip":"198.0.0.1","newField":"10
|
|||||||
"compress": true,
|
"compress": true,
|
||||||
"enable": false,
|
"enable": false,
|
||||||
"enableRemoteTransfer": true,
|
"enableRemoteTransfer": true,
|
||||||
"filename": "/var/log/mdm-elect-voter-service/runtime.log",
|
"filename": "/var/log/example-service/runtime.log",
|
||||||
"maxSizeMb": 512,
|
"maxSizeMb": 512,
|
||||||
"rotateTimeoutMs": 86400000
|
"rotateTimeoutMs": 86400000
|
||||||
},
|
},
|
||||||
@@ -185,12 +184,11 @@ ispctl set mdm-elect-voter .metrics '{"address":{"ip":"198.0.0.1","newField":"10
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
_________
|
|
||||||
* Полное обновление конфигурации
|
* Полное обновление конфигурации
|
||||||
|
|
||||||
Запрос
|
Запрос
|
||||||
```bash
|
```bash
|
||||||
ispctl set mdm-elect-voter . '{"journal":{"bufferSize":1111,"compress":false,"enable":true,"filename":"/var/log/mdm-elect-voter-service/runtime.log","newField":"1000"},"metrics":{"address":{"ip":"198.0.0.1","newField":"100","port":1},"gc":1,"memory":false}}'
|
ispctl set example . '{"journal":{"bufferSize":1111,"compress":false,"enable":true,"filename":"/var/log/example-service/runtime.log","newField":"1000"},"metrics":{"address":{"ip":"198.0.0.1","newField":"100","port":1},"gc":1,"memory":false}}'
|
||||||
```
|
```
|
||||||
Ответ
|
Ответ
|
||||||
```bash
|
```bash
|
||||||
@@ -199,7 +197,7 @@ ispctl set mdm-elect-voter . '{"journal":{"bufferSize":1111,"compress":false,"en
|
|||||||
"bufferSize": 1111,
|
"bufferSize": 1111,
|
||||||
"compress": false,
|
"compress": false,
|
||||||
"enable": true,
|
"enable": true,
|
||||||
"filename": "/var/log/mdm-elect-voter-service/runtime.log",
|
"filename": "/var/log/example-service/runtime.log",
|
||||||
"newField": "1000"
|
"newField": "1000"
|
||||||
},
|
},
|
||||||
"metrics": {
|
"metrics": {
|
||||||
@@ -213,15 +211,13 @@ ispctl set mdm-elect-voter . '{"journal":{"bufferSize":1111,"compress":false,"en
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
_________________
|
|
||||||
### ispctl delete
|
### ispctl delete
|
||||||
`ispctl delete [flag...] module_name property_path`
|
`ispctl delete [flag...] module_name property_path`
|
||||||
____________
|
|
||||||
* Удаление объекта конфигурации
|
* Удаление объекта конфигурации
|
||||||
|
|
||||||
Запрос
|
Запрос
|
||||||
```bash
|
```bash
|
||||||
ispctl delete mdm-elect-voter .journal
|
ispctl delete example .journal
|
||||||
```
|
```
|
||||||
Ответ
|
Ответ
|
||||||
```bash
|
```bash
|
||||||
@@ -237,12 +233,11 @@ ispctl delete mdm-elect-voter .journal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
___________________
|
|
||||||
* Удаление поля из конфигурации
|
* Удаление поля из конфигурации
|
||||||
|
|
||||||
Запрос
|
Запрос
|
||||||
```bash
|
```bash
|
||||||
ispctl delete mdm-elect-voter .metrics.address.ip
|
ispctl delete example .metrics.address.ip
|
||||||
```
|
```
|
||||||
Ответ
|
Ответ
|
||||||
```bash
|
```bash
|
||||||
@@ -257,12 +252,11 @@ ispctl delete mdm-elect-voter .metrics.address.ip
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
____________
|
|
||||||
* Удаление конфигурации
|
* Удаление конфигурации
|
||||||
|
|
||||||
Запрос
|
Запрос
|
||||||
```bash
|
```bash
|
||||||
ispctl delete mdm-elect-voter .
|
ispctl delete example .
|
||||||
```
|
```
|
||||||
Ответ
|
Ответ
|
||||||
```bash
|
```bash
|
||||||
@@ -270,11 +264,9 @@ ispctl delete mdm-elect-voter .
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Запрос с флагами
|
### Запрос с флагами
|
||||||
* При указании флагов `-g` и `-u` игнорируется файл конфигурации утилиты
|
|
||||||
|
|
||||||
Запрос
|
Запрос
|
||||||
```bash
|
```bash
|
||||||
ispctl -u 00000000-1111-2222-3333-444444444444 -g 127.0.0.1:0000 -c set mdm-elect-voter . '{"metrics":{"address":{"ip":"127.0.0.1","newField":"100","port":1},"gc":1,"memory":false}}'
|
ispctl -u 00000000-1111-2222-3333-444444444444 -g 127.0.0.1:0000 -c set example . '{"metrics":{"address":{"ip":"127.0.0.1","newField":"100","port":1},"gc":1,"memory":false}}'
|
||||||
```
|
```
|
||||||
Ответ
|
Ответ
|
||||||
```json
|
```json
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package cfg
|
package cfg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/integration-system/isp-lib/config/schema"
|
||||||
|
"github.com/integration-system/isp-lib/structure"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,3 +22,23 @@ type Config struct {
|
|||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
Data map[string]interface{}
|
Data map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Connection struct {
|
||||||
|
LibVersion string
|
||||||
|
Version string
|
||||||
|
Address structure.AddressConfiguration
|
||||||
|
Endpoints []structure.EndpointConfig `json:",omitempty"`
|
||||||
|
EstablishedAt time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
type ModuleInfo struct {
|
||||||
|
Id int32
|
||||||
|
Name string
|
||||||
|
Active bool
|
||||||
|
CreatedAt time.Time
|
||||||
|
LastConnectedAt time.Time
|
||||||
|
LastDisconnectedAt time.Time
|
||||||
|
Configs []Config `json:",omitempty"`
|
||||||
|
ConfigSchema *schema.Schema `json:",omitempty"`
|
||||||
|
Status []Connection `json:",omitempty"`
|
||||||
|
}
|
||||||
+2
-3
@@ -2,7 +2,6 @@ package cfg
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/integration-system/isp-lib/http"
|
"github.com/integration-system/isp-lib/http"
|
||||||
"isp-config-service/domain"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -31,8 +30,8 @@ func (c *configClient) ReceiveConfig(gateHost, instanceUuid string) {
|
|||||||
c.gateHost = scheme + gateHost
|
c.gateHost = scheme + gateHost
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *configClient) GetAvailableConfigs() ([]domain.ModuleInfo, error) {
|
func (c *configClient) GetAvailableConfigs() ([]ModuleInfo, error) {
|
||||||
response := make([]domain.ModuleInfo, 0)
|
response := make([]ModuleInfo, 0)
|
||||||
if err := c.client.Invoke("POST", c.gateHost+getAvailableConfigs, c.headers, nil, &response); err != nil {
|
if err := c.client.Invoke("POST", c.gateHost+getAvailableConfigs, c.headers, nil, &response); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ func checkFlags(c *cli.Context) error {
|
|||||||
color = c.GlobalBool(colorFlag[1])
|
color = c.GlobalBool(colorFlag[1])
|
||||||
}
|
}
|
||||||
service.ColorService.Enable = color
|
service.ColorService.Enable = color
|
||||||
|
|
||||||
service.ColorService.Print(nil)
|
|
||||||
|
|
||||||
hostFlag := strings.Split(flag.GateHostName, ", ")
|
hostFlag := strings.Split(flag.GateHostName, ", ")
|
||||||
if c.GlobalString(hostFlag[0]) != "" {
|
if c.GlobalString(hostFlag[0]) != "" {
|
||||||
host = c.GlobalString(hostFlag[0])
|
host = c.GlobalString(hostFlag[0])
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ func (statusCommand) action(c *cli.Context) {
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if arrayOfModules, err := service.ConfigClient.GetAvailableConfigs(); err != nil {
|
if arrayOfModules, err := service.ConfigClient.GetAvailableConfigs(); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user