Skip to content

Commit 2a9f62b

Browse files
author
root
committed
add telegraf
1 parent 34c841c commit 2a9f62b

51 files changed

Lines changed: 2877 additions & 799 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/branch-protection-guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ It is useful for early feedback, but it is not a merge-governance layer and shou
6262
Recommended use:
6363

6464
- run lightweight lint, backend/frontend tests, and fast security checks on `push -> non-main branches`
65+
- include narrow, high-signal regression suites when a subsystem is expensive or noisy in the full backend matrix; current examples are `make test backend-iac` for the IaC refactor surface and `make test backend-software` for software catalog/executor contracts
6566
- do not treat `Dev Fast CI` as a required check for `main`
6667
- do not use it as a substitute for PR review or branch protection
6768

.github/workflows/dev-fast-ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ jobs:
6666
- name: Run fast backend tests
6767
run: make test backend fast
6868

69+
- name: Run focused IaC regression tests
70+
run: make test backend-iac
71+
72+
- name: Run focused software regression tests
73+
run: make test backend-software
74+
6975
- name: Run frontend tests
7076
run: make test web
7177

Makefile

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
.PHONY: help install tidy build run test test-strict test-fast lint lint-strict lint-fast fmt fmt-strict fmt-fast check check-fast sec sec-strict sec-fast artifact-scan \
3-
backend web backend-targeted fast strict build-local latest dev \
3+
backend web backend-targeted backend-iac backend-software fast strict build-local latest dev \
44
image start stop restart logs stats delete rm kill-port redo \
55
openapi-gen openapi-merge openapi-check openapi-sync
66

@@ -51,7 +51,9 @@ help:
5151
@echo " make test backend Run strict backend Go tests from backend/"
5252
@echo " make test backend fast Run faster backend Go tests from backend/"
5353
@echo " make test web Run web tests from web/"
54-
@echo " make test backend-targeted Run backend routes/secrets/migrations test set"
54+
@echo " make test backend-targeted Run the legacy mixed routes/secrets/migrations integration bundle"
55+
@echo " make test backend-iac Run focused IaC domain + route regression tests"
56+
@echo " make test backend-software Run focused software catalog/executor regression tests"
5557
@echo " make test e2e Run the full end-to-end suite entrypoint"
5658
@echo " make test e2e fast Run the smoke E2E suite"
5759
@echo " make lint Run strict linters (golangci-lint, actionlint, eslint, web typecheck)"
@@ -310,9 +312,17 @@ else ifeq ($(QUALITY_SCOPE),web)
310312
rm -f "$$log_file"
311313
@echo "✓ Web tests completed"
312314
else ifeq ($(QUALITY_SCOPE),backend-targeted)
313-
@echo "Running targeted backend tests..."
315+
@echo "Running legacy mixed backend integration bundle..."
314316
@cd backend && go test ./domain/routes ./domain/secrets ./infra/migrations -v
315-
@echo "✓ Targeted backend tests completed"
317+
@echo "✓ Legacy mixed backend integration bundle completed"
318+
else ifeq ($(QUALITY_SCOPE),backend-iac)
319+
@echo "Running focused IaC backend tests..."
320+
@cd backend && go test ./domain/iac ./domain/routes -run '^(TestService|TestIACRoutes)' -v
321+
@echo "✓ Focused IaC backend tests completed"
322+
else ifeq ($(QUALITY_SCOPE),backend-software)
323+
@echo "Running focused software backend tests..."
324+
@cd backend && go test ./domain/software/catalog ./domain/software/executor -run '^(TestLoadServerCatalogComponentKeys|TestServerCatalogCanResolveAllEntries|TestResolveTemplateSubstitutesScriptEnv|TestServerCatalogCapabilityComponentMapConsistency|TestBuildManagedScriptCommand_EmbeddedScript|TestBuildManagedScriptCommand_EmbeddedScriptWithEnv)$$' -v
325+
@echo "✓ Focused software backend tests completed"
316326
else ifeq ($(QUALITY_SCOPE),e2e)
317327
ifeq ($(QUALITY_MODE),fast)
318328
@echo "Running E2E smoke suite..."
@@ -1007,7 +1017,7 @@ endif
10071017
echo "Error: fuser or lsof required"; exit 1; \
10081018
fi
10091019

1010-
backend web backend-targeted fast strict build-local latest dev:
1020+
backend web backend-targeted backend-iac backend-software fast strict build-local latest dev:
10111021
@:
10121022

10131023
# Swallow positional args (e.g., make start 9092, make build backend)

backend/docs/openapi/api.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6080,6 +6080,49 @@ paths:
60806080
summary: Get monitor target series
60816081
tags:
60826082
- Monitoring
6083+
/api/monitor/telegraf/write:
6084+
post:
6085+
description: Receives Influx line protocol payloads from managed-server Telegraf agents and forwards them to the embedded VictoriaMetrics Influx write endpoint. Authenticate with HTTP Basic Auth where username is the server record ID and password is the per-server monitor agent token issued during managed metrics collector setup.
6086+
operationId: post_api_monitor_telegraf_write
6087+
parameters:
6088+
- description: Basic base64(serverId:monitorAgentToken)
6089+
in: header
6090+
name: Authorization
6091+
required: true
6092+
schema:
6093+
type: string
6094+
requestBody:
6095+
content:
6096+
application/json:
6097+
schema:
6098+
$ref: '#/components/schemas/GenericRequest'
6099+
required: false
6100+
responses:
6101+
"204":
6102+
description: No Content
6103+
"401":
6104+
content:
6105+
application/json:
6106+
schema:
6107+
$ref: '#/components/schemas/MonitorErrorResponse'
6108+
description: Unauthorized
6109+
"413":
6110+
content:
6111+
application/json:
6112+
schema:
6113+
$ref: '#/components/schemas/MonitorErrorResponse'
6114+
description: Payload Too Large
6115+
"502":
6116+
content:
6117+
application/json:
6118+
schema:
6119+
$ref: '#/components/schemas/MonitorErrorResponse'
6120+
description: Bad Gateway
6121+
security:
6122+
- bearerAuth: []
6123+
summary: Write Telegraf metrics
6124+
tags:
6125+
- Monitoring Ingest
60836126
/api/monitor/write:
60846127
post:
60856128
description: Receives Prometheus remote-write protobuf payloads from managed-server Netdata agents. This endpoint is served by the AppOS backend and forwards accepted payloads to the embedded time-series database. Authenticate with HTTP Basic Auth where username is the server record ID and password is the per-server monitor agent token issued during Netdata install/update. Reverse-proxy forwarding headers used elsewhere for agent URL generation are parsed defensively only the first comma-separated host/port value is used and forwarded ports must be numeric.

backend/docs/openapi/ext-api.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4561,6 +4561,48 @@ paths:
45614561
application/json:
45624562
schema:
45634563
$ref: '#/components/schemas/MonitorErrorResponse'
4564+
/api/monitor/telegraf/write:
4565+
post:
4566+
tags: [Monitoring Ingest]
4567+
summary: Write Telegraf metrics
4568+
description: "Receives Influx line protocol payloads from managed-server Telegraf agents and forwards them to the embedded VictoriaMetrics Influx write endpoint. Authenticate with HTTP Basic Auth where username is the server record ID and password is the per-server monitor agent token issued during managed metrics collector setup."
4569+
operationId: post_api_monitor_telegraf_write
4570+
parameters:
4571+
- name: Authorization
4572+
in: header
4573+
description: "Basic base64(serverId:monitorAgentToken)"
4574+
required: true
4575+
schema:
4576+
type: string
4577+
requestBody:
4578+
required: false
4579+
content:
4580+
application/json:
4581+
schema:
4582+
$ref: '#/components/schemas/GenericRequest'
4583+
security:
4584+
- bearerAuth: []
4585+
responses:
4586+
"204":
4587+
description: No Content
4588+
"401":
4589+
description: Unauthorized
4590+
content:
4591+
application/json:
4592+
schema:
4593+
$ref: '#/components/schemas/MonitorErrorResponse'
4594+
"413":
4595+
description: Payload Too Large
4596+
content:
4597+
application/json:
4598+
schema:
4599+
$ref: '#/components/schemas/MonitorErrorResponse'
4600+
"502":
4601+
description: Bad Gateway
4602+
content:
4603+
application/json:
4604+
schema:
4605+
$ref: '#/components/schemas/MonitorErrorResponse'
45644606
/api/monitor/write:
45654607
post:
45664608
tags: [Monitoring Ingest]

backend/docs/openapi/group-matrix.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ groups:
425425
apiType: Ext
426426
extSurface:
427427
- POST /api/monitor/write
428+
- POST /api/monitor/telegraf/write
428429
nativeSurface: []
429430
sources:
430431
extRouteFiles:

backend/domain/iac/contracts.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package iac
2+
3+
import (
4+
"io"
5+
6+
"github.com/websoft9/appos/backend/infra/filesvc"
7+
)
8+
9+
// ReadPort is the minimum filesystem capability needed for IaC read-side use cases.
10+
type ReadPort interface {
11+
List(path string) ([]filesvc.Entry, error)
12+
ReadFile(path string) ([]byte, filesvc.Entry, error)
13+
}
14+
15+
// LibraryPort is the minimum read-only library capability needed for current IaC use cases.
16+
type LibraryPort interface {
17+
ReadPort
18+
Stat(path string) (filesvc.Entry, error)
19+
}
20+
21+
// WorkspacePort is the minimum workspace capability needed for current IaC use cases.
22+
type WorkspacePort interface {
23+
ReadPort
24+
Stat(path string) (filesvc.Entry, error)
25+
Resolve(path string) (string, error)
26+
WriteFile(path string, data []byte, overwrite bool) (filesvc.Entry, error)
27+
WriteReader(path string, reader io.Reader, overwrite bool, maxBytes int64) (filesvc.Entry, error)
28+
Mkdir(path string) (filesvc.Entry, error)
29+
Delete(path string, recursive bool) error
30+
Move(fromPath string, toPath string, overwrite bool) (filesvc.Entry, error)
31+
}
32+
33+
// CrossCopyPort copies content from the IaC library boundary into the IaC workspace boundary.
34+
type CrossCopyPort interface {
35+
CopyLibraryToWorkspace(fromPath string, toPath string, overwrite bool) error
36+
}

backend/domain/iac/dto.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package iac
2+
3+
import "time"
4+
5+
// Entry is the IaC-facing file or directory projection returned by read-side use cases.
6+
type Entry struct {
7+
Name string
8+
Type string
9+
Size int64
10+
ModifiedAt time.Time
11+
}
12+
13+
// FileContent is the IaC-facing text file projection returned by read-side use cases.
14+
type FileContent struct {
15+
Path string
16+
Content string
17+
Size int64
18+
ModifiedAt time.Time
19+
}
20+
21+
// DownloadFile is the IaC-facing file projection used for attachment downloads.
22+
type DownloadFile struct {
23+
Path string
24+
AbsPath string
25+
Filename string
26+
}

backend/domain/iac/errors.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package iac
2+
3+
import "errors"
4+
5+
var (
6+
ErrInvalidPath = errors.New("invalid path")
7+
ErrNotFound = errors.New("not found")
8+
ErrDirectoryRequired = errors.New("directory required")
9+
ErrFileRequired = errors.New("file required")
10+
ErrConflict = errors.New("conflict")
11+
ErrBinaryContent = errors.New("binary content not supported")
12+
ErrLimitExceeded = errors.New("limit exceeded")
13+
ErrRootDeleteDenied = errors.New("root delete denied")
14+
ErrCrossRootMoveDenied = errors.New("cross-root move denied")
15+
ErrInvalidFilename = errors.New("invalid filename")
16+
ErrExtensionBlocked = errors.New("extension blocked")
17+
)

0 commit comments

Comments
 (0)