fa-mcp-sdk 0.4.142 → 0.11.2
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 +5 -0
- package/cli-template/.dockerignore +16 -0
- package/cli-template/.gitlab-ci.yml +135 -0
- package/cli-template/AGENTS.md +1 -0
- package/cli-template/CHANGELOG.md +64 -0
- package/cli-template/FA-MCP-SDK-DOC/00-FA-MCP-SDK-index.md +27 -4
- package/cli-template/FA-MCP-SDK-DOC/02-1-tools-and-api.md +195 -0
- package/cli-template/FA-MCP-SDK-DOC/02-2-prompts-and-resources.md +172 -9
- package/cli-template/FA-MCP-SDK-DOC/03-configuration.md +170 -12
- package/cli-template/FA-MCP-SDK-DOC/04-authentication.md +158 -8
- package/cli-template/FA-MCP-SDK-DOC/06-utilities.md +67 -6
- package/cli-template/FA-MCP-SDK-DOC/07-testing-and-operations.md +31 -15
- package/cli-template/FA-MCP-SDK-DOC/10-mcp-apps.md +1 -1
- package/cli-template/FA-MCP-SDK-DOC/11-public-contract.md +342 -0
- package/cli-template/README.md +37 -0
- package/cli-template/deploy/docker/.env.example +10 -0
- package/cli-template/deploy/docker/Dockerfile +44 -0
- package/cli-template/deploy/docker/Dockerfile.local +29 -0
- package/cli-template/deploy/docker/README.md +94 -0
- package/cli-template/deploy/docker/config/local.docker.yaml +14 -0
- package/cli-template/deploy/docker/docker-compose.yml +31 -0
- package/cli-template/deploy/gitlab-runner/.env.example +16 -0
- package/cli-template/deploy/gitlab-runner/README.md +65 -0
- package/cli-template/deploy/gitlab-runner/config/config.toml.template +26 -0
- package/cli-template/deploy/gitlab-runner/docker-compose.yml +39 -0
- package/cli-template/deploy/gitlab-runner/entrypoint.sh +27 -0
- package/cli-template/deploy/gitlab-runner/start.sh +47 -0
- package/cli-template/gitignore +96 -95
- package/cli-template/package.json +1 -1
- package/config/_local.yaml +73 -11
- package/config/custom-environment-variables.yaml +102 -0
- package/config/default.yaml +164 -11
- package/config/local.yaml +20 -19
- package/dist/core/_types_/config.d.ts +119 -0
- package/dist/core/_types_/config.d.ts.map +1 -1
- package/dist/core/_types_/types.d.ts +137 -4
- package/dist/core/_types_/types.d.ts.map +1 -1
- package/dist/core/agent-tester/agent-tester-router.d.ts.map +1 -1
- package/dist/core/agent-tester/agent-tester-router.js +25 -11
- package/dist/core/agent-tester/agent-tester-router.js.map +1 -1
- package/dist/core/agent-tester/services/TesterMcpClientService.d.ts.map +1 -1
- package/dist/core/agent-tester/services/TesterMcpClientService.js +6 -4
- package/dist/core/agent-tester/services/TesterMcpClientService.js.map +1 -1
- package/dist/core/auth/admin-auth.js +4 -4
- package/dist/core/auth/admin-auth.js.map +1 -1
- package/dist/core/auth/agent-tester-auth.d.ts +1 -1
- package/dist/core/auth/agent-tester-auth.d.ts.map +1 -1
- package/dist/core/auth/agent-tester-auth.js +8 -4
- package/dist/core/auth/agent-tester-auth.js.map +1 -1
- package/dist/core/auth/auth-profile.d.ts +38 -0
- package/dist/core/auth/auth-profile.d.ts.map +1 -0
- package/dist/core/auth/auth-profile.js +101 -0
- package/dist/core/auth/auth-profile.js.map +1 -0
- package/dist/core/auth/jwt-v2.d.ts +27 -0
- package/dist/core/auth/jwt-v2.d.ts.map +1 -0
- package/dist/core/auth/jwt-v2.js +180 -0
- package/dist/core/auth/jwt-v2.js.map +1 -0
- package/dist/core/auth/jwt.d.ts +27 -13
- package/dist/core/auth/jwt.d.ts.map +1 -1
- package/dist/core/auth/jwt.js +36 -13
- package/dist/core/auth/jwt.js.map +1 -1
- package/dist/core/auth/key-resolver.d.ts +74 -0
- package/dist/core/auth/key-resolver.d.ts.map +1 -0
- package/dist/core/auth/key-resolver.js +330 -0
- package/dist/core/auth/key-resolver.js.map +1 -0
- package/dist/core/auth/middleware.d.ts.map +1 -1
- package/dist/core/auth/middleware.js +66 -0
- package/dist/core/auth/middleware.js.map +1 -1
- package/dist/core/auth/multi-auth.d.ts +1 -1
- package/dist/core/auth/multi-auth.d.ts.map +1 -1
- package/dist/core/auth/multi-auth.js +7 -7
- package/dist/core/auth/multi-auth.js.map +1 -1
- package/dist/core/auth/token-generator/server.js +4 -4
- package/dist/core/auth/token-generator/server.js.map +1 -1
- package/dist/core/auth/types.d.ts +5 -0
- package/dist/core/auth/types.d.ts.map +1 -1
- package/dist/core/db/pg-db.d.ts +7 -0
- package/dist/core/db/pg-db.d.ts.map +1 -1
- package/dist/core/db/pg-db.js +54 -3
- package/dist/core/db/pg-db.js.map +1 -1
- package/dist/core/errors/BaseMcpError.d.ts +21 -1
- package/dist/core/errors/BaseMcpError.d.ts.map +1 -1
- package/dist/core/errors/BaseMcpError.js +20 -1
- package/dist/core/errors/BaseMcpError.js.map +1 -1
- package/dist/core/errors/ValidationError.d.ts +5 -0
- package/dist/core/errors/ValidationError.d.ts.map +1 -1
- package/dist/core/errors/ValidationError.js +6 -1
- package/dist/core/errors/ValidationError.js.map +1 -1
- package/dist/core/errors/errors.d.ts +31 -3
- package/dist/core/errors/errors.d.ts.map +1 -1
- package/dist/core/errors/errors.js +86 -6
- package/dist/core/errors/errors.js.map +1 -1
- package/dist/core/errors/specific-errors.d.ts +54 -0
- package/dist/core/errors/specific-errors.d.ts.map +1 -0
- package/dist/core/errors/specific-errors.js +82 -0
- package/dist/core/errors/specific-errors.js.map +1 -0
- package/dist/core/index.d.ts +10 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +9 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/init-mcp-server.d.ts.map +1 -1
- package/dist/core/init-mcp-server.js +39 -0
- package/dist/core/init-mcp-server.js.map +1 -1
- package/dist/core/mcp/create-mcp-server.d.ts +12 -6
- package/dist/core/mcp/create-mcp-server.d.ts.map +1 -1
- package/dist/core/mcp/create-mcp-server.js +592 -33
- package/dist/core/mcp/create-mcp-server.js.map +1 -1
- package/dist/core/mcp/debug-trace.d.ts +3 -1
- package/dist/core/mcp/debug-trace.d.ts.map +1 -1
- package/dist/core/mcp/debug-trace.js +17 -2
- package/dist/core/mcp/debug-trace.js.map +1 -1
- package/dist/core/mcp/deprecation.d.ts +31 -0
- package/dist/core/mcp/deprecation.d.ts.map +1 -0
- package/dist/core/mcp/deprecation.js +96 -0
- package/dist/core/mcp/deprecation.js.map +1 -0
- package/dist/core/mcp/mcp-logging.d.ts +32 -0
- package/dist/core/mcp/mcp-logging.d.ts.map +1 -0
- package/dist/core/mcp/mcp-logging.js +97 -0
- package/dist/core/mcp/mcp-logging.js.map +1 -0
- package/dist/core/mcp/pagination.d.ts +13 -0
- package/dist/core/mcp/pagination.d.ts.map +1 -0
- package/dist/core/mcp/pagination.js +50 -0
- package/dist/core/mcp/pagination.js.map +1 -0
- package/dist/core/mcp/prompts.d.ts +5 -1
- package/dist/core/mcp/prompts.d.ts.map +1 -1
- package/dist/core/mcp/prompts.js +3 -1
- package/dist/core/mcp/prompts.js.map +1 -1
- package/dist/core/mcp/resources.d.ts +9 -0
- package/dist/core/mcp/resources.d.ts.map +1 -1
- package/dist/core/mcp/resources.js +158 -11
- package/dist/core/mcp/resources.js.map +1 -1
- package/dist/core/mcp/server-stdio.d.ts +7 -1
- package/dist/core/mcp/server-stdio.d.ts.map +1 -1
- package/dist/core/mcp/server-stdio.js +8 -3
- package/dist/core/mcp/server-stdio.js.map +1 -1
- package/dist/core/mcp/task-store.d.ts +97 -0
- package/dist/core/mcp/task-store.d.ts.map +1 -0
- package/dist/core/mcp/task-store.js +175 -0
- package/dist/core/mcp/task-store.js.map +1 -0
- package/dist/core/mcp/tool-limits.d.ts +22 -0
- package/dist/core/mcp/tool-limits.d.ts.map +1 -0
- package/dist/core/mcp/tool-limits.js +115 -0
- package/dist/core/mcp/tool-limits.js.map +1 -0
- package/dist/core/mcp/validate-tool-args.d.ts +16 -0
- package/dist/core/mcp/validate-tool-args.d.ts.map +1 -0
- package/dist/core/mcp/validate-tool-args.js +67 -0
- package/dist/core/mcp/validate-tool-args.js.map +1 -0
- package/dist/core/mcp/validate-tool-names.d.ts +11 -0
- package/dist/core/mcp/validate-tool-names.d.ts.map +1 -0
- package/dist/core/mcp/validate-tool-names.js +23 -0
- package/dist/core/mcp/validate-tool-names.js.map +1 -0
- package/dist/core/metrics/metrics.d.ts +45 -0
- package/dist/core/metrics/metrics.d.ts.map +1 -0
- package/dist/core/metrics/metrics.js +119 -0
- package/dist/core/metrics/metrics.js.map +1 -0
- package/dist/core/utils/mask-sensitive.d.ts +44 -0
- package/dist/core/utils/mask-sensitive.d.ts.map +1 -0
- package/dist/core/utils/mask-sensitive.js +64 -0
- package/dist/core/utils/mask-sensitive.js.map +1 -0
- package/dist/core/utils/testing/McpHttpClient.d.ts +8 -33
- package/dist/core/utils/testing/McpHttpClient.d.ts.map +1 -1
- package/dist/core/utils/testing/McpHttpClient.js +8 -74
- package/dist/core/utils/testing/McpHttpClient.js.map +1 -1
- package/dist/core/utils/testing/McpStreamableHttpClient.d.ts +24 -30
- package/dist/core/utils/testing/McpStreamableHttpClient.d.ts.map +1 -1
- package/dist/core/utils/testing/McpStreamableHttpClient.js +36 -198
- package/dist/core/utils/testing/McpStreamableHttpClient.js.map +1 -1
- package/dist/core/utils/utils.d.ts.map +1 -1
- package/dist/core/utils/utils.js +2 -0
- package/dist/core/utils/utils.js.map +1 -1
- package/dist/core/web/admin-router.js +3 -3
- package/dist/core/web/admin-router.js.map +1 -1
- package/dist/core/web/cors.d.ts +9 -1
- package/dist/core/web/cors.d.ts.map +1 -1
- package/dist/core/web/cors.js +26 -5
- package/dist/core/web/cors.js.map +1 -1
- package/dist/core/web/event-store.d.ts +33 -0
- package/dist/core/web/event-store.d.ts.map +1 -0
- package/dist/core/web/event-store.js +65 -0
- package/dist/core/web/event-store.js.map +1 -0
- package/dist/core/web/oauth-router.d.ts +37 -0
- package/dist/core/web/oauth-router.d.ts.map +1 -0
- package/dist/core/web/oauth-router.js +207 -0
- package/dist/core/web/oauth-router.js.map +1 -0
- package/dist/core/web/request-id.d.ts +44 -0
- package/dist/core/web/request-id.d.ts.map +1 -0
- package/dist/core/web/request-id.js +82 -0
- package/dist/core/web/request-id.js.map +1 -0
- package/dist/core/web/server-http.d.ts.map +1 -1
- package/dist/core/web/server-http.js +322 -182
- package/dist/core/web/server-http.js.map +1 -1
- package/package.json +15 -2
- package/scripts/claude-2-agents-symlink.js +10 -1
- package/scripts/generate-jwt.js +129 -51
- package/src/template/custom-resources.ts +14 -0
- package/src/template/prompts/custom-prompts.ts +4 -0
- package/src/template/tools/handle-tool-call.ts +59 -3
- package/src/template/tools/tools.ts +92 -31
- package/src/tests/mcp/test-http.js +1 -1
- package/src/tests/mcp/test-sse.js +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ── Local development: no in-container build ─────────────────────────────────
|
|
2
|
+
# Assumes dist/ already exists on host (yarn build / yarn cb).
|
|
3
|
+
# Usage: docker compose -f docker-compose.local.yml up -d --build
|
|
4
|
+
FROM node:22-alpine
|
|
5
|
+
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
9
|
+
ENV NODE_ENV=${NODE_ENV}
|
|
10
|
+
|
|
11
|
+
# Production dependencies only
|
|
12
|
+
COPY package.json yarn.lock ./
|
|
13
|
+
RUN printf "strict-ssl false" > .yarnrc
|
|
14
|
+
RUN yarn install --production=true && yarn cache clean
|
|
15
|
+
|
|
16
|
+
# Pre-built backend (dist/ must exist on host)
|
|
17
|
+
COPY dist/ ./dist/
|
|
18
|
+
|
|
19
|
+
# Configs (default.yaml, production.yaml, custom-environment-variables.yaml, etc.)
|
|
20
|
+
COPY config/ ./config/
|
|
21
|
+
|
|
22
|
+
# External configs (local.yaml) are mounted via volumes in docker-compose.yml.
|
|
23
|
+
|
|
24
|
+
EXPOSE {{port}}
|
|
25
|
+
|
|
26
|
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
|
|
27
|
+
CMD wget --spider -q http://localhost:{{port}}/health || exit 1
|
|
28
|
+
|
|
29
|
+
ENTRYPOINT ["node", "dist/src/start.js"]
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Docker Production Deployment
|
|
2
|
+
|
|
3
|
+
## Quick Start
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# 1. Copy and edit config
|
|
7
|
+
cp config/local.docker.yaml config/local.yaml
|
|
8
|
+
# Edit config/local.yaml with your settings (DB, auth tokens, etc.)
|
|
9
|
+
|
|
10
|
+
# 2. Copy and edit environment
|
|
11
|
+
cp .env.example .env
|
|
12
|
+
# Edit .env (HOST_PORT, SERVICE_NAME, etc.)
|
|
13
|
+
|
|
14
|
+
# 3. Build and run
|
|
15
|
+
docker compose up -d --build
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Build Only
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
docker compose build
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Run Without Compose
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
docker build -t {{project.name}} -f deploy/docker/Dockerfile .
|
|
28
|
+
|
|
29
|
+
docker run -d \
|
|
30
|
+
--name {{project.name}} \
|
|
31
|
+
-p {{port}}:{{port}} \
|
|
32
|
+
-e NODE_ENV=production \
|
|
33
|
+
-e WS_PORT={{port}} \
|
|
34
|
+
-v $(pwd)/deploy/docker/config/local.yaml:/app/config/local.yaml:ro \
|
|
35
|
+
{{project.name}}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
The container uses `node-config` (the `config` npm package). Config is resolved in this order:
|
|
41
|
+
|
|
42
|
+
1. `config/default.yaml` — baked into the image
|
|
43
|
+
2. `config/production.yaml` — environment-specific overrides
|
|
44
|
+
3. `config/local.yaml` — **mounted via Docker volume** (your custom settings)
|
|
45
|
+
4. Environment variables — mapped via `config/custom-environment-variables.yaml`
|
|
46
|
+
|
|
47
|
+
Key environment variables:
|
|
48
|
+
|
|
49
|
+
| Variable | Config key | Description |
|
|
50
|
+
|----------|-----------|-------------|
|
|
51
|
+
| `WS_PORT` | `webServer.port` | HTTP server port (default: {{port}}) |
|
|
52
|
+
| `WS_HOST` | `webServer.host` | Bind address (default: 0.0.0.0) |
|
|
53
|
+
| `NODE_ENV` | — | Node environment (production) |
|
|
54
|
+
| `DB_HOST` | `db.postgres.dbs.main.host` | PostgreSQL host |
|
|
55
|
+
| `DB_PORT` | `db.postgres.dbs.main.port` | PostgreSQL port |
|
|
56
|
+
| `DB_NAME` | `db.postgres.dbs.main.database` | Database name |
|
|
57
|
+
| `DB_USER` | `db.postgres.dbs.main.user` | Database user |
|
|
58
|
+
| `DB_PASSWORD` | `db.postgres.dbs.main.password` | Database password |
|
|
59
|
+
|
|
60
|
+
## Health Check
|
|
61
|
+
|
|
62
|
+
The container includes a built-in health check:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
GET http://localhost:{{port}}/health
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Response:
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"status": "healthy",
|
|
72
|
+
"details": {
|
|
73
|
+
"uptime": 123.456,
|
|
74
|
+
"memoryUsage": { ... },
|
|
75
|
+
"timestamp": "..."
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Useful Commands
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# View logs
|
|
84
|
+
docker compose logs -f app
|
|
85
|
+
|
|
86
|
+
# Restart
|
|
87
|
+
docker compose restart app
|
|
88
|
+
|
|
89
|
+
# Stop
|
|
90
|
+
docker compose down
|
|
91
|
+
|
|
92
|
+
# Rebuild after code changes
|
|
93
|
+
docker compose up -d --build --force-recreate app
|
|
94
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
# Docker-specific configuration overrides.
|
|
4
|
+
# Copy this file to local.yaml and modify as needed:
|
|
5
|
+
# cp config/local.docker.yaml config/local.yaml
|
|
6
|
+
# local.yaml is mounted into the container at /app/config/local.yaml.
|
|
7
|
+
|
|
8
|
+
webServer:
|
|
9
|
+
host: '0.0.0.0'
|
|
10
|
+
port: {{port}}
|
|
11
|
+
|
|
12
|
+
logger:
|
|
13
|
+
level: info
|
|
14
|
+
useFileLogger: false
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: {{project.name}}
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
app:
|
|
5
|
+
container_name: {{project.name}}
|
|
6
|
+
build:
|
|
7
|
+
context: ..
|
|
8
|
+
dockerfile: deploy/docker/Dockerfile
|
|
9
|
+
image: ${IMAGE_TAG:-{{project.name}}:latest}
|
|
10
|
+
restart: unless-stopped
|
|
11
|
+
ports:
|
|
12
|
+
- "${HOST_PORT:-{{port}}}:{{port}}"
|
|
13
|
+
environment:
|
|
14
|
+
- NODE_ENV=${NODE_ENV:-production}
|
|
15
|
+
- SERVICE_NAME=${SERVICE_NAME:-{{project.name}}}
|
|
16
|
+
- SERVICE_INSTANCE=${SERVICE_INSTANCE:-prod}
|
|
17
|
+
- WS_PORT={{port}}
|
|
18
|
+
volumes:
|
|
19
|
+
- ./config/local.yaml:/app/config/local.yaml:ro
|
|
20
|
+
healthcheck:
|
|
21
|
+
test: ["CMD", "wget", "--spider", "-q", "http://localhost:{{port}}/health"]
|
|
22
|
+
interval: 30s
|
|
23
|
+
timeout: 5s
|
|
24
|
+
retries: 3
|
|
25
|
+
start_period: 60s
|
|
26
|
+
mem_limit: 2g
|
|
27
|
+
logging:
|
|
28
|
+
driver: json-file
|
|
29
|
+
options:
|
|
30
|
+
max-size: "50m"
|
|
31
|
+
max-file: "5"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# ── GitLab Runner version ─────────────────────────────────
|
|
2
|
+
GITLAB_VERSION=v18.10.3
|
|
3
|
+
HELPER_VERSION=v18.10.3
|
|
4
|
+
|
|
5
|
+
# ── GitLab connection ─────────────────────────────────────
|
|
6
|
+
GITLAB_URL=https://gitlab.finam.ru/
|
|
7
|
+
RUNNER_TAGS={{project.name}},docker
|
|
8
|
+
|
|
9
|
+
# ── Runner identity ──────────────────────────────────────
|
|
10
|
+
RUNNER_NAME={{project.name}}
|
|
11
|
+
RUNNER_TOKEN=
|
|
12
|
+
|
|
13
|
+
# ── Project directory on host ─────────────────────────────
|
|
14
|
+
# Absolute or relative path to the project root on the server.
|
|
15
|
+
# Defaults to ../../ (two levels up from this directory).
|
|
16
|
+
# PROJECT_DIR=/var/opt/node/{{project.name}}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# GitLab Runner Setup
|
|
2
|
+
|
|
3
|
+
Docker-based GitLab Runner for CI/CD pipelines. Uses Docker executor with Docker-out-of-Docker (DooD) pattern.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
1. `start.sh` validates `.env`, resolves `PROJECT_DIR`, starts the runner container
|
|
8
|
+
2. `entrypoint.sh` substitutes variables in `config.toml.template` → `config.toml`, starts `gitlab-runner run`
|
|
9
|
+
3. Runner registers with GitLab, listens for CI jobs matching its tags
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# 1. Copy environment template
|
|
15
|
+
cp .env.example .env
|
|
16
|
+
|
|
17
|
+
# 2. Get runner token from GitLab UI:
|
|
18
|
+
# Settings → CI/CD → Runners → New project runner
|
|
19
|
+
# Set tags, then copy the token
|
|
20
|
+
|
|
21
|
+
# 3. Fill .env with your token and settings
|
|
22
|
+
# Required: GITLAB_URL, RUNNER_NAME, RUNNER_TOKEN
|
|
23
|
+
|
|
24
|
+
# 4. Start the runner
|
|
25
|
+
bash start.sh
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Environment Variables
|
|
29
|
+
|
|
30
|
+
| Variable | Required | Default | Description |
|
|
31
|
+
|----------|----------|---------|-------------|
|
|
32
|
+
| `GITLAB_VERSION` | yes | v18.10.3 | GitLab Runner Docker image version |
|
|
33
|
+
| `HELPER_VERSION` | yes | v18.10.3 | GitLab Runner Helper image version |
|
|
34
|
+
| `GITLAB_URL` | yes | — | GitLab instance URL |
|
|
35
|
+
| `RUNNER_TAGS` | no | {{project.name}},docker | Comma-separated tags for job matching |
|
|
36
|
+
| `RUNNER_NAME` | yes | — | Runner hostname and container name |
|
|
37
|
+
| `RUNNER_TOKEN` | yes | — | Authentication token from GitLab UI |
|
|
38
|
+
| `PROJECT_DIR` | no | ../../ | Absolute path to project on host |
|
|
39
|
+
|
|
40
|
+
## Management Commands
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Start
|
|
44
|
+
bash start.sh
|
|
45
|
+
|
|
46
|
+
# View logs
|
|
47
|
+
docker compose logs -f
|
|
48
|
+
|
|
49
|
+
# Check status
|
|
50
|
+
docker compose exec gitlab-runner gitlab-runner status
|
|
51
|
+
|
|
52
|
+
# Stop
|
|
53
|
+
docker compose down
|
|
54
|
+
|
|
55
|
+
# Restart
|
|
56
|
+
docker compose restart
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Infrastructure
|
|
60
|
+
|
|
61
|
+
- **Network:** `gitlab-network` (bridge)
|
|
62
|
+
- **DNS:** Corporate DNS servers (10.77.96.10, 10.77.196.10)
|
|
63
|
+
- **Executor:** Docker with `docker:27` default image
|
|
64
|
+
- **Volumes:** Docker socket, daemon.json, project directory, /cache
|
|
65
|
+
- **Healthcheck:** `gitlab-runner status` every 60s
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
concurrent = 2
|
|
2
|
+
check_interval = 0
|
|
3
|
+
shutdown_timeout = 0
|
|
4
|
+
sentry_dsn = ""
|
|
5
|
+
|
|
6
|
+
[session_server]
|
|
7
|
+
session_timeout = 1800
|
|
8
|
+
|
|
9
|
+
[[runners]]
|
|
10
|
+
name = "__RUNNER_NAME__"
|
|
11
|
+
url = "__GITLAB_URL__"
|
|
12
|
+
token = "__RUNNER_TOKEN__"
|
|
13
|
+
executor = "docker"
|
|
14
|
+
tag_list = "__RUNNER_TAGS__"
|
|
15
|
+
[runners.docker]
|
|
16
|
+
tls_verify = false
|
|
17
|
+
image = "docker:27"
|
|
18
|
+
privileged = true
|
|
19
|
+
disable_entrypoint_overwrite = false
|
|
20
|
+
oom_kill_disable = false
|
|
21
|
+
disable_cache = false
|
|
22
|
+
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/etc/docker/daemon.json:/etc/docker/daemon.json", "__PROJECT_DIR__:__PROJECT_DIR__", "/cache"]
|
|
23
|
+
shm_size = 0
|
|
24
|
+
network_mtu = 0
|
|
25
|
+
pull_policy = ["if-not-present"]
|
|
26
|
+
helper_image = "gitlab/gitlab-runner-helper:__HELPER_VERSION__"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: {{project.name}}-runner
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
gitlab-runner:
|
|
5
|
+
image: gitlab/gitlab-runner:${GITLAB_VERSION}
|
|
6
|
+
hostname: ${RUNNER_NAME}
|
|
7
|
+
container_name: ${RUNNER_NAME}
|
|
8
|
+
environment:
|
|
9
|
+
- TZ=Europe/Moscow
|
|
10
|
+
- RUNNER_NAME=${RUNNER_NAME}
|
|
11
|
+
- RUNNER_TOKEN=${RUNNER_TOKEN}
|
|
12
|
+
- PROJECT_DIR=${PROJECT_DIR}
|
|
13
|
+
- GITLAB_URL=${GITLAB_URL}
|
|
14
|
+
- GITLAB_VERSION=${GITLAB_VERSION}
|
|
15
|
+
- RUNNER_TAGS=${RUNNER_TAGS}
|
|
16
|
+
- HELPER_VERSION=${HELPER_VERSION}
|
|
17
|
+
dns:
|
|
18
|
+
- 10.77.96.10
|
|
19
|
+
- 10.77.196.10
|
|
20
|
+
restart: always
|
|
21
|
+
entrypoint: ["/bin/sh", "/entrypoint.sh"]
|
|
22
|
+
volumes:
|
|
23
|
+
- './config:/etc/gitlab-runner'
|
|
24
|
+
- './entrypoint.sh:/entrypoint.sh:ro'
|
|
25
|
+
- '/var/run/docker.sock:/var/run/docker.sock'
|
|
26
|
+
- '/etc/docker/daemon.json:/etc/docker/daemon.json'
|
|
27
|
+
healthcheck:
|
|
28
|
+
test: ["CMD", "gitlab-runner", "status"]
|
|
29
|
+
interval: 1m
|
|
30
|
+
timeout: 10s
|
|
31
|
+
retries: 3
|
|
32
|
+
start_period: 30s
|
|
33
|
+
networks:
|
|
34
|
+
- gitlab
|
|
35
|
+
|
|
36
|
+
networks:
|
|
37
|
+
gitlab:
|
|
38
|
+
name: gitlab-network
|
|
39
|
+
driver: bridge
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
TEMPLATE="/etc/gitlab-runner/config.toml.template"
|
|
5
|
+
CONFIG="/etc/gitlab-runner/config.toml"
|
|
6
|
+
|
|
7
|
+
if [ -z "$RUNNER_TOKEN" ]; then
|
|
8
|
+
echo "ERROR: RUNNER_TOKEN is required" >&2
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
if [ -z "$PROJECT_DIR" ]; then
|
|
13
|
+
echo "ERROR: PROJECT_DIR is required" >&2
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
sed \
|
|
18
|
+
-e "s|__RUNNER_NAME__|${RUNNER_NAME}|g" \
|
|
19
|
+
-e "s|__RUNNER_TOKEN__|${RUNNER_TOKEN}|g" \
|
|
20
|
+
-e "s|__PROJECT_DIR__|${PROJECT_DIR}|g" \
|
|
21
|
+
-e "s|__RUNNER_TAGS__|${RUNNER_TAGS}|g" \
|
|
22
|
+
-e "s|__GITLAB_URL__|${GITLAB_URL}|g" \
|
|
23
|
+
-e "s|__GITLAB_VERSION__|${GITLAB_VERSION}|g" \
|
|
24
|
+
-e "s|__HELPER_VERSION__|${HELPER_VERSION}|g" \
|
|
25
|
+
"$TEMPLATE" > "$CONFIG"
|
|
26
|
+
|
|
27
|
+
exec gitlab-runner run
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
cd "$(dirname "$0")"
|
|
4
|
+
|
|
5
|
+
# Проверка наличия .env файла
|
|
6
|
+
if [ ! -f .env ]; then
|
|
7
|
+
echo "ERROR: .env file not found in $(pwd)"
|
|
8
|
+
echo "Copy .env.example to .env and fill in the values:"
|
|
9
|
+
echo " cp .env.example .env"
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
# Загружаем .env в текущий shell
|
|
14
|
+
set -a
|
|
15
|
+
. .env
|
|
16
|
+
set +a
|
|
17
|
+
|
|
18
|
+
# Проверка обязательных переменных
|
|
19
|
+
required_vars=(
|
|
20
|
+
"GITLAB_URL"
|
|
21
|
+
"RUNNER_NAME"
|
|
22
|
+
"RUNNER_TOKEN"
|
|
23
|
+
)
|
|
24
|
+
missing=()
|
|
25
|
+
for var in "${required_vars[@]}"; do
|
|
26
|
+
if [ -z "${!var}" ]; then
|
|
27
|
+
missing+=("$var")
|
|
28
|
+
fi
|
|
29
|
+
done
|
|
30
|
+
if [ ${#missing[@]} -gt 0 ]; then
|
|
31
|
+
echo "ERROR: Required variables not set in .env:"
|
|
32
|
+
for var in "${missing[@]}"; do
|
|
33
|
+
echo " - $var"
|
|
34
|
+
done
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# PROJECT_DIR: если не задан — два уровня вверх (корень проекта)
|
|
39
|
+
if [ -z "$PROJECT_DIR" ]; then
|
|
40
|
+
PROJECT_DIR="../.."
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Резолвим в абсолютный путь
|
|
44
|
+
PROJECT_DIR=$(cd "$PROJECT_DIR" && pwd)
|
|
45
|
+
export PROJECT_DIR
|
|
46
|
+
|
|
47
|
+
exec docker compose up -d "$@"
|
package/cli-template/gitignore
CHANGED
|
@@ -1,95 +1,96 @@
|
|
|
1
|
-
# Dependency directories
|
|
2
|
-
node_modules/
|
|
3
|
-
jspm_packages/
|
|
4
|
-
|
|
5
|
-
# Build outputs
|
|
6
|
-
dist/
|
|
7
|
-
build/
|
|
8
|
-
out/
|
|
9
|
-
.next/
|
|
10
|
-
.nuxt/
|
|
11
|
-
.cache/
|
|
12
|
-
|
|
13
|
-
# Environment variables
|
|
14
|
-
.env
|
|
15
|
-
.env.local
|
|
16
|
-
.env.development.local
|
|
17
|
-
.env.test.local
|
|
18
|
-
.env.production.local
|
|
19
|
-
|
|
20
|
-
# Logs
|
|
21
|
-
logs
|
|
22
|
-
*.log
|
|
23
|
-
npm-debug.log*
|
|
24
|
-
yarn-debug.log*
|
|
25
|
-
yarn-error.log*
|
|
26
|
-
lerna-debug.log*
|
|
27
|
-
|
|
28
|
-
# Coverage directory used by tools like istanbul
|
|
29
|
-
coverage/
|
|
30
|
-
.nyc_output/
|
|
31
|
-
|
|
32
|
-
# IDE / editors
|
|
33
|
-
.idea/
|
|
34
|
-
.vscode/
|
|
35
|
-
*.swp
|
|
36
|
-
*.swo
|
|
37
|
-
.DS_Store
|
|
38
|
-
*.sublime-project
|
|
39
|
-
*.sublime-workspace
|
|
40
|
-
|
|
41
|
-
# Misc
|
|
42
|
-
Thumbs.db
|
|
43
|
-
|
|
44
|
-
# Files formed by Realtime
|
|
45
|
-
/_files/
|
|
46
|
-
/_cache/
|
|
47
|
-
/_data/
|
|
48
|
-
|
|
49
|
-
# DEV directories
|
|
50
|
-
.tmp/
|
|
51
|
-
temp/
|
|
52
|
-
/__misc/
|
|
53
|
-
**/_tmp/
|
|
54
|
-
**/_sand/
|
|
55
|
-
|
|
56
|
-
# TypeScript cache
|
|
57
|
-
*.tsbuildinfo
|
|
58
|
-
|
|
59
|
-
# Keep example env file
|
|
60
|
-
!.env.example
|
|
61
|
-
|
|
62
|
-
# OS specific files
|
|
63
|
-
.github
|
|
64
|
-
|
|
65
|
-
# Private exceptions
|
|
66
|
-
/config/local.*
|
|
67
|
-
local-*.*
|
|
68
|
-
/t.*
|
|
69
|
-
*.local.*
|
|
70
|
-
*.private.*
|
|
71
|
-
**/ignor.*
|
|
72
|
-
**/ignore.*
|
|
73
|
-
**/*.ignore/**
|
|
74
|
-
~$*.*
|
|
75
|
-
*.rar
|
|
76
|
-
|
|
77
|
-
# API response logs for testing
|
|
78
|
-
_api_responses/
|
|
79
|
-
_logs/
|
|
80
|
-
/config.yaml
|
|
81
|
-
/.claude/glm.ps1
|
|
82
|
-
|
|
83
|
-
/_misc_/
|
|
84
|
-
/deploy/config.yml
|
|
85
|
-
/config/__server__/
|
|
86
|
-
glm.ps1
|
|
87
|
-
glm.sh
|
|
88
|
-
/~last-cli-config.json
|
|
89
|
-
/.npmrc
|
|
90
|
-
/.serena/
|
|
91
|
-
/.playwright-mcp/
|
|
92
|
-
/claudedocs/
|
|
93
|
-
preferred-language.txt
|
|
94
|
-
/mcp-ext-apps/
|
|
95
|
-
.agents/
|
|
1
|
+
# Dependency directories
|
|
2
|
+
node_modules/
|
|
3
|
+
jspm_packages/
|
|
4
|
+
|
|
5
|
+
# Build outputs
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
out/
|
|
9
|
+
.next/
|
|
10
|
+
.nuxt/
|
|
11
|
+
.cache/
|
|
12
|
+
|
|
13
|
+
# Environment variables
|
|
14
|
+
.env
|
|
15
|
+
.env.local
|
|
16
|
+
.env.development.local
|
|
17
|
+
.env.test.local
|
|
18
|
+
.env.production.local
|
|
19
|
+
|
|
20
|
+
# Logs
|
|
21
|
+
logs
|
|
22
|
+
*.log
|
|
23
|
+
npm-debug.log*
|
|
24
|
+
yarn-debug.log*
|
|
25
|
+
yarn-error.log*
|
|
26
|
+
lerna-debug.log*
|
|
27
|
+
|
|
28
|
+
# Coverage directory used by tools like istanbul
|
|
29
|
+
coverage/
|
|
30
|
+
.nyc_output/
|
|
31
|
+
|
|
32
|
+
# IDE / editors
|
|
33
|
+
.idea/
|
|
34
|
+
.vscode/
|
|
35
|
+
*.swp
|
|
36
|
+
*.swo
|
|
37
|
+
.DS_Store
|
|
38
|
+
*.sublime-project
|
|
39
|
+
*.sublime-workspace
|
|
40
|
+
|
|
41
|
+
# Misc
|
|
42
|
+
Thumbs.db
|
|
43
|
+
|
|
44
|
+
# Files formed by Realtime
|
|
45
|
+
/_files/
|
|
46
|
+
/_cache/
|
|
47
|
+
/_data/
|
|
48
|
+
|
|
49
|
+
# DEV directories
|
|
50
|
+
.tmp/
|
|
51
|
+
temp/
|
|
52
|
+
/__misc/
|
|
53
|
+
**/_tmp/
|
|
54
|
+
**/_sand/
|
|
55
|
+
|
|
56
|
+
# TypeScript cache
|
|
57
|
+
*.tsbuildinfo
|
|
58
|
+
|
|
59
|
+
# Keep example env file
|
|
60
|
+
!.env.example
|
|
61
|
+
|
|
62
|
+
# OS specific files
|
|
63
|
+
.github
|
|
64
|
+
|
|
65
|
+
# Private exceptions
|
|
66
|
+
/config/local.*
|
|
67
|
+
local-*.*
|
|
68
|
+
/t.*
|
|
69
|
+
*.local.*
|
|
70
|
+
*.private.*
|
|
71
|
+
**/ignor.*
|
|
72
|
+
**/ignore.*
|
|
73
|
+
**/*.ignore/**
|
|
74
|
+
~$*.*
|
|
75
|
+
*.rar
|
|
76
|
+
|
|
77
|
+
# API response logs for testing
|
|
78
|
+
_api_responses/
|
|
79
|
+
_logs/
|
|
80
|
+
/config.yaml
|
|
81
|
+
/.claude/glm.ps1
|
|
82
|
+
|
|
83
|
+
/_misc_/
|
|
84
|
+
/deploy/config.yml
|
|
85
|
+
/config/__server__/
|
|
86
|
+
glm.ps1
|
|
87
|
+
glm.sh
|
|
88
|
+
/~last-cli-config.json
|
|
89
|
+
/.npmrc
|
|
90
|
+
/.serena/
|
|
91
|
+
/.playwright-mcp/
|
|
92
|
+
/claudedocs/
|
|
93
|
+
preferred-language.txt
|
|
94
|
+
/mcp-ext-apps/
|
|
95
|
+
.agents/
|
|
96
|
+
.qwen/
|