docs: update README and docs with strict Quick Start (docker-compose-prod), fix WebSocket paths, enforce strict tone

This commit is contained in:
2025-09-04 13:43:10 +03:00
parent afa2829872
commit 7ccdf75bab
15 changed files with 825 additions and 131 deletions

View File

@@ -45,12 +45,12 @@ curl -X POST "http://localhost:9001/api/auth/login" \
```javascript
const token = "your-jwt-token";
const ws = new WebSocket(`ws://localhost:9001/ws/logs/container-id?token=${token}`);
const ws = new WebSocket(`ws://localhost:9001/api/websocket/logs/container-id?token=${token}`);
```
## Endpoints
### ws://host:port/ws/logs/{container_id}
### ws://host:port/api/websocket/logs/{container_id}
Получение логов отдельного контейнера в реальном времени.
@@ -70,7 +70,7 @@ const ws = new WebSocket(`ws://localhost:9001/ws/logs/container-id?token=${token
const containerId = "abc123def456";
const token = "your-jwt-token";
const ws = new WebSocket(`ws://localhost:9001/ws/logs/${containerId}?token=${token}&tail=100`);
const ws = new WebSocket(`ws://localhost:9001/api/websocket/logs/${containerId}?token=${token}&tail=100`);
ws.onopen = function() {
console.log('WebSocket соединение установлено');
@@ -104,7 +104,7 @@ Connected to container: myproject_web_1
2024-01-15T10:30:15.123456789Z 2024/01/15 10:30:15 [notice] 1#1: start worker process 1234
```
### ws://host:port/ws/fan/{service_name}
### ws://host:port/api/websocket/fan/{service_name}
Получение логов всех реплик сервиса Docker Compose (fan-in).
@@ -123,7 +123,7 @@ Connected to container: myproject_web_1
const serviceName = "web";
const token = "your-jwt-token";
const ws = new WebSocket(`ws://localhost:9001/ws/fan/${serviceName}?token=${token}&tail=100`);
const ws = new WebSocket(`ws://localhost:9001/api/websocket/fan/${serviceName}?token=${token}&tail=100`);
ws.onmessage = function(event) {
// Логи приходят с префиксом ID контейнера
@@ -140,7 +140,7 @@ ws.onmessage = function(event) {
[def456gh] 2024-01-15T10:30:16.123456789Z 2024/01/15 10:30:16 [notice] 1#1: start worker processes
```
### ws://host:port/ws/fan_group
### ws://host:port/api/websocket/fan_group
Получение логов группы сервисов одновременно.
@@ -159,7 +159,7 @@ ws.onmessage = function(event) {
const services = "web,db,redis";
const token = "your-jwt-token";
const ws = new WebSocket(`ws://localhost:9001/ws/fan_group?services=${services}&token=${token}&tail=100`);
const ws = new WebSocket(`ws://localhost:9001/api/websocket/fan_group?services=${services}&token=${token}&tail=100`);
ws.onmessage = function(event) {
// Логи приходят с префиксом ID контейнера и имени сервиса
@@ -193,7 +193,7 @@ class LogBoardWebSocket {
connectToContainer(containerId, options = {}) {
const { tail = 100, onMessage, onError, onClose } = options;
const url = `ws://${this.baseUrl.replace('http://', '')}/ws/logs/${containerId}?token=${this.token}&tail=${tail}`;
const url = `ws://${this.baseUrl.replace('http://', '')}/api/websocket/logs/${containerId}?token=${this.token}&tail=${tail}`;
const ws = new WebSocket(url);
ws.onopen = () => {
@@ -222,7 +222,7 @@ class LogBoardWebSocket {
connectToService(serviceName, options = {}) {
const { tail = 100, project, onMessage, onError, onClose } = options;
let url = `ws://${this.baseUrl.replace('http://', '')}/ws/fan/${serviceName}?token=${this.token}&tail=${tail}`;
let url = `ws://${this.baseUrl.replace('http://', '')}/api/websocket/fan/${serviceName}?token=${this.token}&tail=${tail}`;
if (project) url += `&project=${project}`;
const ws = new WebSocket(url);
@@ -253,7 +253,7 @@ class LogBoardWebSocket {
connectToServiceGroup(services, options = {}) {
const { tail = 100, project, onMessage, onError, onClose } = options;
let url = `ws://${this.baseUrl.replace('http://', '')}/ws/fan_group?services=${services}&token=${this.token}&tail=${tail}`;
let url = `ws://${this.baseUrl.replace('http://', '')}/api/websocket/fan_group?services=${services}&token=${this.token}&tail=${tail}`;
if (project) url += `&project=${project}`;
const ws = new WebSocket(url);
@@ -393,7 +393,7 @@ class LogBoardWebSocket:
async def connect_to_container(self, container_id, tail=100, callback=None):
"""Подключение к логам контейнера"""
uri = f"{self.base_url}/ws/logs/{container_id}?token={self.token}&tail={tail}"
uri = f"{self.base_url}/api/websocket/logs/{container_id}?token={self.token}&tail={tail}"
try:
async with websockets.connect(uri) as websocket:
@@ -412,7 +412,7 @@ class LogBoardWebSocket:
async def connect_to_service(self, service_name, tail=100, project=None, callback=None):
"""Подключение к логам сервиса"""
uri = f"{self.base_url}/ws/fan/{service_name}?token={self.token}&tail={tail}"
uri = f"{self.base_url}/api/websocket/fan/{service_name}?token={self.token}&tail={tail}"
if project:
uri += f"&project={project}"
@@ -433,7 +433,7 @@ class LogBoardWebSocket:
async def connect_to_service_group(self, services, tail=100, project=None, callback=None):
"""Подключение к логам группы сервисов"""
uri = f"{self.base_url}/ws/fan_group?services={services}&token={self.token}&tail={tail}"
uri = f"{self.base_url}/api/websocket/fan_group?services={services}&token={self.token}&tail={tail}"
if project:
uri += f"&project={project}"
@@ -507,7 +507,7 @@ class LogBoardWebSocket {
connectToContainer(containerId, options = {}) {
const { tail = 100, onMessage, onError, onClose } = options;
const url = `${this.baseUrl}/ws/logs/${containerId}?token=${this.token}&tail=${tail}`;
const url = `${this.baseUrl}/api/websocket/logs/${containerId}?token=${this.token}&tail=${tail}`;
const ws = new WebSocket(url);
ws.on('open', () => {
@@ -538,7 +538,7 @@ class LogBoardWebSocket {
connectToService(serviceName, options = {}) {
const { tail = 100, project, onMessage, onError, onClose } = options;
let url = `${this.baseUrl}/ws/fan/${serviceName}?token=${this.token}&tail=${tail}`;
let url = `${this.baseUrl}/api/websocket/fan/${serviceName}?token=${this.token}&tail=${tail}`;
if (project) url += `&project=${project}`;
const ws = new WebSocket(url);