https://github.com/codex-team/devops-toolbox-api
https://github.com/codex-team/devops-toolbox-api
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/codex-team/devops-toolbox-api
- Owner: codex-team
- Created: 2020-10-21T10:36:51.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-05T17:28:20.000Z (about 4 years ago)
- Last Synced: 2024-12-31T05:28:26.635Z (5 months ago)
- Language: TypeScript
- Size: 859 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DevOps Toolbox API
## Development guide
To run application in Docker:
1. Fill `.env` file with necessary values (see .env.example)
2. Run the `docker-compose`:
Development mode with hot-reloading:
```bash
docker-compose -f docker-compose.dev.yml up
```
Production mode:
```bash
docker-compose -f docker-compose.prod.yml up
```## API
### REST API routes
The REST API used for communication between agents and the backend.
__Authorization__
All the REST request requires the authorization via the `Authorization` header:
```bash
Authorization: Bearer
```#### `PUT /services`
Route for updating the information about the services running of observed server.
##### Fields
| Field | Type | Required | Description |
| -- | -- | -- | -- |
| `services` | _Service[]_ | yes | List of all found [services](docs/services.md) |##### Example
```json
{
"services": [
{
"type": "nginx",
"payload": [
{
"server_name": "api.notes.codex.so",
"listen": [
"443"
],
"proxy_pass": [
"http://127.0.0.1:5500/"
]
}
]
}
]
}
```##### Response
| Field | Type | Description |
| -- | -- | -- |
| `success` | _boolean_ | `true` on successful saving, otherwise `false` |
| `workspace` | _Workspace_ | Updated workspace info |### CTProto API
The communication between the backend and clients is going through the [CodeX Transport Protocol](https://github.com/codex-team/ctproto).
All supported messages will be listed below.
#### `authorize`
Message for authorization required by protocol.
##### Payload
| Field | Type | Required | Description |
| -- | -- | -- | -- |
| `token` | _string_ | yes | Client Authorization token |##### Example
```json
{
"type": "authorize",
"messageId": "deo2BInCZC",
"payload": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
}
```##### Response
| Field | Type | Description |
| -- | -- | -- |
| `workspaceIds` | _string[]_ | Owned workspaces ids |