Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
development:vscode [2026/01/12 21:34] 192.168.1.159development:vscode [2026/01/31 05:33] (текущий) 192.168.1.1
Строка 24: Строка 24:
  
 ===== Отладка / Расширения ===== ===== Отладка / Расширения =====
 +
 +==== PHP ====
 +
 +<code json>
 +{
 +    // Use IntelliSense to learn about possible attributes.
 +    // Hover to view descriptions of existing attributes.
 +    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
 +    "version": "0.2.0",
 +    "configurations": [
 +
 +        {
 +            "name": "Listen for Xdebug",
 +            "type": "php",
 +            "request": "launch",
 +            "port": 9000,
 +            "pathMappings": {
 +                "/var/www/api": "${workspaceFolder}"
 +            }
 +        },
 +        {
 +            "name": "Launch currently open script",
 +            "type": "php",
 +            "request": "launch",
 +            "program": "${file}",
 +            "cwd": "${fileDirname}",
 +            "port": 0,
 +            "runtimeArgs": [
 +                "-dxdebug.start_with_request=yes"
 +            ],
 +            "env": {
 +                "XDEBUG_MODE": "debug,develop",
 +                "XDEBUG_CONFIG": "client_port=${port}"
 +            }
 +        },
 +        {
 +            "name": "Launch Built-in web server",
 +            "type": "php",
 +            "request": "launch",
 +            "runtimeArgs": [
 +                "-dxdebug.mode=debug",
 +                "-dxdebug.start_with_request=yes",
 +                "-S",
 +                "localhost:0"
 +            ],
 +            "program": "",
 +            "cwd": "${workspaceRoot}",
 +            "port": 9003,
 +            "serverReadyAction": {
 +                "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
 +                "uriFormat": "http://localhost:%s",
 +                "action": "openExternally"
 +            }
 +        }
 +    ]
 +}
 +</code>
 +
 +==== Chrome Extension ====
 +
 +<code json>
 +</code>
 +
 +==== Electron ====
 +
 +<code json>
 +{
 +    "version": "0.2.0",
 +    "configurations": [
 +        
 +        {
 +            "name": "Attach electron: Renderer Process",
 +            "type": "chrome",
 +            "request": "attach",
 +            "port": 9223,
 +            "webRoot": "${workspaceFolder}/packages/insomnia",
 +            "timeout": 30000,
 +            "presentation": {
 +                "hidden": false,
 +                "group": "Insomnia",
 +                "order": 1
 +            },
 +        },
 +
 +        {
 +            "name": "Launch electron: main",
 +            "type": "node",
 +            "request": "launch",
 +            "protocol": "inspector",
 +            "sourceMaps": true,
 +            "presentation": {
 +                "hidden": false,
 +                "group": "Insomnia",
 +                "order": 2
 +            },
 +            "cwd": "${workspaceFolder}/packages/insomnia",
 +            "runtimeExecutable": "${workspaceFolder}/packages/insomnia/node_modules/.bin/electron",
 +            "runtimeArgs": ["--remote-debugging-port=9222", "."],
 +            "outputCapture": "std",
 +            "windows": {
 +                "type": "node",
 +                "request": "launch",
 +                "name": "Electron: main",
 +                "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
 +            },
 +            "env": {
 +                "NODE_ENV": "development",
 +                "ELECTRON_IS_DEV": "1"
 +            }
 +        },
 +
 +        {
 +            "name": "Launch electron: renderer",
 +            "type": "pwa-chrome",
 +            "request": "attach",
 +            "presentation": {
 +                "hidden": false,
 +                "group": "Insomnia",
 +                "order": 3
 +            },
 +            "port": 9222,
 +            "webRoot": "${workspaceFolder}/packages/insomnia/src",
 +            "timeout": 60000
 +        },
 +
 +    ],
 +    "inputs": [
 +        {
 +            "id": "insoCommandArgs",
 +            "description": "Add an additional argument to inso",
 +            "type": "promptString"
 +        },
 +        {
 +            "id": "insoCommand",
 +            "description": "Pick an inso command to run",
 +            "type": "pickString",
 +            "options": [
 +                {
 +                    "value": "run test"
 +                },
 +                {
 +                    "value": "lint spec"
 +                },
 +                {
 +                    "value": "export spec"
 +                },
 +                {
 +                    "value": "script"
 +                },
 +                {
 +                    "value": "help"
 +                }
 +            ]
 +        }
 +    ],
 +
 +    "compounds": [
 +    {
 +        "name": "Launch Insomnia",
 +        "presentation": {
 +        "hidden": false,
 +        "group": "Insomnia",
 +        "order": 10
 +        },
 +        "stopAll": true,
 +        "preLaunchTask": "Insomnia: Compile (Watch)",
 +        "configurations": [
 +            "Launch electron: main",
 +            "Launch electron: renderer"
 +        ]
 +    }
 +    ]
 +}
 +</code>
  
 ==== Golang ==== ==== Golang ====
 +
 +<code Dockerfile>
 +# Base stage for shared environment
 +FROM golang:1.24-alpine AS base
 +WORKDIR /app
 +RUN apk add --no-cache git
 +
 +# Builder stage for production
 +FROM base AS builder
 +COPY go.mod go.sum ./
 +RUN go mod download
 +COPY . .
 +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /app/proxy .
 +
 +# Debug builder stage for delve and debug binary
 +FROM base AS debug-builder
 +RUN go install github.com/go-delve/delve/cmd/dlv@latest
 +COPY go.mod go.sum ./
 +RUN go mod download
 +COPY . .
 +# Build with optimizations disabled for better debugging
 +RUN CGO_ENABLED=0 GOOS=linux go build -gcflags="all=-N -l" -o /app/proxy .
 +
 +# Debug stage
 +FROM alpine:latest AS debug
 +RUN apk add --no-cache ca-certificates libc6-compat
 +WORKDIR /app
 +COPY --from=debug-builder /go/bin/dlv /usr/local/bin/dlv
 +COPY --from=debug-builder /app/proxy /app/proxy
 +EXPOSE 8080 40000
 +# Run delve in headless mode
 +CMD ["/usr/local/bin/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "--accept-multiclient", "exec", "/app/proxy"]
 +</code>
 +
 +<code yaml>
 +services:
 +
 +  proxy-debug:
 +    build:
 +      context: .
 +      target: debug
 +    environment:
 +      - GEMINI_API_KEY=${GEMINI_API_KEY}
 +      - LISTEN_ADDR=:8080
 +    ports:
 +      - "${PORT:-8080}:8080"
 +      - "40000:40000"
 +    security_opt:
 +      - "seccomp:unconfined" # Required for Delve/ptrace
 +    cap_add:
 +      - SYS_PTRACE
 +    restart: "no"
 +</code>
 +
 +<code bash>
 +$ docker compose up proxy-debug
 +</code>
  
 <code json> <code json>