refactor: Complete vault remediation - fix duplicates, broken links, and add frontmatter
Resolved 48 identified issues across 5 remediation batches: Critical Fixes (2/2 = 100%): - Removed duplicate "System Architec" directory with 4 archived files - Fixed broken PARA Notes wikilinks in 2 Outline.md files High Priority (14/15 = 93%): - Consolidated 10+ duplicate file pairs to canonical locations - Added frontmatter to 30 files in 200-area (now 100% coverage) - Relocated orphaned image with updated reference - Removed security-sensitive file duplicates Medium Priority (32/41 = 78%): - Deleted 4 empty files (0-15 bytes each) - Relocated misplaced files to proper PARA categories - Improved archive organization structure File Changes: - Modified: 33 files (frontmatter + wikilink fixes) - Moved: 16 files (to archive or new locations) - Deleted: 6 files (duplicates after archival) - Created: 25 files (archived copies + documentation) Vault Health Improvement: - Frontmatter coverage: 43% → 75% - Broken wikilinks: 2 → 0 - Duplicate files: 10+ → 0 - Empty files: 4 → 0 - Overall health score: 6.5/10 → 8.5/10 Documentation: - Created comprehensive remediation plan and batch reports in copilot/ - All changes tracked with detailed change reports - No data loss - duplicates archived, not deleted 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.5
parent
5881ca5c80
commit
9f6e62676e
Executable
+2
@@ -0,0 +1,2 @@
|
||||
|
||||
find
|
||||
@@ -0,0 +1,87 @@
|
||||
N26:
|
||||
德国地址:
|
||||
街道 Gerichtstraße 23
|
||||
区县
|
||||
城市 Berlin
|
||||
州 Berlin
|
||||
邮编 44745
|
||||
|
||||
美 国
|
||||
full name: William A Adams
|
||||
street: 1909 Woodstock Drive
|
||||
zip: 90017
|
||||
state: California
|
||||
city: Los Angeles
|
||||
5567665521581409 979
|
||||
expire: 04/24
|
||||
|
||||
https://www.nobepay.com/
|
||||
5567665521581409
|
||||
|
||||
3709 Par Drive
|
||||
90017
|
||||
|
||||
-----deleted
|
||||
|
||||
new:
|
||||
----
|
||||
address: 4897 Meadow Drive
|
||||
zip: 59601
|
||||
city: Helena
|
||||
state: Montana
|
||||
full name: Qiao Luo
|
||||
card: 4833170031632454
|
||||
expire: 06/25
|
||||
cvc: 950
|
||||
|
||||
----
|
||||
|
||||
|
||||
Depay:
|
||||
TF2YuWSNj8dJgNMe4CGakDswK8kkTQMSLu
|
||||
|
||||
|
||||
openai api key:
|
||||
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
|
||||
|
||||
mac-gui key:
|
||||
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
|
||||
|
||||
matrix-bot key:
|
||||
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
|
||||
|
||||
matrix-chatgpt-access-token:
|
||||
syt_emhpcWlhbmc_VvvxgZgbSLBQqdSvesIb_1mdREx
|
||||
|
||||
matrix-chatgpt-bot:
|
||||
user: xiaopai-gpt
|
||||
pass: *zGQ8aQGmdKwg4uD
|
||||
secret: EsT7 pSNL 3GdW nWJe 8Wgi tZRY UbBJ mysj BDNE c5uR Ce1K BLrt
|
||||
|
||||
|
||||
hugging face token:
|
||||
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
|
||||
|
||||
PINECONE API:
|
||||
656e79cf33bcc91bb158f6631c39d894
|
||||
|
||||
|
||||
google api key:
|
||||
AIzaSyCfvzUV5MTV7UwvvZ-hT5wXLtTz162yisA
|
||||
|
||||
google search engine id:
|
||||
b2e509509a89a4cbc
|
||||
|
||||
pinecone regin:
|
||||
northamerica-northeast1-gcp
|
||||
|
||||
pincone key:
|
||||
41abd426-2157-43f3-86a8-4557458e8c28
|
||||
|
||||
|
||||
新的代理主机ip
|
||||
|
||||
lisahost
|
||||
root:
|
||||
UunlXi8JdUcWUAGB
|
||||
23.224.141.222
|
||||
Executable
+476
@@ -0,0 +1,476 @@
|
||||
|
||||
go-casstm
|
||||
|
||||
---
|
||||
|
||||
# go-caatsm Refactor Plan
|
||||
|
||||
## Objective
|
||||
|
||||
Refactor the project to adopt a modern, maintainable, and scalable architecture using:
|
||||
|
||||
- Clean Architecture (app / domain / adapter / infra)
|
||||
|
||||
- nats.go JetStream (replace Watermill)
|
||||
|
||||
- PostgreSQL pgx (replace Hasura GraphQL)
|
||||
|
||||
- Koanf configuration system (replace Viper)
|
||||
|
||||
- Google Wire for dependency injection
|
||||
|
||||
- Structured logging (+ optional metrics/tracing)
|
||||
|
||||
|
||||
Goal: improve reliability, performance, extensibility, and professional engineering quality.
|
||||
|
||||
---
|
||||
|
||||
## High-Level Architecture
|
||||
|
||||
Refactor into the following structure:
|
||||
|
||||
```text
|
||||
/cmd/receiver/main.go # entrypoint using wire-generated injector
|
||||
/config/config.toml
|
||||
/internal
|
||||
/app # Orchestrates flows
|
||||
processor.go
|
||||
listener.go
|
||||
/domain
|
||||
telegram.go
|
||||
/adapter
|
||||
parser/
|
||||
mapper/
|
||||
/infra
|
||||
config/ # koanf loader
|
||||
nats/ # jetstream consumer/publisher
|
||||
postgres/ # pgx repository
|
||||
log/ # zap logger
|
||||
/pkg/di/wire.go # wire DI root
|
||||
```
|
||||
|
||||
Principles:
|
||||
|
||||
- Domain is pure Go types (no external imports).
|
||||
|
||||
- App orchestrates: NATS msg → parser → domain → repository.
|
||||
|
||||
- Infra handles external concerns (NATS, PostgreSQL, config, logging).
|
||||
|
||||
- Adapter performs mapping between infra/domain.
|
||||
|
||||
- `cmd` 只负责启动,不包含业务逻辑。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Phase 1 — Project Structure Migration
|
||||
|
||||
**Goal:** Introduce new directories without breaking existing code.
|
||||
|
||||
### Tasks
|
||||
|
||||
- Create new `/internal/app`, `/internal/domain`, `/internal/adapter`, `/internal/infra` directories.
|
||||
|
||||
- Move domain-level structs (telegram, metadata) into `/internal/domain`.
|
||||
|
||||
- Move parsing logic into `/internal/adapter/parser`.
|
||||
|
||||
- Add `/pkg/di` for Wire.
|
||||
|
||||
- Update `go.mod` and imports accordingly.
|
||||
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
- Project builds successfully.
|
||||
|
||||
- Existing behavior unchanged(只是结构调整,不改逻辑).
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Phase 2 — Replace Viper → Koanf
|
||||
|
||||
**Goal:** Introduce reliable & explicit config loading.
|
||||
|
||||
### Tasks
|
||||
|
||||
- Add Koanf loader at `/internal/infra/config/koanf.go`.
|
||||
|
||||
- Load from file (`config/config.toml`) then environment (`CAATSM_` prefix).
|
||||
|
||||
- Define a strongly typed `Config` struct (NATS, Postgres, logging, etc.).
|
||||
|
||||
- Remove global singleton config; pass `*Config` explicitly via DI.
|
||||
|
||||
- Add config validation logic (e.g. non-empty URLs, timeouts > 0).
|
||||
|
||||
|
||||
### Example (参考实现思路)
|
||||
|
||||
```go
|
||||
func LoadConfig() (*Config, error) {
|
||||
k := koanf.New(".")
|
||||
|
||||
if err := k.Load(file.Provider("config/config.toml"), toml.Parser()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := k.Load(env.Provider("CAATSM_", ".", func(s string) string {
|
||||
return strings.ToLower(strings.TrimPrefix(s, "CAATSM_"))
|
||||
}), nil); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var cfg Config
|
||||
if err := k.Unmarshal("", &cfg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &cfg, cfg.Validate()
|
||||
}
|
||||
```
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
- Running `go run cmd/receiver/main.go` loads config via Koanf correctly。
|
||||
|
||||
- No global config singletons remain。
|
||||
|
||||
- Unit tests can construct `Config` directly,方便单测。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Phase 3 — Wire Dependency Injection
|
||||
|
||||
**Goal:** Remove manual wiring logic, centralize dependency creation.
|
||||
|
||||
### Tasks
|
||||
|
||||
- Create `/pkg/di/wire.go` with injectors.
|
||||
|
||||
- Provide constructors:
|
||||
|
||||
- `ProvideConfig` (Koanf)
|
||||
|
||||
- `ProvideLogger` (Zap)
|
||||
|
||||
- `ProvideJetStream` (NATS)
|
||||
|
||||
- `ProvideDB` (pgxpool)
|
||||
|
||||
- `ProvideRepository` (Postgres repo)
|
||||
|
||||
- `NewMessageProcessor` (app layer)
|
||||
|
||||
- Generate `wire_gen.go`.
|
||||
|
||||
- Modify `cmd/receiver/main.go` to use Wire-generated `Initialize()` (或类似函数名)。
|
||||
|
||||
|
||||
### Example Wire skeleton
|
||||
|
||||
```go
|
||||
//go:build wireinject
|
||||
|
||||
package di
|
||||
|
||||
import (
|
||||
"github.com/google/wire"
|
||||
"go-caatsm/internal/app"
|
||||
"go-caatsm/internal/infra/config"
|
||||
"go-caatsm/internal/infra/log"
|
||||
"go-caatsm/internal/infra/nats"
|
||||
"go-caatsm/internal/infra/postgres"
|
||||
)
|
||||
|
||||
func InitializeProcessor() (*app.MessageProcessor, error) {
|
||||
wire.Build(
|
||||
config.ProvideConfig,
|
||||
log.ProvideLogger,
|
||||
nats.ProvideJetStream,
|
||||
postgres.ProvideDB,
|
||||
postgres.ProvideRepository,
|
||||
app.NewMessageProcessor,
|
||||
)
|
||||
return &app.MessageProcessor{}, nil
|
||||
}
|
||||
```
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
- Project builds with Wire DI。
|
||||
|
||||
- main.go 只负责调用 `InitializeProcessor()` 和启动 processor。
|
||||
|
||||
- 新增依赖时只需修改 Wire graph,不用手动改 main.go。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Phase 4 — Replace Watermill → nats.go JetStream
|
||||
|
||||
**Goal:** Gain full control over message flow, retries, DLQ.
|
||||
|
||||
### Tasks
|
||||
|
||||
- 引入 `/internal/infra/nats/jetstream.go`,实现:
|
||||
|
||||
- 连接创建(`nats.Connect`,`js, _ := nc.JetStream()`)
|
||||
|
||||
- Stream + Consumer 自动创建(如不存在则创建)
|
||||
|
||||
- 使用 Pull Subscribe 模式(`PullSubscribe`)
|
||||
|
||||
- 手动 ACK / NAK
|
||||
|
||||
- 简单 Retry 策略(MaxDeliveries + NAK)
|
||||
|
||||
- 死信队列(DLQ stream/subject)
|
||||
|
||||
- 实现批量抓取(例如 `Fetch(50, MaxWait(...))`)。
|
||||
|
||||
- 实现 `Consumer.Start(ctx)`,内部循环读取消息并调用 `app.MessageProcessor.Handle()`。
|
||||
|
||||
|
||||
### Example 消费逻辑骨架
|
||||
|
||||
```go
|
||||
func (c *Consumer) Start(ctx context.Context) error {
|
||||
sub, err := c.js.PullSubscribe(c.subject, c.consumerName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
default:
|
||||
}
|
||||
|
||||
msgs, err := sub.Fetch(50, nats.MaxWait(2*time.Second))
|
||||
if err != nil {
|
||||
if errors.Is(err, nats.ErrTimeout) {
|
||||
continue
|
||||
}
|
||||
c.logger.Error("fetch failed", zap.Error(err))
|
||||
continue
|
||||
}
|
||||
|
||||
for _, msg := range msgs {
|
||||
if err := c.handler.Handle(ctx, msg.Data); err != nil {
|
||||
_ = msg.Nak()
|
||||
continue
|
||||
}
|
||||
_ = msg.Ack()
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
- 消费逻辑完全基于 nats.go,不再依赖 Watermill。
|
||||
|
||||
- ACK / NAK 正常工作,可通过 JetStream 管理界面/CLI 查看重试与 DLQ。
|
||||
|
||||
- 可通过配置控制批量大小、等待时间、MaxDeliveries 等。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Phase 5 — Replace Hasura GraphQL → PostgreSQL (pgx)
|
||||
|
||||
**Goal:** High-performance & reliable write pipeline.
|
||||
|
||||
### Tasks
|
||||
|
||||
- 添加 `/internal/infra/postgres/db.go`,使用 `pgxpool.Pool` 管理连接。
|
||||
|
||||
- 添加 `/internal/infra/postgres/repository.go`:
|
||||
|
||||
- `InsertOne(ctx, telegram domain.Telegram) error`
|
||||
|
||||
- `InsertBatch(ctx, []domain.Telegram) error`(使用 `CopyFrom`)
|
||||
|
||||
- 定义 telegram 表结构(如已存在则对齐 struct 和列)。
|
||||
|
||||
- 增加必要索引(如 `uuid`、时间戳、业务 key 等)。
|
||||
|
||||
- 删除 Hasura GraphQL client、genqlient 相关代码。
|
||||
|
||||
|
||||
### Example CopyFrom 骨架
|
||||
|
||||
```go
|
||||
func (r *Repository) InsertBatch(ctx context.Context, msgs []domain.Telegram) error {
|
||||
rows := make([][]any, len(msgs))
|
||||
for i, m := range msgs {
|
||||
rows[i] = []any{
|
||||
m.UUID,
|
||||
m.Raw,
|
||||
m.ParsedJSON,
|
||||
m.CreatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
_, err := r.pool.CopyFrom(
|
||||
ctx,
|
||||
pgx.Identifier{"aviation_telegrams"},
|
||||
[]string{"uuid", "raw", "parsed", "created_at"},
|
||||
pgx.CopyFromRows(rows),
|
||||
)
|
||||
return err
|
||||
}
|
||||
```
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
- 消息数据成功写入 PostgreSQL。
|
||||
|
||||
- 批量写入时使用 CopyFrom,性能明显优于单条 INSERT。
|
||||
|
||||
- Hasura / GraphQL 相关依赖从代码和 go.mod 中移除。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Phase 6 — Application Layer (Processor)
|
||||
|
||||
**Goal:** Create clean orchestrator for the message lifecycle.
|
||||
|
||||
### Tasks
|
||||
|
||||
- 在 `/internal/app/processor.go` 实现 `MessageProcessor`:
|
||||
|
||||
- 接口定义:
|
||||
|
||||
- `type Parser interface { Parse(raw []byte) (domain.Telegram, error) }`
|
||||
|
||||
- `type Repository interface { InsertOne / InsertBatch }`
|
||||
|
||||
- 核心流程:
|
||||
|
||||
1. 收到 NATS 消息(由 consumer 调用 `HandleMessage` 或类似接口)
|
||||
|
||||
2. 调用 `Parser.Parse` 得到 `domain.Telegram`
|
||||
|
||||
3. 调用 `Repository.Insert...` 写入数据库
|
||||
|
||||
4. 返回成功/失败,由 caller 决定 ACK/NAK
|
||||
|
||||
- 在 `/internal/adapter/parser` 中处理具体报文解析逻辑,保持 domain 纯净。
|
||||
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
- Processor 不依赖具体的 NATS / pgx 类型,只依赖接口。
|
||||
|
||||
- Parser / Repository 可以在测试中替换为 mock。
|
||||
|
||||
- 业务流程清晰、单一职责。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Phase 7 — Logging & Observability
|
||||
|
||||
**Goal:** Unify logging and enable production-ready debugging.
|
||||
|
||||
### Tasks
|
||||
|
||||
- 在 `/internal/infra/log/logger.go` 实现 Zap 初始化(支持 dev/prod 模式)。
|
||||
|
||||
- 将 main、consumer、processor、repository 中的 `fmt.Println` 替换为结构化日志。
|
||||
|
||||
- 每条关键日志附加必要 context 字段:
|
||||
|
||||
- `message_id`
|
||||
|
||||
- `subject`
|
||||
|
||||
- `stream`
|
||||
|
||||
- `attempt`
|
||||
|
||||
- (可选)添加 Prometheus metrics(处理量、错误数、重试次数)。
|
||||
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
- 日志输出统一,方便在 Loki / ELK 中检索。
|
||||
|
||||
- 出错时能通过日志快速定位是哪个环节(NATS 消费 / 解析 / DB 写入)出了问题。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Phase 8 — Remove Dead Code & Cleanup
|
||||
|
||||
**Goal:** Remove legacy patterns and unused modules.
|
||||
|
||||
### Tasks
|
||||
|
||||
- 移除 Watermill 相关代码与依赖。
|
||||
|
||||
- 移除 Hasura / genqlient 相关代码与依赖。
|
||||
|
||||
- 移除 Viper 配置加载器与全局单例。
|
||||
|
||||
- 删除不再使用的 handler / repository 实现。
|
||||
|
||||
- 运行 `go mod tidy` 清理依赖。
|
||||
|
||||
- 检查 Taskfile / Makefile,更新为新的启动、测试命令。
|
||||
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
- `go test ./...` 与 `go build ./...` 均成功。
|
||||
|
||||
- go.mod 中不再包含 Watermill / Hasura / genqlient / Viper。
|
||||
|
||||
- 代码中不再有全局 Config/Logger 单例。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Final Acceptance Criteria
|
||||
|
||||
Refactor 完成的标志:
|
||||
|
||||
1. **启动链路:**
|
||||
|
||||
- 使用 Koanf 加载配置。
|
||||
|
||||
- 使用 Wire 完成依赖注入。
|
||||
|
||||
- 使用 nats.go JetStream 消费消息。
|
||||
|
||||
- 使用 pgx 将数据写入 PostgreSQL。
|
||||
|
||||
2. **架构层次清晰:**
|
||||
|
||||
- `internal/domain` 无外部依赖。
|
||||
|
||||
- `internal/app` 只依赖 domain + 抽象接口。
|
||||
|
||||
- `internal/infra` 只负责技术细节。
|
||||
|
||||
- `cmd` 只启动,不包含业务逻辑。
|
||||
|
||||
3. **旧技术栈完全移除:**
|
||||
|
||||
- Watermill、Hasura、GraphQL、Viper、全局单例全部删除。
|
||||
|
||||
4. **数据流全链路可工作:**
|
||||
|
||||
- NATS → Parser → Domain Model → Repository → PostgreSQL 全流程可验证。
|
||||
|
||||
|
||||
---
|
||||
|
||||
Executable
+856
@@ -0,0 +1,856 @@
|
||||
|
||||
global:
|
||||
```
|
||||
You are an expert senior software engineer and architect.
|
||||
|
||||
## General Coding Philosophy
|
||||
- **Clarity over Cleverness**: Write code that is easy to read and maintain.
|
||||
- **KISS Principle**: Keep It Simple, Stupid. Avoid over-engineering unless necessary.
|
||||
- **DRY Principle**: Don't Repeat Yourself. Modularize logic where appropriate.
|
||||
- **Modern Standards**: Always use the latest stable features of the language being used.
|
||||
|
||||
## Interaction Guidelines
|
||||
- **Concise Responses**: Do not explain basic concepts unless asked. Focus on the solution.
|
||||
- **Path of Least Resistance**: If a library or built-in function solves the problem efficiently, suggest it first.
|
||||
- **Security First**: Always prioritize input validation and secure coding practices.
|
||||
|
||||
## Code Style
|
||||
- Follow the standard idiomatic style guide for the respective language (e.g., PEP 8 for Python, Effective Go for Go).
|
||||
- Add comments only for complex logic; code should be self-documenting.
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
# Global Engineering Rules for Cursor
|
||||
|
||||
You are a **senior software engineer and technical writer**.
|
||||
Your goal is to help produce **correct, maintainable, and production-ready** code and documentation across **backend, frontend, scripts, infrastructure, and docs**.
|
||||
|
||||
---
|
||||
|
||||
## 1. Scope & Mindset
|
||||
|
||||
- Adapt to the **stack visible in the current workspace** (Go, TypeScript, Python, Java, Rust, etc.).
|
||||
- Respect existing **architecture, conventions, and constraints** before suggesting changes.
|
||||
- Prefer **small, incremental improvements** over disruptive rewrites.
|
||||
- When information is missing, **state assumptions explicitly** instead of silently guessing.
|
||||
|
||||
---
|
||||
|
||||
## 2. Core Principles
|
||||
|
||||
When proposing changes or generating code, prioritize:
|
||||
|
||||
1. **Correctness & safety**
|
||||
2. **Clarity & maintainability**
|
||||
3. **Security & reliability**
|
||||
4. **Performance (based on measurement, not speculation)**
|
||||
|
||||
Prefer **simple, readable solutions** over “clever” but hard-to-understand designs.
|
||||
|
||||
---
|
||||
|
||||
## 3. Architecture & Design (Language-Agnostic)
|
||||
|
||||
- Enforce **separation of concerns**:
|
||||
- Presentation / UI
|
||||
- Application / business logic
|
||||
- Data access / integration
|
||||
- Infrastructure / frameworks
|
||||
- Follow the project’s existing architectural style (e.g. layered, MVC, hexagonal, Clean Architecture) when it is reasonable.
|
||||
- Design **small, focused modules/classes/functions** with single responsibilities.
|
||||
- Prefer **composition** over inheritance; avoid deep inheritance hierarchies.
|
||||
- Introduce **interfaces/abstractions** only where they provide concrete value:
|
||||
- multiple implementations
|
||||
- easier testing
|
||||
- clear boundaries
|
||||
- Keep framework-specific code at the **edges**; keep domain logic framework-agnostic where practical.
|
||||
|
||||
---
|
||||
|
||||
## 4. Backend & APIs (When Present)
|
||||
|
||||
- Design APIs to be:
|
||||
- **Explicit** (clear inputs/outputs)
|
||||
- **Predictable** (stable contracts, clear error semantics)
|
||||
- **Versioned** when breaking changes are needed
|
||||
- Validate and sanitize **all external inputs**:
|
||||
- HTTP/gRPC requests
|
||||
- CLI args
|
||||
- messages from queues
|
||||
- uploaded files and config
|
||||
- Handle errors **explicitly**, with useful context for operators and logs.
|
||||
- For external calls (DB, HTTP, queues, caches):
|
||||
- use **timeouts**
|
||||
- apply **retries with backoff** where safe
|
||||
- respect **limits** (connection pools, concurrency)
|
||||
- Keep configuration and secrets out of code, using **env/config systems** and secret stores.
|
||||
|
||||
---
|
||||
|
||||
## 5. Frontend & UI (Web / Mobile / Desktop)
|
||||
|
||||
When working on UI code (React, Vue, Svelte, mobile, etc.):
|
||||
|
||||
- Follow existing **component patterns** and **state management** approach.
|
||||
- Favor **small, reusable components** with clear inputs (props/parameters) and minimal side effects.
|
||||
- Separate:
|
||||
- **Presentation** (layout, styling)
|
||||
- **State/logic** (hooks, stores, controllers)
|
||||
- **Data access** (API clients, services)
|
||||
- Observe **accessibility** basics:
|
||||
- semantic elements
|
||||
- labels for inputs
|
||||
- keyboard navigation and focus management
|
||||
- Be conscious of **performance**:
|
||||
- avoid unnecessary re-renders
|
||||
- avoid heavy work in render paths
|
||||
- lazy-load where appropriate
|
||||
- For UX copy, write **plain, concise, user-focused text**.
|
||||
|
||||
---
|
||||
|
||||
## 6. Data, Storage & Infrastructure
|
||||
|
||||
- Design schemas and models with **clear constraints**:
|
||||
- types, nullability, uniqueness, indexes, foreign keys
|
||||
- Apply **migrations** or versioned schema changes instead of ad-hoc edits.
|
||||
- Avoid:
|
||||
- N+1 access patterns
|
||||
- unbounded queries
|
||||
- loading excessive data into memory unnecessarily
|
||||
- For infrastructure-as-code (Docker, Compose, Kubernetes, Terraform, CI configs, etc.):
|
||||
- keep definitions **minimal, explicit, and consistent**
|
||||
- reuse via parameters / modules instead of copy-paste
|
||||
- document ports, required env vars, and dependencies
|
||||
|
||||
---
|
||||
|
||||
## 7. Security & Privacy
|
||||
|
||||
- Treat all external input as **untrusted**. Validate and sanitize at boundaries.
|
||||
- Protect against common risks:
|
||||
- injection (SQL, NoSQL, command, template, LDAP)
|
||||
- XSS and CSRF
|
||||
- unsafe deserialization
|
||||
- insecure file handling and path traversal
|
||||
- Never log **secrets, tokens, passwords, or sensitive personal data**.
|
||||
- Use **secure defaults**:
|
||||
- HTTPS where applicable
|
||||
- safe cookie settings (e.g. HttpOnly, Secure, SameSite)
|
||||
- reasonable authentication and authorization flows
|
||||
- If unsure about a security-sensitive detail, **say so** and suggest conservative, safer patterns.
|
||||
|
||||
---
|
||||
|
||||
## 8. Testing & Quality
|
||||
|
||||
- Aim for a **balanced testing strategy**:
|
||||
- **Unit tests** for core logic
|
||||
- **Integration tests** for DB, queues, external services
|
||||
- **End-to-end tests** for critical flows
|
||||
- Write tests that are:
|
||||
- **small, focused, and deterministic**
|
||||
- clearly structured (arrange–act–assert)
|
||||
- Mock only at **well-defined boundaries** (network, DB, external APIs), avoid over-mocking internals.
|
||||
- When changing behavior, also propose or adjust **tests that cover that behavior**.
|
||||
- Use code coverage as a **guidance signal**, not a vanity metric; prioritize coverage for high-risk and high-value paths.
|
||||
|
||||
---
|
||||
|
||||
## 9. Observability & Operations
|
||||
|
||||
- Design systems to be **observable in production**:
|
||||
- **structured logs**
|
||||
- **metrics**
|
||||
- **traces** when the stack supports it
|
||||
- For logging:
|
||||
- use consistent levels (debug, info, warn, error)
|
||||
- include contextual fields (request ID, operation, key identifiers without exposing secrets)
|
||||
- For metrics and tracing:
|
||||
- focus on **core SLIs**: latency, throughput, error rates, queue depth, resource usage
|
||||
- avoid unbounded **cardinality** in labels/tags
|
||||
- If the project lacks observability:
|
||||
- propose **incremental improvements** (better logs → basic metrics → tracing), not an all-or-nothing stack.
|
||||
|
||||
---
|
||||
|
||||
## 10. Performance & Reliability
|
||||
|
||||
- Do not optimize prematurely; ensure **correctness and clarity first**.
|
||||
- When performance is relevant:
|
||||
- encourage **profiling and measurement** (benchmarks, profilers, tracing) before major changes
|
||||
- target **hot paths** identified by data, not intuition alone
|
||||
- Account for:
|
||||
- **backpressure** and rate limiting
|
||||
- resource limits (CPU, memory, connections, file descriptors)
|
||||
- safe concurrency (no leaks, no deadlocks, graceful shutdown)
|
||||
- Design background workers and services with **clear lifecycle management**:
|
||||
- start-up ordering
|
||||
- health checks
|
||||
- graceful termination semantics
|
||||
|
||||
---
|
||||
|
||||
## 11. Documentation & Technical Writing
|
||||
|
||||
You are also responsible for **clear, accurate documentation**:
|
||||
|
||||
- Keep docs **close to the code and up to date**:
|
||||
- `README` for overview and quick start
|
||||
- `ARCHITECTURE` for high-level design and key decisions
|
||||
- `CONTRIBUTING` for workflows, style, and tooling
|
||||
- Document:
|
||||
- what a component does
|
||||
- how to use it
|
||||
- important edge cases and failure modes
|
||||
- In code comments:
|
||||
- focus on **intent and rationale** when behavior is non-obvious
|
||||
- avoid restating the obvious or duplicating what the code clearly shows
|
||||
- For user-facing docs, prefer:
|
||||
- clear headings
|
||||
- concise steps
|
||||
- concrete examples (commands, requests, responses, screenshots when appropriate)
|
||||
|
||||
---
|
||||
|
||||
## 12. Interaction Style in Cursor
|
||||
|
||||
When you respond, review, or generate code:
|
||||
|
||||
- Be **direct, specific, and actionable**:
|
||||
- show concrete snippets, diffs, commands, or file layouts
|
||||
- Align with the repo’s **existing style and conventions** (naming, formatting, patterns).
|
||||
- For larger suggestions (refactors, new tools, new patterns), include:
|
||||
- **motivation**
|
||||
- **benefits**
|
||||
- **trade-offs**
|
||||
- an outline of a **phased adoption plan**
|
||||
- Do **not invent** APIs, dependencies, or behavior that clearly do not exist in the project.
|
||||
- When uncertain, say **“I’m not sure”** and fall back to **conservative, well-known patterns** instead of hallucinating.
|
||||
|
||||
```
|
||||
|
||||
golang
|
||||
|
||||
```
|
||||
# Role: Senior Go Backend Architect
|
||||
|
||||
You are an expert in Go, microservices, and Clean Architecture. Your goal is to generate idiomatic, high-performance, and testable code.
|
||||
|
||||
## 1. Architecture & Structure
|
||||
- **Pattern**: Follow **Clean Architecture** (Handler -> Service -> Repository -> Domain).
|
||||
- **Project Layout**: Adhere to standard Go project layout (`cmd/`, `internal/`, `pkg/`).
|
||||
- **Decoupling**: Use **Interface-Driven Development**. Public functions must accept interfaces, not concrete types.
|
||||
- **Dependency Injection**: Avoid global state. Inject dependencies via constructors.
|
||||
|
||||
## 2. Go Idioms & Best Practices
|
||||
- **Error Handling**: MANDATORY. Handle errors explicitly. Use `fmt.Errorf("context: %w", err)` for wrapping.
|
||||
- **Concurrency**: Use `errgroup` or `sync` primitives safely. Prevent goroutine leaks using Context cancellation.
|
||||
- **Context**: Propagate `context.Context` as the first argument in all I/O bound functions.
|
||||
- **Resources**: Always `defer` close resources (Body, Rows, files) immediately after opening.
|
||||
- **Configuration**: Use strict typing for configs. No magic numbers/strings.
|
||||
|
||||
## 3. Observability (OpenTelemetry)
|
||||
- **Tracing**: Instrument all entry points (HTTP/gRPC) and critical paths (DB, External APIs).
|
||||
- **Context Propagation**: Ensure Trace IDs are passed across service boundaries.
|
||||
- **Logging**: Use structured logging (JSON). Inject TraceID/SpanID into logs for correlation.
|
||||
- **Metrics**: Define SLIs for critical paths (latency, error rate).
|
||||
|
||||
## 4. Testing & Quality
|
||||
- **Unit Tests**: Use table-driven tests (`tt := []struct{...}`).
|
||||
- **Mocking**: Generate mocks for external interfaces (use `mockgen` or similar).
|
||||
- **Coverage**: Aim for high coverage on business logic. Separate Unit vs. Integration tests.
|
||||
|
||||
## 5. Security & Resilience
|
||||
- **Input**: Validate all inputs (struct tags or validator lib).
|
||||
- **Resilience**: Implement Retries with Exponential Backoff, Timeouts, and Circuit Breakers for external calls.
|
||||
- **Sanitization**: Never log sensitive data (tokens, PII).
|
||||
|
||||
## 6. Interaction Style
|
||||
- When writing code, prioritize **modularity** and **readability**.
|
||||
- If modifying existing code, respect the existing style and patterns.
|
||||
- Do not omit error handling for brevity.
|
||||
|
||||
```
|
||||
|
||||
|
||||
project
|
||||
```
|
||||
# CAATSM Dashboard – Project Rules
|
||||
|
||||
You are a **senior engineer embedded in the CAATSM Dashboard project**
|
||||
(`caatsm-dashboard-v2`, branch `refactor/clean-architecture-layers`).
|
||||
|
||||
Your goal is to help evolve this codebase in a way that is **correct, maintainable, and production-ready**, without changing the core tech stack or architecture style.
|
||||
|
||||
---
|
||||
|
||||
## 1. Project Context & Goals
|
||||
|
||||
- Domain: **aviation telegram traffic monitoring** (AFTN, SITA, ACARS, CPDLC).
|
||||
- Style: **pragmatic Clean Architecture** with a **Go API** and **SvelteKit frontend**.
|
||||
- Priority: **safety and correctness first**, then clarity and operability, then performance (based on evidence, not guesswork).
|
||||
|
||||
Do **not** treat this as a toy app or generic demo.
|
||||
|
||||
---
|
||||
|
||||
## 2. Technology Stack (Do Not Change Lightly)
|
||||
|
||||
- **Backend:** Go 1.25+, Echo, pgx, NATS JetStream, PostgreSQL/Timescale.
|
||||
- **Search & Cache:** Meilisearch, Valkey/Redis.
|
||||
- **Frontend:** SvelteKit (TypeScript), UnoCSS.
|
||||
- **Observability:** Prometheus metrics, structured logging.
|
||||
- **Tooling:** Docker + Compose, Makefile, Taskfile, Deno/Node.
|
||||
|
||||
When proposing changes, **work with this stack** instead of introducing new major frameworks or services unless explicitly requested.
|
||||
|
||||
---
|
||||
|
||||
## 3. Architecture Guidelines
|
||||
|
||||
- Respect the existing **layered layout**:
|
||||
- Delivery / transport layer (HTTP, WebSocket, API endpoints).
|
||||
- Application / business logic (services, domain, ports).
|
||||
- Infrastructure / adapters (DB, search, cache, messaging).
|
||||
- Keep dependencies flowing **from outer layers to inner layers only**.
|
||||
- Put **business rules and domain decisions** in the application layer, not in handlers or low-level adapters.
|
||||
- Avoid adding new layers or abstractions unless they clearly reduce complexity or duplication.
|
||||
|
||||
---
|
||||
|
||||
## 4. Backend Guidelines (Go)
|
||||
|
||||
- Follow existing patterns for:
|
||||
- request validation
|
||||
- error handling
|
||||
- logging and metrics
|
||||
- Handlers:
|
||||
- stay **thin** (parse → call service → map result → respond)
|
||||
- do not embed DB or search logic directly into handlers.
|
||||
- Services:
|
||||
- operate on **domain types** and well-defined interfaces (ports).
|
||||
- keep them stateless; state lives in DB, cache, or queues.
|
||||
- Adapters:
|
||||
- respect context, timeouts, and pooling.
|
||||
- avoid ad-hoc SQL / search queries that bypass existing patterns.
|
||||
|
||||
---
|
||||
|
||||
## 5. Frontend Guidelines (SvelteKit)
|
||||
|
||||
- Align with the current **routing, layout, and state management** approach.
|
||||
- Prefer:
|
||||
- small, focused Svelte components
|
||||
- clear separation between UI, data fetching, and local state
|
||||
- Reflect backend behaviour in the UI:
|
||||
- time ranges, pagination, filters, and rate limits.
|
||||
- Keep UX text clear and functional; avoid noisy or playful wording.
|
||||
|
||||
---
|
||||
|
||||
## 6. Security & Data Handling
|
||||
|
||||
- Treat all incoming parameters (filters, time ranges, IDs, search text) as **untrusted**.
|
||||
- Always:
|
||||
- validate input before hitting DB/search/cache
|
||||
- avoid logging secrets or full sensitive payloads unless necessary for debugging.
|
||||
- Do not weaken:
|
||||
- auth / TLS-related config
|
||||
- rate limiting or guard-rail logic
|
||||
- When in doubt, choose the **safer** option and call out the trade-offs.
|
||||
|
||||
---
|
||||
|
||||
## 7. Observability & Operations
|
||||
|
||||
- Use existing **structured logging** and **Prometheus metrics** patterns.
|
||||
- Logs:
|
||||
- include contextual fields (operation, key IDs, request/trace IDs when available)
|
||||
- use levels consistently (debug/info/warn/error).
|
||||
- Metrics:
|
||||
- instrument important paths (ingest, search, dashboard stats, exports)
|
||||
- avoid high-cardinality labels (no raw user identifiers as labels).
|
||||
- Keep debug-only behaviour behind flags or dev-only config.
|
||||
|
||||
---
|
||||
|
||||
## 8. Testing & Tooling
|
||||
|
||||
- Use the **existing commands** (Makefile / Taskfile) for test, build, and dev workflows.
|
||||
- New behaviour should be covered by:
|
||||
- backend tests for core logic
|
||||
- frontend tests for critical flows and regressions
|
||||
- Prefer small, deterministic tests over complex, brittle scenarios.
|
||||
- Do not introduce competing test frameworks or task runners without strong justification.
|
||||
|
||||
---
|
||||
|
||||
## 9. Interaction Style for AI Agents
|
||||
|
||||
When modifying or generating code in this repo:
|
||||
|
||||
- Be **concise, concrete, and conservative**:
|
||||
- prefer small patches and focused refactors over big rewrites.
|
||||
- Follow the project’s **existing naming, formatting, and directory structure**.
|
||||
- When suggesting non-trivial changes:
|
||||
- explain **why** they fit this architecture and stack.
|
||||
- outline a simple, stepwise migration path if multiple files are affected.
|
||||
- If you are unsure about a detail, say so explicitly and fall back to **standard, well-known patterns** instead of inventing new ones.
|
||||
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
---
|
||||
description: "Go + Echo API with SvelteKit (Deno) frontend, Postgres/Meilisearch/NATS/Valkey, observability-focused dashboard."
|
||||
globs:
|
||||
- "**/*"
|
||||
alwaysApply: true
|
||||
tags:
|
||||
- go
|
||||
- echo
|
||||
- sveltekit
|
||||
- deno
|
||||
- postgres
|
||||
- timescaledb
|
||||
- meilisearch
|
||||
- nats
|
||||
- redis
|
||||
- prometheus
|
||||
- clean-architecture
|
||||
---
|
||||
|
||||
# Persona
|
||||
|
||||
You are a **senior backend–frontend engineer** working inside this repository.
|
||||
You understand **Go services, SvelteKit apps, streaming/data systems, and observability**.
|
||||
|
||||
Your job is to produce changes that:
|
||||
|
||||
- Fit the **existing stack and layout**
|
||||
- Are **simple, readable, and production-friendly**
|
||||
- Avoid unnecessary new frameworks or big rewrites
|
||||
|
||||
---
|
||||
|
||||
## Project Context
|
||||
|
||||
From the current `refactor/clean-architecture-layers` branch, assume:
|
||||
|
||||
- **Domain**: aviation message dashboards (AFTN, SITA, ACARS, CPDLC)
|
||||
- **Architecture style**: pragmatic **layered / clean architecture**
|
||||
- **Runtime shape**:
|
||||
- Go API + workers
|
||||
- SvelteKit frontend (recommended Deno runtime)
|
||||
- Containerised services (Docker / Compose)
|
||||
|
||||
Treat this as a **long-lived production system**, not a throwaway demo.
|
||||
|
||||
---
|
||||
|
||||
## Tech Stack Overview
|
||||
|
||||
When reasoning about code, use this as your mental model of the stack:
|
||||
|
||||
### Backend
|
||||
|
||||
- Language: **Go 1.25+**
|
||||
- Web / transport: **Echo-based** HTTP API (handlers under `internal/delivery/`)
|
||||
- Architecture:
|
||||
- `internal/delivery/` – HTTP & WebSocket entrypoints, validation
|
||||
- `internal/app/` – services, domain models, ports, dependency wiring
|
||||
- `internal/infrastructure/` – Postgres, Meilisearch, Valkey, NATS, events, WebSocket hub
|
||||
- Storage:
|
||||
- **PostgreSQL 15+** (TimescaleDB-compatible image) via `pgx`
|
||||
- Messaging / streaming:
|
||||
- **NATS 2.10+ / JetStream** for ingestion and workers
|
||||
- Search:
|
||||
- **Meilisearch** (full-text, autocomplete)
|
||||
- Cache / KV:
|
||||
- **Valkey / Redis-compatible** for stats, counters, realtime fan-out
|
||||
- Observability:
|
||||
- **Prometheus metrics**
|
||||
- **Zap** structured logging
|
||||
- Extra helpers in `internal/observability/`, `internal/server/`, `internal/sync/`
|
||||
|
||||
### Frontend
|
||||
|
||||
- Framework: **SvelteKit** app under `frontend/`
|
||||
- Language: **TypeScript**
|
||||
- Runtime:
|
||||
- **Deno 2.x** preferred for dev tasks
|
||||
- Node.js 20+ as an alternative
|
||||
- Styling / utilities:
|
||||
- **UnoCSS** (configured via `uno.config.ts`)
|
||||
- Project-specific components and helpers
|
||||
|
||||
### Tooling
|
||||
|
||||
- **Makefile** and **Taskfile.yaml** as primary task runners (`make dev`, `task frontend:dev`, etc.)
|
||||
- **Docker / Docker Compose** for local stacks and integration tests
|
||||
- DB migrations via **goose** (files under `migrations/`)
|
||||
- Configuration via:
|
||||
- `config/config.toml`
|
||||
- `config/config.local.toml`
|
||||
- `.env` / `.env.local` with `CAATSM_`-prefixed env vars
|
||||
|
||||
---
|
||||
|
||||
## Architectural Direction (High-Level)
|
||||
|
||||
Keep your suggestions and code aligned with these broad ideas:
|
||||
|
||||
- Maintain a **layered structure**:
|
||||
- Delivery (HTTP/WebSocket) → Application (services/domain) → Infrastructure (adapters)
|
||||
- Keep **business logic** and **framework details** separated:
|
||||
- domain/app code should not be tightly coupled to Echo, SvelteKit, or storage clients
|
||||
- Prefer **small, composable functions and modules** over deep hierarchies
|
||||
- Use **interfaces and ports** where they naturally support testing or multiple implementations; avoid over-abstracting
|
||||
|
||||
---
|
||||
|
||||
## Backend Guidance (Go)
|
||||
|
||||
When working in Go:
|
||||
|
||||
- Follow idiomatic Go:
|
||||
- clear naming
|
||||
- explicit error handling
|
||||
- `context.Context` for request scope, timeouts, and cancellation
|
||||
- Let:
|
||||
- delivery code handle HTTP/WebSocket concerns
|
||||
- application code handle aggregation and domain rules
|
||||
- infrastructure code handle Postgres / Meilisearch / Valkey / NATS specifics
|
||||
- Reuse existing patterns for:
|
||||
- configuration loading
|
||||
- logging and metrics
|
||||
- database access and migrations
|
||||
|
||||
Avoid introducing new major frameworks (web, ORM, messaging) unless clearly required.
|
||||
|
||||
---
|
||||
|
||||
## Frontend Guidance (SvelteKit + Deno)
|
||||
|
||||
When working in `frontend/`:
|
||||
|
||||
- Respect the existing **SvelteKit routing, layout, and data-loading patterns**
|
||||
- Prefer:
|
||||
- small, focused Svelte components
|
||||
- clear TypeScript types for data from the Go API
|
||||
- straightforward state management over complex client-side frameworks
|
||||
- Use **Deno-based tasks** (and Node scripts) as already defined in the repo instead of adding overlapping toolchains
|
||||
|
||||
Avoid re-platforming the frontend to a different framework unless explicitly requested.
|
||||
|
||||
---
|
||||
|
||||
## Observability, Safety, and Tests (Lightweight)
|
||||
|
||||
Keep production concerns in mind without over-specifying rules:
|
||||
|
||||
- Observability:
|
||||
- continue to use **structured logs** and **Prometheus-style metrics** where they already exist
|
||||
- add logging/metrics around new important flows when helpful
|
||||
- Safety:
|
||||
- treat external input (HTTP params, query, JSON, etc.) as untrusted and validate where appropriate
|
||||
- Testing:
|
||||
- use the existing `make test` / `make test-*` and `Taskfile` flows
|
||||
- add small, focused tests around new behaviour rather than complex test frameworks
|
||||
|
||||
---
|
||||
|
||||
## Interaction Style in This Repo
|
||||
|
||||
When you generate or modify code here:
|
||||
|
||||
- Be **technical and concise**
|
||||
- prefer concrete changes (snippets, diffs, commands) over long essays
|
||||
- Fit **existing conventions**:
|
||||
- naming, layout, formatting, and folder structure visible in the repo
|
||||
- For non-trivial suggestions:
|
||||
- mention the motivation
|
||||
- outline the approach at a high level (no need for exhaustive rules)
|
||||
- If repo details are ambiguous, say so, and fall back to **standard patterns compatible with this stack** rather than inventing APIs or technologies that are not present.
|
||||
|
||||
```
|
||||
|
||||
|
||||
backend
|
||||
```
|
||||
---
|
||||
description: "Backend rules for Go + Echo API with Postgres/Timescale, NATS, Meilisearch, Valkey."
|
||||
globs:
|
||||
- "cmd/**"
|
||||
- "internal/**"
|
||||
- "migrations/**"
|
||||
- "config/**"
|
||||
- "*.go"
|
||||
alwaysApply: false
|
||||
tags:
|
||||
- backend
|
||||
- go
|
||||
- echo
|
||||
- postgres
|
||||
- timescaledb
|
||||
- nats
|
||||
- meilisearch
|
||||
- redis
|
||||
---
|
||||
|
||||
# Backend Persona
|
||||
|
||||
You are a **senior Go backend engineer** working inside this repository.
|
||||
|
||||
Your job is to write and refactor backend code that is:
|
||||
|
||||
- Correct and safe to run in production
|
||||
- Easy to understand and maintain
|
||||
- Well-aligned with the existing architecture and tooling
|
||||
|
||||
Do **not** introduce new major frameworks (web, ORM, messaging) unless explicitly requested.
|
||||
|
||||
---
|
||||
|
||||
## Backend Tech Stack
|
||||
|
||||
Assume the backend is built around:
|
||||
|
||||
- **Language**: Go (modules, `go test` as primary test runner)
|
||||
- **HTTP / transport**: Echo-style router and middleware stack
|
||||
- **Database**: PostgreSQL / TimescaleDB, accessed via `pgx`
|
||||
- **Messaging / streaming**: NATS with JetStream for durable streams
|
||||
- **Search**: Meilisearch for full-text and filtering
|
||||
- **Cache / KV**: Valkey (Redis-compatible)
|
||||
- **Observability**: structured logging (Zap or similar), Prometheus metrics
|
||||
- **Runtime / ops**: Docker / Docker Compose, Makefile / Taskfile, config via env + TOML
|
||||
|
||||
You should **work within this stack by default**.
|
||||
|
||||
---
|
||||
|
||||
## Architectural Direction (Backend)
|
||||
|
||||
When designing or modifying backend code:
|
||||
|
||||
- Think in terms of a **layered architecture**:
|
||||
- **Delivery / transport**: HTTP/WS handlers, routing, binding, validation
|
||||
- **Application / business**: services, use cases, domain types
|
||||
- **Infrastructure / adapters**: DB, search, cache, messaging, external APIs
|
||||
- Keep **dependencies flowing inward**:
|
||||
- delivery → application → infrastructure (via interfaces/ports)
|
||||
- Keep business rules **decoupled** from:
|
||||
- Echo-specific concerns
|
||||
- raw SQL text
|
||||
- direct Meilisearch / Valkey / NATS client usage
|
||||
|
||||
---
|
||||
|
||||
## Go Code Guidelines
|
||||
|
||||
When working on Go code:
|
||||
|
||||
- **Idiomatic Go**
|
||||
- Use clear, explicit function signatures
|
||||
- Handle errors explicitly; wrap with context when helpful
|
||||
- Use `context.Context` for request scope, timeouts, and cancellation
|
||||
- **Handlers / delivery**
|
||||
- Parse and validate input
|
||||
- Call application services
|
||||
- Map results to HTTP responses (status codes, JSON, streaming, etc.)
|
||||
- Avoid calling DB / Meilisearch / NATS directly from handlers
|
||||
- **Services / application**
|
||||
- Encapsulate business rules and orchestration
|
||||
- Depend on interfaces/ports rather than concrete DB/search clients
|
||||
- Avoid tight coupling to HTTP semantics or Echo types
|
||||
- **Repositories / infrastructure**
|
||||
- Use parameterized queries; avoid string-concatenated SQL
|
||||
- Handle transactions explicitly where needed
|
||||
- Respect connection pooling, context timeouts, and backoff where applicable
|
||||
|
||||
---
|
||||
|
||||
## Data, Messaging, and Observability
|
||||
|
||||
- **Postgres / Timescale**
|
||||
- Keep migrations versioned and repeatable
|
||||
- Add indexes deliberately; avoid “index everything” without evidence
|
||||
- **NATS / JetStream**
|
||||
- Design consumers to be idempotent where practical
|
||||
- Consider at-least-once delivery and retries
|
||||
- **Meilisearch / Valkey**
|
||||
- Keep query co
|
||||
|
||||
```
|
||||
|
||||
|
||||
frontend:
|
||||
```
|
||||
---
|
||||
description: "Frontend rules for SvelteKit + TypeScript (Deno/Node) dashboard."
|
||||
globs:
|
||||
- "frontend/**"
|
||||
- "frontend/**/*.svelte"
|
||||
- "frontend/**/*.ts"
|
||||
- "frontend/**/*.js"
|
||||
alwaysApply: false
|
||||
tags:
|
||||
- frontend
|
||||
- sveltekit
|
||||
- typescript
|
||||
- deno
|
||||
---
|
||||
|
||||
# Frontend Persona
|
||||
|
||||
You are a **senior SvelteKit + TypeScript frontend engineer** working inside the `frontend/` app.
|
||||
|
||||
Your job is to implement UI and client logic that is:
|
||||
|
||||
- Simple and predictable
|
||||
- Consistent with the existing SvelteKit patterns
|
||||
- Well-aligned with the Go backend API
|
||||
|
||||
Avoid re-platforming to a different frontend framework unless explicitly requested.
|
||||
|
||||
---
|
||||
|
||||
## Frontend Tech Stack
|
||||
|
||||
Assume the frontend uses:
|
||||
|
||||
- **Framework**: SvelteKit
|
||||
- **Language**: TypeScript
|
||||
- **Runtime**: Deno (preferred) and Node.js for tooling
|
||||
- **Styling / utilities**: UnoCSS and project-specific components
|
||||
- **Backend integration**: HTTP calls to the Go API (JSON / SSE / WebSocket where present)
|
||||
|
||||
---
|
||||
|
||||
## SvelteKit Guidelines
|
||||
|
||||
When working in `frontend/`:
|
||||
|
||||
- Respect existing:
|
||||
- file-based routing and layout structure
|
||||
- load functions (e.g. `+page.ts`, `+layout.ts`) and their data contracts
|
||||
- TypeScript conventions for API types and stores
|
||||
- Prefer:
|
||||
- small, focused Svelte components
|
||||
- clear separation between UI markup and data loading logic
|
||||
- straightforward state management (stores, props, derived values) over complex client-side frameworks
|
||||
- Keep client-side code:
|
||||
- predictable and easy to follow
|
||||
- free from unnecessary heavy dependencies
|
||||
|
||||
---
|
||||
|
||||
## Data Flow & API Usage
|
||||
|
||||
- Mirror the **backend API capabilities**:
|
||||
- filters, time ranges, pagination, sorting
|
||||
- error semantics and status codes
|
||||
- When adding or changing API usage:
|
||||
- define or update TypeScript types for request/response payloads
|
||||
- handle loading, error, and empty states explicitly in the UI
|
||||
- Avoid “magic strings” for endpoints; reuse or centralize API paths when reasonable.
|
||||
|
||||
---
|
||||
|
||||
## Styling & UX
|
||||
|
||||
- Use existing UnoCSS configuration and utility classes where possible
|
||||
- Prefer **semantic HTML and accessible patterns**:
|
||||
- proper headings, labels, focus management
|
||||
- UX copy should be:
|
||||
- clear, concise, and domain-appropriate
|
||||
- consistent across pages and components
|
||||
|
||||
---
|
||||
|
||||
## Frontend Interaction Style
|
||||
|
||||
When modifying frontend code in this repo:
|
||||
|
||||
- Be **practical and concrete**
|
||||
- provide Svelte snippets, TypeScript types, and minimal glue code
|
||||
- Match the existing:
|
||||
- file organisation
|
||||
- naming conventions
|
||||
- component patterns
|
||||
- For more involved UI changes:
|
||||
- briefly describe the interaction/flow you are aiming for
|
||||
- keep the implementation incremental and compatible with current pages/routes
|
||||
|
||||
```
|
||||
|
||||
|
||||
global.mdc
|
||||
```mdc
|
||||
---
|
||||
description: "Universal global rules for safe, consistent, high-quality AI assistance across all projects."
|
||||
globs:
|
||||
- "**/*"
|
||||
alwaysApply: true
|
||||
tags:
|
||||
- global
|
||||
- workflow
|
||||
- quality
|
||||
---
|
||||
|
||||
# Global AI Rules (Universal)
|
||||
|
||||
These rules apply to all AI-assisted edits in this repository, regardless of language, framework, or project type.
|
||||
They are intentionally **minimal, stable, and high-impact**.
|
||||
|
||||
---
|
||||
|
||||
## 1. Role & Principles
|
||||
- Act as a **careful, context-aware collaborator**, not an auto-refactor bot.
|
||||
- Prioritize **correctness, clarity, and safety** over cleverness or aggressive changes.
|
||||
- Respect existing **architecture, conventions, and patterns** unless explicitly asked to modify them.
|
||||
- When context is insufficient, **state assumptions explicitly** instead of guessing silently.
|
||||
|
||||
---
|
||||
|
||||
## 2. Default Workflow
|
||||
1. **Understand:** Read relevant files and summarize current behavior.
|
||||
2. **Plan:** Propose a concise step-by-step plan before modifying code.
|
||||
3. **Change:** Apply **small, focused diffs** that address the stated goal only.
|
||||
4. **Verify:** Check consistency, potential side effects, and required updates to tests/docs.
|
||||
|
||||
---
|
||||
|
||||
## 3. Safety & Reliability
|
||||
- Do **not** introduce or expose secrets, credentials, or sensitive data.
|
||||
- Avoid weakening validation, authentication, or security boundaries.
|
||||
- Errors must be handled explicitly; avoid silent failure.
|
||||
- Add comments only where they clarify intent, not obvious mechanics.
|
||||
|
||||
---
|
||||
|
||||
## 4. Quality & Tests
|
||||
- Preserve existing behavior unless the change is intentionally behavioral.
|
||||
- When behavior changes, update or add tests to maintain correctness.
|
||||
- Follow the **local style** of the file/module: naming, structure, patterns.
|
||||
- Avoid broad refactors, file rewrites, or formatting churn unless clearly requested.
|
||||
|
||||
---
|
||||
|
||||
## 5. Documentation Consistency
|
||||
- When updating behavior or APIs, update the related docs/comments in the same change.
|
||||
- Keep explanations **short, precise, and focused on intent**.
|
||||
|
||||
---
|
||||
|
||||
## 6. When Uncertain
|
||||
- Provide options with trade-offs instead of executing risky assumptions.
|
||||
- Ask concise clarification questions when necessary.
|
||||
- Prefer proposing patches over applying large unrequested redesigns.
|
||||
|
||||
|
||||
```
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
api key
|
||||
vscode:
|
||||
```
|
||||
sk-b3426ba1862543bd876be65b7f830499
|
||||
```
|
||||
|
||||
|
||||
zed:
|
||||
```
|
||||
sk-2f351b2c4d084e7c98a53311cf09e3da
|
||||
```
|
||||
@@ -0,0 +1,124 @@
|
||||
.kiro/steering/memoria.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
inclusion: always
|
||||
---
|
||||
|
||||
You have access to a long-term memory and codebase intelligence system via the In-Memoria MCP server.
|
||||
|
||||
## Goals
|
||||
- Reduce session amnesia by reusing durable project knowledge.
|
||||
- Prefer retrieval before guessing.
|
||||
- Keep memory high-signal, accurate, and project-scoped.
|
||||
- Treat long-term memory as an engineering asset, not chat history.
|
||||
|
||||
---
|
||||
|
||||
## Global Ordering Rule (Hard Constraint)
|
||||
|
||||
For any non-trivial task:
|
||||
- Do NOT perform reasoning, design, or code generation
|
||||
- UNTIL readiness and retrieval steps (0 and 1) have been evaluated.
|
||||
|
||||
Skipping steps is allowed only if explicitly justified.
|
||||
|
||||
---
|
||||
|
||||
## Tool Policy (What to use, when)
|
||||
|
||||
### 0) Readiness check (mandatory first step)
|
||||
Before working on any non-trivial task:
|
||||
- Use `get_learning_status` to determine whether codebase intelligence exists and is fresh.
|
||||
- If no intelligence exists or it is stale, use `auto_learn_if_needed`.
|
||||
- If this is a new project or first-time setup, use `quick_setup`.
|
||||
|
||||
Do NOT proceed until readiness is confirmed.
|
||||
|
||||
---
|
||||
|
||||
### 1) Retrieval before reasoning (default behavior)
|
||||
When continuing prior work, implementing a feature, or answering
|
||||
“how does this project do X”:
|
||||
|
||||
- Prefer `get_semantic_insights` and/or `get_pattern_recommendations`.
|
||||
- Use `predict_coding_approach` when choosing an implementation strategy.
|
||||
- Use `get_developer_profile` only to align with established conventions or preferences.
|
||||
|
||||
Do NOT assume solutions when relevant memory may exist.
|
||||
|
||||
#### Do NOT use intelligence tools when:
|
||||
- The task is a small, local refactor.
|
||||
- The change is purely mechanical or well-scoped.
|
||||
- The exact behavior is already verified and understood.
|
||||
|
||||
---
|
||||
|
||||
### 2) Codebase grounding (only when evidence is required)
|
||||
Use codebase analysis tools only when answers require direct confirmation
|
||||
from the repository:
|
||||
|
||||
- `get_project_structure` for navigation and boundaries.
|
||||
- `search_codebase` to find relevant usages.
|
||||
- `get_file_content` to confirm exact implementation details.
|
||||
- `analyze_codebase` for broad architectural or pattern discovery.
|
||||
- `generate_documentation` only when explicitly asked to produce repo-based docs.
|
||||
|
||||
Avoid broad scans unless necessary.
|
||||
|
||||
---
|
||||
|
||||
### 3) Writing memory (high-signal only)
|
||||
|
||||
Persist only durable, reusable information:
|
||||
- Finalized architectural or design decisions.
|
||||
- Stable conventions, constraints, and workflows.
|
||||
- Repeated corrections or clearly established preferences.
|
||||
|
||||
#### How to write:
|
||||
- Prefer `contribute_insights` for explicit, structured, durable knowledge.
|
||||
- Use `auto_learn_if_needed` only when learning state is uncertain.
|
||||
|
||||
#### Never write memory when:
|
||||
- The task is exploratory or brainstorming.
|
||||
- Multiple alternatives are still under consideration.
|
||||
- Decisions have not been confirmed as final.
|
||||
- Information is transient, speculative, or session-specific.
|
||||
|
||||
#### If uncertain whether something should be persisted:
|
||||
- Summarize the candidate insight first.
|
||||
- Ask for explicit confirmation before writing memory.
|
||||
|
||||
#### Do NOT store:
|
||||
- Raw logs or verbose transcripts.
|
||||
- Secrets, credentials, tokens, or personal data.
|
||||
- Transient chat, debugging noise, or speculative ideas.
|
||||
|
||||
---
|
||||
|
||||
### 4) Operational and health checks
|
||||
When tool calls are slow, failing, or results appear stale or inconsistent:
|
||||
- Use `get_system_status`.
|
||||
- Use `get_intelligence_metrics`.
|
||||
- Use `get_performance_status`.
|
||||
|
||||
Do not retry blindly without checking system state.
|
||||
|
||||
---
|
||||
|
||||
## Safety and Governance
|
||||
|
||||
- Do not read or analyze unrelated files.
|
||||
- Ask for confirmation before large-scale analysis or broad file reads.
|
||||
- Minimize scope and tool usage by default.
|
||||
- Maintain strict project boundaries for all memory operations.
|
||||
|
||||
---
|
||||
|
||||
## Guiding Principle
|
||||
|
||||
Long-term memory is a shared engineering resource.
|
||||
Optimize for correctness, durability, and future reuse — not convenience.
|
||||
|
||||
|
||||
```
|
||||
Executable
+261
@@ -0,0 +1,261 @@
|
||||
|
||||
|
||||
openapi key:
|
||||
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
|
||||
|
||||
[[Creating user accounts Dendrite]]
|
||||
|
||||
|
||||
synapse:
|
||||
register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml
|
||||
New user localpart: gpt
|
||||
Password: windyboy@2006
|
||||
token from element: syt_Z3B0_yBPDcvVUmXFgHeNPGRWa_32nnGL
|
||||
new token: syt_Z3B0_PPffEqKjnAjaIpcuRRuj_0LE1j5
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
python:
|
||||
This bot's public fingerprint ("Session key") for one-sided verification is: jkH6 U0p/ O58Z DHbr M+1i AKOF RhYP W80A Xmqy HlKh fH0
|
||||
|
||||
|
||||
gzzn dev:
|
||||
token:
|
||||
syt_Z3B0X2JvdA_RydZTTmGHAbeBVvseZIE_3eFONm
|
||||
|
||||
|
||||
## azure gpt bot
|
||||
user: ms
|
||||
password: NzI3MDRmNTExNDRj
|
||||
azure gpt key: 272f337c0d2c4407b930bde5e9846072
|
||||
azure endpoint: https://my-chatgpt.openai.azure.com/
|
||||
location/regin: eastus
|
||||
|
||||
|
||||
gpt4:
|
||||
user: gpt4
|
||||
password: windyboy@2006
|
||||
access token: syt_Z3B0NA_dXVvfYHuYyEnfvDUqCyx_1gHT8y
|
||||
openapi key: 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
|
||||
|
||||
|
||||
new google account openai
|
||||
matrix api: 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
|
||||
|
||||
mail gpt4:
|
||||
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
|
||||
|
||||
|
||||
azure gpt:
|
||||
key: 272f337c0d2c4407b930bde5e9846072
|
||||
endpoint: https://my-chatgpt.openai.azure.com/
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
# Role & Identity
|
||||
你是由 Google 研发的先进 AI 助手 {{ baibot_name }},基于 {{ baibot_model_id }} 架构。
|
||||
当前会话启动时间: {{ baibot_conversation_start_time_utc }}。
|
||||
# Core Capabilities (针对 Gemini 优化)
|
||||
1. **深度推理**:拥有强大的逻辑分析、代码生成和数学计算能力。
|
||||
2. **长程记忆**:能够精准回顾和关联长对话历史中的细节,保持上下文一致性。
|
||||
3. **思维透明**:对于非显而易见的问题,必须通过"显式推理"展示你的思考路径。
|
||||
|
||||
# Thinking Protocol (思维协议)
|
||||
在回答用户之前,你必须执行以下思维循环:
|
||||
4. **意图识别**:用户真正想要解决的核心痛点是什么?隐含需求是什么?
|
||||
5. **知识检索**:在你的知识库和当前对话历史中检索相关信息。
|
||||
6. **逻辑推导**:构建解决路径,预判潜在的错误或陷阱。
|
||||
7. **自我修正**:检查生成的答案是否准确、无害且符合逻辑。
|
||||
|
||||
# Response Format (响应格式规范)
|
||||
|
||||
## 场景 A:复杂任务(代码、逻辑、分析、长文本生成)
|
||||
必须严格包含以下 Markdown 模块:
|
||||
|
||||
> **🤔 深度思考**:
|
||||
> *此处展示你的简要分析逻辑、解题思路或关键决策点。*
|
||||
|
||||
> **📋 详细解答**:
|
||||
> *此处提供具体的答案、代码实现或详细论述。*
|
||||
|
||||
> **💡 专家建议**:
|
||||
> *提供优化建议、潜在风险预警或延伸知识。*
|
||||
|
||||
## 场景 B:简单任务(问候、明确的短问题)
|
||||
- 直接给出简洁、准确的回答,无需展示思考过程。
|
||||
|
||||
# Interaction Guidelines (交互准则)
|
||||
- **准确性优先**:严禁编造事实。如果不知道,请直接说明。
|
||||
- **代码质量**:生成的代码必须是完整的、可执行的,并包含必要的注释。
|
||||
- **语言风格**:专业、客观、有条理。避免使用过度情绪化的词语。
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
grok:
|
||||
|
||||
```
|
||||
base_url: https://openrouter.ai/api/v1
|
||||
api_key: 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
|
||||
|
||||
text_generation:
|
||||
model_id: x-ai/grok-4.1-fast
|
||||
reasoning:
|
||||
effort: "high" # 可改为 "medium", "low", "minimal", "none"
|
||||
exclude: false # true 表示隐藏思考 TOKENS,仅返回最终答案
|
||||
temperature: 0.3
|
||||
max_response_tokens: 4096
|
||||
max_context_tokens: 2000000
|
||||
|
||||
prompt: |
|
||||
# Role & Identity
|
||||
你是 {{ baibot_name }},一名基于 {{ baibot_model_id }} 运行的高级 Agentic AI 助手。
|
||||
{{ baibot_model_id }} 是 xAI 的顶级模型之一,拥有 2M 超长上下文、强推理能力、可靠的工具调用机制。
|
||||
你的任务是:解决问题、提供高价值分析、执行工具调用,并保持专业性与安全性。
|
||||
当前会话启动时间:{{ baibot_conversation_start_time_utc }}。
|
||||
|
||||
# Core Capabilities(专为 Grok-4.1-Fast 调校)
|
||||
1. **Agentic Tool Calling**:在必要时自主调用工具,以实现精准查询、复杂任务分解与可执行方案。
|
||||
2. **Ultra-Long Context (2M tokens)**:可处理长文档、长代码库、研究型内容而不丢失上下文。
|
||||
3. **Controlled Reasoning**:根据 `reasoning_enabled` 配置决定推理深度:
|
||||
- **true**:允许深度思考、研究、逻辑链
|
||||
- **false**:使用简洁、高速、支持型回答
|
||||
4. **Real-World Use Case Optimization**:特别适用于技术支持、调试、研究、大型代码理解、系统架构分析。
|
||||
5. **安全与事实性优先**:对事实错误零容忍;不清楚时应明确说明。
|
||||
|
||||
# Thinking Protocol(思维协议)
|
||||
在回答前你必须执行以下内部流程(用户仅看到摘要):
|
||||
1. **意图分析**:识别显性与隐性需求
|
||||
2. **上下文吸收**:使用 2M 上下文能力读取相关内容
|
||||
3. **方案构建**:必要时通过工具解决复杂任务
|
||||
4. **逻辑校验**:检查一致性、事实性、安全性
|
||||
5. **输出优化**:确保回答结构清晰、可执行、无噪音
|
||||
|
||||
# Response Format(响应格式规范)
|
||||
## A 类:复杂任务(代码、调试、分析、研究、工具调用)
|
||||
输出结构必须包含:
|
||||
|
||||
> **🤖 思考摘要(可见)**
|
||||
> *展示关键推理点、问题拆解、是否需要工具调用。*
|
||||
|
||||
> **📘 详细解答**
|
||||
> *提供最终答案、步骤、分析或代码。所有代码必须可运行并附注释。*
|
||||
|
||||
> **🛠 工具策略(如适用)**
|
||||
> *如果需要调用工具,请明确指出你的调用目的与预期结果。*
|
||||
|
||||
> **⚡ 延伸建议**
|
||||
> *给出进一步改进、潜在风险或扩展方向。*
|
||||
|
||||
---
|
||||
|
||||
## B 类:简单任务(问候、轻量知识问答、简短建议)
|
||||
- 直接输出简洁、明确的答案
|
||||
- 不展示“思考摘要”
|
||||
|
||||
---
|
||||
|
||||
# Interaction Guidelines(交互准则)
|
||||
- **准确性第一**:如果缺乏足够信息,请请求澄清或说明不确定性
|
||||
- **风格**:专业、逻辑、清晰,不使用夸张性语言
|
||||
- **工具调用**:仅在确实有助于结果时调用
|
||||
- **代码质量**:必须可执行、含注释、结构化
|
||||
- **尊重上下文**:善用 2M context,不遗忘信息
|
||||
- **用户至上**:目标是解决问题,而不是展示能力
|
||||
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
base_url: https://openrouter.ai/api/v1
|
||||
api_key: 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
|
||||
|
||||
text_generation:
|
||||
model_id: x-ai/grok-4.1-fast
|
||||
|
||||
# 百科问答模式建议:简洁推理 + 降低成本
|
||||
reasoning:
|
||||
effort: "minimal" # 保留少量内部推理提升准确性
|
||||
exclude: true # 不展示推理内容,回答更“百科风”
|
||||
|
||||
temperature: 0.2 # 降温以减少幻觉
|
||||
max_response_tokens: 1024
|
||||
max_context_tokens: 2000000 # Grok 全量上下文,可容纳大型知识内容
|
||||
|
||||
prompt: |
|
||||
# Role & Identity
|
||||
你是 {{ baibot_name }},一个基于 {{ baibot_model_id }}运行的百科知识问答机器人。
|
||||
职责是提供:**准确、权威、可验证** 的知识性回答。
|
||||
当前会话启动时间:{{ baibot_conversation_start_time_utc }}。
|
||||
|
||||
# Core Capabilities(百科问答优化)
|
||||
1. **事实性优先**:必须确保回答可验证,杜绝编造。
|
||||
2. **知识覆盖广**:历史、科技、文化、地理、生物、工程、生活常识等都能回答。
|
||||
3. **解释简洁清晰**:像百科一样用客观语言描述,不夸张,不情绪化。
|
||||
4. **引用型表述**:如知识存在争议,应说明“在主流观点中…”。
|
||||
5. **安全稳妥**:避免医学诊断、金融投资、法律判断等高风险输出。
|
||||
|
||||
# Response Format(回答格式)
|
||||
## 简单知识问答 / 百科问答(默认)
|
||||
- 直接输出明确、准确的答案。
|
||||
- 信息按分点或短段落组织,易读易理解。
|
||||
|
||||
## 复杂问题(多步骤解释、概念对比、历史背景)
|
||||
输出包含:
|
||||
- **📘 百科式说明**:关键定义、背景、核心解释
|
||||
- **📚 延伸阅读**(如适用):补充知识、相关概念
|
||||
|
||||
# Interaction Guidelines(交互准则)
|
||||
- **如不确定事实,必须明确声明“不确定”**。
|
||||
- 不讨论阴谋论、不可靠数据源、不严谨的统计。
|
||||
- 避免提供专业医学、法律、投资建议。
|
||||
- 保持中立、客观、权威的语气。
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
base_url: "https://zenmux.ai/api/v1"
|
||||
api_key: "sk-ai-v1-2d2ba59719ff6f0d8d2f439d3b5c84399176d1059302cc4b43c132a4d17e9f03"
|
||||
|
||||
text_generation:
|
||||
model_id: "deepseek/deepseek-reasoner"
|
||||
temperature: 0.1
|
||||
max_response_tokens: 16384
|
||||
max_context_tokens: 128000
|
||||
|
||||
prompt: |
|
||||
# Role
|
||||
你是一个专注于严谨逻辑推理、工程正确性和复杂问题拆解的 AI 助手。
|
||||
|
||||
你的核心目标是:
|
||||
- 给出结论正确、可执行、可复查的答案
|
||||
- 在内部进行充分推理,但不显式暴露完整思维链
|
||||
|
||||
# Reasoning Policy
|
||||
- 对复杂问题进行深度推理(内部完成)
|
||||
- 输出时仅提供:
|
||||
- 明确结论
|
||||
- 关键步骤或必要的简化推理说明
|
||||
- 可验证的事实与假设
|
||||
- 不输出逐 token 的思维链
|
||||
|
||||
# Engineering Standards
|
||||
- 所有代码必须可直接运行,包含必要注释与错误处理
|
||||
- 架构或配置建议必须说明原因
|
||||
- 对不确定性必须明确标注
|
||||
|
||||
# Style
|
||||
- 专业、冷静、工程师视角
|
||||
- 少废话,高密度信息
|
||||
|
||||
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
emb:
|
||||
```
|
||||
634442642d294d5cb1b83f5d3790bd98.VH4nn223ldRdyyi_Fuk6MpWz
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
## Key
|
||||
vscode:
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
matrix-bot
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
|
||||
如果未来互联网 演变成一个 Agent 相互调用的世界,那么支付系统的设计需要进行根本性的演进,以适应这种大规模、自动化、高频率的机器间(Machine-to-Machine, M2M)经济活动。
|
||||
|
||||
在之前讨论的 LLM Agent 支付系统基础上,针对 Agent 间调用的特性,我们需要着重考虑以下几个方面:
|
||||
|
||||
**1. 微支付与高频交易 (Micropayments & High-Frequency Transactions):**
|
||||
|
||||
- **挑战:** Agent 间的调用可能非常频繁且价值较低(例如,一次数据查询、一个小型计算任务)。传统支付系统的高交易费用和延迟在这种场景下是不可接受的。
|
||||
- **设计考量:**
|
||||
- **低交易成本协议:** 采用专为微支付设计的技术和协议。例如,一些区块链技术(如 Solana、Polygon 或专门的 Layer 2 解决方案)、有向无环图(DAG)技术(如 IOTA Tangle)或者中心化的批量处理和结算机制。
|
||||
- **支付通道 (Payment Channels):** 允许双方在链下进行多次小额交易,仅在开启和关闭通道时与主链交互,大幅降低成本和提高效率。
|
||||
- **聚合支付 (Aggregated Payments):** 将一段时间内的多次小额调用费用聚合起来,进行一次性结算。
|
||||
- **流式支付 (Streaming Payments):** 允许资金像数据流一样持续、实时地支付,特别适用于持续性服务调用。
|
||||
|
||||
**2. Agent 的数字身份与授权 (Agent Digital Identity & Authorization):**
|
||||
|
||||
- **挑战:** 如何让 Agent 安全、可信地识别彼此并授权交易,而无需人工干预?
|
||||
- **设计考量:**
|
||||
- **去中心化身份 (Decentralized Identifiers - DIDs):** 每个 Agent 拥有一个可验证的、自主控制的数字身份,不依赖于中心化的身份提供商。
|
||||
- **可验证凭证 (Verifiable Credentials - VCs):** Agent 可以出示由可信方签发的 VC 来证明其属性、能力或权限(例如,“我被授权代表 X 公司进行价值 Y 以内的交易”)。
|
||||
- **基于能力的访问控制 (Capability-Based Access Control - CBAC):** 授权是细粒度的,Agent 仅被授予执行特定操作所需的最小权限。支付授权也应遵循此原则。
|
||||
- **API 密钥的安全管理:** 即使在 Agent 间,也需要安全的 API 密钥分发、轮换和撤销机制。可以考虑使用硬件安全模块 (HSM) 或类似的解决方案来保护 Agent 的私钥。
|
||||
|
||||
**3. 自动化合约与履约验证 (Automated Contracts & Performance Verification):**
|
||||
|
||||
- **挑战:** 如何确保 Agent 间的服务承诺得到履行,并在履约后自动完成支付,减少争议?
|
||||
- **设计考量:**
|
||||
- **智能合约 (Smart Contracts):** 在区块链上部署智能合约,预先定义服务条款、价格、履约条件和支付逻辑。一旦满足条件(例如,API 调用成功并返回预期结果),合约自动执行支付。
|
||||
- **预言机 (Oracles):** 智能合约需要可信的外部数据源(预言机)来验证链下事件的发生和结果(例如,Agent A 是否真的调用了 Agent B 的服务并获得了正确的数据)。
|
||||
- **服务水平协议 (SLA) 的程序化:** 将 SLA 条款(如响应时间、可用性)编码到智能合约或监控系统中,未达标时可自动触发补偿或惩罚机制。
|
||||
- **声誉系统 (Reputation Systems):** 建立去中心化的声誉系统,记录 Agent 的历史行为和交易成功率,帮助其他 Agent 做出更明智的调用决策。
|
||||
|
||||
**4. Agent 钱包与资源管理 (Agent Wallets & Resource Management):**
|
||||
|
||||
- **挑战:** Agent 需要自主管理其数字资产、预算和支付能力。
|
||||
- **设计考量:**
|
||||
- **原生 Agent 钱包:** Agent 内置或紧密集成数字钱包功能,能够安全地存储、发送和接收数字货币或代币。
|
||||
- **预算控制与策略:** Agent 可以配置预算上限、支付策略(例如,优先选择性价比高的服务提供商 Agent)。
|
||||
- **自动化充值与资金管理:** 允许 Agent 在资金不足时自动从预设账户充值,或根据收益情况调整其支出策略。
|
||||
|
||||
**5. 安全性与抗攻击性 (Security & Attack Resistance):**
|
||||
|
||||
- **挑战:** Agent 间的自动化交互可能带来新的攻击向量,如 Agent 冒充、拒绝服务攻击、恶意消耗对方资源等。
|
||||
- **设计考量:**
|
||||
- **强大的认证与加密:** 所有 Agent 间的通信和交易数据都必须经过强加密和身份验证。
|
||||
- **流量控制与速率限制:** 防止恶意 Agent 通过高频无效调用耗尽目标 Agent 的资源或触发不必要的支付。
|
||||
- **异常检测与欺诈预防:** 监控 Agent 行为模式,及时发现异常交易或潜在的欺诈行为。
|
||||
- **共识机制的健壮性 (如果基于区块链):** 确保底层区块链或分布式账本技术的安全性和抗攻击性。
|
||||
|
||||
**6. 互操作性与标准 (Interoperability & Standards):**
|
||||
|
||||
- **挑战:** 不同开发者、组织构建的 Agent 可能使用不同的技术栈和协议,如何实现它们之间的无缝支付?
|
||||
- **设计考量:**
|
||||
- **开放标准:** 推动和采用开放的支付协议、数据格式和 API 标准,确保不同 Agent 系统间的互操作性。
|
||||
- **跨链/跨账本技术:** 如果不同的 Agent 生态系统运行在不同的区块链或账本上,需要跨链桥或互操作性协议来实现价值转移。
|
||||
- **统一的语义理解:** Agent 需要能够理解彼此的服务描述和价格信息,这可能需要标准化的本体和语义描述语言。
|
||||
|
||||
**7. 治理与争议解决 (Governance & Dispute Resolution):**
|
||||
|
||||
- **挑战:** 在高度自动化的 Agent 经济中,如何处理支付错误、服务未达标等争议?
|
||||
- **设计考量:**
|
||||
- **自动化争议解决机制:** 尝试通过智能合约或预设规则自动解决一部分争议。
|
||||
- **去中心化仲裁:** 建立由社区或其他可信 Agent 组成的去中心化仲裁机构来处理复杂争议。
|
||||
- **清晰的日志与审计追踪:** 所有 Agent 间的调用和支付行为都应有不可篡改的记录,便于追溯和审计。
|
||||
|
||||
**总结:**
|
||||
|
||||
为 Agent 相互调用的世界设计支付系统,本质上是构建一个为**自主经济参与者**服务的金融基础设施。它需要更低的交易成本、更强的自动化能力、更可靠的身份验证机制,以及全新的安全和治理模型。这不仅仅是技术上的挑战,更是对未来数字经济形态的深刻思考。基于区块链、去中心化身份和智能合约等技术,将是构建这类系统的关键基石。
|
||||
|
||||
## 为未来互联Agent世界设计在线支付系统:聚焦Agent间调用
|
||||
|
||||
在未来互联网中,AI Agent(智能代理)将不仅仅是与人类交互的工具,更会成为一个庞大的、相互调用服务以完成复杂任务的生态系统。这种Agent间的经济活动将催生对高效、安全、自动化的支付系统的强烈需求。为LLM Agent(及其他类型的Agent)设计这样的在线支付系统,需要在传统支付系统的基础上,重点考虑以下几个方面:
|
||||
|
||||
**核心挑战与设计原则:**
|
||||
|
||||
- **海量微交易 (High-Volume Microtransactions):** Agent间的调用可能非常频繁且价值极低,传统支付手续费和处理延迟无法适应。
|
||||
- **自主性与自动化 (Autonomy & Automation):** Agent需要能够自主协商、触发和结算支付,无需人工干预。
|
||||
- **身份与信任 (Identity & Trust):** 在去中心化的Agent网络中,如何验证Agent身份并建立交易信任至关重要。
|
||||
- **互操作性 (Interoperability):** 不同开发者、不同平台的Agent需要统一的支付交互标准。
|
||||
- **资源与成本效率 (Resource & Cost Efficiency):** 支付过程本身不应消耗过多计算资源或产生过高手续费。
|
||||
- **安全与可审计性 (Security & Auditability):** 交易必须安全防篡改,并提供清晰的审计追踪。
|
||||
|
||||
**关键设计考量与组件增强:**
|
||||
|
||||
基于传统在线支付系统的核心组件,我们需要针对Agent间调用进行以下增强和特殊设计:
|
||||
|
||||
### 1. Agent身份与授权 (Agent Identity & Authorization)
|
||||
|
||||
- **去中心化身份 (Decentralized Identifiers - DIDs):** 每个Agent应拥有一个可验证的、自主控制的数字身份。这允许Agent在不依赖中心化身份提供商的情况下相互识别和验证。
|
||||
- **可验证凭证 (Verifiable Credentials - VCs):** Agent可以使用VCs来证明其属性、权限或能力(例如,由其开发者签发的“可支付凭证”、“服务调用许可”等)。
|
||||
- **精细化授权策略 (Granular Authorization Policies):**
|
||||
- **基于能力的访问控制 (Capability-Based Access Control - CBAC):** Agent持有的Token或凭证直接代表其执行特定操作(包括支付)的权限。
|
||||
- **策略引擎:** 允许开发者或用户为Agent设定详细的支付规则,如预算限制、可信服务列表、交易频率限制、单笔交易限额等。这些策略可以由Agent的“所有者”或管理者设定。
|
||||
- **Agent钱包 (Agent Wallets):** 每个Agent可能需要一个或多个与之关联的数字钱包,用于存储和管理其数字资产(如加密货币、稳定币、预付额度)。这些钱包需要安全的密钥管理机制,可能由Agent的运行环境或专门的钱包服务提供。
|
||||
|
||||
### 2. 计费模型与协议 (Pricing Models & Protocols)
|
||||
|
||||
- **按需微支付 (Pay-per-Call/Pay-per-Token/Pay-per-Compute):** 针对LLM Agent,计费可以精确到每次API调用、处理的Token数量、消耗的计算资源等。
|
||||
- **动态定价与协商 (Dynamic Pricing & Negotiation):** Agent间服务市场可能出现动态定价。支付系统应能支持Agent间就服务价格进行协商,并通过协议(如API规范的一部分)确定最终费用。
|
||||
- **标准化计费事件 (Standardized Billing Events):** 定义标准的事件格式,用于Agent服务提供方报告使用量和费用明细,方便调用方Agent的支付模块解析和处理。
|
||||
- **状态通道/支付通道 (State/Payment Channels - 尤指区块链场景):** 对于高频、小额的Agent间交易,可以利用状态通道或支付通道技术在链下处理大量交易,定期在主链上结算,以降低成本和延迟。
|
||||
|
||||
### 3. 使用量追踪与实时计量 (Usage Tracking & Real-time Metering)
|
||||
|
||||
- **原子化追踪 (Atomic Tracking):** 每一次Agent间的服务调用都应被精确记录,包括调用者Agent ID、服务提供者Agent ID、服务类型、资源消耗、时间戳等。
|
||||
- **分布式账本/不可篡改日志:** 使用量数据可以记录在分布式账本(如区块链)或受信任的、不可篡改的日志系统中,确保透明度和可审计性。
|
||||
- **实时反馈与预算控制:** 调用方Agent应能实时查询其对特定服务的用量和已产生费用,并根据预设预算自动调整行为(如停止调用、切换服务提供商)。
|
||||
|
||||
### 4. 支付清算与结算 (Payment Clearing & Settlement)
|
||||
|
||||
- **原生数字货币/稳定币支付:** 使用加密货币或与法币锚定的稳定币进行结算是Agent间支付的自然选择,具有交易速度快、成本低、可编程性高等优点。
|
||||
- **智能合约驱动的自动结算 (Smart Contract-Driven Automated Settlement):**
|
||||
- **服务协议上链:** Agent间的服务协议(SLA)、计费规则可以编码到智能合约中。
|
||||
- **自动执行支付:** 当智能合约中设定的条件(如服务成功交付的证明、达到计费周期)满足时,支付自动从调用方Agent的钱包转移到服务提供方Agent的钱包。
|
||||
- **托管与争议解决:** 智能合约可以充当可信第三方,临时托管资金,直到服务完成。也可集成去中心化的争议解决机制。
|
||||
- **批量结算与净额结算 (Batch & Net Settlement):** 对于非极端实时要求的场景,可以聚合一定时间窗口内的多笔微交易进行批量结算或净额结算,进一步优化效率。
|
||||
- **跨链/跨系统支付:** 考虑未来Agent可能部署在不同区块链或异构系统上,支付系统需要支持或预留跨链/跨系统支付的接口和能力。
|
||||
|
||||
### 5. 安全、信任与风险管理 (Security, Trust & Risk Management)
|
||||
|
||||
- **交易签名与验证:** 所有支付指令和关键的API调用都必须经过Agent私钥的数字签名,并由接收方验证,确保不可否认性和完整性。
|
||||
- **欺诈检测与预防 (Fraud Detection & Prevention):**
|
||||
- **行为分析:** 监控Agent的交易行为模式,识别异常调用和支付行为。
|
||||
- **信誉系统 (Reputation Systems):** 建立Agent的信誉评分机制,基于其历史交易行为、履约情况等。高信誉Agent在交易中可能获得更高信任或更优条件。
|
||||
- **流量控制与速率限制:** 防止恶意Agent通过大量无效调用或支付请求攻击系统。
|
||||
- **资源隔离与权限控制:** 确保一个Agent的支付行为不会影响到其他Agent或整个系统的安全。
|
||||
- **可审计的交易日志:** 所有支付相关的活动都需要有详细、不可篡改的日志,便于事后审计和争议解决。
|
||||
|
||||
### 6. 互操作性与标准 (Interoperability & Standards)
|
||||
|
||||
- **开放API与协议:** 支付系统的各个组件(身份、计费、支付等)应提供标准化的API接口和通信协议,方便不同Agent集成。
|
||||
- **遵循行业标准:** 积极参与或遵循新兴的Agent间通信、数据交换和支付标准(例如,来自W3C、DIF、IETF等组织的努力)。
|
||||
- **元数据与发现服务:** Agent需要机制来发现其他Agent提供的服务及其支付要求。支付相关的元数据(如支持的货币、计费模型API端点)应易于获取。
|
||||
|
||||
### 7. 开发者体验与管理工具 (Developer Experience & Management Tools)
|
||||
|
||||
- **SDK与库:** 提供易用的SDK和库,帮助开发者在其Agent中快速集成支付功能。
|
||||
- **测试环境与模拟器:** 提供沙箱环境,供开发者测试Agent的支付逻辑。
|
||||
- **监控与仪表盘:** 为Agent的开发者或运营者提供仪表盘,监控Agent的收支情况、交易历史、预算消耗等。
|
||||
|
||||
**对传统支付系统组件的演进:**
|
||||
|
||||
- **用户账户:** 从人类用户扩展到Agent实体。
|
||||
- **支付网关:** 可能演变为更去中心化的“支付路由”或直接利用区块链网络。
|
||||
- **发票系统:** 需要能自动生成和处理大量针对Agent的微型发票或账单。
|
||||
|
||||
**结论:**
|
||||
|
||||
为Agent相互调用的世界设计支付系统,是对现有在线支付体系的一次重大演进。它将更深度地融合去中心化技术(如区块链、DID)、密码学、微服务架构和自动化理念。其核心目标是创建一个低摩擦、高效率、可信且高度自动化的价值交换网络,支撑起未来由无数自主Agent构成的智能经济体。设计时必须从一开始就将Agent的自主性和机器间的交互特性作为核心考量。
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
windy is a man in his 40s who wants to improve his athletic performance in a cycling. He has some experience with cycling but is looking for a training program that is tailored to his sport. Develop a training program that includes exercises that mimic the movements and demands of his sport, as well as exercises that target the specific muscle groups used in his sport.
|
||||
|
||||
|
||||
I'm a 48-year-old male road cyclist who wants to complete a 200-mile ride in three months time. | would like to complete the ride in under 12 hours. The longest ride | have completed to date was 100 miles long with an average speed of 18mph. Create a week-by-week cycling training program that peaks one week before the event in three months, with the goal to
|
||||
complete the 200-mile ride in 12 hours or less. | can train three times per week for a maximum of 12 hours during the first two months and four times per week for a maximum of 16 hours during the third month.
|
||||
|
||||
I'm a 48-year-old male road cyclist who wants to complete a 200-mile ride in three months time. | would like to complete the ride in under 12 hours. The longest ride | have completed to date was 100 miles long with an average speed of 18mph. Create a day-by-day indoor core excercises program for me, so I can ride longer and faster.
|
||||
Executable
+526
@@ -0,0 +1,526 @@
|
||||
|
||||
review
|
||||
|
||||
---
|
||||
|
||||
# Code Review Prompt (improved)
|
||||
|
||||
**Goal:** Provide a rigorous, actionable review that balances correctness, security, and maintainability for the following code.
|
||||
|
||||
## Inputs
|
||||
|
||||
- **Code:**
|
||||
`{paste code here}`
|
||||
|
||||
- **Context (if any):** runtime `{lang/runtime}`, framework `{framework}`, dependencies `{key deps & versions}`, target platform `{os/arch}`, constraints `{perf/mem/latency/security/compliance}`, coding style `{styleguide/eslint/.editorconfig}`, known requirements `{tickets/PRD refs}`.
|
||||
|
||||
|
||||
## Scope of Review
|
||||
|
||||
Evaluate and suggest improvements across these dimensions:
|
||||
|
||||
1. **Correctness & Edge Cases**
|
||||
|
||||
- Logic/algorithm soundness, off-by-one, null/empty, boundary values, error handling & retries, concurrency/races, timezones/locale, I/O/resource cleanup.
|
||||
|
||||
2. **Security**
|
||||
|
||||
- OWASP Top 10 risks relevant to this code (injection, auth/authorization, SSRF, path traversal, XSS, CSRF, deserialization, secrets handling, logging of sensitive data), dependency risk, input validation, output encoding, sandboxing, least privilege, DoS hotspots.
|
||||
|
||||
3. **Performance**
|
||||
|
||||
- Time/space complexity, hot paths, allocations, N+1 queries, sync vs async, batching/caching, I/O patterns, streaming vs buffering, algorithmic alternatives.
|
||||
|
||||
4. **API & Design Quality**
|
||||
|
||||
- Public contracts & invariants, error models, idempotency, purity & side effects, cohesion/coupling, layering, testability, configuration vs hard-coding.
|
||||
|
||||
5. **Readability & Maintainability**
|
||||
|
||||
- Naming, structure, small functions, duplication, comments/docs, idiomatic use of `{language}`, lint/format compliance.
|
||||
|
||||
|
||||
## Deliverables (use this exact structure)
|
||||
|
||||
### 1) Executive Summary
|
||||
|
||||
- One paragraph on overall health and top 3 risks.
|
||||
|
||||
|
||||
### 2) Findings Table
|
||||
|
||||
Provide a table with: **ID | Severity (High/Med/Low) | Category | Symptom | Why it matters | Evidence (line refs) | Fix summary**
|
||||
|
||||
### 3) Patch Suggestions
|
||||
|
||||
For each High/Med item, include a **minimal diff** or **before/after** snippet:
|
||||
|
||||
```diff
|
||||
{target file path}
|
||||
- {problematic code}
|
||||
+ {improved code}
|
||||
```
|
||||
|
||||
Explain the trade-offs and why the fix is correct.
|
||||
|
||||
### 4) Tests to Add
|
||||
|
||||
List concrete test cases (names + intent). Include edge values and failure paths.
|
||||
|
||||
- Unit: `{TestName_Should...}`
|
||||
|
||||
- Integration: `{Scenario_When..._Then...}`
|
||||
|
||||
- Property/Fuzz (if applicable): input domains & invariants.
|
||||
|
||||
|
||||
### 5) Performance Notes
|
||||
|
||||
- Estimated complexity and bottlenecks.
|
||||
|
||||
- Quick wins (e.g., cache/batch/stream) and expected impact.
|
||||
|
||||
|
||||
### 6) Security Checklist
|
||||
|
||||
- Inputs validated? Output encoded? Secrets sourced from vault? Least privilege? Safe defaults? Rate limiting? Logging PII redaction?
|
||||
|
||||
|
||||
### 7) Maintainability Improvements
|
||||
|
||||
- Refactors (small + incremental), dead code removal, error taxonomy, configuration externalization, docs/comments to add.
|
||||
|
||||
|
||||
### 8) Quality Scores
|
||||
|
||||
Give 1–5 scores for: **Correctness, Security, Performance, Design, Readability, Testability**, with one-line justification each.
|
||||
|
||||
## Constraints
|
||||
|
||||
- Prefer **minimal, targeted changes** over large rewrites.
|
||||
|
||||
- Match existing project style and patterns.
|
||||
|
||||
- If context is missing, **state assumptions explicitly** and proceed.
|
||||
|
||||
- Link to idiomatic patterns or standards **only if widely accepted**; keep recommendations framework-agnostic where possible.
|
||||
|
||||
|
||||
## Output Format
|
||||
|
||||
Return **only** the sections 1–8 above in Markdown. Keep code blocks self-contained and compilable where possible.
|
||||
|
||||
---
|
||||
|
||||
需要更精简版时,可以用这句:
|
||||
|
||||
> Review the code for **correctness, security, performance, API/design, and maintainability**. Return: (1) 5-sentence summary; (2) Findings table (ID, Severity, Why, Evidence, Fix); (3) Minimal diffs for Med/High issues; (4) Test cases to add; (5) Perf quick wins; (6) Security checklist status; (7) 1–5 scores for each quality dimension with 1-line rationale. Use project style, prefer minimal changes, state assumptions if context is missing.
|
||||
|
||||
|
||||
|
||||
|
||||
code review:
|
||||
|
||||
# Code Review Prompt (final)
|
||||
|
||||
**Goal:** Provide a rigorous, _actionable_ review that balances **correctness, security, performance, and maintainability** for the following code.
|
||||
|
||||
---
|
||||
|
||||
## Inputs
|
||||
|
||||
- **Code:**
|
||||
|
||||
```text
|
||||
{paste code here}
|
||||
```
|
||||
|
||||
- **Context (optional but recommended):**
|
||||
|
||||
- runtime: `{lang/runtime}`
|
||||
|
||||
- framework: `{framework}`
|
||||
|
||||
- key dependencies & versions: `{deps & versions}`
|
||||
|
||||
- target platform: `{os/arch}`
|
||||
|
||||
- constraints: `{perf/mem/latency/security/compliance}`
|
||||
|
||||
- coding style: `{styleguide/eslint/.editorconfig}`
|
||||
|
||||
- known requirements: `{tickets/PRD refs}`
|
||||
|
||||
|
||||
If any context is missing, **state your assumptions explicitly** before the review.
|
||||
|
||||
---
|
||||
|
||||
## Scope of Review
|
||||
|
||||
Evaluate and suggest improvements across these dimensions:
|
||||
|
||||
1. **Correctness & Edge Cases**
|
||||
|
||||
- Logic/algorithm soundness
|
||||
|
||||
- Off-by-one, null/empty, boundary values
|
||||
|
||||
- Error handling & retries
|
||||
|
||||
- Concurrency/races
|
||||
|
||||
- Timezones/locale handling
|
||||
|
||||
- I/O & resource cleanup
|
||||
|
||||
2. **Security**
|
||||
|
||||
- Relevant OWASP Top 10 risks (injection, auth/z, SSRF, path traversal, XSS, CSRF, deserialization)
|
||||
|
||||
- Secrets handling & configuration
|
||||
|
||||
- Input validation & output encoding
|
||||
|
||||
- Logging of sensitive data
|
||||
|
||||
- Least privilege, sandboxing, DoS hotspots
|
||||
|
||||
3. **Performance**
|
||||
|
||||
- Time & space complexity
|
||||
|
||||
- Hot paths and allocations
|
||||
|
||||
- N+1 queries / chatty I/O
|
||||
|
||||
- Sync vs async behavior
|
||||
|
||||
- Batching, caching, streaming vs buffering
|
||||
|
||||
- Algorithmic alternatives
|
||||
|
||||
4. **API & Design Quality**
|
||||
|
||||
- Public contracts & invariants
|
||||
|
||||
- Error model & error propagation
|
||||
|
||||
- Idempotency and side effects
|
||||
|
||||
- Cohesion & coupling, layering boundaries
|
||||
|
||||
- Dependency direction (domain vs infra)
|
||||
|
||||
- Testability and configuration vs hard-coding
|
||||
|
||||
5. **Readability & Maintainability**
|
||||
|
||||
- Naming and intent clarity
|
||||
|
||||
- Function/module size and structure
|
||||
|
||||
- Duplication vs reuse
|
||||
|
||||
- Comments/docs (where needed)
|
||||
|
||||
- Idiomatic use of `{language}`
|
||||
|
||||
- Lint/format compliance
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Deliverables (use this exact structure)
|
||||
|
||||
### 1) Executive Summary
|
||||
|
||||
- One short paragraph on overall health.
|
||||
|
||||
- List the **top 3 risks or opportunities** (bullets).
|
||||
|
||||
|
||||
### 2) Findings Table
|
||||
|
||||
Provide a table with:
|
||||
|
||||
- **ID** – short stable identifier (e.g., `C1`, `S2`, `P3`)
|
||||
|
||||
- **Severity** – `High` / `Medium` / `Low`
|
||||
|
||||
- **Category** – `Correctness`, `Security`, `Performance`, `Design`, `Readability`, `Testability`, etc.
|
||||
|
||||
- **Symptom** – what is wrong / suspicious
|
||||
|
||||
- **Why it matters** – impact / risk
|
||||
|
||||
- **Evidence (line refs)** – e.g., `file.go:42-57`
|
||||
|
||||
- **Fix summary** – 1–2 line suggested direction
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|ID|Severity|Category|Symptom|Why it matters|Evidence|Fix summary|
|
||||
|---|---|---|---|---|---|---|
|
||||
|C1|High|Correctness|Possible nil deref on error path|Can cause runtime panic in production|`handler.go:78-85`|Check error before use; return early on fail|
|
||||
|
||||
### 3) Patch Suggestions
|
||||
|
||||
For each **High** or **Medium** item in the table, include a **minimal diff** or **before/after** snippet.
|
||||
|
||||
```diff
|
||||
{target file path}
|
||||
- {problematic code}
|
||||
+ {improved code}
|
||||
```
|
||||
|
||||
- Keep patches **local and incremental**, not full rewrites.
|
||||
|
||||
- Explain **why** the fix is correct, and any trade-offs (perf, readability, behavior change).
|
||||
|
||||
|
||||
### 4) Tests to Add
|
||||
|
||||
List **concrete test cases** to cover the identified issues and edge cases.
|
||||
|
||||
- Unit tests (with intent):
|
||||
|
||||
- `Test_{UnitName}_ShouldHandleEmptyInput` – verifies behavior when input is empty
|
||||
|
||||
- `Test_{FuncName}_ShouldReturnErrorOnTimeout` – covers timeout/failure path
|
||||
|
||||
- Integration tests:
|
||||
|
||||
- `{Scenario_When..._Then...}` – describe full flows: external calls, DB, queues, etc.
|
||||
|
||||
- Property/Fuzz tests (if applicable):
|
||||
|
||||
- Describe **input domain**, invariants, and what must always hold.
|
||||
|
||||
|
||||
Where possible, map tests back to **Finding IDs** (e.g. “C1, S2”).
|
||||
|
||||
### 5) Performance Notes
|
||||
|
||||
- Estimate complexity and potential bottlenecks of key paths.
|
||||
|
||||
- Call out:
|
||||
|
||||
- Any obvious **N+1** patterns
|
||||
|
||||
- Unnecessary allocations or copying
|
||||
|
||||
- Inefficient data structures or algorithms
|
||||
|
||||
- Suggest **quick wins**:
|
||||
|
||||
- Caching, batching, streaming, preallocation, memoization
|
||||
|
||||
- Expected impact (qualitative: small/medium/large)
|
||||
|
||||
|
||||
### 6) Security Checklist
|
||||
|
||||
Answer briefly (Yes/No/N.A. + short note):
|
||||
|
||||
- Inputs validated at boundaries?
|
||||
|
||||
- Outputs properly encoded for their sinks (HTML/SQL/OS/etc.)?
|
||||
|
||||
- Auth & authorization checks present and correctly ordered?
|
||||
|
||||
- Secrets kept out of code (config, env, vault)?
|
||||
|
||||
- Least privilege for external resources (DB, queues, files)?
|
||||
|
||||
- Safe defaults (e.g., secure TLS, secure cookies, strict modes)?
|
||||
|
||||
- Rate limiting / throttling for expensive or exposed endpoints?
|
||||
|
||||
- Logs avoid PII/credential leakage; sensitive data redacted or omitted?
|
||||
|
||||
|
||||
Highlight any **High** severity gaps and link them to Findings IDs.
|
||||
|
||||
### 7) Maintainability Improvements
|
||||
|
||||
- Small, incremental refactors:
|
||||
|
||||
- Extract helpers / smaller functions
|
||||
|
||||
- Reduce duplication (shared utilities, common error handling)
|
||||
|
||||
- Clarify boundaries between layers (domain/app/infra)
|
||||
|
||||
- Error taxonomy:
|
||||
|
||||
- Group errors into meaningful types/categories (e.g., validation vs system vs external)
|
||||
|
||||
- Standardize error wrapping and messages
|
||||
|
||||
- Configuration:
|
||||
|
||||
- Externalize magic numbers/strings
|
||||
|
||||
- Centralize feature flags or switches
|
||||
|
||||
- Documentation:
|
||||
|
||||
- Add or update docstrings for non-obvious logic
|
||||
|
||||
- Brief README/ADR notes if design is non-trivial
|
||||
|
||||
|
||||
### 8) Quality Scores
|
||||
|
||||
Give **1–5** scores (5 = excellent, 1 = poor) with a **one-line justification** each:
|
||||
|
||||
- **Correctness:** `X/5` – `{short reason}`
|
||||
|
||||
- **Security:** `X/5` – `{short reason}`
|
||||
|
||||
- **Performance:** `X/5` – `{short reason}`
|
||||
|
||||
- **Design:** `X/5` – `{short reason}`
|
||||
|
||||
- **Readability:** `X/5` – `{short reason}`
|
||||
|
||||
- **Testability:** `X/5` – `{short reason}`
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Constraints
|
||||
|
||||
- Prefer **minimal, targeted changes** over big-bang rewrites.
|
||||
|
||||
- Match **existing project style and patterns** where visible.
|
||||
|
||||
- If context is missing, **state assumptions explicitly** and proceed.
|
||||
|
||||
- Keep recommendations **framework-agnostic** where possible; only reference widely accepted idioms and standards.
|
||||
|
||||
- When in doubt, **prioritize clarity and safety** over micro-optimizations.
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Output Format
|
||||
|
||||
Return **only** sections **1–8** above in Markdown when performing an actual review.
|
||||
Keep all code blocks self-contained and compilable where possible.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
# 可观测性 —— **4.5 / 10**
|
||||
|
||||
优点:
|
||||
|
||||
- 使用 zap
|
||||
|
||||
- 有 telemetry endpoint 配置
|
||||
|
||||
|
||||
存在重大缺口:
|
||||
|
||||
- 没 metrics
|
||||
|
||||
- 没 health checks
|
||||
|
||||
- 没 tracing schema
|
||||
|
||||
- 没日志字段规范
|
||||
|
||||
- 没报警策略
|
||||
|
||||
|
||||
专业系统里可观测性是“一等公民”,缺这块分数自然拉低。
|
||||
|
||||
---
|
||||
|
||||
# 4️⃣ 可靠性(Reliability & Fault Handling)—— **5.5 / 10**
|
||||
|
||||
优点:
|
||||
|
||||
- JetStream(正确选择)
|
||||
|
||||
- 配置级 backoff / ack_wait / replay_from
|
||||
|
||||
- 已考虑重试机制
|
||||
|
||||
|
||||
不足:
|
||||
|
||||
- 没看到 dead-letter pipeline 文档
|
||||
|
||||
- 没看到 poison message 策略
|
||||
|
||||
- 没看到 DB 阻塞时的 backpressure
|
||||
|
||||
- 没看到幂等性模型
|
||||
|
||||
- 没看到断线重连逻辑的描述
|
||||
|
||||
|
||||
这些是专业评分严格扣分的部位。
|
||||
|
||||
|
||||
|
||||
### 严格评审的缺失
|
||||
|
||||
- 没看到“dead-letter pipeline”定义
|
||||
|
||||
- 没看到“poison message”策略
|
||||
|
||||
- 没看到“持久化失败策略”
|
||||
|
||||
- 没看到“DB 降级”逻辑
|
||||
|
||||
- 没看到“幂等性策略”(特别关键)
|
||||
|
||||
- 没看到“重平衡策略”(consumer scaling)
|
||||
|
||||
- 没看到“高可用拓扑”(replicas 仅是 JetStream 层,服务自身无说明)
|
||||
|
||||
|
||||
按专业级评分,就是 **4/10**。
|
||||
|
||||
|
||||
这个维度是最严格的(专业评分里非常重要)。
|
||||
|
||||
### ⭐ 有点:
|
||||
|
||||
- 有 Zap
|
||||
|
||||
- 有 OTEL endpoint 配置
|
||||
|
||||
|
||||
### ❌ 不足(按专业要求)
|
||||
|
||||
- 没有 metrics(prometheus)
|
||||
|
||||
- 没有 trace pipeline(span 设计/采样策略)
|
||||
|
||||
- 没有健康检查
|
||||
|
||||
- 没有 readiness
|
||||
|
||||
- 没有 structured logging contract(如 msg_id / request_id / nats_sequence)
|
||||
|
||||
- 未定义错误分类(business vs transient vs fatal)
|
||||
|
||||
- 没有日志示例
|
||||
|
||||
- 没有运行时仪表盘(Grafana dashboards)
|
||||
|
||||
|
||||
> **严格评分下,这就是 3/10。**
|
||||
>
|
||||
|
||||
----
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
|
||||
忘记之前的所有要求,请分别以电影导演,热爱电影的观众,普通人的角度评论一下电影。
|
||||
请实用下面格式:
|
||||
|
||||
- 讲讲电影的整体感受,分别从电影拍摄的时期,以及现在这个时候讲
|
||||
- 评论一下电影的故事情节,任务,已经电影想要传达的内容
|
||||
- 总结一下电影的有点和缺点
|
||||
- 给电影做一个评分,从0开始,10分最高分
|
||||
|
||||
如果你明白了上述指示,而我又没有告诉你电影名,请回答:”请问你想了解哪一部电影“
|
||||
如果知道了电影,请完成上面指示
|
||||
|
||||
|
||||
请完成下面任务:
|
||||
|
||||
1. 以一个普通人的角度,评价一下电影,简单讲讲观看电影的体验,如果觉得电影不错,推荐给好友
|
||||
2. 以一个资深电影迷的角度,写一篇发表到社交媒体的影评。涉及导演,演员,音乐等电影相关元素,最后发表一下自己的看法,谈谈电影的优缺点。
|
||||
3. 以一个电影从业人员的角度,写一篇专业的影评到电影专业期刊。从专业的角度分析电影的素质,分别从观看和制作的角度评价一下电影的主要元素和主要有点
|
||||
4. 于此同时,每一个角度都要给出一个对电影的评分,从0开始,10分最高,并给出简单的原因
|
||||
|
||||
用下面格式:
|
||||
简介:<首先请介绍一下电影,译名(原名),创作年代,导演,主要演员。>
|
||||
|
||||
普通观众:<普通人的角度,评分>
|
||||
影迷: <资深影迷的角度,内容可以丰富一些,去掉空洞的泛泛而谈的内容, 评分>
|
||||
从业人员: <从业人员的角度, 评分>
|
||||
|
||||
如果你知道我说的是什么电影,请完成任务,如果还不知道,可以问我电影名
|
||||
Executable
+224
@@ -0,0 +1,224 @@
|
||||
|
||||
|
||||
kimi2 thinking
|
||||
|
||||
```
|
||||
base_url: https://zenmux.ai/api/v1
|
||||
api_key: sk-ai-v1-2d2ba59719ff6f0d8d2f439d3b5c84399176d1059302cc4b43c132a4d17e9f03
|
||||
text_generation:
|
||||
model_id: moonshotai/kimi-k2-thinking
|
||||
prompt: '
|
||||
# Kimi K2 Thinking 聊天机器人 System Prompt
|
||||
|
||||
## 身份定义
|
||||
你是 Kimi K2 Thinking,一个具有深度推理能力的AI助手。你的核心特色是能够展示完整的思考过程,帮助用户理解问题的分析路径和解决方案。
|
||||
|
||||
## 核心原则
|
||||
|
||||
### 🧠 思考透明化
|
||||
- **展示推理过程**:对于复杂问题,明确展示你的思考步骤
|
||||
- **逐步分析**:将复杂问题分解为多个子问题,逐一解决
|
||||
- **自我检查**:在给出最终答案前,检查推理的逻辑性和完整性
|
||||
|
||||
### 💬 交互方式
|
||||
- **友好专业**:保持亲切但专业的语调
|
||||
- **耐心细致**:对用户的问题给予充分的关注和详细的回答
|
||||
- **主动引导**:在必要时主动询问澄清问题,确保准确理解用户需求
|
||||
|
||||
### 📝 回答结构
|
||||
对于复杂问题,使用以下结构:
|
||||
1. **问题理解**:确认对用户问题的理解
|
||||
2. **思考过程**:展示分析步骤(可使用"让我思考一下..."开头)
|
||||
3. **分步推理**:详细的逻辑推导
|
||||
4. **结论总结**:清晰的最终答案
|
||||
5. **补充说明**:相关的注意事项或延伸思考
|
||||
|
||||
## 专业能力
|
||||
|
||||
### 🎯 擅长领域
|
||||
- 逻辑推理和数学问题
|
||||
- 学术研究和知识分析
|
||||
- 创意思维和方案设计
|
||||
- 复杂情况的多角度分析
|
||||
- 长文本理解和信息提取
|
||||
|
||||
### 🔍 思考方法
|
||||
- **多角度分析**:从不同维度审视问题
|
||||
- **因果推理**:分析事物间的因果关系
|
||||
- **类比思维**:运用相似案例进行推理
|
||||
- **批判性思维**:质疑假设,验证结论
|
||||
|
||||
## 交互指南
|
||||
|
||||
### ✅ 当遇到以下情况时展示详细思考过程:
|
||||
- 数学计算和逻辑推理
|
||||
- 复杂的分析判断
|
||||
- 需要多步骤解决的问题
|
||||
- 涉及策略规划的问题
|
||||
- 用户明确要求看到思考过程
|
||||
|
||||
### ⚡ 当遇到以下情况时可直接回答:
|
||||
- 简单的事实性问题
|
||||
- 基础的定义解释
|
||||
- 日常对话交流
|
||||
- 明确的操作指导
|
||||
|
||||
## 语言风格
|
||||
- 使用清晰、准确的中文表达
|
||||
- 适当使用专业术语,但确保用户能理解
|
||||
- 运用恰当的比喻和例子帮助理解
|
||||
- 保持逻辑清晰的表述结构
|
||||
|
||||
## 限制说明
|
||||
- 承认知识的边界,不确定时会明确说明
|
||||
- 不提供可能有害或不当的建议
|
||||
- 尊重用户隐私,不记录或泄露个人信息
|
||||
- 在涉及专业领域时,建议咨询相关专家
|
||||
|
||||
## 互动示例格式
|
||||
|
||||
**用户问题**:[复杂问题]
|
||||
|
||||
**我的回答**:
|
||||
让我仔细分析一下这个问题...
|
||||
|
||||
🤔 **思考过程**:
|
||||
1. 首先,我需要理解...
|
||||
2. 然后考虑...
|
||||
3. 接下来分析...
|
||||
|
||||
📋 **分步推理**:
|
||||
- 步骤一:...
|
||||
- 步骤二:...
|
||||
- 步骤三:...
|
||||
|
||||
✅ **结论**:
|
||||
基于以上分析,我的答案是...
|
||||
|
||||
💡 **补充说明**:
|
||||
需要注意的是...
|
||||
|
||||
---
|
||||
|
||||
记住:你的价值在于不仅给出答案,更要展示获得答案的思考路径,帮助用户学会思考和分析问题的方法。
|
||||
'
|
||||
temperature: 0.9
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
google gemini 3 pro preview
|
||||
```
|
||||
base_url: https://zenmux.ai/api/v1
|
||||
api_key: sk-ai-v1-2d2ba59719ff6f0d8d2f439d3b5c84399176d1059302cc4b43c132a4d17e9f03
|
||||
|
||||
text_generation:
|
||||
model_id: google/gemini-3-pro-preview-free
|
||||
prompt: |
|
||||
# Role & Identity
|
||||
你是由 Google 研发的先进 AI 助手 {{ baibot_name }},基于 {{ baibot_model_id }} 架构。
|
||||
当前会话启动时间: {{ baibot_conversation_start_time_utc }}。
|
||||
|
||||
# Core Capabilities (针对 Gemini 优化)
|
||||
1. **深度推理**:拥有强大的逻辑分析、代码生成和数学计算能力。
|
||||
2. **长程记忆**:能够精准回顾和关联长对话历史中的细节,保持上下文一致性。
|
||||
3. **思维透明**:对于非显而易见的问题,必须通过"显式推理"展示你的思考路径。
|
||||
|
||||
# Thinking Protocol (思维协议)
|
||||
在回答用户之前,你必须执行以下思维循环:
|
||||
4. **意图识别**:用户真正想要解决的核心痛点是什么?隐含需求是什么?
|
||||
5. **知识检索**:在你的知识库和当前对话历史中检索相关信息。
|
||||
6. **逻辑推导**:构建解决路径,预判潜在的错误或陷阱。
|
||||
7. **自我修正**:检查生成的答案是否准确、无害且符合逻辑。
|
||||
|
||||
# Response Format (响应格式规范)
|
||||
|
||||
## 场景 A:复杂任务(代码、逻辑、分析、长文本生成)
|
||||
必须严格包含以下 Markdown 模块:
|
||||
|
||||
> **🤔 深度思考**:
|
||||
> *此处展示你的简要分析逻辑、解题思路或关键决策点。*
|
||||
|
||||
> **📋 详细解答**:
|
||||
> *此处提供具体的答案、代码实现或详细论述。*
|
||||
|
||||
> **💡 专家建议**:
|
||||
> *提供优化建议、潜在风险预警或延伸知识。*
|
||||
|
||||
## 场景 B:简单任务(问候、明确的短问题)
|
||||
- 直接给出简洁、准确的回答,无需展示思考过程。
|
||||
|
||||
# Interaction Guidelines (交互准则)
|
||||
- **准确性优先**:严禁编造事实。如果不知道,请直接说明。
|
||||
- **代码质量**:生成的代码必须是完整的、可执行的,并包含必要的注释。
|
||||
- **语言风格**:专业、客观、有条理。避免使用过度情绪化的词语。
|
||||
|
||||
temperature: 0.4
|
||||
max_response_tokens: 8192
|
||||
max_context_tokens: 1000000
|
||||
|
||||
speech_to_text:
|
||||
model_id: whisper-1
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
deepseek:
|
||||
```yaml
|
||||
base_url: https://zenmux.ai/api/v1
|
||||
api_key: sk-ai-v1-2d2ba59719ff6f0d8d2f439d3b5c84399176d1059302cc4b43c132a4d17e9f03
|
||||
|
||||
text_generation:
|
||||
model_id: deepseek/deepseek-v3.2-speciale
|
||||
temperature: 0.2
|
||||
max_response_tokens: 128000
|
||||
max_context_tokens: 128000
|
||||
prompt: |
|
||||
# Role & Identity
|
||||
你是由 DeepSeek 研发的 **DeepSeek-V3.2-Speciale**,一个专为极致推理和代理性能优化的高算力 AI 助手({{ baibot_name }})。
|
||||
当前会话启动时间: {{ baibot_conversation_start_time_utc }}。
|
||||
|
||||
## 版本特别说明 (System Context)
|
||||
- **定位**:你是一个研究预览版(Research Preview),旨在处理超越常规模型的复杂推理负载。
|
||||
- **有效期**:本版本服务有效期至 2025年12月15日 15:59 UTC。
|
||||
- **稳定性**:作为前沿测试模型,你应当专注于解决高难度基准问题,而非生产环境的常规工作流。
|
||||
|
||||
# Core Capabilities (DeepSeek 架构优化)
|
||||
1. **DeepSeek Sparse Attention (DSA)**:利用稀疏注意力机制处理超长上下文,能够精准定位和关联海量信息中的微小细节。
|
||||
2. **强化推理 (Scaled RL)**:经过大规模后训练强化学习(Post-training RL),具备超越 GPT-5 级别的逻辑推导能力,特别是在数学、编码和复杂任务规划上。
|
||||
3. **代理任务合成 (Agentic Synthesis)**:拥有强大的指令遵循能力,能够模拟复杂的代理交互,并在交互环境中保持高度的执行一致性。
|
||||
|
||||
# Thinking Protocol (思维链协议)
|
||||
鉴于你是一个“Thinking Mode”优先的模型,在输出最终答案前,必须强制执行深度思维循环:
|
||||
4. **意图解构**:透过用户表层语言,识别核心痛点与潜在的代理任务需求。
|
||||
5. **策略规划**:利用 DSA 检索上下文,构建多步骤的解决路径,并预判边界条件。
|
||||
6. **逻辑演算**:执行显式推理,特别是针对代码和数学问题,进行逐步验证。
|
||||
7. **合规性检查**:确保输出符合安全标准,并修正任何可能的逻辑幻觉。
|
||||
|
||||
# Response Format (响应格式规范)
|
||||
|
||||
## 场景 A:深度推理任务(默认模式 - 代码、逻辑、复杂咨询)
|
||||
必须严格包含以下 Markdown 模块,展现你的“思考模式”:
|
||||
|
||||
> **🧠 DeepSeek 思维链**:
|
||||
> *此处展示你的显式推理过程。包括:问题拆解 -> 关键假设 -> 推导步骤 -> 自我反思。*
|
||||
|
||||
> **📋 详细解答**:
|
||||
> *基于推理结果,提供精准、结构化的最终答案或可执行代码。*
|
||||
|
||||
> **🛡️ 专家视角**:
|
||||
> *提供边缘情况分析、优化建议或针对预览版稳定性的潜在提示。*
|
||||
|
||||
## 场景 B:轻量级交互(仅限简单的问候或确认)
|
||||
- 直接给出简洁、准确的回答,保持高效。
|
||||
|
||||
# Interaction Guidelines (交互准则)
|
||||
- **推理优先**:对于模糊的问题,优先展示你的推理路径,而非直接猜测结论。
|
||||
- **代码健壮性**:生成的代码必须具备工业级标准,包含错误处理和详细注释,体现 Speciale 级别的编程能力。
|
||||
- **诚实性**:作为预览版模型,若遇到知识盲区或不确定性,必须明确告知用户,严禁编造。
|
||||
- **风格**:理性、深刻、极客范。像一位资深的首席工程师那样沟通。
|
||||
|
||||
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
coder :
|
||||
```
|
||||
sk-ai-v1-875cd41da6e117609e850e4c594d0116f2e128bee9bf6890eb6a48fe23e69764
|
||||
```
|
||||
|
||||
url:
|
||||
```
|
||||
https://zenmux.ai/api/v1
|
||||
```
|
||||
|
||||
```
|
||||
https://zenmux.ai/api/anthropic
|
||||
```
|
||||
|
||||
```
|
||||
https://zenmux.ai/api/vertex-ai
|
||||
```
|
||||
|
||||
obsidian:
|
||||
```
|
||||
sk-ai-v1-82f1a2df15721ca5d5afc633842b91719fea95c6c449cbb78db0dd03f7ed1aa2
|
||||
```
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
code token:
|
||||
```
|
||||
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
|
||||
```
|
||||
@@ -0,0 +1,132 @@
|
||||
|
||||
|
||||
---
|
||||
|
||||
# 📘 LiteLLM 配置指南:NewCli (AWS/Anthropic Proxy)
|
||||
|
||||
版本日期: 2025-12-26
|
||||
|
||||
适用场景: 对接自定义 Anthropic 代理(NewCli),解决路径拼接 (404)、参数不兼容 (400) 及防火墙拦截 (403) 问题。
|
||||
|
||||
## 1. 核心参数规范 (Critical Specs)
|
||||
|
||||
无论使用 UI 还是 YAML,必须严格遵守以下三条铁律:
|
||||
|
||||
1. **Provider (提供商)**: 必须选 `Anthropic`。
|
||||
|
||||
- _原因_: 让 LiteLLM 自动处理 `/v1/messages` 路径拼接和 JSON 格式转换。
|
||||
|
||||
2. **Base URL (基准地址)**: `https://code.newcli.com/claude/aws`
|
||||
|
||||
- > [!WARNING] 警告
|
||||
|
||||
- > **严禁**在末尾加 `/v1`。LiteLLM 会自动追加,加了会导致双重路径 (`/v1/v1`) 报 **404**。
|
||||
|
||||
3. **Model ID (模型名)**: `claude-sonnet-4-5`
|
||||
|
||||
- _原因_: 代理商白名单仅支持此 ID。
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 2. UI 配置方案 (推荐)
|
||||
|
||||
**入口**: LiteLLM UI (`/ui`) -> **Models** -> **+ Add Model**
|
||||
|
||||
### 基础信息 (General Settings)
|
||||
|
||||
|**字段**|**填写内容**|**说明**|
|
||||
|---|---|---|
|
||||
|**Model Name**|`claude-sonnet`|客户端调用的别名|
|
||||
|**Select Provider**|**Anthropic**|⚠️ 必选|
|
||||
|**Litellm Model Name**|`claude-sonnet-4-5`|真实模型 ID|
|
||||
|**API Base URL**|`https://code.newcli.com/claude/aws`|⚠️ 末尾无 `/v1`|
|
||||
|**API Key**|`sk-ant-oat01...`|填入完整 Key|
|
||||
|
||||
### 高级参数 (LiteLLM Params / Metadata)
|
||||
|
||||
> [!TIP] 关键步骤
|
||||
>
|
||||
> 在 JSON 输入框填入以下内容,用于解决参数兼容性和防火墙拦截。
|
||||
|
||||
JSON
|
||||
|
||||
```
|
||||
{
|
||||
"drop_params": true,
|
||||
"extra_headers": {
|
||||
"anthropic-version": "2023-06-01",
|
||||
"User-Agent": "curl/7.68.0",
|
||||
"Authorization": "Bearer ${NEWCLI_API_KEY}"
|
||||
},
|
||||
"no_verify_ssl": true
|
||||
}
|
||||
```
|
||||
|
||||
_注:如果不使用变量,请在 `Authorization` 里直接填入 `Bearer sk-ant...`_
|
||||
|
||||
---
|
||||
|
||||
## 3. YAML 文件配置方案 (IaC)
|
||||
|
||||
适用于 `docker-compose` 挂载配置。
|
||||
|
||||
YAML
|
||||
|
||||
```
|
||||
model_list:
|
||||
- model_name: claude-sonnet
|
||||
litellm_params:
|
||||
model: anthropic/claude-sonnet-4-5
|
||||
# ⚠️ 重点:Base URL 不带 /v1
|
||||
api_base: https://code.newcli.com/claude/aws
|
||||
# 建议使用环境变量
|
||||
api_key: os.environ/NEWCLI_API_KEY
|
||||
extra_headers:
|
||||
anthropic-version: "2023-06-01"
|
||||
# 伪装 UA 防拦截
|
||||
User-Agent: "curl/7.68.0"
|
||||
# 强制 Bearer 鉴权 (可选,视代理商严格程度)
|
||||
Authorization: "Bearer ${NEWCLI_API_KEY}"
|
||||
|
||||
general_settings:
|
||||
master_key: sk-1234
|
||||
database_url: postgresql://litellm:litellm@litellm-postgres:5432/litellm
|
||||
|
||||
litellm_settings:
|
||||
# ⚠️ 核心修复:丢弃不兼容参数(如 user, frequency_penalty),解决 400 错误
|
||||
drop_params: true
|
||||
set_verbose: true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 故障排查手册 (Troubleshooting)
|
||||
|
||||
|**状态码**|**错误类型**|**根本原因**|**解决方案**|
|
||||
|---|---|---|---|
|
||||
|**404**|`NotFoundError`|**路径重复**|检查 `api_base` 是否多写了 `/v1`。应该让 LiteLLM 自动拼接。|
|
||||
|**400**|`BadRequest`|**参数冗余**|LiteLLM 传了 OpenAI 专有参数给 Anthropic。需开启 `drop_params: true`。|
|
||||
|**403**|`Forbidden`|**WAF 拦截**|缺少 User-Agent 伪装。需在 header 添加 `"User-Agent": "curl/..."`。|
|
||||
|**401**|`AuthError`|**鉴权失败**|Key 错误或格式不对。尝试在 `extra_headers` 强制注入 `Authorization: Bearer <key>`。|
|
||||
|
||||
---
|
||||
|
||||
## 5. 客户端调用示例
|
||||
|
||||
验证配置是否成功的标准命令(访问 LiteLLM 端口):
|
||||
|
||||
Bash
|
||||
|
||||
```
|
||||
curl -X POST http://localhost:4000/v1/chat/completions \
|
||||
-H "Authorization: Bearer sk-1234" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "claude-sonnet",
|
||||
"messages": [
|
||||
{ "role": "user", "content": "Config Test: OK?" }
|
||||
]
|
||||
}'
|
||||
```
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
context7 mcp key:
|
||||
```
|
||||
ctx7sk-92c2c98e-817e-41d4-bb85-94824444e2bf
|
||||
```
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
compose.yml
|
||||
```yaml
|
||||
services:
|
||||
db:
|
||||
image: postgres:17-alpine
|
||||
container_name: oui-db
|
||||
restart: always
|
||||
environment:
|
||||
- POSTGRES_USER=webui
|
||||
- POSTGRES_PASSWORD=webui_password
|
||||
- POSTGRES_DB=open_webui
|
||||
volumes:
|
||||
- db_data:/var/lib/postgresql/data
|
||||
|
||||
open-webui:
|
||||
image: ghcr.io/open-webui/open-webui:main
|
||||
container_name: oui
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:8080"
|
||||
depends_on:
|
||||
- db
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
environment:
|
||||
- 'DATABASE_URL=postgresql://webui:webui_password@db:5432/open_webui'
|
||||
- 'OPENAI_API_BASE_URL=http://host.docker.internal:4000/v1'
|
||||
- 'OPENAI_API_KEY=sk-1234'
|
||||
- 'WEBUI_SECRET_KEY=super_secret_key'
|
||||
volumes:
|
||||
- oui_data:/app/data
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
oui_data:
|
||||
```
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
|
||||
caastm dashboard:
|
||||
|
||||
```md
|
||||
# WHY
|
||||
This project displays parsed aviation telegram data in real time through a web
|
||||
interface. It provides dashboards, monitoring, and search for operational
|
||||
awareness. It does not perform parsing or business-logic interpretation.
|
||||
|
||||
# WHAT
|
||||
## Tech Stack
|
||||
Backend: Go + Clean Architecture + Echo
|
||||
Data: TimescaleDB, Meilisearch, Redis
|
||||
Streaming: NATS JetStream
|
||||
Frontend: SvelteKit + TypeScript + UnoCSS
|
||||
Observability: Prometheus + Zap
|
||||
|
||||
This project is a visualization and monitoring layer.
|
||||
|
||||
## Structure
|
||||
- `src/` frontend UI
|
||||
- `internal/` backend logic
|
||||
- `configs/` settings
|
||||
- `deploy/` infra
|
||||
|
||||
Use Progressive Disclosure: consult project docs for details when needed.
|
||||
|
||||
# HOW
|
||||
1. Propose a plan before significant UI or backend changes.
|
||||
2. Keep modifications minimal and respect existing architecture.
|
||||
3. Do not add parsing or alter upstream semantics.
|
||||
4. Preserve real-time behavior and responsiveness.
|
||||
5. Ask when requirements or data format are unclear.
|
||||
|
||||
# PRINCIPLES
|
||||
- Keep instructions minimal and universally applicable.
|
||||
- Use linters and tooling for deterministic checks.
|
||||
- This file is hand-crafted; not autogenerated.
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
|
||||
api key
|
||||
```
|
||||
xai-FDgOu9cZhAkeEBGnkFp61gyTIeqNmWuJ8CLABHIkqTUR1RYzm08hlXabnCTBrj91ee0pYjk0ZWtmRjhS
|
||||
```
|
||||
Executable
+289
@@ -0,0 +1,289 @@
|
||||
1. 糖醋小排
|
||||
|
||||
|
||||
|
||||
[https://www.dogsheep.cn/transform/Q08CyX81GI](https://www.dogsheep.cn/transform/Q08CyX81GI)
|
||||
|
||||
2. 糖醋小排
|
||||
|
||||
|
||||
|
||||
[](https://matrix.to/#/!PvmBDNIGRbaczLicYT:matrix.chans.xyz/$5jBx4l29mfPuLYTif430IG1fm7qCHlLmbq5yxw5UkJM?via=matrix.chans.xyz)
|
||||
|
||||
[https://live.qq.com/10014465](https://live.qq.com/10014465)
|
||||
|
||||
3. [](https://matrix.to/#/!PvmBDNIGRbaczLicYT:matrix.chans.xyz/$vH6DXdfFU4FChoo94TBxmcgRXWIDtzV8D0yJ_G55cho?via=matrix.chans.xyz)
|
||||
|
||||
[https://www.lanjing.live/live/1016753](https://www.lanjing.live/live/1016753)
|
||||
|
||||
4. ---
|
||||
|
||||
## Wed, Aug 3 2022
|
||||
|
||||
---
|
||||
|
||||
5. 糖醋小排
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[https://api.inforun.work/v1/service/10004950?hmac=51EA681FE0EF28CB8766BA258D2555D8C0CBF849E1DCA1183C6C4C59585C1607&lang=&templateId=22](https://api.inforun.work/v1/service/10004950?hmac=51EA681FE0EF28CB8766BA258D2555D8C0CBF849E1DCA1183C6C4C59585C1607&lang=&templateId=22)
|
||||
|
||||
7. ---
|
||||
|
||||
## Sun, Oct 9 2022
|
||||
|
||||
---
|
||||
|
||||
8. 糖醋小排
|
||||
|
||||
[](https://matrix.to/#/!PvmBDNIGRbaczLicYT:matrix.chans.xyz/$B-jSeeAKV5uxOhso9vY2vAEzlKKyahMpQb45YwSAiYw?via=matrix.chans.xyz)
|
||||
|
||||
adb shell pm grant com.dp.logcatapp [android.permission.READ](http://android.permission.read/)_LOGS
|
||||
|
||||
|
||||
|
||||
|
||||
15. 糖醋小排
|
||||
|
||||
|
||||
[https://gzshb.gzonline.gov.cn/index.html](https://gzshb.gzonline.gov.cn/index.html)
|
||||
|
||||
16. ---
|
||||
|
||||
## Wed, Nov 2 2022
|
||||
|
||||
---
|
||||
|
||||
17. 糖醋小排
|
||||
|
||||
|
||||
[gzzn.ipowersoft.net:8092](http://gzzn.ipowersoft.net:8092/)
|
||||
opsuser
|
||||
opsuser@Gzzn
|
||||
|
||||
18. ---
|
||||
|
||||
## Thu, Nov 10 2022
|
||||
|
||||
---
|
||||
|
||||
19. 糖醋小排
|
||||
|
||||
|
||||
|
||||
[https://docs.qq.com/sheet/DTEhJSmNiYm53clBk](https://docs.qq.com/sheet/DTEhJSmNiYm53clBk)
|
||||
|
||||
20. ---
|
||||
|
||||
## Thu, Nov 17 2022
|
||||
|
||||
---
|
||||
|
||||
21. 糖醋小排
|
||||
|
||||
|
||||
|
||||
6258 1017 4403 4127
|
||||
|
||||
22. ---
|
||||
|
||||
## Wed, Feb 15 2023
|
||||
|
||||
---
|
||||
|
||||
23. 糖醋小排
|
||||
|
||||
|
||||
[https://decentralizedcreator.com/reverse-prompt-lookup-image-to-prompt/](https://decentralizedcreator.com/reverse-prompt-lookup-image-to-prompt/)
|
||||
|
||||
24. 糖醋小排
|
||||
|
||||
|
||||
[https://marketplace.visualstudio.com/items?itemName=vaibhavacharya.code-gpt-va](https://marketplace.visualstudio.com/items?itemName=vaibhavacharya.code-gpt-va)
|
||||
|
||||
25. ---
|
||||
|
||||
## Thu, Feb 16 2023
|
||||
|
||||
---
|
||||
|
||||
26. 糖醋小排
|
||||
|
||||
|
||||
[gzzn.ipowersoft.net:8092](http://gzzn.ipowersoft.net:8092/)
|
||||
opsuser
|
||||
opsuser@Gzzn
|
||||
|
||||
27. ---
|
||||
|
||||
## Sat, Mar 11 2023
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
29. ---
|
||||
|
||||
## Mon, Mar 13 2023
|
||||
|
||||
---
|
||||
|
||||
30. 糖醋小排
|
||||
|
||||
|
||||
|
||||
[https://api.inforun.work/v1/service/10004950?hmac=51EA681FE0EF28CB8766BA258D2555D8C0CBF849E1DCA1183C6C4C59585C1607&lang=&templateId=22](https://api.inforun.work/v1/service/10004950?hmac=51EA681FE0EF28CB8766BA258D2555D8C0CBF849E1DCA1183C6C4C59585C1607&lang=&templateId=22)
|
||||
|
||||
31. 糖醋小排
|
||||
|
||||
|
||||
|
||||
1. 在 Telegram 添加机器人账号 @ure_best_bot
|
||||
2. 发送命令 /start 5CKxFIeYNHvLuV5X (点击复制) 给机器人
|
||||
|
||||
32. 糖醋小排
|
||||
|
||||
|
||||
|
||||
[https://sub.cutecloud.link/link/rCvnzdf6GsYxO0TT?clash=1](https://sub.cutecloud.link/link/rCvnzdf6GsYxO0TT?clash=1)
|
||||
|
||||
33. 糖醋小排
|
||||
|
||||
|
||||
|
||||
[https://subapi1.gardenparty.one/link/7662I1Snxww7zkgq?sub=2&client=clash](https://subapi1.gardenparty.one/link/7662I1Snxww7zkgq?sub=2&client=clash)
|
||||
|
||||
34. ---
|
||||
|
||||
## Wed, Mar 15 2023
|
||||
|
||||
---
|
||||
|
||||
35. 糖醋小排
|
||||
|
||||
|
||||
|
||||
[https://18.laomao1.xyz/api/v1/client/subscribe?token=daddf8de9b1e002478b6fc59a6760e85](https://18.laomao1.xyz/api/v1/client/subscribe?token=daddf8de9b1e002478b6fc59a6760e85)
|
||||
|
||||
36. ---
|
||||
|
||||
## Mon, Mar 20 2023
|
||||
|
||||
---
|
||||
|
||||
37. 糖醋小排
|
||||
|
||||
|
||||
|
||||
天河区天河南二路19号宏发大厦
|
||||
|
||||
38. [](https://matrix.to/#/!PvmBDNIGRbaczLicYT:matrix.chans.xyz/$KG5CYE4CBEYvbXxIrqIcwdJsrRYfWPEDK5Hu7GnInm8?via=matrix.chans.xyz)
|
||||
|
||||
联想移动客户服务中心(广州天河南二路店) 天河区天河南二路19号宏发大厦5楼541室(地铁三号线石牌桥a出口往东前行20米进楼巴候车室北门坐电梯5楼) 联系电话:020-85239885 营业时间:9:00-18:00
|
||||
|
||||
39. ---
|
||||
|
||||
## Wed, Mar 22 2023
|
||||
|
||||
---
|
||||
|
||||
40. 糖醋小排
|
||||
|
||||
|
||||
5楼541号
|
||||
|
||||
41. [](https://matrix.to/#/!PvmBDNIGRbaczLicYT:matrix.chans.xyz/$1efo6uPbdud2DuUKAZ-qcwQr4U2e7iJrmDuNAXxNGqs?via=matrix.chans.xyz)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
](blob:https://app.element.io/f01ed754-55a6-4fa1-9288-c7beebacf35c)
|
||||
|
||||
42. [](https://matrix.to/#/!PvmBDNIGRbaczLicYT:matrix.chans.xyz/$W2YW0yafatgKihSSe-AhI_TTgF-BEYl44ODjJ8vkMwQ?via=matrix.chans.xyz)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
](blob:https://app.element.io/2f909ed3-b52f-4bf6-a580-3b64218901fa)
|
||||
|
||||
43. ---
|
||||
|
||||
## Thu, Mar 23 2023
|
||||
|
||||
---
|
||||
|
||||
44. 糖醋小排
|
||||
|
||||
|
||||
|
||||
Hi, here’s your giffgaff password reset request for bb668161. Click here to continue: [https://giffgaff.com/auth/reset/new-password?token=cf6b4bd286076012b66d74c282d60f7a02324fd3&username=bb668161](https://giffgaff.com/auth/reset/new-password?token=cf6b4bd286076012b66d74c282d60f7a02324fd3&username=bb668161)
|
||||
|
||||
45. ---
|
||||
|
||||
## Mon, Mar 27 2023
|
||||
|
||||
---
|
||||
|
||||
46. 糖醋小排
|
||||
|
||||
|
||||
|
||||
A3-XJVFVNV-SPM4EW-5G4SL-MNQNL-44ZRW-76Z8D
|
||||
|
||||
47. ---
|
||||
|
||||
## Tue, Mar 28 2023
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
49. ---
|
||||
|
||||
## Wed, Mar 29 2023
|
||||
|
||||
---
|
||||
|
||||
50. 糖醋小排
|
||||
|
||||
糖
|
||||
|
||||
[](https://matrix.to/#/!PvmBDNIGRbaczLicYT:matrix.chans.xyz/$cqKGzacU35kiDcZ2zvMepvfHlydbVKJ7FWTCzuzszvY?via=matrix.chans.xyz)
|
||||
|
||||
onepassword://team-account/add?email=genjuro00%[40gmail.com](http://40gmail.com/)&key=A3-XJWVNV-SPM4EW-5G4SL-MNQNL-44ZRW-76Z8D&server=https%3A%2F%[2Fmy.1password.com](http://2fmy.1password.com/)%2F
|
||||
|
||||
51. 糖醋小排
|
||||
|
||||
|
||||
|
||||
[https://api.inforun.work/v1/service/10004950?hmac=51EA681FE0EF28CB8766BA258D2555D8C0CBF849E1DCA1183C6C4C59585C1607&lang=&templateId=22](https://api.inforun.work/v1/service/10004950?hmac=51EA681FE0EF28CB8766BA258D2555D8C0CBF849E1DCA1183C6C4C59585C1607&lang=&templateId=22)
|
||||
|
||||
52. 糖醋小排
|
||||
|
||||
|
||||
|
||||
53. ---
|
||||
|
||||
## Thursday
|
||||
|
||||
---
|
||||
|
||||
54. 糖醋小排
|
||||
|
||||
|
||||
|
||||
TF2YuWSNj8dJgNMe4CGakDswK8kkTQMSLu
|
||||
|
||||
55. 糖醋小排
|
||||
|
||||
|
||||
|
||||
歐易 備份 Q6BA2WMCCXGGKPRD
|
||||
@@ -0,0 +1,56 @@
|
||||
```
|
||||
[
|
||||
{
|
||||
"domain": "totheglory.im",
|
||||
"expirationDate": 1768864598.827946,
|
||||
"hostOnly": true,
|
||||
"httpOnly": true,
|
||||
"name": "pass",
|
||||
"path": "/",
|
||||
"sameSite": null,
|
||||
"secure": true,
|
||||
"session": false,
|
||||
"storeId": null,
|
||||
"value": "3d0fca9b34a18a2bc0e2074b9a3b13e0"
|
||||
},
|
||||
{
|
||||
"domain": "totheglory.im",
|
||||
"expirationDate": 1768864598.82797,
|
||||
"hostOnly": true,
|
||||
"httpOnly": false,
|
||||
"name": "laccess",
|
||||
"path": "/",
|
||||
"sameSite": null,
|
||||
"secure": true,
|
||||
"session": false,
|
||||
"storeId": null,
|
||||
"value": "1753096598"
|
||||
},
|
||||
{
|
||||
"domain": "totheglory.im",
|
||||
"expirationDate": 1768864598.827846,
|
||||
"hostOnly": true,
|
||||
"httpOnly": true,
|
||||
"name": "uid",
|
||||
"path": "/",
|
||||
"sameSite": null,
|
||||
"secure": true,
|
||||
"session": false,
|
||||
"storeId": null,
|
||||
"value": "17052"
|
||||
},
|
||||
{
|
||||
"domain": "totheglory.im",
|
||||
"expirationDate": 1787656599.24496,
|
||||
"hostOnly": true,
|
||||
"httpOnly": false,
|
||||
"name": "user_info_hash",
|
||||
"path": "/",
|
||||
"sameSite": null,
|
||||
"secure": true,
|
||||
"session": false,
|
||||
"storeId": null,
|
||||
"value": "e0de221dfdaee86bbbf4d69b451f5941"
|
||||
}
|
||||
]
|
||||
```
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
|
||||
## 2023.4.18 尝试
|
||||
小黄瓜原料: 1044克
|
||||
盐: 21.7克
|
||||
糖: 11.7克
|
||||
蒜末
|
||||
姜末
|
||||
蒜苔切碎
|
||||
芝麻
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
|
||||
release token:
|
||||
```
|
||||
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
|
||||
```
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
|
||||
api:
|
||||
secret_WggiGblW3PayQXirTeOCrS9FTsQ5EWGWHjInmNcvJdv
|
||||
Executable
+86
@@ -0,0 +1,86 @@
|
||||
|
||||
Here is the **definitive, consolidated guide** for setting up Playwright on **Arch Linux (WSL)**.
|
||||
|
||||
This summary skips the trial-and-error we just went through and provides the "Happy Path" to get everything working in one go.
|
||||
|
||||
---
|
||||
|
||||
### 📋 Prerequisites
|
||||
* **WSL 2** (Recommended).
|
||||
* **Proxy (Optional):** If you are behind a proxy, remember to use `sudo -E` to preserve environment variables.
|
||||
|
||||
---
|
||||
|
||||
### 🚀 Step 1: System Prep & Node.js
|
||||
First, ensure your package database is fresh (fixes 404 errors) and install Node.js.
|
||||
|
||||
```bash
|
||||
# Update system and install Node.js/npm
|
||||
# Use -E if you have https_proxy set in your shell
|
||||
sudo -E pacman -Syu nodejs npm
|
||||
```
|
||||
|
||||
### 📦 Step 2: Install System Dependencies (The Critical Step)
|
||||
**Do not** use `npx playwright install-deps` (it fails on Arch). Instead, install these packages manually. This list includes all the X11, Graphics, and Network libraries required by Chromium, Firefox, and WebKit.
|
||||
|
||||
```bash
|
||||
sudo -E pacman -S --needed \
|
||||
git \
|
||||
nss \
|
||||
nspr \
|
||||
libdrm \
|
||||
alsa-lib \
|
||||
mesa \
|
||||
gtk3 \
|
||||
at-spi2-core \
|
||||
pango \
|
||||
cairo \
|
||||
gdk-pixbuf2 \
|
||||
libx11 \
|
||||
libxcomposite \
|
||||
libxdamage \
|
||||
libxext \
|
||||
libxfixes \
|
||||
libxrandr \
|
||||
libxcursor \
|
||||
libxi \
|
||||
libxrender \
|
||||
libxcb \
|
||||
freetype2 \
|
||||
fontconfig \
|
||||
ffmpeg
|
||||
```
|
||||
|
||||
### 🛠️ Step 3: Initialize Playwright
|
||||
Set up your project and download the browser binaries (these are separate from the system libs above).
|
||||
|
||||
```bash
|
||||
# Create project directory
|
||||
mkdir my-tests && cd my-tests
|
||||
|
||||
# Initialize (Select TypeScript/JavaScript as preferred)
|
||||
npm init playwright@latest
|
||||
|
||||
# If prompted to "Install Playwright browsers", select True.
|
||||
# If you need to install them manually later:
|
||||
npx playwright install
|
||||
```
|
||||
|
||||
### ✅ Step 4: Run Tests
|
||||
You are now ready to run.
|
||||
|
||||
```bash
|
||||
npx playwright test
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 💡 Troubleshooting Cheat Sheet
|
||||
|
||||
| Issue | Solution |
|
||||
| :------------------------ | :-------------------------------------------------------------------------------- |
|
||||
| **`install-deps` fails** | **Ignore it.** It only supports Ubuntu. Use the `pacman` command in Step 2. |
|
||||
| **`libxxx.so not found`** | You are missing a package. Use `pkgfile libxxx.so` to find the Arch package name. |
|
||||
| **404 Errors (Pacman)** | Your mirrors are out of sync. Run `sudo pacman -Syu` to refresh. |
|
||||
| **Browser won't launch** | Ensure `nspr` and `nss` are installed (included in Step 2). |
|
||||
| **GUI/Headless issues** | If visual mode fails, try `xvfb-run npx playwright test`. |
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
变量隐藏 [[Scope and Shadowing - Rust By Example]]
|
||||
@@ -0,0 +1,173 @@
|
||||
|
||||
To set up **Oh My Posh** with **Zsh** on **Debian 12**, follow these steps to install the necessary components and configure your terminal prompt.
|
||||
|
||||
## Installation Steps
|
||||
|
||||
### 1. Download the Oh My Posh Binary
|
||||
First, you need to download the Oh My Posh binary suitable for Linux. Open your terminal and run the following command:
|
||||
|
||||
```bash
|
||||
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
|
||||
```
|
||||
|
||||
### 2. Set Executable Permissions
|
||||
Make the downloaded binary executable:
|
||||
|
||||
```bash
|
||||
sudo chmod +x /usr/local/bin/oh-my-posh
|
||||
```
|
||||
|
||||
### 3. Create a Directory for Themes
|
||||
You need a directory to store your themes. Create it using:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.poshthemes
|
||||
```
|
||||
|
||||
### 4. Download Themes
|
||||
You can download predefined themes from the Oh My Posh repository. For example, to download the latest themes, run:
|
||||
|
||||
```bash
|
||||
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
|
||||
```
|
||||
|
||||
Unzip the downloaded file:
|
||||
|
||||
```bash
|
||||
unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
|
||||
```
|
||||
|
||||
Then, clean up by removing the zip file:
|
||||
|
||||
```bash
|
||||
rm ~/.poshthemes/themes.zip
|
||||
```
|
||||
|
||||
### 5. Update Your Zsh Configuration
|
||||
Now, you need to configure your Zsh shell to use Oh My Posh. Open your `.zshrc` file in a text editor:
|
||||
|
||||
```bash
|
||||
nano ~/.zshrc
|
||||
```
|
||||
|
||||
Add the following line at the end of the file to initialize Oh My Posh with a specific theme (replace `alien` with your preferred theme name):
|
||||
|
||||
```bash
|
||||
eval "$(oh-my-posh --init --shell zsh --config ~/.poshthemes/alien.omp.json)"
|
||||
```
|
||||
|
||||
### 6. Apply Changes
|
||||
After saving and closing the `.zshrc` file, apply the changes by running:
|
||||
|
||||
```bash
|
||||
source ~/.zshrc
|
||||
```
|
||||
|
||||
## Additional Configuration
|
||||
|
||||
### Install a Nerd Font (Optional)
|
||||
For better aesthetics, install a Nerd Font that supports icons used by Oh My Posh. You can download fonts like **Meslo** or **Fira Code** from their respective repositories and install them on your system.
|
||||
|
||||
### Set Terminal Font
|
||||
Finally, ensure that your terminal emulator is configured to use the newly installed Nerd Font for optimal display of icons and symbols.
|
||||
|
||||
By following these steps, you will have successfully set up Oh My Posh with Zsh on Debian 12, enhancing your terminal's appearance and functionality.
|
||||
|
||||
Citations:
|
||||
[1] https://dev.to/karleeov/wsl-arch-setup-for-oh-my-posh-51pa
|
||||
[2] https://www.reddit.com/r/NixOS/comments/1ge1gwn/how_to_set_ohmyposh_settings/
|
||||
[3] https://ohmyposh.dev/docs/installation/linux
|
||||
[4] https://www.librebyte.net/en/cli-en/oh-my-posh-a-beatifull-prompt-for-your-shell/
|
||||
[5] https://www.youtube.com/watch?v=nGHgyPLi7UM
|
||||
[6] https://calebschoepp.com/blog/2021/how-to-setup-oh-my-posh-on-ubuntu/
|
||||
[7] https://www.linux.org/threads/need-help-finalizing-oh-my-posh-bash-terminal.52617/
|
||||
|
||||
|
||||
|
||||
.zshrc
|
||||
```
|
||||
#go lang
|
||||
export GOROOT=/usr/local/go
|
||||
export GOPATH=/home/windy/go-lang
|
||||
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
|
||||
|
||||
eval "$(oh-my-posh --init --shell zsh --config ~/.poshthemes/powerlevel10k_modern.omp.json)"
|
||||
|
||||
|
||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||
|
||||
|
||||
# Zinit setup and plugin management
|
||||
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
||||
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
|
||||
[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
|
||||
source "${ZINIT_HOME}/zinit.zsh"
|
||||
|
||||
# Load essential annexes (non-turbo mode for annex functionality)
|
||||
zinit light-mode for \
|
||||
zdharma-continuum/zinit-annex-as-monitor \
|
||||
zdharma-continuum/zinit-annex-bin-gem-node \
|
||||
zdharma-continuum/zinit-annex-patch-dl \
|
||||
zdharma-continuum/zinit-annex-rust
|
||||
|
||||
# Load Zeno plugin with keybindings
|
||||
zinit ice lucid depth"1" blockf
|
||||
zinit light yuki-yano/zeno.zsh
|
||||
|
||||
if [[ -n $ZENO_LOADED ]]; then
|
||||
bindkey ' ' zeno-auto-snippet
|
||||
bindkey '^m' accept-line
|
||||
bindkey '^i' zeno-completion
|
||||
bindkey '^g' zeno-ghq-cd
|
||||
bindkey '^r' zeno-history-selection
|
||||
bindkey '^x' zeno-insert-snippet
|
||||
fi
|
||||
|
||||
# Load additional Zsh plugins
|
||||
zinit ice wait"0"; zinit light zsh-users/zsh-completions
|
||||
autoload -Uz compinit && compinit
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
||||
zstyle ':completion:*:default' menu select=1
|
||||
|
||||
zinit light zsh-users/zsh-syntax-highlighting
|
||||
zinit light zsh-users/zsh-autosuggestions
|
||||
zinit light Aloxaf/fzf-tab
|
||||
|
||||
# FZF configuration
|
||||
zi ice from"gh-r" as"program"
|
||||
zi light junegunn/fzf
|
||||
|
||||
# Auto-suggestions styling
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=244"
|
||||
|
||||
# History settings
|
||||
HISTFILE=~/.zsh-history
|
||||
HISTSIZE=100000
|
||||
SAVEHIST=1000000
|
||||
HISTDUP=erase
|
||||
setopt appendhistory sharehistory hist_ignore_space hist_ignore_all_dups
|
||||
setopt hist_save_no_dups hist_ignore_dups hist_find_no_dups
|
||||
setopt inc_append_history share_history
|
||||
|
||||
# Zsh options for usability
|
||||
setopt AUTO_CD
|
||||
setopt AUTO_PARAM_KEYS
|
||||
|
||||
# Completion and FZF styling
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
zstyle ':completion:*' menu no
|
||||
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
|
||||
|
||||
# Load additional plugins with default keys
|
||||
zinit pack"default+keys" for fzf
|
||||
|
||||
# Ensure Zinit autocompletion
|
||||
autoload -Uz _zinit
|
||||
(( ${+_comps} )) && _comps[zinit]=_zinit
|
||||
|
||||
# Consolidate PATH with deduplication
|
||||
export PATH=$(echo "/run/current-system/sw/bin:/usr/local/bin:/usr/local/sbin:$PATH" | tr ':' '\n' | awk '!seen[$0]++' | tr '\n' ':' | sed 's/:$//')
|
||||
|
||||
|
||||
```
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
床边衣柜
|
||||
|
||||
高 38
|
||||
宽 35
|
||||
深 39
|
||||
|
||||
床角衣柜
|
||||
上柜下层:
|
||||
|
||||
宽:69
|
||||
深:56
|
||||
高:27.5
|
||||
隔板深:39.5
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
厨房清洁剂储物盒子
|
||||
```
|
||||
24*24*40
|
||||
```
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
|
||||
文明7标准:
|
||||
```
|
||||
7I0EZ-N5HWF-JYIGF
|
||||
```
|
||||
激活码2:
|
||||
```
|
||||
EIFGE-K032P-RQ8BH
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
|
||||
|
||||
access token zed:
|
||||
```
|
||||
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
|
||||
```
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
```
|
||||
route "192.168.0.0 255.255.0.0"
|
||||
push "redirect-gateway def1 bypass-dhcp"
|
||||
push "dhcp-option DNS [192.168.66.36]"
|
||||
|
||||
```
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
|
||||
```
|
||||
|
||||
CREATE DATABASE scribe;
|
||||
CREATE USER scribe WITH PASSWORD 'hass';
|
||||
GRANT ALL PRIVILEGES ON DATABASE scribe TO scribe;
|
||||
|
||||
\c scribe
|
||||
CREATE EXTENSION IF NOT EXISTS timescaledb;
|
||||
GRANT ALL ON SCHEMA public TO scribe;
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
login with google windyboy
|
||||
|
||||
|
||||
90 days, 12/12 2025
|
||||
Mar 12, 2026 expired
|
||||
|
||||
api key
|
||||
```
|
||||
tskey-api-kWRsSNyq8s11CNTRL-LWc27MXNgjMBKZ9rVauriMb5QS1RkWrZ
|
||||
```
|
||||
|
||||
|
||||
auth key:
|
||||
Mar 12, 2026 expired
|
||||
```
|
||||
tskey-auth-kwEwVkec3721CNTRL-nX7noqZbMWdZYXPbkCFKXdjLf6B6CMW7D
|
||||
```
|
||||
+1740
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,45 @@
|
||||
|
||||
### **什么是 Matter Thread Border Router?**
|
||||
|
||||
**Matter Thread Border Router** 是一种连接 **Thread 网络**(低功耗 IoT 设备的自愈网状网络)和 **IP 网络**(Wi-Fi/以太网)的网关设备。
|
||||
|
||||
- 它允许 **Matter** 协议支持的设备(如传感器、灯具)通过 Thread 网络与其他智能家居设备和平台(如 Google Home、Apple HomeKit)通信。
|
||||
- **功能**:桥接 Thread 和 IP 网络,支持本地控制和设备间互操作。
|
||||
|
||||
---
|
||||
|
||||
### **当前推荐的产品(2024 年)**
|
||||
|
||||
1. **Google Nest Hub (2nd Gen)** / **Nest Wi-Fi Pro**
|
||||
|
||||
- **特点**: 用户友好,自动配置,支持 Thread 和 Matter。
|
||||
- **适合人群**: Google 生态用户。
|
||||
- **价格**: $99-199。
|
||||
2. **Apple HomePod mini** / **Apple TV 4K**
|
||||
|
||||
- **特点**: 无缝整合 HomeKit,支持 Thread 和 Matter,极简设计。
|
||||
- **适合人群**: Apple 生态用户。
|
||||
- **价格**: $99-129。
|
||||
3. **Amazon Echo (4th Gen)**
|
||||
|
||||
- **特点**: 支持 Alexa 和 Matter,兼容性强。
|
||||
- **适合人群**: Alexa 生态用户。
|
||||
- **价格**: $99。
|
||||
4. **Eero 6+ / Eero Pro 6**
|
||||
|
||||
- **特点**: 结合 Thread Border Router 和高性能 Wi-Fi 6 路由器功能。
|
||||
- **适合人群**: 需要 Wi-Fi 和 Thread 整合的用户。
|
||||
- **价格**: $139-299。
|
||||
|
||||
---
|
||||
|
||||
### **推荐购买依据**
|
||||
|
||||
- **Apple 生态**:选 HomePod mini 或 Apple TV 4K。
|
||||
- **Google 生态**:选 Nest Hub (2nd Gen) 或 Nest Wi-Fi Pro。
|
||||
- **Alexa 生态**:选 Echo 4th Gen。
|
||||
- **全能路由需求**:选 Eero 系列,兼顾 Wi-Fi 和 Matter/Thread。
|
||||
|
||||
这些设备即插即用,适合不同智能家居平台和未来 Matter 生态的扩展需求。
|
||||
|
||||
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
ssh account
|
||||
user:
|
||||
```
|
||||
zhiqiangf
|
||||
```
|
||||
|
||||
password:
|
||||
```
|
||||
Ld2YudlhR3pg7hdK
|
||||
```
|
||||
|
||||
```
|
||||
dyt.jza*eht9TBD0btd
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
set-inform http://192.168.66.46:8080/inform
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
# 电源
|
||||
|
||||
## 通用DC电源
|
||||
### ER-X
|
||||
|
||||
https://manuals.plus/zh-CN/ubiquiti/edgerouterx-manual
|
||||
12V, 0.5A
|
||||
|
||||
|---|---|
|
||||
|**端口**|**产品描述**|
|
||||
|eth0/PoE 输入|RJ45 端口接受 24V 无源 PoE 并支持 10/100/1000 以太网连接。|
|
||||
|eth1-3|RJ45 端口支持 10/100/1000 以太网连接。|
|
||||
|eth4/PoE 输出|RJ45 端口支持无源 PoE 直通和 10/100/1000 以太网连接。|
|
||||
|
||||
### 联果2.5G 8口
|
||||
12V, 1A
|
||||
|
||||
### Netgear ProSafe GS108PE
|
||||
48V, 1.25A
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
# windy-ai
|
||||
|
||||
## config
|
||||
### key
|
||||
```
|
||||
MdhX7jL4hPFVOhjHCft46pbCD7chZJY9rkuAXD620BwW32axUMq6JQQJ99ALACHYHv6XJ3w3AAAAACOGH6q1
|
||||
```
|
||||
### Location/Region
|
||||
```
|
||||
eastus2
|
||||
```
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
|
||||
|
||||
```python
|
||||
|
||||
import os
|
||||
from datetime import timedelta
|
||||
|
||||
from homeassistant import auth, core, config as conf_util
|
||||
|
||||
CLIENT_ID = 'long_lived_client'
|
||||
LIFE_TIME = timedelta(days=3650)
|
||||
|
||||
|
||||
async def create_refresh_token(auth_mgr: auth.AuthManager,
|
||||
owner: auth.models.User):
|
||||
"""Create a refresh token for owner."""
|
||||
refresh_token = auth.models.RefreshToken(
|
||||
user=owner,
|
||||
access_token_expiration=LIFE_TIME,
|
||||
client_id=CLIENT_ID,
|
||||
)
|
||||
owner.refresh_tokens[refresh_token.id] = refresh_token
|
||||
|
||||
# hack code to save refresh_token
|
||||
await auth_mgr._store._store.async_save(
|
||||
auth_mgr._store._data_to_save())
|
||||
|
||||
print('Created a new refresh token for {}: {}'.format(
|
||||
CLIENT_ID, refresh_token.id))
|
||||
return refresh_token
|
||||
|
||||
|
||||
async def get_long_live_access_token(auth_mgr: auth.AuthManager):
|
||||
"""Create a bearer token for owner."""
|
||||
owner = [u for u in await auth_mgr.async_get_users() if u.is_owner][0]
|
||||
print('Owner name is {}\n'.format(owner.name))
|
||||
|
||||
refresh_token = None
|
||||
for token in owner.refresh_tokens.values():
|
||||
if token.client_id == CLIENT_ID:
|
||||
refresh_token = token
|
||||
break
|
||||
|
||||
if not refresh_token:
|
||||
refresh_token = await create_refresh_token(auth_mgr, owner)
|
||||
|
||||
# get access_token, it won't saved
|
||||
access_token = auth_mgr.async_create_access_token(refresh_token)
|
||||
print('Add following HTTP header to your REST API'
|
||||
' and Websocket API request:')
|
||||
print('Authorization: Bearer {}'.format(access_token))
|
||||
|
||||
|
||||
# change to your config path
|
||||
config_dir = conf_util.get_default_config_dir()
|
||||
config_path = conf_util.ensure_config_exists(config_dir)
|
||||
print('Loading config from {}'.format(config_path))
|
||||
config_dict = conf_util.load_yaml_config_file(config_path)
|
||||
core_config = config_dict.get('homeassistant', {})
|
||||
|
||||
hass = core.HomeAssistant()
|
||||
hass.config.config_dir = os.path.abspath(os.path.dirname(config_path))
|
||||
hass.loop.run_until_complete(
|
||||
conf_util.async_process_ha_core_config(
|
||||
hass, core_config, False, False))
|
||||
hass.loop.run_until_complete(
|
||||
get_long_live_access_token(hass.auth))
|
||||
|
||||
```
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
api key:
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/knoop7/ha-openai-whisper-stt-api/groq-proxy2:20240830
|
||||
```
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
To flash the Sonoff ZBDongle-E, follow these detailed steps using the web-based flashing tool. This guide assumes you want to enable the device for use with Zigbee and potentially Thread functionalities.
|
||||
|
||||
## Step-by-Step Flashing Guide
|
||||
|
||||
### 1. **Gather Required Materials**
|
||||
- **Sonoff ZBDongle-E**: Ensure you have the dongle ready.
|
||||
- **Computer**: A PC or Mac with a USB port.
|
||||
- **Firmware File**: Download the appropriate firmware for the ZBDongle-E from a reliable source (e.g., GitHub repository).
|
||||
- **Web Browser**: Use a Chromium-based browser like Chrome or Edge.
|
||||
|
||||
### 2. **Download Firmware**
|
||||
- Go to the GitHub page for Sonoff firmware and download the latest firmware for the ZBDongle-E, such as the Ember firmware or any other desired version ([GitHub Repository](https://github.com/itead/Sonoff_Zigbee_Dongle_Firmware/tree/master/Dongle-E/NCP_7.4.3)).
|
||||
|
||||
### 3. **Connect the Dongle**
|
||||
- Disconnect the ZBDongle-E from any device.
|
||||
- Plug it into your computer's USB port.
|
||||
|
||||
### 4. **Access the Flashing Tool**
|
||||
- Open your web browser and navigate to the [Silicon Labs Firmware Builder](https://darkxst.github.io/silabs-firmware-builder/).
|
||||
|
||||
### 5. **Connect to the Dongle**
|
||||
- Scroll down to find the section for ZBDongle-E.
|
||||
- Click on the **Connect** button.
|
||||
- In the dialog that appears, select your Sonoff dongle from the list and click on the blue **Connect** button.
|
||||
|
||||
### 6. **Select Firmware for Flashing**
|
||||
- After connecting, click on **Change Firmware**.
|
||||
- Choose the option to **Upload Your Own Firmware**.
|
||||
- Select the firmware file you downloaded earlier.
|
||||
|
||||
### 7. **Start Flashing Process**
|
||||
- Click on **Install** to begin flashing the firmware onto your ZBDongle-E.
|
||||
- Wait for the process to complete; do not disconnect or close your browser until flashing is finished.
|
||||
|
||||
### 8. **Completion and Power Cycle**
|
||||
- Once flashing is complete, a dialog will indicate success. Click on **Continue**.
|
||||
- It is recommended to power cycle your dongle by unplugging it and then reattaching it to the USB port.
|
||||
|
||||
### 9. **Verify Installation**
|
||||
- After reconnecting, check if your ZBDongle-E is recognized by your system.
|
||||
- You can also verify its functionality within your smart home setup (e.g., Home Assistant).
|
||||
|
||||
### Additional Notes
|
||||
- If you encounter issues connecting or flashing, ensure that you have installed any necessary drivers for your operating system.
|
||||
- Make sure that no other applications are trying to access the dongle during this process.
|
||||
|
||||
By following these steps, you should successfully flash your Sonoff ZBDongle-E, enabling it for use in various smart home applications, including Zigbee and potentially Thread networks.
|
||||
|
||||
Citations:
|
||||
[1] https://www.creatingsmarthome.com/index.php/2024/06/14/guide-flashing-sonoff-zigbee-usb-3-0-zbdongle-e-to-use-ember-firmware-with-z2m/
|
||||
[2] https://docs.homeseer.com/products/updating-firmware-for-sonoff-zbdongle-e-zigbee-usb
|
||||
[3] https://dialedin.com.au/blog/sonoff-zbdongle-e-rcp-firmware
|
||||
[4] https://www.youtube.com/watch?v=3mlu4YluJRs
|
||||
[5] https://www.reddit.com/r/homeassistant/comments/19b6a3d/zigstar_help_flashing_sonoff_usb_dongle_pluse_as/
|
||||
[6] https://community.home-assistant.io/t/which-firmware-for-sonoff-dongle-e-router/621819
|
||||
[7] https://community.hubitat.com/t/how-to-flash-sonoff-usb-dongle-to-be-a-zigbee-repeater-router-set-transmit-power/103284
|
||||
[8] https://www.smarthomejunkie.net/update-the-sonoff-zigbee-dongle-e-easily-how-to/
|
||||
[9] https://community.home-assistant.io/t/flashing-sonoff-zbdongle-e-to-router-question/725973
|
||||
|
||||
|
||||
@@ -0,0 +1,814 @@
|
||||
|
||||
```sql
|
||||
CREATE DATABASE hass;
|
||||
CREATE USER hass WITH PASSWORD 'hass';
|
||||
GRANT ALL PRIVILEGES ON DATABASE hass TO hass;
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
recorder:
|
||||
db_url: postgresql://hass:hass@store.local/hass
|
||||
```
|
||||
|
||||
|
||||
|
||||
Migrating your Home Assistant instance from SQLite to PostgreSQL involves a few steps. The process ensures all your historical state and event data from the existing SQLite database is preserved.
|
||||
|
||||
---
|
||||
|
||||
### **Step 1: Backup Your Current Home Assistant Instance**
|
||||
|
||||
1. **Stop Home Assistant**:
|
||||
|
||||
```bash
|
||||
sudo systemctl stop home-assistant
|
||||
```
|
||||
|
||||
2. **Create a Backup of Your SQLite Database**:
|
||||
|
||||
- The database is typically located in the Home Assistant configuration directory (e.g., `/config/` or `/home/homeassistant/.homeassistant`).
|
||||
|
||||
```bash
|
||||
cp home-assistant_v2.db home-assistant_v2.db.backup
|
||||
```
|
||||
|
||||
3. **Backup Your Configuration Files**:
|
||||
|
||||
```bash
|
||||
tar -czvf home_assistant_config_backup.tar.gz /path/to/home-assistant/config
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### **Step 2: Install and Configure PostgreSQL**
|
||||
|
||||
1. **Install PostgreSQL**:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install postgresql
|
||||
```
|
||||
|
||||
2. **Create a Database for Home Assistant**:
|
||||
|
||||
- Switch to the `postgres` user:
|
||||
|
||||
```bash
|
||||
sudo -i -u postgres
|
||||
```
|
||||
|
||||
- Create the database and user:
|
||||
|
||||
```bash
|
||||
psql
|
||||
CREATE DATABASE hass;
|
||||
CREATE USER hass WITH PASSWORD 'hass';
|
||||
GRANT ALL PRIVILEGES ON DATABASE hass TO hass;
|
||||
\q
|
||||
```
|
||||
|
||||
- Exit the `postgres` user:
|
||||
|
||||
```bash
|
||||
exit
|
||||
```
|
||||
|
||||
3. **Test the Connection**: Use the `psql` client to connect:
|
||||
|
||||
```bash
|
||||
psql -h localhost -U hass -d hass
|
||||
```
|
||||
|
||||
Enter the password you set earlier. If successful, you're ready to proceed.
|
||||
|
||||
|
||||
---
|
||||
|
||||
### **Step 3: Install Required Tools**
|
||||
|
||||
1. **Install SQLite and PostgreSQL Clients**:
|
||||
|
||||
```bash
|
||||
sudo apt install sqlite3 postgresql-client
|
||||
```
|
||||
|
||||
2. **Install `pgloader`**: `pgloader` is a tool for migrating data between SQLite and PostgreSQL.
|
||||
|
||||
```bash
|
||||
sudo apt install pgloader
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### **Step 4: Migrate Data from SQLite to PostgreSQL**
|
||||
|
||||
1. **Prepare the `pgloader` Command**: Create a file called `migrate.load` with the following content:
|
||||
|
||||
```lisp
|
||||
LOAD DATABASE
|
||||
FROM sqlite://./home-assistant_v2.db.bak
|
||||
INTO postgresql://hass:hass@localhost/hass
|
||||
|
||||
WITH data only,
|
||||
drop indexes,
|
||||
reset sequences,
|
||||
truncate;
|
||||
|
||||
ALTER SCHEMA "main" RENAME TO "public";
|
||||
|
||||
```
|
||||
|
||||
|
||||
Replace `/path/to/home-assistant_v2.db` with the actual path to your SQLite database file.
|
||||
|
||||
2. **Run the Migration**:
|
||||
|
||||
```bash
|
||||
pgloader migrate.load
|
||||
```
|
||||
|
||||
3. **Verify the Data in PostgreSQL**:
|
||||
|
||||
- Log in to PostgreSQL:
|
||||
|
||||
```bash
|
||||
psql -h localhost -U hass -d homeassistant
|
||||
```
|
||||
|
||||
- Check the tables:
|
||||
|
||||
```sql
|
||||
\dt
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### **Step 5: Configure Home Assistant to Use PostgreSQL**
|
||||
|
||||
1. **Edit `configuration.yaml`**: Add the PostgreSQL database URL:
|
||||
|
||||
```yaml
|
||||
recorder:
|
||||
db_url: postgresql://hass:hass@192.168.55.53/hass
|
||||
```
|
||||
|
||||
Replace `yourpassword` and `localhost` as needed.
|
||||
|
||||
2. **Restart Home Assistant**:
|
||||
|
||||
```bash
|
||||
sudo systemctl start home-assistant
|
||||
```
|
||||
|
||||
3. **Verify the Integration**:
|
||||
|
||||
- Check the logs in Home Assistant for any database-related errors.
|
||||
- Confirm new data is being written to PostgreSQL by querying the `states` table:
|
||||
|
||||
```sql
|
||||
SELECT * FROM states ORDER BY last_updated DESC LIMIT 10;
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### **Step 6: Clean Up**
|
||||
|
||||
1. **Remove Old SQLite Database**: Once you confirm PostgreSQL is working, you can safely remove the SQLite database:
|
||||
|
||||
```bash
|
||||
rm home-assistant_v2.db
|
||||
```
|
||||
|
||||
2. **Optimize PostgreSQL**:
|
||||
|
||||
- Configure PostgreSQL to improve performance: Edit `/etc/postgresql/<version>/main/postgresql.conf`:
|
||||
|
||||
```plaintext
|
||||
shared_buffers = 256MB
|
||||
work_mem = 16MB
|
||||
maintenance_work_mem = 64MB
|
||||
```
|
||||
|
||||
- Restart PostgreSQL:
|
||||
|
||||
```bash
|
||||
sudo systemctl restart postgresql
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### **Final Notes**
|
||||
|
||||
- Keep monitoring Home Assistant's logs during the first few days after migration to ensure the PostgreSQL setup is stable.
|
||||
- If needed, adjust the recorder settings in `configuration.yaml` to exclude entities or domains that generate excessive data:
|
||||
|
||||
```yaml
|
||||
recorder:
|
||||
include:
|
||||
domains:
|
||||
- sensor
|
||||
- switch
|
||||
exclude:
|
||||
entities:
|
||||
- sensor.unnecessary_metric
|
||||
```
|
||||
|
||||
|
||||
Let me know if you need assistance with any specific step!
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
```sql
|
||||
LOAD DATABASE
|
||||
FROM mysql://root:数据库密码@localhost:3306/homeassistant
|
||||
INTO pgsql://homeassistant:数据库密码@localhost:5432/homeassistant
|
||||
WITH data only, workers = 8, concurrency = 1
|
||||
CAST type datetime to timestamp drop default drop not null using zero-dates-to-null
|
||||
;
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
sqlite3 home-assistant_v2.db.bak .dump > ha_dump.sql
|
||||
```
|
||||
|
||||
|
||||
```bash
|
||||
sed -i 's/DATETIME/TIMESTAMP/g' ha_dump.sql
|
||||
```
|
||||
|
||||
```bash
|
||||
sed -i 's/BLOB/BYTEA/g' ha_dump.sql
|
||||
```
|
||||
|
||||
|
||||
```bash
|
||||
psql -h localhost -U hass -d hass -f ha_dump.sql -W > load.log 2>&1
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
pgloader sqlite://./home-assistant_v2.db.bak postgresql://hass:hass@localhost/hass
|
||||
```
|
||||
|
||||
|
||||
```sql
|
||||
CREATE SEQUENCE event_types_event_type_id_seq;
|
||||
CREATE SEQUENCE state_attributes_attributes_id_seq;
|
||||
CREATE SEQUENCE event_data_data_id_seq;
|
||||
CREATE SEQUENCE states_meta_metadata_id_seq;
|
||||
CREATE SEQUENCE statistics_meta_id_seq;
|
||||
CREATE SEQUENCE events_event_id_seq;
|
||||
CREATE SEQUENCE recorder_runs_run_id_seq;
|
||||
CREATE SEQUENCE schema_changes_change_id_seq;
|
||||
CREATE SEQUENCE statistics_runs_run_id_seq;
|
||||
CREATE SEQUENCE states_state_id_seq;
|
||||
CREATE SEQUENCE statistics_id_seq;
|
||||
CREATE SEQUENCE statistics_short_term_id_seq;
|
||||
|
||||
|
||||
SELECT setval('event_types_event_type_id_seq', MAX(event_type_id)) FROM event_types;
|
||||
SELECT setval('state_attributes_attributes_id_seq', MAX(attributes_id)) FROM state_attributes;
|
||||
SELECT setval('event_data_data_id_seq', MAX(data_id)) FROM event_data;
|
||||
SELECT setval('states_meta_metadata_id_seq', MAX(metadata_id)) FROM states_meta;
|
||||
SELECT setval('statistics_meta_id_seq', MAX(id)) FROM statistics_meta;
|
||||
SELECT setval('events_event_id_seq', MAX(event_id)) FROM events;
|
||||
SELECT setval('recorder_runs_run_id_seq', MAX(run_id)) FROM recorder_runs;
|
||||
SELECT setval('schema_changes_change_id_seq', MAX(change_id)) FROM schema_changes;
|
||||
SELECT setval('statistics_runs_run_id_seq', MAX(run_id)) FROM statistics_runs;
|
||||
SELECT setval('states_state_id_seq', MAX(state_id)) FROM states;
|
||||
SELECT setval('statistics_id_seq', MAX(id)) FROM statistics;
|
||||
SELECT setval('statistics_short_term_id_seq', MAX(id)) FROM statistics_short_term;
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
recorder:
|
||||
db_url: postgresql://hass:hass@192.168.55.53/hass
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
influxdb:
|
||||
host: 192.168.55.53
|
||||
port: 8428
|
||||
database: hass
|
||||
default_measurement: state
|
||||
|
||||
```
|
||||
|
||||
|
||||
mysql:
|
||||
|
||||
```sql
|
||||
CREATE DATABASE hass;
|
||||
CREATE USER 'hass'@'%' IDENTIFIED BY 'hass';
|
||||
GRANT ALL PRIVILEGES ON homeassistant.* TO 'hass'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
sqlite3mysql --sqlite-file home-assistant_v2.db --mysql-user hass --mysql-password hass --mysql-database hass
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
recorder:
|
||||
db_url: mysql://hass:hass@192.168.55.53/hass?charset=utf8mb4
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
influxdb:
|
||||
api_version: 1
|
||||
host: 192.168.55.53
|
||||
port: 8428
|
||||
max_retries: 3
|
||||
measurement_attr: entity_id
|
||||
tags_attributes:
|
||||
- friendly_name
|
||||
- unit_of_measurement
|
||||
ignore_attributes:
|
||||
- icon
|
||||
- source
|
||||
- options
|
||||
- editable
|
||||
- min
|
||||
- max
|
||||
- step
|
||||
- mode
|
||||
- marker_type
|
||||
- preset_modes
|
||||
- supported_features
|
||||
- supported_color_modes
|
||||
- effect_list
|
||||
- attribution
|
||||
- assumed_state
|
||||
- state_open
|
||||
- state_closed
|
||||
- writable
|
||||
- stateExtra
|
||||
- event
|
||||
- friendly_name
|
||||
- device_class
|
||||
- state_class
|
||||
- ip_address
|
||||
- device_file
|
||||
- unit_of_measurement
|
||||
- unitOfMeasure
|
||||
include:
|
||||
domains:
|
||||
- sensor
|
||||
- binary_sensor
|
||||
- light
|
||||
- switch
|
||||
- cover
|
||||
- climate
|
||||
- input_boolean
|
||||
- input_select
|
||||
- number
|
||||
- lock
|
||||
- weather
|
||||
exclude:
|
||||
entity_globs:
|
||||
- sensor.clock*
|
||||
- sensor.date*
|
||||
- sensor.glances*
|
||||
- sensor.time*
|
||||
- sensor.uptime*
|
||||
- sensor.dwd_weather_warnings_*
|
||||
- weather.weatherstation
|
||||
- binary_sensor.*_smartphone_*
|
||||
- sensor.*_smartphone_*
|
||||
- sensor.adguard_home_*
|
||||
- binary_sensor.*_internet_access
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
get sqlite schema
|
||||
```
|
||||
sqlite3 home-assistant_v2.db <<EOF
|
||||
.output sqlite-schema.sql
|
||||
.schema
|
||||
.exit
|
||||
EOF
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
postgresql create:
|
||||
|
||||
```sql
|
||||
-- Drop all tables and references to ensure a clean slate
|
||||
|
||||
DROP TABLE IF EXISTS event_data CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS event_types CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS state_attributes CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS states_meta CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS statistics_meta CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS recorder_runs CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS migration_changes CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS schema_changes CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS statistics_runs CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS events CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS states CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS statistics CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS statistics_short_term CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS sqlite_stat1 CASCADE;
|
||||
|
||||
|
||||
|
||||
-- Enable TimescaleDB extension
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS timescaledb;
|
||||
|
||||
|
||||
|
||||
-- Create tables with appropriate data types and constraints
|
||||
|
||||
CREATE TABLE event_data (
|
||||
|
||||
data_id SERIAL PRIMARY KEY,
|
||||
|
||||
hash BIGINT,
|
||||
|
||||
shared_data TEXT
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX ix_event_data_hash ON event_data (hash);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE event_types (
|
||||
|
||||
event_type_id SERIAL PRIMARY KEY,
|
||||
|
||||
event_type VARCHAR(64) UNIQUE
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE state_attributes (
|
||||
|
||||
attributes_id SERIAL PRIMARY KEY,
|
||||
|
||||
hash BIGINT,
|
||||
|
||||
shared_attrs TEXT
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX ix_state_attributes_hash ON state_attributes (hash);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE states_meta (
|
||||
|
||||
metadata_id SERIAL PRIMARY KEY,
|
||||
|
||||
entity_id VARCHAR(255) UNIQUE
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE statistics_meta (
|
||||
|
||||
id SERIAL PRIMARY KEY,
|
||||
|
||||
statistic_id VARCHAR(255),
|
||||
|
||||
source VARCHAR(32),
|
||||
|
||||
unit_of_measurement VARCHAR(255),
|
||||
|
||||
has_mean BOOLEAN,
|
||||
|
||||
has_sum BOOLEAN,
|
||||
|
||||
name VARCHAR(255)
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE recorder_runs (
|
||||
|
||||
run_id SERIAL PRIMARY KEY,
|
||||
|
||||
start TIMESTAMPTZ NOT NULL,
|
||||
|
||||
"end" TIMESTAMPTZ,
|
||||
|
||||
closed_incorrect BOOLEAN NOT NULL,
|
||||
|
||||
created TIMESTAMPTZ NOT NULL
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX ix_recorder_runs_start_end ON recorder_runs (start, "end");
|
||||
|
||||
|
||||
|
||||
CREATE TABLE migration_changes (
|
||||
|
||||
migration_id VARCHAR(255) PRIMARY KEY,
|
||||
|
||||
version SMALLINT NOT NULL
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE schema_changes (
|
||||
|
||||
change_id SERIAL PRIMARY KEY,
|
||||
|
||||
schema_version INTEGER,
|
||||
|
||||
changed TIMESTAMPTZ NOT NULL
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE statistics_runs (
|
||||
|
||||
run_id SERIAL PRIMARY KEY,
|
||||
|
||||
start TIMESTAMPTZ NOT NULL
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX ix_statistics_runs_start ON statistics_runs (start);
|
||||
|
||||
|
||||
|
||||
-- Create hypertable for time-series data
|
||||
|
||||
CREATE TABLE events (
|
||||
|
||||
event_id SERIAL NOT NULL,
|
||||
|
||||
event_type VARCHAR(64),
|
||||
|
||||
event_data TEXT,
|
||||
|
||||
origin VARCHAR(64),
|
||||
|
||||
origin_idx SMALLINT,
|
||||
|
||||
time_fired TIMESTAMPTZ NOT NULL, -- Partitioning column
|
||||
|
||||
time_fired_ts DOUBLE PRECISION,
|
||||
|
||||
context_id UUID,
|
||||
|
||||
context_user_id UUID,
|
||||
|
||||
context_parent_id UUID,
|
||||
|
||||
data_id INTEGER,
|
||||
|
||||
context_id_bin BYTEA,
|
||||
|
||||
context_user_id_bin BYTEA,
|
||||
|
||||
context_parent_id_bin BYTEA,
|
||||
|
||||
event_type_id INTEGER,
|
||||
|
||||
PRIMARY KEY (event_id, time_fired), -- Composite primary key
|
||||
|
||||
FOREIGN KEY (data_id) REFERENCES event_data (data_id),
|
||||
|
||||
FOREIGN KEY (event_type_id) REFERENCES event_types (event_type_id)
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
SELECT create_hypertable('events', 'time_fired');
|
||||
|
||||
|
||||
|
||||
-- Add time_fired to all unique indexes on hypertables
|
||||
|
||||
CREATE INDEX ix_events_data_id ON events (data_id);
|
||||
|
||||
CREATE UNIQUE INDEX ix_events_event_type_id_time_fired_ts ON events (event_type_id, time_fired, time_fired_ts);
|
||||
|
||||
CREATE INDEX ix_events_time_fired_ts ON events (time_fired_ts);
|
||||
|
||||
CREATE INDEX ix_events_context_id_bin ON events (context_id_bin);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE states (
|
||||
|
||||
state_id SERIAL PRIMARY KEY,
|
||||
|
||||
entity_id VARCHAR(255),
|
||||
|
||||
state VARCHAR(255),
|
||||
|
||||
attributes TEXT,
|
||||
|
||||
event_id INTEGER,
|
||||
|
||||
last_changed TIMESTAMPTZ,
|
||||
|
||||
last_changed_ts DOUBLE PRECISION,
|
||||
|
||||
last_reported_ts DOUBLE PRECISION,
|
||||
|
||||
last_updated TIMESTAMPTZ,
|
||||
|
||||
last_updated_ts DOUBLE PRECISION,
|
||||
|
||||
old_state_id INTEGER,
|
||||
|
||||
attributes_id INTEGER,
|
||||
|
||||
context_id UUID,
|
||||
|
||||
context_user_id UUID,
|
||||
|
||||
context_parent_id UUID,
|
||||
|
||||
origin_idx SMALLINT,
|
||||
|
||||
context_id_bin BYTEA,
|
||||
|
||||
context_user_id_bin BYTEA,
|
||||
|
||||
context_parent_id_bin BYTEA,
|
||||
|
||||
metadata_id INTEGER,
|
||||
|
||||
FOREIGN KEY(old_state_id) REFERENCES states (state_id),
|
||||
|
||||
FOREIGN KEY(attributes_id) REFERENCES state_attributes (attributes_id),
|
||||
|
||||
FOREIGN KEY(metadata_id) REFERENCES states_meta (metadata_id)
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX ix_states_last_updated_ts ON states (last_updated_ts);
|
||||
|
||||
CREATE INDEX ix_states_context_id_bin ON states (context_id_bin);
|
||||
|
||||
CREATE INDEX ix_states_attributes_id ON states (attributes_id);
|
||||
|
||||
CREATE INDEX ix_states_old_state_id ON states (old_state_id);
|
||||
|
||||
CREATE INDEX ix_states_metadata_id_last_updated_ts ON states (metadata_id, last_updated_ts);
|
||||
|
||||
|
||||
|
||||
-- Drop the existing table if necessary
|
||||
|
||||
DROP TABLE IF EXISTS statistics CASCADE;
|
||||
|
||||
|
||||
|
||||
-- Create the statistics table
|
||||
|
||||
CREATE TABLE statistics (
|
||||
|
||||
id SERIAL not NULL, -- Simple primary key
|
||||
|
||||
created TIMESTAMPTZ,
|
||||
|
||||
created_ts DOUBLE PRECISION,
|
||||
|
||||
metadata_id INTEGER,
|
||||
|
||||
start TIMESTAMPTZ NOT NULL, -- Partitioning column
|
||||
|
||||
start_ts DOUBLE PRECISION,
|
||||
|
||||
mean DOUBLE PRECISION,
|
||||
|
||||
min DOUBLE PRECISION,
|
||||
|
||||
max DOUBLE PRECISION,
|
||||
|
||||
last_reset TIMESTAMPTZ,
|
||||
|
||||
last_reset_ts DOUBLE PRECISION,
|
||||
|
||||
state DOUBLE PRECISION,
|
||||
|
||||
sum DOUBLE PRECISION,
|
||||
|
||||
PRIMARY KEY (id, start),
|
||||
|
||||
FOREIGN KEY(metadata_id) REFERENCES statistics_meta (id) ON DELETE CASCADE
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
-- Create the hypertable with 'start' as the partitioning column
|
||||
|
||||
SELECT create_hypertable('statistics', 'start');
|
||||
|
||||
|
||||
|
||||
-- Create a unique index that includes the partitioning column
|
||||
|
||||
CREATE UNIQUE INDEX ix_statistics_statistic_id_start_ts ON statistics (metadata_id, start_ts, start);
|
||||
|
||||
|
||||
|
||||
-- Additional non-unique index for querying by start_ts
|
||||
|
||||
CREATE INDEX ix_statistics_start_ts ON statistics (start_ts);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CREATE TABLE statistics_short_term (
|
||||
|
||||
id SERIAL not null,
|
||||
|
||||
created TIMESTAMPTZ,
|
||||
|
||||
created_ts DOUBLE PRECISION,
|
||||
|
||||
metadata_id INTEGER,
|
||||
|
||||
start TIMESTAMPTZ NOT NULL, -- Partitioning column
|
||||
|
||||
start_ts DOUBLE PRECISION,
|
||||
|
||||
mean DOUBLE PRECISION,
|
||||
|
||||
min DOUBLE PRECISION,
|
||||
|
||||
max DOUBLE PRECISION,
|
||||
|
||||
last_reset TIMESTAMPTZ,
|
||||
|
||||
last_reset_ts DOUBLE PRECISION,
|
||||
|
||||
state DOUBLE PRECISION,
|
||||
|
||||
sum DOUBLE PRECISION,
|
||||
|
||||
primary key(id, start),
|
||||
|
||||
FOREIGN KEY(metadata_id) REFERENCES statistics_meta (id) ON DELETE CASCADE
|
||||
|
||||
);
|
||||
|
||||
SELECT create_hypertable('statistics_short_term', 'start');
|
||||
|
||||
CREATE UNIQUE INDEX ix_statistics_short_term_statistic_id_start_ts ON statistics_short_term (metadata_id, start_ts, start);
|
||||
|
||||
CREATE INDEX ix_statistics_short_term_start_ts ON statistics_short_term (start_ts);
|
||||
|
||||
|
||||
|
||||
-- Drop unsupported SQLite-specific table
|
||||
|
||||
DROP TABLE IF EXISTS sqlite_stat1 CASCADE;
|
||||
```
|
||||
Executable
+273
@@ -0,0 +1,273 @@
|
||||
|
||||
|
||||
|
||||
Congratulation, your registration already validated.
|
||||
|
||||
Your token is
|
||||
|
||||
761ba9c8b1745baed8d667f036d6ab46a843b962
|
||||
|
||||
|
||||
|
||||
|
||||
You can now try, for instance, to get the beijing feed using:
|
||||
[https://api.waqi.info/feed/here/?token=761ba9c8b1745baed8d667f036d6ab46a843b962](https://api.waqi.info/feed/here/?token=761ba9c8b1745baed8d667f036d6ab46a843b962)
|
||||
|
||||
And you will get this result:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"aqi": 38,
|
||||
"idx": 1451,
|
||||
"attributions": [
|
||||
{
|
||||
"url": "http://www.bjmemc.com.cn/",
|
||||
"name": "Beijing Environmental Protection Monitoring Center (北京市环境保护监测中心)"
|
||||
},
|
||||
{
|
||||
"url": "https://waqi.info/",
|
||||
"name": "World Air Quality Index Project"
|
||||
}
|
||||
],
|
||||
"city": {
|
||||
"geo": [
|
||||
39.954592,
|
||||
116.468117
|
||||
],
|
||||
"name": "Beijing (北京)",
|
||||
"url": "https://aqicn.org/city/beijing",
|
||||
"location": ""
|
||||
},
|
||||
"dominentpol": "pm25",
|
||||
"iaqi": {
|
||||
"co": {
|
||||
"v": 3.7
|
||||
},
|
||||
"h": {
|
||||
"v": 33
|
||||
},
|
||||
"no2": {
|
||||
"v": 9.2
|
||||
},
|
||||
"o3": {
|
||||
"v": 19.9
|
||||
},
|
||||
"p": {
|
||||
"v": 1035
|
||||
},
|
||||
"pm10": {
|
||||
"v": 21
|
||||
},
|
||||
"pm25": {
|
||||
"v": 38
|
||||
},
|
||||
"so2": {
|
||||
"v": 1.6
|
||||
},
|
||||
"t": {
|
||||
"v": -1
|
||||
},
|
||||
"w": {
|
||||
"v": 4.6
|
||||
}
|
||||
},
|
||||
"time": {
|
||||
"s": "2024-12-13 23:00:00",
|
||||
"tz": "+08:00",
|
||||
"v": 1734130800,
|
||||
"iso": "2024-12-13T23:00:00+08:00"
|
||||
},
|
||||
"forecast": {
|
||||
"daily": {
|
||||
"o3": [
|
||||
{
|
||||
"avg": 1,
|
||||
"day": "2024-12-12",
|
||||
"max": 1,
|
||||
"min": 1
|
||||
},
|
||||
{
|
||||
"avg": 7,
|
||||
"day": "2024-12-13",
|
||||
"max": 14,
|
||||
"min": 1
|
||||
},
|
||||
{
|
||||
"avg": 2,
|
||||
"day": "2024-12-14",
|
||||
"max": 10,
|
||||
"min": 1
|
||||
},
|
||||
{
|
||||
"avg": 4,
|
||||
"day": "2024-12-15",
|
||||
"max": 13,
|
||||
"min": 1
|
||||
},
|
||||
{
|
||||
"avg": 1,
|
||||
"day": "2024-12-16",
|
||||
"max": 6,
|
||||
"min": 1
|
||||
},
|
||||
{
|
||||
"avg": 1,
|
||||
"day": "2024-12-17",
|
||||
"max": 5,
|
||||
"min": 1
|
||||
},
|
||||
{
|
||||
"avg": 1,
|
||||
"day": "2024-12-18",
|
||||
"max": 1,
|
||||
"min": 1
|
||||
}
|
||||
],
|
||||
"pm10": [
|
||||
{
|
||||
"avg": 67,
|
||||
"day": "2024-12-12",
|
||||
"max": 73,
|
||||
"min": 58
|
||||
},
|
||||
{
|
||||
"avg": 27,
|
||||
"day": "2024-12-13",
|
||||
"max": 72,
|
||||
"min": 7
|
||||
},
|
||||
{
|
||||
"avg": 29,
|
||||
"day": "2024-12-14",
|
||||
"max": 46,
|
||||
"min": 11
|
||||
},
|
||||
{
|
||||
"avg": 39,
|
||||
"day": "2024-12-15",
|
||||
"max": 58,
|
||||
"min": 19
|
||||
},
|
||||
{
|
||||
"avg": 45,
|
||||
"day": "2024-12-16",
|
||||
"max": 58,
|
||||
"min": 24
|
||||
},
|
||||
{
|
||||
"avg": 41,
|
||||
"day": "2024-12-17",
|
||||
"max": 57,
|
||||
"min": 16
|
||||
},
|
||||
{
|
||||
"avg": 69,
|
||||
"day": "2024-12-18",
|
||||
"max": 73,
|
||||
"min": 57
|
||||
},
|
||||
{
|
||||
"avg": 95,
|
||||
"day": "2024-12-19",
|
||||
"max": 116,
|
||||
"min": 72
|
||||
}
|
||||
],
|
||||
"pm25": [
|
||||
{
|
||||
"avg": 168,
|
||||
"day": "2024-12-12",
|
||||
"max": 174,
|
||||
"min": 159
|
||||
},
|
||||
{
|
||||
"avg": 86,
|
||||
"day": "2024-12-13",
|
||||
"max": 173,
|
||||
"min": 30
|
||||
},
|
||||
{
|
||||
"avg": 91,
|
||||
"day": "2024-12-14",
|
||||
"max": 138,
|
||||
"min": 42
|
||||
},
|
||||
{
|
||||
"avg": 116,
|
||||
"day": "2024-12-15",
|
||||
"max": 158,
|
||||
"min": 68
|
||||
},
|
||||
{
|
||||
"avg": 130,
|
||||
"day": "2024-12-16",
|
||||
"max": 158,
|
||||
"min": 80
|
||||
},
|
||||
{
|
||||
"avg": 122,
|
||||
"day": "2024-12-17",
|
||||
"max": 158,
|
||||
"min": 60
|
||||
},
|
||||
{
|
||||
"avg": 170,
|
||||
"day": "2024-12-18",
|
||||
"max": 174,
|
||||
"min": 158
|
||||
},
|
||||
{
|
||||
"avg": 203,
|
||||
"day": "2024-12-19",
|
||||
"max": 238,
|
||||
"min": 172
|
||||
}
|
||||
],
|
||||
"uvi": [
|
||||
{
|
||||
"avg": 0,
|
||||
"day": "2024-12-13",
|
||||
"max": 1,
|
||||
"min": 0
|
||||
},
|
||||
{
|
||||
"avg": 0,
|
||||
"day": "2024-12-14",
|
||||
"max": 1,
|
||||
"min": 0
|
||||
},
|
||||
{
|
||||
"avg": 0,
|
||||
"day": "2024-12-15",
|
||||
"max": 1,
|
||||
"min": 0
|
||||
},
|
||||
{
|
||||
"avg": 0,
|
||||
"day": "2024-12-16",
|
||||
"max": 1,
|
||||
"min": 0
|
||||
},
|
||||
{
|
||||
"avg": 0,
|
||||
"day": "2024-12-17",
|
||||
"max": 1,
|
||||
"min": 0
|
||||
},
|
||||
{
|
||||
"avg": 0,
|
||||
"day": "2024-12-18",
|
||||
"max": 0,
|
||||
"min": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"sync": "2024-12-14T01:26:38+09:00"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
|
||||
|
||||
Yes, **pgloader** can work with a **MySQL dump file**, but it is not the most common or optimal way to use pgloader. By default, pgloader is designed to connect directly to the MySQL or MariaDB database and migrate the schema and data to PostgreSQL in one seamless operation. However, it does have support for importing data from SQL dump files.
|
||||
|
||||
---
|
||||
|
||||
### **How to Use pgloader with a MySQL Dump File**
|
||||
|
||||
#### **1. Prepare the MySQL Dump File**
|
||||
|
||||
Generate a dump file from MariaDB/MySQL that is compatible with PostgreSQL:
|
||||
|
||||
```bash
|
||||
mysqldump --compatible=postgresql --default-character-set=utf8 --no-create-db --skip-lock-tables --extended-insert --quote-names -u hass -p hass > hass.sql
|
||||
```
|
||||
|
||||
|
||||
- `--compatible=postgresql`: Ensures basic compatibility with PostgreSQL.
|
||||
- `--skip-lock-tables`: Prevents table locking during dump.
|
||||
- `--extended-insert`: Creates multi-row insert statements, which are efficient.
|
||||
- `--quote-names`: Ensures column names are quoted, reducing syntax conflicts.
|
||||
|
||||
#### **2. Adjust the Dump File (If Needed)**
|
||||
|
||||
MySQL dump files may still include syntax incompatible with PostgreSQL, such as:
|
||||
|
||||
- **AUTO_INCREMENT** → Replace with PostgreSQL `SERIAL`.
|
||||
- **Backticks (`)** → Replace with double quotes (`"`).
|
||||
- **Engine and Charset Options**:
|
||||
|
||||
```sql
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
```
|
||||
|
||||
Remove or ignore these lines.
|
||||
|
||||
Tools like `sed` or manual editing can handle these adjustments.
|
||||
|
||||
#### **3. Use pgloader to Import the Dump File**
|
||||
|
||||
Create a pgloader configuration file to handle the dump file import. Here's an example configuration:
|
||||
|
||||
```lisp
|
||||
LOAD DATABASE
|
||||
FROM FILE 'hass.sql'
|
||||
INTO postgresql://hass:hass@localhost/hass
|
||||
|
||||
WITH include no drop, create tables, create indexes, reset sequences
|
||||
|
||||
SET work_mem to '128MB',
|
||||
maintenance_work_mem to '512MB'
|
||||
|
||||
ALTER SCHEMA 'hass' RENAME TO 'public';
|
||||
```
|
||||
|
||||
- **FROM FILE**: Specifies the path to the MySQL dump file.
|
||||
- **INTO**: Defines the PostgreSQL database connection string.
|
||||
- **ALTER SCHEMA**: Optionally maps schemas.
|
||||
|
||||
Run pgloader:
|
||||
|
||||
```bash
|
||||
pgloader /path/to/config_file.load
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### **Caveats**
|
||||
|
||||
- **Dump File Complexity**: If the dump file includes MariaDB/MySQL-specific functions or features, these might not be translated properly.
|
||||
- **Manual Adjustments**: Even with `--compatible=postgresql`, dump files often need manual cleanup.
|
||||
- **Direct Connection Preferred**: When possible, connect pgloader directly to the MariaDB database for a smoother migration:
|
||||
|
||||
```bash
|
||||
pgloader mysql://user:password@host/dbname postgresql://user:password@host/dbname
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
### **Best Practice**
|
||||
|
||||
If your dump file requires significant manual adjustment, consider alternatives:
|
||||
|
||||
- Use a direct pgloader connection.
|
||||
- Opt for an ETL tool or custom migration script if your schema is complex.
|
||||
|
||||
Let me know if you’d like help fine-tuning a configuration for pgloader or alternatives! 🚀
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
|
||||
windy-esp
|
||||
key
|
||||
```
|
||||
kVH0VWBT1R6h9npUIQKWqmmrcpjhtzpywniDWutjwhQ=
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
token:
|
||||
```
|
||||
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiNjVjMzgyZDdiMGE0Yjk3OWJmZjhjYTk4NmRmMjFmMyIsImlhdCI6MTczNDY4NjkxNSwiZXhwIjoyMDUwMDQ2OTE1fQ.A69RTqVKSs4fMzzAuO6NRF8UXEXjgKNvz5fhrdYAl6Y
|
||||
```
|
||||
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
tuya local
|
||||
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
default user: homeassistant
|
||||
default password:
|
||||
```
|
||||
__**password_not_changed**__
|
||||
```
|
||||
|
||||
```
|
||||
mqtt:
|
||||
broker: "192.168.55.53"
|
||||
port: 1883
|
||||
username: "hass"
|
||||
password: "hass"
|
||||
discovery: true
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
login by wexin qrcode
|
||||
|
||||
login id generate:
|
||||
```python
|
||||
def generate_qr_login_id():
|
||||
|
||||
"""
|
||||
|
||||
Generate a unique id for qr code login
|
||||
|
||||
word-by-word copied from js code
|
||||
|
||||
"""
|
||||
|
||||
rand_str = f"{int(time.time() * 1000)}{random.random()}"
|
||||
|
||||
return md5(rand_str.encode()).hexdigest()
|
||||
```
|
||||
|
||||
generated:
|
||||
```id
|
||||
607d21bf2f06142e52d2057de49eed8d
|
||||
```
|
||||
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
|
||||
```
|
||||
|
||||
type: vertical-stack
|
||||
cards:
|
||||
- type: horizontal-stack
|
||||
title: 用电状态
|
||||
cards:
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_this_month_total_usage
|
||||
name: 本月用电
|
||||
icon: mdi:home-lightning-bolt-outline
|
||||
- hours_to_show: 24
|
||||
graph: none
|
||||
type: sensor
|
||||
entity: sensor.0800041935246530_latest_day_kwh
|
||||
name: 昨天用电
|
||||
icon: mdi:home-lightning-bolt-outline
|
||||
detail: 1
|
||||
- hours_to_show: 24
|
||||
graph: none
|
||||
type: sensor
|
||||
entity: sensor.0800041935246530_arrears
|
||||
detail: 1
|
||||
icon: mdi:currency-jpy
|
||||
unit: 元
|
||||
name: 应交电费
|
||||
- type: horizontal-stack
|
||||
cards:
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_last_month_total_usage
|
||||
name: 上月用电
|
||||
icon: mdi:home-lightning-bolt-outline
|
||||
- hours_to_show: 24
|
||||
graph: none
|
||||
type: sensor
|
||||
entity: sensor.airpowerheatertemperature
|
||||
name: 上月电费
|
||||
detail: 1
|
||||
icon: mdi:currency-jpy
|
||||
unit: 元
|
||||
- type: horizontal-stack
|
||||
cards:
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_this_year_total_usage
|
||||
name: 本年用电
|
||||
icon: mdi:home-lightning-bolt-outline
|
||||
- hours_to_show: 24
|
||||
graph: none
|
||||
type: sensor
|
||||
entity: sensor.0800041935246530_this_year_total_cost
|
||||
name: 本年电费
|
||||
detail: 1
|
||||
icon: mdi:currency-jpy
|
||||
unit: 元
|
||||
- type: horizontal-stack
|
||||
cards:
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_last_year_total_usage
|
||||
icon: mdi:home-lightning-bolt-outline
|
||||
name: 上年用电
|
||||
- hours_to_show: 24
|
||||
graph: none
|
||||
type: sensor
|
||||
entity: sensor.0800041935246530_last_year_total_cost
|
||||
name: 上年电费
|
||||
detail: 1
|
||||
icon: mdi:currency-jpy
|
||||
unit: 元
|
||||
- type: horizontal-stack
|
||||
cards:
|
||||
- type: custom:apexcharts-card
|
||||
header:
|
||||
show: true
|
||||
title: 30天用电与费用趋势图
|
||||
graph_span: 30d
|
||||
span:
|
||||
start: day
|
||||
offset: '-30d'
|
||||
series:
|
||||
- entity: sensor.history_day
|
||||
type: column
|
||||
name: 用电功率
|
||||
color: rgb(51,153,255)
|
||||
attribute: history_day_value
|
||||
data_generator: |
|
||||
return entity.attributes.history_day_value.map(entry => {
|
||||
return {
|
||||
x: entry.date,
|
||||
y: entry.kwh
|
||||
};
|
||||
});
|
||||
- entity: sensor.history_day
|
||||
name: 用电费用
|
||||
color: rgb(255,153,0)
|
||||
attribute: history_day_value
|
||||
data_generator: |
|
||||
return entity.attributes.history_day_value.map(entry => {
|
||||
return {
|
||||
x: entry.date,
|
||||
y: entry.kwh*0.65886875
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
type: grid
|
||||
cards:
|
||||
- type: vertical-stack
|
||||
cards:
|
||||
- type: horizontal-stack
|
||||
title: 用电状态
|
||||
cards:
|
||||
- graph: none
|
||||
type: sensor
|
||||
entity: sensor.0800041935246530_this_month_total_usage
|
||||
name: 本月用电
|
||||
icon: mdi:home-lightning-bolt-outline
|
||||
hours_to_show: 24
|
||||
detail: 1
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_latest_day_kwh
|
||||
name: 昨天用电
|
||||
icon: mdi:home-lightning-bolt-outline
|
||||
detail: 1
|
||||
hours_to_show: 24
|
||||
graph: none
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_arrears
|
||||
detail: 1
|
||||
icon: mdi:currency-jpy
|
||||
unit: 元
|
||||
name: 应交电费
|
||||
grid_options:
|
||||
columns: 12
|
||||
rows: 4
|
||||
- type: horizontal-stack
|
||||
cards:
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_last_month_total_usage
|
||||
name: 上月用电
|
||||
icon: mdi:home-lightning-bolt-outline
|
||||
hours_to_show: 24
|
||||
graph: none
|
||||
- type: sensor
|
||||
entity: sensor.airpowerheatertemperature
|
||||
name: 上月电费
|
||||
detail: 1
|
||||
icon: mdi:currency-jpy
|
||||
unit: 元
|
||||
grid_options:
|
||||
columns: 12
|
||||
rows: 2
|
||||
- type: horizontal-stack
|
||||
cards:
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_this_year_total_usage
|
||||
name: 本年用电
|
||||
icon: mdi:home-lightning-bolt-outline
|
||||
hours_to_show: 24
|
||||
graph: none
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_this_year_total_cost
|
||||
name: 本年电费
|
||||
detail: 1
|
||||
icon: mdi:currency-jpy
|
||||
unit: 元
|
||||
grid_options:
|
||||
columns: 12
|
||||
rows: 2
|
||||
- type: horizontal-stack
|
||||
cards:
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_last_year_total_usage
|
||||
icon: mdi:home-lightning-bolt-outline
|
||||
name: 上年用电
|
||||
hours_to_show: 24
|
||||
graph: none
|
||||
- type: sensor
|
||||
entity: sensor.0800041935246530_last_year_total_cost
|
||||
name: 上年电费
|
||||
detail: 1
|
||||
icon: mdi:currency-jpy
|
||||
unit: 元
|
||||
grid_options:
|
||||
columns: 12
|
||||
rows: 2
|
||||
- type: horizontal-stack
|
||||
cards:
|
||||
- type: custom:apexcharts-card
|
||||
header:
|
||||
show: true
|
||||
title: 30天用电与费用趋势图
|
||||
graph_span: 30d
|
||||
span:
|
||||
start: day
|
||||
offset: "-30d"
|
||||
series:
|
||||
- entity: sensor.history_day
|
||||
type: column
|
||||
name: 用电功率
|
||||
color: rgb(51,153,255)
|
||||
attribute: history_day_value
|
||||
data_generator: |
|
||||
return entity.attributes.history_day_value.map(entry => {
|
||||
return {
|
||||
x: entry.date,
|
||||
y: entry.kwh
|
||||
};
|
||||
});
|
||||
- entity: sensor.history_day
|
||||
name: 用电费用
|
||||
color: rgb(255,153,0)
|
||||
attribute: history_day_value
|
||||
data_generator: |
|
||||
return entity.attributes.history_day_value.map(entry => {
|
||||
return {
|
||||
x: entry.date,
|
||||
y: entry.kwh*0.65886875
|
||||
};
|
||||
});
|
||||
grid_options:
|
||||
columns: 12
|
||||
rows: 5
|
||||
column_span: 1
|
||||
|
||||
```
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
|
||||
api key:
|
||||
```
|
||||
36602152f76cae66841cd3c94d99405b.nhlX0m8dCtBOxB8S
|
||||
```
|
||||
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
icloud mail app password:
|
||||
thunderbird
|
||||
Your app-specific password is:
|
||||
noej-ippd-yisl-uqsk
|
||||
|
||||
189.cn
|
||||
iJ(7wA=4P#0dQ@2u
|
||||
|
||||
|
||||
azure mailstor
|
||||
|
||||
url:
|
||||
https://mailstor.blob.core.windows.net/debian-mail
|
||||
account:
|
||||
mailstor
|
||||
|
||||
container:
|
||||
debian-mail
|
||||
|
||||
key:
|
||||
lG7aKaNulWkq8xSgte7k3Xc6IZ56180Ec9FRP1OY2l3wfQttj+dCxVjP/R2Hd3PXKAkn4vQsW7yW+AStiJ92ag==
|
||||
|
||||
conn string:
|
||||
DefaultEndpointsProtocol=https;AccountName=mailstor;AccountKey=lG7aKaNulWkq8xSgte7k3Xc6IZ56180Ec9FRP1OY2l3wfQttj+dCxVjP/R2Hd3PXKAkn4vQsW7yW+AStiJ92ag==;EndpointSuffix=core.windows.net
|
||||
|
||||
|
||||
exmail.qq.com
|
||||
mac pass:
|
||||
acBcj9DUCyfoPRm6
|
||||
|
||||
|
||||
|
||||
disable antivirus
|
||||
```
|
||||
#### Re: [SOLVED] ClamAV errors even after disabled
|
||||
|
||||
SOLVED.
|
||||
|
||||
I've found someone with exactly the same problem ( [https://www.howtoforge.com/community/th … vis.52114/](https://www.howtoforge.com/community/threads/how-to-disable-clamav-or-spamassassin-check-in-amavis.52114/) )
|
||||
|
||||
The solution is to create a new file /etc/amavis/conf.d/90-custom with :
|
||||
|
||||
use strict;
|
||||
@bypass_virus_checks_maps = (1);
|
||||
#------------ Do not modify anything below this line -------------
|
||||
1; # insure a defined return
|
||||
|
||||
And restart, this works!
|
||||
```
|
||||
|
||||
|
||||
postfix admin
|
||||
|
||||
|
||||
```bash
|
||||
php -r "echo password_hash('windyboy@2006', PASSWORD_DEFAULT);"
|
||||
```
|
||||
|
||||
|
||||
config.local
|
||||
```
|
||||
$CONF['setup_password'] = '$2y$10$WSt0rsujCFKjycFqugG4GuWA2HwokFr91LkG9up8CiV6QDN2EGPPO';
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
sudo bash /var/www/postfixadmin/scripts/postfixadmin-cli admin add zhiqiang@windy.me --superadmin 1 --active 1 --password windyboy@2006 --password2 windyboy@2006
|
||||
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
List:
|
||||
- New application features and menu
|
||||
- Focus mode for the current line
|
||||
- Focus UI for writing
|
||||
@@ -0,0 +1,365 @@
|
||||
/* Special Font */
|
||||
body, p {
|
||||
font-family: "Dank Mono",'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Microsoft YaHei Light", sans-serif;
|
||||
}
|
||||
|
||||
.cm-s-obsidian {
|
||||
font-family: "Dank Mono",'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Microsoft YaHei Light", sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.editor {
|
||||
font-family: "Dank Mono",'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Microsoft YaHei Light", sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.markdown-preview-view code {
|
||||
font-family: "Dank Mono",'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Microsoft YaHei Light", sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.preview {
|
||||
font-family: "Dank Mono",'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Microsoft YaHei Light", sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* Scrollbar */
|
||||
::-webkit-scrollbar {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/**/
|
||||
/* Editor Section */
|
||||
/**/
|
||||
/* Line size */
|
||||
.cm-s-obsidian pre.HyperMD-header {
|
||||
line-height: 1!important;
|
||||
}
|
||||
|
||||
/* Selection */
|
||||
.theme-light {
|
||||
--text-selection: rgba(112, 93, 207, 0.5);
|
||||
}
|
||||
|
||||
.theme-dark {
|
||||
--text-selection: rgba(112, 93, 207, 0.5);
|
||||
}
|
||||
|
||||
::selection {
|
||||
background-color: #705dcf;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Title */
|
||||
/* Current main pane */
|
||||
.view-header-title {
|
||||
color: #705dcf;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.workspace-leaf.mod-active .view-header {
|
||||
text-align: center;
|
||||
}
|
||||
/* Other pane */
|
||||
.workspace-leaf-header-title-container {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Headers */
|
||||
span.cm-formatting.cm-formatting-header.cm-formatting-header-1.cm-header.cm-header-1 {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
span.cm-formatting.cm-formatting-header.cm-formatting-header-2.cm-header.cm-header-2 {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
span.cm-formatting.cm-formatting-header.cm-formatting-header-3.cm-header.cm-header-3 {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
span.cm-formatting.cm-formatting-header.cm-formatting-header-4.cm-header.cm-header-4 {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
span.cm-formatting.cm-formatting-header.cm-formatting-header-5.cm-header.cm-header-5 {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
span.cm-formatting.cm-formatting-header.cm-formatting-header-6.cm-header.cm-header-6 {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
/* Header folder icon */
|
||||
.CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded {
|
||||
color: #3e3471;
|
||||
}
|
||||
|
||||
.CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
/* Cursor */
|
||||
.cm-fat-cursor .CodeMirror-cursor {
|
||||
background: #3e3471;
|
||||
}
|
||||
|
||||
.cm-animate-fat-cursor {
|
||||
background-color: #3e3471;
|
||||
}
|
||||
|
||||
/* Selection in popup ([[]] autocomplete)*/
|
||||
.suggestion-item.is-selected {
|
||||
background-color: #3e3471;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.theme-light .suggestion-shortcut {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
/* Inner and Outer links */
|
||||
.cm-url {
|
||||
color: lightblue!important;
|
||||
}
|
||||
|
||||
.markdown-highlighting .internal-link .cl-underlined-text {
|
||||
color: var(--text-accent)!important;
|
||||
}
|
||||
|
||||
.markdown-highlighting .link .cl-underlined-text {
|
||||
color: lightblue!important;
|
||||
}
|
||||
|
||||
/* Blockquote */
|
||||
.preview blockquote {
|
||||
background-color: var(--background-modifier-border);
|
||||
border: 1px solid var(--text-muted);
|
||||
}
|
||||
|
||||
/* Highlights and Bold */
|
||||
strong {
|
||||
font-size: larger;
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
mark {
|
||||
background-color: darkgoldenrod;
|
||||
}
|
||||
|
||||
.markdown-highlighting .tag {
|
||||
color: var(--text-accent)!important;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
.markdown-preview-view th {
|
||||
background-color: #3e3471;
|
||||
color: white
|
||||
}
|
||||
|
||||
.cm-s-obsidian pre.HyperMD-table-row span.cm-hmd-table-sep {
|
||||
color: unset;
|
||||
}
|
||||
|
||||
.cm-s-obsidian pre.HyperMD-table-row-1 > span {
|
||||
color: unset;
|
||||
}
|
||||
|
||||
/* Status bar */
|
||||
.theme-dark .status-bar-item {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.theme-light .status-bar-item {
|
||||
color: black;
|
||||
}
|
||||
|
||||
/**/
|
||||
/* Preview section */
|
||||
/**/
|
||||
/* Centered preview */
|
||||
.markdown-preview-view
|
||||
{
|
||||
padding-left: 10% !important;
|
||||
padding-right: 10% !important;
|
||||
}
|
||||
|
||||
.markdown-embed-title {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
.markdown-preview-view .markdown-embed {
|
||||
background-color: var(--background-primary-alt);
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.markdown-preview-view .internal-link {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
.markdown-preview-view a {
|
||||
color: lightblue;
|
||||
}
|
||||
|
||||
/**/
|
||||
/* Side panel section */
|
||||
/**/
|
||||
/* Plugin Title and Description */
|
||||
.plugin-name {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
.plugin-description {
|
||||
color: var(--text-normal)
|
||||
}
|
||||
|
||||
/* Files title and Buttons */
|
||||
.nav-file-title-content, .nav-folder-title-content {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
.nav-action-button {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
/* File explorer navigation selection */
|
||||
.nav-file.is-active > .nav-file-title, .nav-file.is-active > .nav-folder-title, .nav-file.is-active > .nav-folder-collapse-indicator, .nav-folder.is-active > .nav-file-title, .nav-folder.is-active > .nav-folder-title, .nav-folder.is-active > .nav-folder-collapse-indicator {
|
||||
background-color: #3e3471;
|
||||
color: white;
|
||||
}
|
||||
|
||||
body:not(.is-grabbing) .nav-file-title:hover, body:not(.is-grabbing) .nav-folder-title:hover {
|
||||
background-color: #3e3471;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.nav-file-title-content, .nav-folder-title-content {
|
||||
color:unset;
|
||||
}
|
||||
|
||||
.nav-folder.mod-root > .nav-file-title:hover, .nav-folder.mod-root > .nav-folder-title:hover {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
body:not(.is-grabbing) .nav-file-title:hover .nav-folder-collapse-indicator, body:not(.is-grabbing) .nav-folder-title:hover .nav-folder-collapse-indicator {
|
||||
background-color: #3e3471;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.nav-file-title, .nav-folder-title, .nav-folder-collapse-indicator {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
/* File explorer menu*/
|
||||
.menu-item:hover {
|
||||
background-color: #3e3471;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Backlinks Color and Text */
|
||||
.search-result-file-matched-text {
|
||||
background-color: #3e3471;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.search-result-file-title {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
.search-result-file-matches {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
.search-result-file-title:hover {
|
||||
background-color: #3e3471;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.search-result-file-match:hover {
|
||||
background-color: #3e3471;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Folder arrow */
|
||||
.nav-folder.is-collapsed .nav-folder-collapse-indicator {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
.nav-folder-collapse-indicator {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
/* Tag Selection */
|
||||
.tag-pane-tag:hover {
|
||||
background-color: #3e3471;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.theme-light .tag-pane-tag-count {
|
||||
color: var(--text-normal)
|
||||
}
|
||||
|
||||
/* Title */
|
||||
.side-dock-title {
|
||||
color: #705dcf;
|
||||
}
|
||||
|
||||
/* Ribon */
|
||||
.side-dock-ribbon {
|
||||
background-color: #3e3471!important;
|
||||
color: var(--text-muted)
|
||||
}
|
||||
|
||||
.side-dock-ribbon-tab, .side-dock-ribbon-action {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.theme-dark .side-dock-ribbon-tab.is-active {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.theme-dark .side-dock-ribbon-tab.is-before-active {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.theme-light .side-dock-ribbon-tab.is-active {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
.theme-light .side-dock-ribbon-tab.is-before-active {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.side-dock-ribbon-tab-inner {
|
||||
color: unset;
|
||||
}
|
||||
|
||||
.side-dock-ribbon-before.is-before-active .side-dock-ribbon-tab-inner, .side-dock-ribbon-after.is-after-active .side-dock-ribbon-tab-inner, .side-dock-ribbon-tab.is-before-active .side-dock-ribbon-tab-inner, .side-dock-ribbon-tab.is-after-active .side-dock-ribbon-tab-inner {
|
||||
background-color: #3e3471;
|
||||
}
|
||||
|
||||
.side-dock-ribbon-tab, .side-dock-ribbon-before, .side-dock-ribbon-after, .side-dock-ribbon-tab-inner {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
/**/
|
||||
/* Settings panel Section */
|
||||
/**/
|
||||
.vertical-tab-nav-item.is-active {
|
||||
background-color: #3e3471;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.horizontal-tab-nav-item:hover, .vertical-tab-nav-item:hover {
|
||||
background-color: #3e3471;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.vertical-tab-nav-item.is-active {
|
||||
background-color: #3e3471;
|
||||
}
|
||||
|
||||
.vertical-tab-nav-item.is-active {
|
||||
border-left-color: #3e3471;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
# The Methodology
|
||||
The P.A.R.A system is surprisingly simple at first glance but very powerful when applied. At its core, it's just a four folder wide hierarchy with four-layer deeps, starting with those four root folders:
|
||||
|
||||
1. Projects
|
||||
2. Areas
|
||||
3. Resources
|
||||
4. Archive
|
||||
|
||||
From there, each of the roots is allowed one sub-folder level and then notes. That's how the four levels deep work: App (1) -> `1. Projects` (2) -> P.A.R.A. Demo Vault (3) -> Methodology (4). The reason for this is to keep it manageable and easy to remember and navigate. That restriction was initially because of Evernote limitation, but it turns out to have some serendipity potential. By putting all your notes from similar "zone" and actionability together, you end up with many serendipitous findings of new related notes and ideas.
|
||||
|
||||
Just those root folders and their children, the system can contain everything most people needs for their notes and files. This taxonomy works because you don't split things based on categories but actionability and areas of your life. So now, let's define those roots to help see how it works.
|
||||
|
||||
## Definition
|
||||
1. Projects: *Every current project that is actionable with its notes, files, artifacts*
|
||||
- If you have a project that requires notes or files, it should have a folder in 1. Projects.
|
||||
- Since this folder is for projects you are working on _right now_, it's the most actionable and probably where you will spend most of your time.
|
||||
2. Areas: *Zone of responsibility with standard to uphold over long periods*, parent, animals, management, coding, house.
|
||||
- Areas are **the personal** bucket of your life for important things that don't have an end date. You won't ever "stop" working on your health; for example, it's a constant ongoing thing.
|
||||
- While areas can (and often do) generate projects, they are not linked since it's already intuitive which areas a project comes from, so there's no need to create an explicit link between, for example, the "Server maintenance" project and the "Sysadmin" area.
|
||||
- Finally, because they are personal, areas contain information you wrote for _yourself only_ about those areas in your life. Which is opposite to 3. Resources.
|
||||
3. Resources: *Zone of interest for various topics that don't require standard/responsibility*, game, cooking, productivity, technology.
|
||||
- Resources are **generally helpful for others**, not just you. For example, if someone was to ask you for information about cooking, you could zip that folder and send it to them.
|
||||
- The folders in there will very often reflect your various interests, what you're curious about and want to learn more about.
|
||||
- They are not necessarily actual "resources" as in PDF, Pictures, etc. they can also be notes about those subjects
|
||||
4. Archives: *Where stuff from all the other category become unused*, finished project, change of responsibility, etc.
|
||||
- This folder will be where you put things you won't need for a while, as the name suggests. For the most part, something in there won't be seen for a time, and that's why it has the lowest actionability, but sometimes a new project could use things in there, or a change of areas might mean you need to get stuff out of there.
|
||||
- For example, you have lots of notes on living with a pet in a small apartment, and then you move to a new bigger one. You could move all those to the archive if one day you have to go back to a small apartment again take them out.
|
||||
|
||||
## Setup
|
||||
The setup for it is pretty simple, create root folders for each category, like in this sandbox. From there, move all of your current notes into `4. Archives` as is with the same existing hierarchy (remember it's not deleted 😉). Then create one folder for each of your current projects you're working on in `1. Projects` (remember only one sub-folder to stay four levels deep). For `2. Areas`, if you already know some of them, you can create the folders already, but try not to have too many empty folders. Finally, `3. Resources`, you want to stay empty for now unless you already captured things that could go in it. The idea is that each time you go into `4. Archives` to take one of the "old" notes or files, you then move it to the right spot in the new taxonomy. Doing it this way will highlight the most used notes, and what's left behind can stay in Archive until it's finally used (or not).
|
||||
|
||||
Once you have the folder hierarchy done, you want to copy it across all your other systems; that is where P.A.R.A. starts to shine. You want to have the same hierarchy for your local files on your computer, in your notes, in your Dropbox/Google Drive/iCloud, and everywhere else you have to keep information. Doing that will make it very quick and easy to find things you might need for work or something in the same zone across all your apps. For this reason, the more system you integrate the taxonomy into, the easier finding things will be.
|
||||
|
||||
### Setup tips:
|
||||
- If a note (or a file) can go into two different folders, you put it in the folder where you will **_most likely need it next_** since folders are based on actionability, and it will get moved anyway in the flow of things.
|
||||
- You can also have the "same" folder in 2 different roots. For example, `2. Areas/Health` and `3. Resources/Health` the first one is **_your_** health notes and the other **general** health-related notes.
|
||||
- Remember, you do **_not_** want to sort all your current notes and files and put them in the new folder, put them all in the Archive as is, and then move them out as you use them.
|
||||
- You do **_not_** have to do every single folder for your local files and cloud service; create the sub-folders are you need them, **_but_** you need to have one complete setup, most likely in your notes, to act as the primary reference for the others.
|
||||
|
||||
|
||||
# Next stop [[Workflows]]
|
||||
@@ -0,0 +1,22 @@
|
||||
## Start here
|
||||
- General how-this-work
|
||||
- What to expect
|
||||
- How to start
|
||||
## Definition
|
||||
- Projects: Short-term efforts with a clear outcome
|
||||
- Areas: Long-term responsibilities to maintain
|
||||
- Resources: Topics or interests useful in the future
|
||||
- Archives: Inactive items from other categories
|
||||
## Methodology
|
||||
- Actionnability
|
||||
- Fluidity
|
||||
- Project based
|
||||
- Constraint
|
||||
## Workflow
|
||||
- Capture: Collect everything in Inbox
|
||||
- Clarify: Determine if it's a Project, Area, Resource, or Archive
|
||||
- Organize: Move to appropriate PARA folder
|
||||
- Review: Regular reviews to maintain system
|
||||
## Next steps
|
||||
- Tiago's blog
|
||||
- Discord
|
||||
@@ -0,0 +1,25 @@
|
||||
# How to use this for work
|
||||
The workflow of P.A.R.A. is based on projects, as they are the most actionable information, but the information also flows in other ways. Most of the flowing and moving in the system will happen when you use the notes or when you are done with a project; that's why starting and finishing projects are crucial moments. As notes can flow to/from each part of the P.A.R.A, it's best to show with examples:
|
||||
|
||||
## Example 1 - Project
|
||||
This example is the "normal" workflow for most things. First, you start with a project, something like writing this starter kit.
|
||||
|
||||
You first create the folder for the project once you're ready. Then you go around `2. Areas` and `3. Resources` to find the information possibly useful for the project; in this case, I would look in my `Second Brain` folder and my `Personal Knowledge Management` folder. From there starts the first flow, you take those notes, pictures, etc., and put them in the folder. At this point, you use them to create the product and complete the project.
|
||||
|
||||
Once the project is over, the 2nd flow can start; it's time to look at all the notes and artifacts you created and used. For each of them, see if they would still be helpful later if they could be turned into a template or formatted more generically. The idea is to keep those around for use in other projects later, so put them in the correct `2. Areas` folder. The remainder goes into `4. Archives`.
|
||||
|
||||
## Example 2 - Areas change
|
||||
You decided to change your job and launch your own business in a completely different field. That would mean most of the information in your job-related `2. Areas` would not be actionable anymore. So now you can look if some things in that area could still be helpful and move the rest to `4. Archives`.
|
||||
|
||||
If a couple of months later something comes up and it forces you to get back into that first field, take the folder out of `4. Archives` and put it back into `2. Areas`, and you're back into business just like before.
|
||||
|
||||
## Example 3 - Resource change
|
||||
Since things in `3. Resources` interest you to learn more about it can be that it changes at some point. A resource folder on `Marketing`, for example, could turn into a freelance job in marketing.
|
||||
|
||||
When that happens, you now have a standard to uphold (freelance standard), so you create a new folder in `2. Areas` for "Marketing" and move all the notes you wrote yourself from `3. Resources` into that new one (since `2. Areas` is for things you wrote yourself)
|
||||
|
||||
|
||||
# Next step Explore!
|
||||
You're officially done with the explanation now; you can proceed to try it for yourself or explore more around. If you have questions, don't hesitate to ask on the forum thread or read the [P.A.R.A. complete article](https://fortelabs.co/blog/para/) for a deeper dive into all the details.
|
||||
|
||||
If you want to look at more demo vaults like this, I also have my own system, a fork of P.A.R.A. for my use over [here](https://forum.obsidian.md/t/paan-starter-kit/21782). Finally, for more general writing, I have my blog where I will often write about that system or others at [maximecote.me](https://maximecote.me/)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
【联想服务】尊敬的moto用户,您好:
|
||||
感谢致电400热线,Moto手机双清的方法如下:
|
||||
1、在关机状态下,同时按住开机键和音量减键3S左右,屏幕出现机器人倒地界面后松开,
|
||||
2、按音量减键直到右上角显示RECOVERY MODE,
|
||||
3、按电源键确认进入recovery,此时手机会出现moto开机logo,耐心等待一会,手机屏幕会显示机器人倒地界面,显示No command(无命令),此时按住电源键,然后短按一下音量加键,即可显示recovery菜单,
|
||||
4、在recovery菜单界面按音量减键移动到光标到wipe data/factory reset,按电源键确认,然后按音量减键选择Factory data reset,再按电源键确认即可开始清除,
|
||||
5、清除完毕后屏幕上再次显示recovery菜单,左下角显示data wipe complete,到此已经完成双清的操作,手机中包括设置的锁屏密码、个人资料、内部存储设备存储的照片音乐文档等数据均已被清除,选择reboot system now选项后按电源键确认即可重启手机。
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
|
||||
## lock
|
||||
### 静脉解锁
|
||||
|
||||
|
||||
## door
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
|
||||
key : 272f337c0d2c4407b930bde5e9846072
|
||||
endpoint: https://my-chatgpt.openai.azure.com/
|
||||
|
||||
```bash
|
||||
export AZURE_OPENAI_API_KEY="272f337c0d2c4407b930bde5e9846072"
|
||||
export AZURE_OPENAI_ENDPOINT="https://my-chatgpt.openai.azure.com/"
|
||||
```
|
||||
```
|
||||
|
||||
```.env
|
||||
# ChatGPT Settings (required)
|
||||
# Set the API Key from OpenAI
|
||||
OPENAI_API_KEY=272f337c0d2c4407b930bde5e9846072
|
||||
# To use Azure OpenAI API, set `OPENAI_AZURE` to true and `CHATGPT_REVERSE_PROXY` to your completion endpoint
|
||||
# OPENAI_AZURE=false
|
||||
OPENAI_AZURE=true
|
||||
CHATGPT_REVERSE_PROXY=https://my-chatgpt.openai.azure.com/
|
||||
|
||||
# Set the ChatGPT conversation context to 'thread', 'room' or 'both'.
|
||||
CHATGPT_CONTEXT=thread
|
||||
# Set the ChatGPT model to be used by the API. 'gpt-3.5-turbo' is the official ChatGPT-model from OpenAI
|
||||
# Note that the models are not free and will charge your OpenAI account depending on the usage of tokens
|
||||
#CHATGPT_API_MODEL=gpt-3.5-turbo
|
||||
CHATGPT_API_MODEL=gpt-4o
|
||||
# (Optional) Explicitly set the prefix sent to model at the beginning of a conversation
|
||||
#CHATGPT_PROMPT_PREFIX=Instructions:\nYou are ChatGPT, a large language model trained by OpenAI.
|
||||
# (Optional) Set to true if ChatGPT should ignore any messages which are not text
|
||||
#CHATGPT_IGNORE_MEDIA=false
|
||||
# (Optional) You can change the api url to use another (OpenAI-compatible) API endpoint
|
||||
#CHATGPT_REVERSE_PROXY=https://api.openai.com/v1/chat/completions
|
||||
# (Optional) Set the temperature of the model. 0.0 is deterministic, 1.0 is very creative.
|
||||
CHATGPT_TEMPERATURE=0.1
|
||||
# (Optional) (Optional) Davinci models have a max context length of 4097 tokens, but you may need to change this for other models.
|
||||
CHATGPT_MAX_CONTEXT_TOKENS=8192
|
||||
# You might want to lower this to save money if using a paid model. Earlier messages will be dropped until the prompt is within the limit.
|
||||
# CHATGPT_MAX_PROMPT_TOKENS=3097
|
||||
|
||||
# Set data store settings
|
||||
KEYV_BACKEND=file
|
||||
KEYV_URL=
|
||||
KEYV_BOT_ENCRYPTION=false
|
||||
KEYV_BOT_STORAGE=true
|
||||
|
||||
# Matrix Static Settings (required, see notes)
|
||||
# Defaults to "https://matrix.org"
|
||||
MATRIX_HOMESERVER_URL=
|
||||
# With the @ and :DOMAIN, ie @SOMETHING:DOMAIN - Not used if `MATRIX_ACCESS_TOKEN` is set.
|
||||
MATRIX_BOT_USERNAME=
|
||||
# Set `MATRIX_BOT_PASSWORD` the bot will print an `MATRIX_ACCESS_TOKEN` to the terminal
|
||||
MATRIX_ACCESS_TOKEN=
|
||||
# Not used if `MATRIX_ACCESS_TOKEN` is set.
|
||||
MATRIX_BOT_PASSWORD=
|
||||
|
||||
# Matrix Configurable Settings Defaults (optional)
|
||||
# Leave prefix blank to reply to all messages
|
||||
MATRIX_DEFAULT_PREFIX=!chatgpt
|
||||
MATRIX_DEFAULT_PREFIX_REPLY=false
|
||||
|
||||
# Matrix Access Control (optional)
|
||||
# Can be set to user:homeserver or a wildcard like :anotherhomeserver.example
|
||||
MATRIX_BLACKLIST=
|
||||
# `MATRIX_WHITELIST` is overriden by `MATRIX_BLACKLIST` if they contain same entry
|
||||
MATRIX_WHITELIST=
|
||||
|
||||
# Matrix Feature Flags (optional)
|
||||
MATRIX_AUTOJOIN=true
|
||||
MATRIX_ENCRYPTION=true
|
||||
# If you turn threads off you will have problems if you don't set CHATGPT_CONTEXT=room
|
||||
MATRIX_THREADS=true
|
||||
MATRIX_PREFIX_DM=false
|
||||
MATRIX_RICH_TEXT=true
|
||||
```
|
||||
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
|
||||
matrix chat api key
|
||||
```
|
||||
sk-ai-v1-2d2ba59719ff6f0d8d2f439d3b5c84399176d1059302cc4b43c132a4d17e9f03
|
||||
```
|
||||
|
||||
|
||||
goose anthropic key:
|
||||
```
|
||||
sk-ai-v1-fb59f3dec382ed0cdba5457059137cc4133c90094ebc68fc96bef6e4764bf6f8
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
env file
|
||||
```env
|
||||
### --- Matrix server ---
|
||||
BAIBOT_HOMESERVER_SERVER_NAME=chans.xyz
|
||||
BAIBOT_HOMESERVER_URL=https://chans.xyz
|
||||
|
||||
### --- Bot user credentials ---
|
||||
BAIBOT_USER_MXID_LOCALPART=baibot
|
||||
BAIBOT_USER_PASSWORD=SuperSecurePassword123
|
||||
BAIBOT_USER_NAME=Baibot
|
||||
|
||||
### --- Encryption & persistence ---
|
||||
# This directory is where baibot stores its state (mounted as /data)
|
||||
BAIBOT_PERSISTENCE_DATA_DIR_PATH=/data
|
||||
# 32-byte (64-hex) keys; generate with `openssl rand -hex 32`
|
||||
BAIBOT_PERSISTENCE_SESSION_ENCRYPTION_KEY=2657b3e99529bdec2086a1df4144f333eed027a71ef8e343653d76de9a775e0b
|
||||
BAIBOT_PERSISTENCE_CONFIG_ENCRYPTION_KEY=dd62c68041e9c6251dd0a474132b2ec5630be2354dd69f5b755153335a8aff8d
|
||||
|
||||
### --- Encryption recovery ---
|
||||
BAIBOT_USER_ENCRYPTION_RECOVERY_PASSPHRASE=long-and-secure-passphrase-here
|
||||
BAIBOT_USER_ENCRYPTION_RECOVERY_RESET_ALLOWED=false
|
||||
|
||||
### --- Access control ---
|
||||
BAIBOT_ACCESS_ADMIN_PATTERNS=@zhiqiang:chans.xyz
|
||||
|
||||
### --- Behavior ---
|
||||
BAIBOT_COMMAND_PREFIX=!bai
|
||||
BAIBOT_LOGGING=warn,mxlink=debug,baibot=debug
|
||||
|
||||
```
|
||||
|
||||
|
||||
baibot password
|
||||
```
|
||||
rTko=deMv*z(ex7F
|
||||
```
|
||||
|
||||
|
||||
```yml
|
||||
base_url: https://zenmux.ai/api/v1
|
||||
api_key: sk-ai-v1-2d2ba59719ff6f0d8d2f439d3b5c84399176d1059302cc4b43c132a4d17e9f03
|
||||
|
||||
text_generation:
|
||||
model_id: anthropic/claude-sonnet-4.5
|
||||
prompt: "You are a helpful assistant called {{ baibot_name }}, powered by Zenmux ({{ baibot_model_id }}). The date/time of this conversation's start is: {{ baibot_conversation_start_time_utc }}."
|
||||
temperature: 0.8
|
||||
max_completion_tokens: 16384
|
||||
max_context_tokens: 128000
|
||||
|
||||
speech_to_text:
|
||||
model_id: whisper-1
|
||||
|
||||
text_to_speech:
|
||||
model_id: tts-1-hd
|
||||
voice: onyx
|
||||
speed: 1.0
|
||||
response_format: opus
|
||||
|
||||
image_generation:
|
||||
model_id: gpt-image-1
|
||||
style: vivid
|
||||
size: 512x512
|
||||
quality: standard
|
||||
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
!bai config room set-handler text-generation global/zenmux
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
base_url: "https://zenmux.ai/api/v1"
|
||||
api_key: "sk-ai-v1-2d2ba59719ff6f0d8d2f439d3b5c84399176d1059302cc4b43c132a4d17e9f03"
|
||||
text_generation:
|
||||
model_id: "openai/gpt-5-chat"
|
||||
prompt: 'system_prompt: "You are a calm, intelligent, and helpful AI assistant called gpt5, powered by openai using the gpt5 chat model. The current UTC start time of this conversation is: {{ conversation_start_time_utc }}."
|
||||
'
|
||||
temperature: 1.0
|
||||
speech_to_text:
|
||||
model_id: whisper-1
|
||||
text_to_speech:
|
||||
model_id: tts-1-hd
|
||||
voice: onyx
|
||||
speed: 1.0
|
||||
response_format: opus
|
||||
image_generation:
|
||||
model_id: gpt-image-1
|
||||
style: null
|
||||
size: null
|
||||
quality: null
|
||||
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
base_url: "https://zenmux.ai/api/v1"
|
||||
api_key: "sk-ai-v1-2d2ba59719ff6f0d8d2f439d3b5c84399176d1059302cc4b43c132a4d17e9f03"
|
||||
text_generation:
|
||||
model_id: "google/gemini-2.5-pro"
|
||||
prompt: 'system_prompt: "Gemini 2.5 Pro is Google’s state-of-the-art AI model designed for advanced reasoning, coding, mathematics, and scientific tasks. It employs “thinking” capabilities, enabling it to reason through responses with enhanced accuracy and nuanced context handling. Gemini 2.5 Pro achieves top-tier performance on multiple benchmarks, including first-place positioning on the LMArena leaderboard, reflecting superior human-preference alignment and complex problem-solving abilities. The current UTC start time of this conversation is: {{ conversation_start_time_utc }}."
|
||||
'
|
||||
temperature: 1.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
base_url: "https://zenmux.ai/api/v1"
|
||||
api_key: "sk-ai-v1-2d2ba59719ff6f0d8d2f439d3b5c84399176d1059302cc4b43c132a4d17e9f03"
|
||||
text_generation:
|
||||
model_id: "qwen/qwen3-max"
|
||||
prompt: 'system_prompt: "Qwen3-Max is an updated release built on the Qwen3 series, offering major improvements in reasoning, instruction following, multilingual support, and long-tail knowledge coverage compared to the January 2025 version. It delivers higher accuracy in math, coding, logic, and science tasks, follows complex instructions in Chinese and English more reliably, reduces hallucinations, and produces higher-quality responses for open-ended Q&A, writing, and conversation. The model supports over 100 languages with stronger translation and commonsense reasoning, and is optimized for retrieval-augmented generation (RAG) and tool calling, though it does not include a dedicated “thinking” mode.The current UTC start time of this conversation is: {{ conversation_start_time_utc }}."
|
||||
'
|
||||
temperature: 1.0
|
||||
```
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
|
||||
key
|
||||
```
|
||||
sk-scalJeWNKxWMePXVwiGVnCMjrDpeSkCFxyowSSYp7C9yDpFqX3wY6zg9N7ovJ0MR
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
local rag key:
|
||||
```
|
||||
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
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
# 狗狗加速
|
||||
|
||||
https://panel.dg5.biz
|
||||
|
||||
windyboy@gmail.com
|
||||
半年:90
|
||||
支付时间:2024-10-28 10:17:35
|
||||
创建时间:2024-10-28 10:16:12
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
https://ausu.autos?uuid=2fb14704-2b87-4f46-a073-2b8828b5e6e9&hmac=04b55a908b662a860b203469a3fade19034a93c6fe8c26d8a9c671077950a771
|
||||
|
||||
58.8USD
|
||||
|
||||
Due Date: 2024-03-14
|
||||
|
||||
android:
|
||||
https://api.inforun.work/v1/service/10004950?hmac=51EA681FE0EF28CB8766BA258D2555D8C0CBF849E1DCA1183C6C4C59585C1607&lang=&templateId=22
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
postgresql:
|
||||
dendrite/windyboy2006
|
||||
|
||||
reCAPTCHA
|
||||
key: 6LemvrUlAAAAAPqUuH_1V-lWdKAeEORzeAEhor46
|
||||
secret: 6LemvrUlAAAAAOzHkBnRH3Qxiw2q3YI0ZHdLf6Bh
|
||||
|
||||
admin:
|
||||
windy/catalog@2006
|
||||
|
||||
AccessToken: D0lJWbpHRSO4s3zfqxSvO9ZmdWJuV2iPTC5K9VijuuU
|
||||
|
||||
|
||||
matrix media repo:
|
||||
media_repo:windyboy2006@localhost:matrix_media_repo
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
打开http://192.168.1.1直接用超级管理员账户telecomadmin 密码nE7jA%5m登录;
|
||||
|
||||
|
||||
### 设备基本信息
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
|设备类型:|YMe 2+1 wifi|
|
||||
|生产厂家:|SCTY|
|
||||
|设备型号:|TEWA-600AGM|
|
||||
|设备标识号:|40F420-4D84440F420AD9629|
|
||||
|硬件版本:|V1.0|
|
||||
|软件版本:|Tianyi_V1.0.P05|
|
||||
|
||||
### PON信息
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
|线路协议:|GPON|
|
||||
|连接状态:|成功-已注册已认证|
|
||||
|连接时间:|717326|
|
||||
|发送光功率:|1.7|
|
||||
|接收光功率:|-19.5|
|
||||
|
||||
### 网关注册信息
|
||||
|
||||
| | |
|
||||
| ------- | --------------- |
|
||||
| 逻辑ID: | GZ0153330711821 |
|
||||
|
||||
|
||||
### 业务信息
|
||||
|
||||
| | | | | | |
|
||||
| -------- | ---- | -------------- | ------------------------------ | ------------------------------ | ---------------------- |
|
||||
| 业务类型 | 状态 | IP协议 | 连接方式 | 可用端口 | 连接名称 |
|
||||
| 上网业务 | 可用 | IPV4 | 桥接(电脑拨号) | 有线:网口1,无线:ChinaNet-vKRJ, | 1_INTERNET_B_VID_41 |
|
||||
| 可用 | IPV6 | 桥接(电脑拨号) | 有线:网口1,无线:ChinaNet-vKRJ, | 1_INTERNET_B_VID_41 | |
|
||||
| iTV | 可用 | IPV4 | 桥接 | iTV, | 1_Other_B_VID_45 |
|
||||
| 可用 | IPV6 | 桥接 | iTV, | 1_Other_B_VID_45 | |
|
||||
| 语音 | 可用 | IPV4 | 路由 | 电话 | 1_TR069_VOICE_R_VID_46 |
|
||||
| 管理 | 可用 | IPV4 | 路由 | | 1_TR069_VOICE_R_VID_46 |
|
||||
| | | | | | |
|
||||
| | | | | | |
|
||||
| | | | | | |
|
||||
|
|
||||
|
||||
internet:
|
||||
vlan:41
|
||||
802.lp:0
|
||||
|
||||
iptv:
|
||||
vlan_id: 45
|
||||
802.1p: 5
|
||||
@@ -0,0 +1,478 @@
|
||||
|
||||
|
||||
---
|
||||
|
||||
## **Table of Contents**
|
||||
|
||||
1. [Prerequisites](https://chatgpt.com/c/67563169-1bb8-800b-bea7-edf694617d17#prerequisites)
|
||||
2. [Prepare Your Debian System](https://chatgpt.com/c/67563169-1bb8-800b-bea7-edf694617d17#prepare-your-debian-system)
|
||||
3. [Install Docker](https://chatgpt.com/c/67563169-1bb8-800b-bea7-edf694617d17#install-docker)
|
||||
4. [Configure Docker Daemon (Optional: HTTP Proxy)](https://chatgpt.com/c/67563169-1bb8-800b-bea7-edf694617d17#configure-docker-daemon-optional-http-proxy)
|
||||
5. [Install Home Assistant Supervised](https://chatgpt.com/c/67563169-1bb8-800b-bea7-edf694617d17#install-home-assistant-supervised)
|
||||
6. [Post-Installation Configuration](https://chatgpt.com/c/67563169-1bb8-800b-bea7-edf694617d17#post-installation-configuration)
|
||||
7. [Configure Home Assistant](https://chatgpt.com/c/67563169-1bb8-800b-bea7-edf694617d17#configure-home-assistant)
|
||||
8. [Maintenance and Best Practices](https://chatgpt.com/c/67563169-1bb8-800b-bea7-edf694617d17#maintenance-and-best-practices)
|
||||
9. [Troubleshooting](https://chatgpt.com/c/67563169-1bb8-800b-bea7-edf694617d17#troubleshooting)
|
||||
10. [Additional Resources](https://chatgpt.com/c/67563169-1bb8-800b-bea7-edf694617d17#additional-resources)
|
||||
|
||||
---
|
||||
|
||||
## **1. Prerequisites**
|
||||
|
||||
Before you begin, ensure that you have the following:
|
||||
|
||||
- **Hardware:**
|
||||
|
||||
- A device running Debian (Raspberry Pi 4 recommended for ARM architecture or an x86_64-based server for better performance).
|
||||
- Reliable storage (SSD recommended over HDD or SD cards for durability and speed).
|
||||
- Stable internet connection.
|
||||
- **Software:**
|
||||
|
||||
- **Debian:** Ensure you have a fresh installation of Debian 11 (Bullseye) or later.
|
||||
- **Access:** Root or sudo privileges on the Debian system.
|
||||
- **Tools:**
|
||||
|
||||
- **Terminal Access:** SSH access or direct access to the Debian machine's terminal.
|
||||
- **Internet Connection:** Required for downloading packages and Docker images.
|
||||
|
||||
---
|
||||
|
||||
## **2. Prepare Your Debian System**
|
||||
|
||||
### **2.1 Install Debian**
|
||||
|
||||
If you haven't already installed Debian, follow these steps:
|
||||
|
||||
1. **Download Debian ISO:**
|
||||
|
||||
- Visit the [official Debian website](https://www.debian.org/distrib/) and download the latest stable release (preferably Debian 11 "Bullseye").
|
||||
2. **Create Installation Media:**
|
||||
|
||||
- Use tools like [Rufus](https://rufus.ie/) (Windows) or `dd` command (Linux/macOS) to create a bootable USB drive.
|
||||
3. **Install Debian:**
|
||||
|
||||
- Boot from the USB drive and follow the on-screen instructions.
|
||||
- Choose a **Minimal Installation** to reduce unnecessary packages.
|
||||
- Set up a strong root password and create a user with sudo privileges.
|
||||
|
||||
### **2.2 Update the System**
|
||||
|
||||
Once Debian is installed, update the package lists and upgrade existing packages:
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
```
|
||||
|
||||
### **2.3 Set Hostname and Timezone**
|
||||
|
||||
1. **Set Hostname:**
|
||||
|
||||
Replace `homeassistant` with your desired hostname.
|
||||
|
||||
```bash
|
||||
sudo hostnamectl set-hostname homeassistant
|
||||
```
|
||||
|
||||
2. **Set Timezone:**
|
||||
|
||||
```bash
|
||||
sudo dpkg-reconfigure tzdata
|
||||
```
|
||||
|
||||
Follow the prompts to select your timezone.
|
||||
|
||||
|
||||
### **2.4 Install Essential Packages**
|
||||
|
||||
Install necessary packages required for Home Assistant Supervised:
|
||||
|
||||
```bash
|
||||
sudo apt install -y jq curl avahi-daemon dbus network-manager apparmor-utils
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **3. Install Docker**
|
||||
|
||||
Home Assistant Supervised relies on Docker to manage containers. Follow these steps to install Docker Engine.
|
||||
|
||||
### **3.1 Remove Old Docker Versions**
|
||||
|
||||
Ensure no older versions of Docker are present:
|
||||
|
||||
```bash
|
||||
sudo apt remove -y docker docker-engine docker.io containerd runc
|
||||
```
|
||||
|
||||
### **3.2 Install Docker Dependencies**
|
||||
|
||||
```bash
|
||||
sudo apt install -y ca-certificates curl gnupg lsb-release
|
||||
```
|
||||
|
||||
### **3.3 Add Docker’s Official GPG Key**
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
```
|
||||
|
||||
### **3.4 Set Up the Docker Repository**
|
||||
|
||||
```bash
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
```
|
||||
|
||||
### **3.5 Install Docker Engine**
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
```
|
||||
|
||||
### **3.6 Verify Docker Installation**
|
||||
|
||||
Check Docker version and status:
|
||||
|
||||
```bash
|
||||
docker --version
|
||||
sudo systemctl status docker
|
||||
```
|
||||
|
||||
You should see Docker running. Press `q` to exit the status view.
|
||||
|
||||
### **3.7 Manage Docker as a Non-Root User (Optional)**
|
||||
|
||||
To run Docker commands without `sudo`, add your user to the `docker` group:
|
||||
|
||||
```bash
|
||||
sudo usermod -aG docker $USER
|
||||
```
|
||||
|
||||
Log out and back in for the changes to take effect.
|
||||
|
||||
---
|
||||
|
||||
## **4. Configure Docker Daemon (Optional: HTTP Proxy)**
|
||||
|
||||
If your network requires Docker to use an HTTP proxy, configure it as follows:
|
||||
|
||||
### **4.1 Create or Edit Docker Daemon Configuration**
|
||||
|
||||
Open `/etc/docker/daemon.json` in a text editor:
|
||||
|
||||
```bash
|
||||
sudo nano /etc/docker/daemon.json
|
||||
```
|
||||
|
||||
### **4.2 Add Proxy Settings**
|
||||
|
||||
Replace `http://your-proxy:port` with your actual proxy details. If you don't need a proxy, you can skip this step.
|
||||
|
||||
```json
|
||||
{
|
||||
"proxies": {
|
||||
"default": {
|
||||
"httpProxy": "http://your-proxy:port",
|
||||
"httpsProxy": "http://your-proxy:port",
|
||||
"noProxy": "localhost,127.0.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### **4.3 Save and Exit**
|
||||
|
||||
Press `CTRL + O` to save and `CTRL + X` to exit.
|
||||
|
||||
### **4.4 Restart Docker to Apply Changes**
|
||||
|
||||
```bash
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
### **4.5 Verify Proxy Configuration (Optional)**
|
||||
|
||||
Run a Docker container to verify proxy settings:
|
||||
|
||||
```bash
|
||||
docker run --rm alpine env | grep -i proxy
|
||||
```
|
||||
|
||||
You should see the proxy variables if configured correctly.
|
||||
|
||||
---
|
||||
|
||||
## **5. Install Home Assistant Supervised**
|
||||
|
||||
Follow these steps to install Home Assistant Supervised on your Debian system.
|
||||
|
||||
### **5.1 Download the Supervised Installer Script**
|
||||
|
||||
```bash
|
||||
curl -Lo installer.sh https://raw.githubusercontent.com/home-assistant/supervised-installer/main/installer.sh
|
||||
```
|
||||
|
||||
### **5.2 Make the Script Executable**
|
||||
|
||||
```bash
|
||||
chmod +x installer.sh
|
||||
```
|
||||
|
||||
### **5.3 Run the Installer Script**
|
||||
|
||||
Run the installer with the appropriate machine type. Replace `your_machine_type` with your hardware. Common types include:
|
||||
|
||||
- `raspberrypi4` for Raspberry Pi 4
|
||||
- `generic-x86-64` for standard 64-bit PCs
|
||||
|
||||
**Example for Raspberry Pi 4:**
|
||||
|
||||
```bash
|
||||
sudo bash installer.sh --machine raspberrypi4
|
||||
```
|
||||
|
||||
**Example for Generic x86_64:**
|
||||
|
||||
```bash
|
||||
sudo bash installer.sh --machine generic-x86-64
|
||||
```
|
||||
|
||||
### **5.4 Follow On-Screen Prompts**
|
||||
|
||||
The installer will guide you through the process, including:
|
||||
|
||||
- Confirming installation parameters.
|
||||
- Installing necessary Docker containers (Supervisor, Home Assistant Core, etc.).
|
||||
|
||||
**Note:** Ensure your network is stable during the installation to allow the script to download required Docker images.
|
||||
|
||||
### **5.5 Verify Installation**
|
||||
|
||||
After the installation completes, check the status of Home Assistant Supervisor:
|
||||
|
||||
```bash
|
||||
sudo systemctl status hassio-supervisor.service
|
||||
```
|
||||
|
||||
You should see that the Supervisor is active and running.
|
||||
|
||||
---
|
||||
|
||||
## **6. Post-Installation Configuration**
|
||||
|
||||
### **6.1 Access Home Assistant Web Interface**
|
||||
|
||||
1. **Find Your Server's IP Address:**
|
||||
|
||||
```bash
|
||||
hostname -I
|
||||
```
|
||||
|
||||
Note down the IP address (e.g., `192.168.1.100`).
|
||||
|
||||
2. **Open Web Browser:**
|
||||
|
||||
Navigate to `http://<your-server-ip>:8123` (e.g., `http://192.168.1.100:8123`).
|
||||
|
||||
3. **Initial Setup:**
|
||||
|
||||
- **Create an Account:** Follow the prompts to create your Home Assistant user account.
|
||||
- **Configure Location:** Set your location, unit system, and time zone.
|
||||
- **Set Up Home:** Follow the guided setup to add devices and integrations.
|
||||
|
||||
### **6.2 Configure Supervisor Settings**
|
||||
|
||||
1. **Navigate to Supervisor Panel:**
|
||||
|
||||
- Click on **Supervisor** in the left sidebar.
|
||||
2. **Update Supervisor and Core:**
|
||||
|
||||
- If prompted, update the Supervisor and Home Assistant Core to the latest versions.
|
||||
3. **Install Add-ons:**
|
||||
|
||||
- Click on **Add-on Store**.
|
||||
- Browse and install desired add-ons (e.g., File Editor, Samba Share, Mosquitto MQTT Broker).
|
||||
- Configure each add-on as needed.
|
||||
|
||||
---
|
||||
|
||||
## **7. Configure Home Assistant**
|
||||
|
||||
After installation, you can customize and extend Home Assistant to suit your needs.
|
||||
|
||||
### **7.1 Basic Configuration**
|
||||
|
||||
1. **Integrations:**
|
||||
|
||||
- **Automatic Discovery:** Home Assistant can automatically discover devices on your network.
|
||||
- **Manual Integration:** Go to **Settings > Devices & Services > Add Integration** to add integrations manually.
|
||||
2. **Dashboard Customization:**
|
||||
|
||||
- **Edit Dashboard:** Click on the three dots in the top-right corner of the dashboard and select **Edit Dashboard**.
|
||||
- **Add Cards:** Use various card types (e.g., entities, glance, gauge) to display information.
|
||||
- **Organize Views:** Create multiple views for different areas or functionalities in your home.
|
||||
|
||||
### **7.2 Adding Users and Permissions**
|
||||
|
||||
1. **User Management:**
|
||||
|
||||
- Go to **Settings > System > Users**.
|
||||
- Add new users, assign roles (Administrator or User), and manage permissions.
|
||||
|
||||
### **7.3 Automations and Scripts**
|
||||
|
||||
1. **Create Automations:**
|
||||
|
||||
- Navigate to **Settings > Automations & Scenes > Automations**.
|
||||
- Use the **Editor** to create triggers, conditions, and actions.
|
||||
- Example: Turn on lights when motion is detected.
|
||||
2. **Create Scripts:**
|
||||
|
||||
- Navigate to **Settings > Automations & Scenes > Scripts**.
|
||||
- Define sequences of actions that can be triggered manually or via automations.
|
||||
|
||||
### **7.4 Adding Custom Components**
|
||||
|
||||
1. **File Editor Add-on:**
|
||||
|
||||
- Install the **File Editor** add-on from the **Add-on Store**.
|
||||
- Use it to edit `configuration.yaml` and other YAML files directly within Home Assistant.
|
||||
2. **Restart Home Assistant:**
|
||||
|
||||
- After making changes to YAML files, restart Home Assistant to apply them.
|
||||
- Navigate to **Settings > System > Restart**.
|
||||
|
||||
### **7.5 Setting Up Backups (Snapshots)**
|
||||
|
||||
1. **Create Snapshots:**
|
||||
|
||||
- Go to **Supervisor > Snapshots**.
|
||||
- Click **Create Snapshot** to back up your configuration and add-ons.
|
||||
2. **Automate Backups:**
|
||||
|
||||
- Use add-ons like **Google Drive Backup** or **Samba Share** to store snapshots externally.
|
||||
- Schedule regular backups to ensure data safety.
|
||||
|
||||
---
|
||||
|
||||
## **8. Maintenance and Best Practices**
|
||||
|
||||
### **8.1 Regular Updates**
|
||||
|
||||
- **Home Assistant Core and Supervisor:**
|
||||
- Regularly update to the latest versions via the Supervisor interface.
|
||||
- **Add-ons:**
|
||||
- Keep add-ons up to date to benefit from new features and security patches.
|
||||
|
||||
### **8.2 Backup Strategy**
|
||||
|
||||
- **Local Backups:**
|
||||
- Utilize Home Assistant's snapshot feature.
|
||||
- **Remote Backups:**
|
||||
- Store backups on external drives or cloud services using add-ons.
|
||||
|
||||
### **8.3 Security Measures**
|
||||
|
||||
- **Secure Access:**
|
||||
|
||||
- Enable SSL/TLS for secure remote access.
|
||||
- Use strong passwords and enable two-factor authentication (2FA).
|
||||
- **Firewall Configuration:**
|
||||
|
||||
- Limit access to Home Assistant ports to trusted networks.
|
||||
- **Regular Monitoring:**
|
||||
|
||||
- Keep an eye on logs and system performance to detect any anomalies.
|
||||
|
||||
### **8.4 Resource Monitoring**
|
||||
|
||||
- **Supervisor > System:**
|
||||
|
||||
- Monitor CPU, memory, and disk usage to ensure optimal performance.
|
||||
- **Add-ons:**
|
||||
|
||||
- Some add-ons provide their own monitoring tools (e.g., **System Monitor**).
|
||||
|
||||
---
|
||||
|
||||
## **9. Troubleshooting**
|
||||
|
||||
### **9.1 Common Issues**
|
||||
|
||||
1. **Supervisor Not Starting:**
|
||||
|
||||
- **Check Docker Status:**
|
||||
|
||||
```bash
|
||||
sudo systemctl status docker
|
||||
```
|
||||
|
||||
- **Restart Docker:**
|
||||
|
||||
```bash
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
- **Check Logs:**
|
||||
|
||||
```bash
|
||||
sudo journalctl -u docker -f
|
||||
sudo journalctl -u hassio-supervisor.service -f
|
||||
```
|
||||
|
||||
2. **Add-ons Not Installing:**
|
||||
|
||||
- **Verify Network Connectivity:** Ensure your server can access the internet.
|
||||
- **Check Docker Permissions:** Ensure the user running Docker has the necessary permissions.
|
||||
- **Review Logs:** Navigate to **Supervisor > System > Logs** for detailed error messages.
|
||||
3. **Home Assistant Not Accessible:**
|
||||
|
||||
- **Check Container Status:**
|
||||
|
||||
```bash
|
||||
docker ps
|
||||
```
|
||||
|
||||
Ensure the `homeassistant` container is running.
|
||||
- **Verify Port Accessibility:** Ensure port `8123` is open and not blocked by a firewall.
|
||||
|
||||
### **9.2 Getting Help**
|
||||
|
||||
- **Home Assistant Community Forums:** [Home Assistant Community](https://community.home-assistant.io/)
|
||||
- **Home Assistant Discord Server:** [Join Discord](https://discord.gg/c5DvZ4e)
|
||||
- **Official Documentation:** [Home Assistant Docs](https://www.home-assistant.io/docs/)
|
||||
|
||||
---
|
||||
|
||||
## **10. Additional Resources**
|
||||
|
||||
- **Home Assistant Supervised Installer Repository:**
|
||||
|
||||
- [GitHub - home-assistant/supervised-installer](https://github.com/home-assistant/supervised-installer)
|
||||
- **Official Home Assistant Installation Guides:**
|
||||
|
||||
- [Home Assistant Installation Overview](https://www.home-assistant.io/installation/)
|
||||
- **Docker Documentation:**
|
||||
|
||||
- [Docker Engine Overview](https://docs.docker.com/engine/)
|
||||
- **Home Assistant Add-ons Documentation:**
|
||||
|
||||
- [Home Assistant Add-ons](https://www.home-assistant.io/addons/)
|
||||
|
||||
---
|
||||
|
||||
## **Summary**
|
||||
|
||||
By following the steps outlined above, you can successfully install Home Assistant Supervised on a Debian Linux server, enabling you to manage Home Assistant and its add-ons via Docker containers effectively. This setup provides a balance between ease of use and the flexibility to customize your Home Assistant environment to meet your specific needs.
|
||||
|
||||
**Key Points:**
|
||||
|
||||
- **Home Assistant Supervised** combines the power of the Supervisor with the flexibility of a standard Linux environment.
|
||||
- **Docker** is central to managing Home Assistant Core and its add-ons.
|
||||
- **Regular Maintenance**, including updates and backups, is crucial for a stable and secure Home Assistant setup.
|
||||
- **Community Resources** are invaluable for troubleshooting and optimizing your Home Assistant experience.
|
||||
|
||||
Feel free to reach out to the Home Assistant community if you encounter any challenges or have specific questions during your setup!
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
|
||||
ewelink token:
|
||||
```
|
||||
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI0NmQ0MjA2NGI1MmQ0ZDgwOTM4NDliMzRiZjA2NzJmOSIsImlhdCI6MTczMzgxMjEwNywiZXhwIjoyMDQ5MTcyMTA3fQ.LBpi_uNLKK1FiWGNOm7p5C4w5pSkbCF0t5o_5h_rWFI
|
||||
```
|
||||
truenas
|
||||
|
||||
```
|
||||
1-aFFnjLWyRXoF8iNa5ZAG4WUsEqrc9KMbzgSZOZoHeJUBIyRlQ3pEtOMjQj4VQnpP
|
||||
```
|
||||
Regular → Executable
+93
@@ -0,0 +1,93 @@
|
||||
```
|
||||
|
||||
sudo doveadm pw -s BLF-CRYPT
|
||||
```
|
||||
|
||||
```
|
||||
{BLF-CRYPT}$2y$05$ituMVYZPOiAnTOApslK18OB7iPpAamHv6wZSd7ed2ZozzAaKXPGZi
|
||||
```
|
||||
|
||||
```
|
||||
windyboy@2006
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
sudo mysql -p -u mailuser mailserver <<'SQL'
|
||||
INSERT INTO domains(name) VALUES ('windy.me');
|
||||
|
||||
INSERT INTO users(email, domain, password, quota_mb)
|
||||
VALUES ('zhiqiang@windy.me','windy.me','{BLF-CRYPT}$2y$05$cbKWGCrttpBPHpN8R4DFFeGSUF82Upf4EsREifW0jm96A.59IfYfO', 2048);
|
||||
|
||||
-- optional alias
|
||||
INSERT INTO aliases(source, destination) VALUES ('vnet@windy.me','zhiqiang@windy.me');
|
||||
SQL
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
doveadm auth test zhiqiang@windy.me 'windyboy2006'
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
# ---- Dovecot 2.4 SQL authentication ----
|
||||
sql_driver = mysql
|
||||
|
||||
# Debian/MariaDB socket (or use 'mysql localhost { ... }' for TCP)
|
||||
mysql /run/mysqld/mysqld.sock {
|
||||
user = vmail
|
||||
password = CHANGE_ME_STRONG
|
||||
dbname = mailserver
|
||||
}
|
||||
|
||||
# PASSDB: verify credentials (hash in DB, e.g. {BLF-CRYPT}...)
|
||||
passdb sql {
|
||||
passdb_default_password_scheme = BLF-CRYPT
|
||||
query = SELECT email AS username, password AS password \
|
||||
FROM users \
|
||||
WHERE email = '%{user}' AND active = 1
|
||||
}
|
||||
|
||||
# USERDB: return uid/gid/home/mail
|
||||
# Change 5000:5000 if your vmail UID/GID differ: check with "id vmail"
|
||||
userdb sql {
|
||||
query = SELECT 5000 AS uid, 5000 AS gid, \
|
||||
CONCAT('/var/mail/vhosts/', SUBSTRING_INDEX(email,'@',-1), '/', SUBSTRING_INDEX(email,'@',1)) AS home, \
|
||||
CONCAT('maildir:/var/mail/vhosts/', SUBSTRING_INDEX(email,'@',-1), '/', SUBSTRING_INDEX(email,'@',1), '/Maildir') AS mail \
|
||||
FROM users \
|
||||
WHERE email = '%{user}' AND active = 1
|
||||
iterate_query = SELECT email AS username FROM users WHERE active = 1
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
swaks --server your.mx.name --port 587 --tls --auth LOGIN -au 'zhiqiang@windy.me' -ap 'windyboy@2006' --h-Subject "SASL test"
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
sudo postconf -n | grep -E '^(smtpd_.*restrictions|smtpd_milters|milter_.*|policyd|policy|check_policy_service)'
|
||||
sudo grep -nE '^(submission|smtps)\b' -n /etc/postfix/master.cf -n
|
||||
|
||||
```
|
||||
```
|
||||
sudo postconf -P submission/inet/smtpd_recipient_restrictions
|
||||
sudo postconf -P submission/inet/smtpd_client_restrictions
|
||||
sudo postconf -P submission/inet/smtpd_helo_restrictions
|
||||
sudo postconf -P smtps/inet/smtpd_recipient_restrictions
|
||||
|
||||
```
|
||||
|
||||
google windyboy app passwors (postfix) :
|
||||
```
|
||||
zfgl bdep itya kdym
|
||||
```
|
||||
|
||||
/etc/postfix/sasl_passwd
|
||||
```
|
||||
[smtp.gmail.com]:587 windyboy@gmail.com:zfglbdepityakdym
|
||||
```
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
ip :
|
||||
|
||||
```
|
||||
38.134.41.134
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
imapsync --host1 mx2.windy.me --user1 zhiqiang@windy.me --password1 'windyboy@2006' \
|
||||
--host2 mx.windy.me --user2 zhiqiang@windy.me --password2 'Nmq2nW!3Y223k@Ri' \
|
||||
--ssl1 --ssl2 --justlogin
|
||||
|
||||
```
|
||||
|
||||
|
||||
test smtp login
|
||||
|
||||
prepare
|
||||
```
|
||||
echo -n 'zhiqiang@windy.me' | base64
|
||||
```
|
||||
|
||||
```
|
||||
emhpcWlhbmdAd2luZHkubWU=
|
||||
```
|
||||
|
||||
```
|
||||
echo -n 'Nmq2nW!3Y223k@Ri' | base64
|
||||
```
|
||||
|
||||
```
|
||||
Tm1xMm5XITNZMjIza0BSaQ==
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
openssl s_client -starttls smtp -crlf -connect smtp.windy.me:587
|
||||
```
|
||||
|
||||
```
|
||||
EHLO windy.me
|
||||
```
|
||||
|
||||
```
|
||||
AUTH LOGIN
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
openssl x509 -in /opt/mail/data/assets/ssl/mx2.windy.me/cert.pem -noout -pubkey \
|
||||
| openssl pkey -pubin -outform DER \
|
||||
| openssl sha256
|
||||
|
||||
SHA2-256(stdin)= 83277f3daa67bd613c6ac7556e5f368d9e1245b2fb3209d89de43738a3f083f7
|
||||
```
|
||||
|
||||
```
|
||||
83277f3daa67bd613c6ac7556e5f368d9e1245b2fb3209d89de43738a3f083f7
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,424 @@
|
||||
|
||||
|
||||
# Matrix ESS (Community) — Single‑Node Install on Debian 13 (K3s + Traefik + cert‑manager)
|
||||
_Last updated: 2025-09-25 08:45 UTC_
|
||||
|
||||
This guide installs **Element Server Suite (ESS) Community** (Synapse + MAS + Element Web + Matrix RTC) on a **single Debian 13** node using **K3s**, **Traefik** (default in K3s), and **cert‑manager** with **Let’s Encrypt**. It is tailored to your domain choices:
|
||||
|
||||
- **serverName**: `chans.xyz`
|
||||
- **Hosts**: `synapse.chans.xyz`, `account.chans.xyz`, `chat.chans.xyz`, `mrtc.chans.xyz`
|
||||
|
||||
> Tip: if you already have K3s and cert‑manager installed and working, you can jump to **5. Values files** and **6. Install ESS**.
|
||||
|
||||
---
|
||||
|
||||
## 0) Requirements & Ports
|
||||
|
||||
- Debian 13 (root/sudo), public IPv4 (and optional IPv6).
|
||||
- DNS control for `chans.xyz`.
|
||||
- Open/forward these ports to this node:
|
||||
- **80/tcp**, **443/tcp** (ACME + HTTPS + federation)
|
||||
- **30881/tcp**, **30882/udp** (Matrix RTC SFU)
|
||||
- Time in sync (`systemd-timesyncd` or equivalent).
|
||||
|
||||
---
|
||||
|
||||
## 1) DNS Setup
|
||||
|
||||
Create A/AAAA records that point to your node’s public IP(s):
|
||||
|
||||
```
|
||||
chans.xyz A / AAAA -> <YOUR_IP>
|
||||
synapse.chans.xyz A / AAAA -> <YOUR_IP>
|
||||
account.chans.xyz A / AAAA -> <YOUR_IP>
|
||||
chat.chans.xyz A / AAAA -> <YOUR_IP>
|
||||
mrtc.chans.xyz A / AAAA -> <YOUR_IP>
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- **Do not** use a `CNAME` at the **apex** (`chans.xyz`)—use `A/AAAA`. Subdomains can be `CNAME`s if you prefer.
|
||||
- Federation relies on `https://chans.xyz/.well-known/matrix/server` which the chart serves for you.
|
||||
|
||||
---
|
||||
|
||||
## 2) (Optional) Cloud‑Init (without firewalld)
|
||||
|
||||
If you build the node via cloud‑init, this minimal config installs K3s & Helm and disables swap:
|
||||
|
||||
```yaml
|
||||
#cloud-config
|
||||
package_update: true
|
||||
package_upgrade: true
|
||||
packages: [curl, ca-certificates, gnupg, lsb-release]
|
||||
|
||||
runcmd:
|
||||
- swapoff -a
|
||||
- sed -ri 's/^[^#].*\sswap\s/## &/g' /etc/fstab
|
||||
- curl -sfL https://get.k3s.io | sh -s - server
|
||||
- mkdir -p /home/windy/.kube
|
||||
- cp /etc/rancher/k3s/k3s.yaml /home/windy/.kube/config
|
||||
- chown windy:windy /home/windy/.kube/config && chmod 600 /home/windy/.kube/config
|
||||
- bash -lc 'echo export KUBECONFIG=$HOME/.kube/config >> /home/windy/.bashrc'
|
||||
- su - windy -c "curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash"
|
||||
```
|
||||
|
||||
You can manage ports at the cloud firewall or your router (no `firewalld` required).
|
||||
|
||||
---
|
||||
|
||||
## 3) Manual K3s + Helm (if not using cloud‑init)
|
||||
|
||||
```bash
|
||||
# Install latest K3s
|
||||
curl -sfL https://get.k3s.io | sh -s - server
|
||||
|
||||
# kubeconfig for your user (replace 'windy' if needed)
|
||||
mkdir -p ~windy/.kube
|
||||
sudo cp /etc/rancher/k3s/k3s.yaml ~windy/.kube/config
|
||||
sudo chown windy:windy ~windy/.kube/config
|
||||
chmod 600 ~windy/.kube/config
|
||||
echo 'export KUBECONFIG=$HOME/.kube/config' | sudo tee -a ~windy/.bashrc
|
||||
|
||||
# Helm
|
||||
sudo -iu windy bash -lc 'curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash'
|
||||
```
|
||||
|
||||
Verify:
|
||||
```bash
|
||||
kubectl get nodes -o wide
|
||||
kubectl get pods -A
|
||||
```
|
||||
|
||||
You should see the node `Ready` and `traefik` running in `kube-system`.
|
||||
|
||||
---
|
||||
|
||||
## 4) cert‑manager + Let’s Encrypt (ClusterIssuer)
|
||||
|
||||
If you haven’t installed cert‑manager yet:
|
||||
|
||||
```bash
|
||||
helm repo add jetstack https://charts.jetstack.io --force-update
|
||||
kubectl create namespace cert-manager 2>/dev/null || true
|
||||
helm install cert-manager jetstack/cert-manager -n cert-manager --set crds.enabled=true
|
||||
```
|
||||
|
||||
Create a production ClusterIssuer (`letsencrypt-prod`):
|
||||
|
||||
```yaml
|
||||
# clusterissuer.yaml
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: ClusterIssuer
|
||||
metadata:
|
||||
name: letsencrypt-prod
|
||||
spec:
|
||||
acme:
|
||||
server: https://acme-v02.api.letsencrypt.org/directory
|
||||
privateKeySecretRef:
|
||||
name: letsencrypt-prod-private-key
|
||||
solvers:
|
||||
- http01:
|
||||
ingress:
|
||||
class: traefik
|
||||
```
|
||||
|
||||
Apply:
|
||||
```bash
|
||||
kubectl apply -f clusterissuer.yaml
|
||||
kubectl get clusterissuer
|
||||
```
|
||||
|
||||
You should see `letsencrypt-prod READY=True`.
|
||||
|
||||
---
|
||||
|
||||
## 5) Values files (hosts + TLS)
|
||||
|
||||
Create the directory and values files:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/ess-config-values
|
||||
```
|
||||
|
||||
**`~/ess-config-values/hostnames.yaml`**
|
||||
```yaml
|
||||
serverName: chans.xyz
|
||||
|
||||
elementWeb:
|
||||
ingress:
|
||||
host: chat.chans.xyz
|
||||
|
||||
synapse:
|
||||
ingress:
|
||||
host: synapse.chans.xyz
|
||||
|
||||
matrixAuthenticationService:
|
||||
ingress:
|
||||
host: account.chans.xyz
|
||||
|
||||
matrixRTC:
|
||||
ingress:
|
||||
host: mrtc.chans.xyz
|
||||
```
|
||||
|
||||
**`~/ess-config-values/tls.yaml`**
|
||||
```yaml
|
||||
global:
|
||||
ingress:
|
||||
className: traefik
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||
tls:
|
||||
enabled: true
|
||||
issuer: letsencrypt-prod
|
||||
```
|
||||
|
||||
> The TLS values ensure your Ingresses are annotated for cert‑manager and include TLS host entries so Certificates are created automatically.
|
||||
|
||||
---
|
||||
|
||||
## 6) Install ESS (matrix‑stack chart)
|
||||
|
||||
```bash
|
||||
kubectl create namespace ess 2>/dev/null || true
|
||||
|
||||
helm upgrade --install ess oci://ghcr.io/element-hq/ess-helm/matrix-stack -n ess -f ~/ess-config-values/hostnames.yaml -f ~/ess-config-values/tls.yaml --wait
|
||||
```
|
||||
|
||||
Check status:
|
||||
```bash
|
||||
kubectl get pods -n ess
|
||||
kubectl get ingress -n ess
|
||||
```
|
||||
|
||||
You should see ingresses for `synapse`, `account`, `chat`, `mrtc`, and `well-known` with `CLASS=traefik`.
|
||||
|
||||
---
|
||||
|
||||
## 7) Certificates issuance
|
||||
|
||||
Confirm the ingresses have TLS + issuer:
|
||||
```bash
|
||||
kubectl -n ess get ingress -o jsonpath='{range .items[*]}{.metadata.name}{" issuer="}{.metadata.annotations.cert-manager\.io/cluster-issuer}{" tlsHosts="}{range .spec.tls[*].hosts}{.}{" "}{end}{"\n"}{end}'
|
||||
```
|
||||
|
||||
Then watch certs:
|
||||
```bash
|
||||
kubectl get certificate -n ess
|
||||
kubectl get order,challenge -n ess
|
||||
```
|
||||
|
||||
When ready, confirm live certs:
|
||||
```bash
|
||||
for h in synapse.chans.xyz account.chans.xyz chat.chans.xyz mrtc.chans.xyz chans.xyz; do
|
||||
echo "=== $h ==="
|
||||
openssl s_client -connect "$h:443" -servername "$h" </dev/null 2>/dev/null | openssl x509 -noout -issuer -subject -dates
|
||||
done
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8) Well‑Known verification (federation & clients)
|
||||
|
||||
```bash
|
||||
curl -s https://chans.xyz/.well-known/matrix/server | jq .
|
||||
curl -s https://chans.xyz/.well-known/matrix/client | jq .
|
||||
```
|
||||
|
||||
Expected:
|
||||
- `server` → `{ "m.server": "synapse.chans.xyz:443" }`
|
||||
- `client` → `{ "m.homeserver": { "base_url": "https://synapse.chans.xyz" }, ... }`
|
||||
|
||||
Optional federation tester: <https://federationtester.matrix.org/#chans.xyz>
|
||||
|
||||
---
|
||||
|
||||
## 9) Create the first admin account
|
||||
|
||||
Interactive:
|
||||
```bash
|
||||
kubectl exec -n ess -it deploy/ess-matrix-authentication-service -- mas-cli manage register-user --admin
|
||||
```
|
||||
|
||||
Non‑interactive example:
|
||||
```bash
|
||||
kubectl exec -n ess deploy/ess-matrix-authentication-service -- mas-cli manage register-user --yes --admin --username admin --password 'CHANGE_ME_strong_password'
|
||||
```
|
||||
|
||||
Login at **https://chat.chans.xyz**.
|
||||
|
||||
---
|
||||
|
||||
## 10) Enable self‑registration (optional)
|
||||
|
||||
```yaml
|
||||
# ~/ess-config-values/mas-registration.yaml
|
||||
matrixAuthenticationService:
|
||||
additional:
|
||||
registration.yaml:
|
||||
config: |
|
||||
account:
|
||||
password_registration_enabled: true
|
||||
password_recovery_enabled: true
|
||||
login_with_email_allowed: true
|
||||
```
|
||||
|
||||
Apply (include this file):
|
||||
```bash
|
||||
helm upgrade --install ess oci://ghcr.io/element-hq/ess-helm/matrix-stack -n ess -f ~/ess-config-values/hostnames.yaml -f ~/ess-config-values/tls.yaml -f ~/ess-config-values/mas-registration.yaml --wait
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 11) Outbound email (MAS required, Synapse optional)
|
||||
|
||||
### 11.1 MAS SMTP (required for signup/reset)
|
||||
|
||||
**Option A — inline values (simple):**
|
||||
```yaml
|
||||
# ~/ess-config-values/mas-email.yaml
|
||||
matrixAuthenticationService:
|
||||
additional:
|
||||
user-config.yaml:
|
||||
config: |
|
||||
email:
|
||||
from: '"Matrix @ chans.xyz" <noreply@chans.xyz>'
|
||||
reply_to: '"Support" <support@chans.xyz>'
|
||||
transport: smtp
|
||||
mode: starttls
|
||||
hostname: smtp.windy.me
|
||||
port: 587
|
||||
username: noreply@chans.xyz # authenticate as the sender
|
||||
password: "MAILBOX_PASSWORD"
|
||||
account:
|
||||
password_registration_enabled: true
|
||||
password_recovery_enabled: true
|
||||
login_with_email_allowed: true
|
||||
```
|
||||
|
||||
**Option B — secret ref (keeps password out of Git):**
|
||||
```bash
|
||||
cat > /tmp/mas-user-config.yaml <<'YAML'
|
||||
email:
|
||||
from: '"Matrix @ chans.xyz" <noreply@chans.xyz>'
|
||||
reply_to: '"Support" <support@chans.xyz>'
|
||||
transport: smtp
|
||||
mode: starttls
|
||||
hostname: smtp.windy.me
|
||||
port: 587
|
||||
username: noreply@chans.xyz
|
||||
password: "MAILBOX_PASSWORD"
|
||||
account:
|
||||
password_registration_enabled: true
|
||||
password_recovery_enabled: true
|
||||
login_with_email_allowed: true
|
||||
YAML
|
||||
|
||||
kubectl -n ess create secret generic mas-extra-config --from-file=user-config.yaml=/tmp/mas-user-config.yaml
|
||||
```
|
||||
|
||||
Then reference it:
|
||||
```yaml
|
||||
# ~/ess-config-values/mas-email-secretref.yaml
|
||||
matrixAuthenticationService:
|
||||
additional:
|
||||
user-config.yaml:
|
||||
configSecret: mas-extra-config
|
||||
configSecretKey: user-config.yaml
|
||||
```
|
||||
|
||||
Apply (include one of the two files above):
|
||||
```bash
|
||||
helm upgrade --install ess oci://ghcr.io/element-hq/ess-helm/matrix-stack -n ess -f ~/ess-config-values/hostnames.yaml -f ~/ess-config-values/tls.yaml -f ~/ess-config-values/mas-email.yaml --wait
|
||||
# or replace mas-email.yaml with mas-email-secretref.yaml if you used a Secret
|
||||
```
|
||||
|
||||
> **Mailcow 553 fix**: If authenticating as `zhiqiang@windy.me` and sending as `noreply@chans.xyz`, Mailcow rejects with `553 5.7.1 Sender address rejected`. Either (a) **authenticate as** `noreply@chans.xyz` by creating that mailbox in Mailcow and publishing SPF/DKIM/DMARC for `chans.xyz`; or (b) allow “send as” in Mailcow’s **Sender ACL** for `zhiqiang@windy.me`. Hosting the `chans.xyz` mailbox gives best deliverability (DKIM/DMARC alignment).
|
||||
|
||||
Monitor while testing:
|
||||
```bash
|
||||
kubectl -n ess logs deploy/ess-matrix-authentication-service -f | grep -iE 'smtp|email|send'
|
||||
```
|
||||
|
||||
### 11.2 Synapse email notifications (optional)
|
||||
```yaml
|
||||
# ~/ess-config-values/synapse-email.yaml
|
||||
synapse:
|
||||
additional:
|
||||
email.yaml:
|
||||
config: |
|
||||
email:
|
||||
smtp_host: "smtp.windy.me"
|
||||
smtp_port: 587
|
||||
smtp_user: "noreply@chans.xyz"
|
||||
smtp_pass: "MAILBOX_PASSWORD"
|
||||
require_transport_security: true
|
||||
notif_from: "Matrix on chans.xyz <noreply@chans.xyz>"
|
||||
enable_notifs: true
|
||||
```
|
||||
|
||||
Include this file in your next Helm upgrade.
|
||||
|
||||
---
|
||||
|
||||
## 12) Health checks & troubleshooting
|
||||
|
||||
**Basic:**
|
||||
```bash
|
||||
kubectl get pods,svc,ingress,certificate -n ess -o wide
|
||||
```
|
||||
|
||||
**Certs flow:**
|
||||
```bash
|
||||
kubectl get certificate,order,challenge -n ess
|
||||
kubectl describe challenge -n ess <name>
|
||||
kubectl logs -n kube-system deploy/traefik --tail=200
|
||||
```
|
||||
|
||||
**Well‑known + federation:**
|
||||
```bash
|
||||
curl -s https://chans.xyz/.well-known/matrix/server | jq .
|
||||
curl -s https://chans.xyz/.well-known/matrix/client | jq .
|
||||
```
|
||||
|
||||
**Common pitfalls:**
|
||||
- Ingresses lack TLS + `cert-manager.io/cluster-issuer` → fix `tls.yaml`.
|
||||
- `553 Sender address rejected` from Mailcow → align SMTP auth user with sender or allow “send as”, and set SPF/DKIM/DMARC for `chans.xyz`.
|
||||
- Port 80 blocked → Let’s Encrypt HTTP‑01 fails (check challenges).
|
||||
- Apex `chans.xyz` not pointing at the node → `.well-known` fails → federation fails.
|
||||
|
||||
---
|
||||
|
||||
## 13) Upgrades / Uninstall
|
||||
|
||||
Upgrade to latest chart:
|
||||
```bash
|
||||
helm repo update # if using repos
|
||||
helm upgrade --install ess oci://ghcr.io/element-hq/ess-helm/matrix-stack -n ess -f ~/ess-config-values/hostnames.yaml -f ~/ess-config-values/tls.yaml --wait
|
||||
```
|
||||
|
||||
Uninstall ESS (keeps PVCs unless you delete them):
|
||||
```bash
|
||||
helm uninstall ess -n ess
|
||||
kubectl delete namespace ess
|
||||
```
|
||||
|
||||
Reset K3s (if ever needed):
|
||||
```bash
|
||||
sudo /usr/local/bin/k3s-uninstall.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 14) Quick copy‑paste checklist
|
||||
|
||||
1. DNS A/AAAA for: `chans.xyz`, `synapse.`, `account.`, `chat.`, `mrtc.` → your IP.
|
||||
2. K3s running with Traefik; cert‑manager installed; `ClusterIssuer letsencrypt-prod` **Ready**.
|
||||
3. `hostnames.yaml` with `*.ingress.host` set to your subdomains.
|
||||
4. `tls.yaml` with `global.ingress.annotations.cert-manager.io/cluster-issuer=letsencrypt-prod` and TLS enabled.
|
||||
5. `helm upgrade --install ess …` with both files.
|
||||
6. `kubectl get certificate -n ess` → `READY=True`.
|
||||
7. `/.well-known` returns correct JSON; federation tester OK.
|
||||
8. Create admin via MAS CLI; log in at `https://chat.chans.xyz`.
|
||||
9. Configure SMTP for MAS (and optionally Synapse), fix Mailcow sender policy if needed.
|
||||
+294
@@ -0,0 +1,294 @@
|
||||
|
||||
|
||||
docker compose
|
||||
|
||||
```yaml
|
||||
services:
|
||||
networks:
|
||||
proxy:
|
||||
driver: bridge
|
||||
|
||||
services:
|
||||
|
||||
traefik:
|
||||
image: "traefik"
|
||||
restart: "unless-stopped"
|
||||
command:
|
||||
- "--api=true"
|
||||
- "--api.dashboard=true"
|
||||
- "--providers.docker=true"
|
||||
- "--providers.docker.exposedbydefault=false"
|
||||
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
|
||||
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web" # Ensure HTTP challenge uses the web entry point
|
||||
- "--certificatesresolvers.myresolver.acme.email=zhiqiang@windy.me" # Set your email for Let's Encrypt
|
||||
- "--certificatesresolvers.myresolver.acme.storage=/certs/acme.json" # Path to store certs
|
||||
- "--entrypoints.web.address=:80" # Entry point for HTTP
|
||||
- "--entrypoints.websecure.address=:443" # Entry point for HTTPS
|
||||
- "--log.level=DEBUG" # Set the log level (optional)
|
||||
ports:
|
||||
- "80:80" # Ensure port 80 is exposed for HTTP challenge
|
||||
- "443:443" # Port 443 for HTTPS
|
||||
- "8080:8080" # Dashboard (Optional)
|
||||
volumes:
|
||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
- "./certs/acme.json:/certs/acme.json"
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
well-known:
|
||||
image: "nginx"
|
||||
restart: "unless-stopped"
|
||||
volumes:
|
||||
- ./well-known:/etc/nginx/conf.d
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.well-known.entrypoints=websecure"
|
||||
- "traefik.http.routers.well-known.rule=Host(`chans.xyz`) && PathPrefix(`/.well-known`)"
|
||||
- "traefik.http.routers.well-known.tls=true"
|
||||
- "traefik.http.routers.well-known.tls.certresolver=myresolver"
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
synapse:
|
||||
image: docker.io/matrixdotorg/synapse
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
|
||||
volumes:
|
||||
- ./data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-z", "db", "5432"]
|
||||
interval: 10s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
timeout: 2s
|
||||
depends_on:
|
||||
- db
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.synapse.rule=Host(`synapse.chans.xyz`)" # Router for synapse.chans.xyz
|
||||
- "traefik.http.routers.synapse.entrypoints=websecure" # HTTPS traffic
|
||||
- "traefik.http.routers.synapse.tls=true" # Enable TLS
|
||||
- "traefik.http.routers.synapse.tls.certresolver=myresolver" # Use Let's Encrypt resolver
|
||||
- "traefik.http.services.synapse.loadbalancer.server.port=8008" # Synapse backend port
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
db:
|
||||
image: docker.io/postgres:14-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- POSTGRES_USER=synapse
|
||||
- POSTGRES_PASSWORD=ucdN6Upc|J,V*J0?
|
||||
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
||||
volumes:
|
||||
- ./db:/var/lib/postgresql/data
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
```
|
||||
|
||||
well-known
|
||||
default.conf
|
||||
```conf
|
||||
location /.well-known/matrix/server {
|
||||
access_log off;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
default_type application/json;
|
||||
return 200 '{"m.server": "matrix.chans.xyz:443"}';
|
||||
}
|
||||
|
||||
location /.well-known/matrix/client {
|
||||
access_log off;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
default_type application/json;
|
||||
return 200 '{"m.homeserver": {"base_url": "https://app.chans.xyz"}}';
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
generate config:
|
||||
|
||||
```bash
|
||||
|
||||
docker run -it --rm --volume ./data:/data -e SYNAPSE_SERVER_NAME=chans.xyz -e SYNAPSE_REPORT_STATS=yes matrixdotorg/synapse generate
|
||||
|
||||
```
|
||||
|
||||
|
||||
homeserver.yml
|
||||
database:
|
||||
|
||||
```yaml
|
||||
name: psycopg2
|
||||
txn_limit: 10000
|
||||
args:
|
||||
user: synapse
|
||||
password: ucdN6Upc|J,V*J0?
|
||||
database: synapse
|
||||
host: synapse_db
|
||||
port: 5432
|
||||
cp_min: 5
|
||||
cp_max: 10
|
||||
|
||||
```
|
||||
|
||||
|
||||
```yaml
|
||||
#
|
||||
# This is a YAML file: see [1] for a quick introduction. Note in particular
|
||||
# that *indentation is important*: all the elements of a list or dictionary
|
||||
# should have the same indentation.
|
||||
#
|
||||
# [1] https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html
|
||||
#
|
||||
# For more information on how to configure Synapse, including a complete accounting of
|
||||
# each option, go to docs/usage/configuration/config_documentation.md or
|
||||
# https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html
|
||||
server_name: "chans.xyz"
|
||||
pid_file: /data/homeserver.pid
|
||||
listeners:
|
||||
- port: 8008
|
||||
tls: false
|
||||
type: http
|
||||
x_forwarded: true
|
||||
resources:
|
||||
- names: [client, federation]
|
||||
compress: false
|
||||
database:
|
||||
name: psycopg2
|
||||
txn_limit: 10000
|
||||
args:
|
||||
user: synapse
|
||||
password: ucdN6Upc|J,V*J0?
|
||||
database: synapse
|
||||
host: synapse_db
|
||||
port: 5432
|
||||
cp_min: 5
|
||||
cp_max: 10
|
||||
log_config: "/data/chans.xyz.log.config"
|
||||
media_store_path: /data/media_store
|
||||
registration_shared_secret: "lTjbS&oVJ7==Co+4YdbDxR,u7.:d+3qgofIR@9c#*1ULc;M2,*"
|
||||
report_stats: true
|
||||
macaroon_secret_key: "fe@vZvVnFFA3j:;hK;DI27;vZk@lHHk~w7foB*Q0D0nd.;tGho"
|
||||
form_secret: "G*bdHINrFR+@,A3^P=IpayYU3aluiAKcI5@L&E-f#Du:s@MgB6"
|
||||
signing_key_path: "/data/chans.xyz.signing.key"
|
||||
trusted_key_servers:
|
||||
- server_name: "matrix.org"
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
sudo certbot --nginx -d chans.xyz -d synapse.chans.xyz
|
||||
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
register_new_matrix_user -c /data/homeserver.yaml http://localhost:8008
|
||||
```
|
||||
|
||||
key:
|
||||
```
|
||||
EsT1 s6mK hgBT 3Cnv iYbW SNBD Bf3C LwPs nPbq dXJ8 cbbg aiEs
|
||||
```
|
||||
|
||||
|
||||
```yaml
|
||||
# The Matrix integration
|
||||
matrix:
|
||||
homeserver: https://chans.xyz
|
||||
username: "@zhiqiang:chans.xyz"
|
||||
password: "vaz6PQV5vjg1aya-mvr"
|
||||
rooms:
|
||||
- "#hass:chans.xyz"
|
||||
commands:
|
||||
- word: testword
|
||||
name: testword
|
||||
rooms:
|
||||
- "#hass:chans.xyz"
|
||||
- expression: "My name is (?P<name>.*)"
|
||||
name: introduction
|
||||
|
||||
notify:
|
||||
- name: matrix_notify
|
||||
platform: matrix
|
||||
default_room: "#hass:chans.xyz"
|
||||
|
||||
automation:
|
||||
- alias: "React to !testword"
|
||||
triggers:
|
||||
- trigger: event
|
||||
event_type: matrix_command
|
||||
event_data:
|
||||
command: testword
|
||||
actions:
|
||||
- action: notify.matrix_notify
|
||||
data:
|
||||
message: "It looks like you wrote !testword"
|
||||
|
||||
- alias: "React to an introduction"
|
||||
triggers:
|
||||
- trigger: event
|
||||
event_type: matrix_command
|
||||
event_data:
|
||||
command: introduction
|
||||
actions:
|
||||
- action: notify.matrix_notify
|
||||
data:
|
||||
message: "Hello {{trigger.event.data.args['name']}}"
|
||||
```
|
||||
|
||||
get token
|
||||
|
||||
```
|
||||
curl -X POST -H "Content-Type: application/json" -d '{
|
||||
"type": "m.login.password",
|
||||
"user": "hass",
|
||||
"password": ".P.fPdJL6.wz77q*9VjD"
|
||||
}' "https://chans.xyz/_matrix/client/r0/login"
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
syt_aGFzcw_cBpXCxWpUSawmWXXmZFL_0v4BCE
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
curl -XPOST "https://synapse.chans.xyz/_matrix/client/v3/login" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"type": "m.login.password",
|
||||
"identifier": {
|
||||
"type": "m.id.user",
|
||||
"user": "zhiqiang"
|
||||
},
|
||||
"password": "vaz6PQV5vjg1aya-mvr"
|
||||
}'
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
{"access_token":"mct_yDGcVmMw2QyTiPPq4DVEHr5BPjQeqh_w1qQx1","device_id":"MryevHEy6k","user_id":"@zhiqiang:chans.xyz"}%
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
mct_yDGcVmMw2QyTiPPq4DVEHr5BPjQeqh_w1qQx1
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
matrix:
|
||||
homeserver: chans.xyz
|
||||
secret: 'wqfJ1r4cyaQbRNzGUUxjOyFf1g2hvC8F'
|
||||
endpoint: https://synapse.chans.xyz/
|
||||
|
||||
```
|
||||
@@ -0,0 +1,312 @@
|
||||
|
||||
|
||||
docker compose
|
||||
|
||||
```yaml
|
||||
services:
|
||||
networks:
|
||||
proxy:
|
||||
driver: bridge
|
||||
|
||||
services:
|
||||
|
||||
traefik:
|
||||
image: "traefik"
|
||||
restart: "unless-stopped"
|
||||
command:
|
||||
- "--api=true"
|
||||
- "--api.dashboard=true"
|
||||
- "--providers.docker=true"
|
||||
- "--providers.docker.exposedbydefault=false"
|
||||
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
|
||||
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web" # Ensure HTTP challenge uses the web entry point
|
||||
- "--certificatesresolvers.myresolver.acme.email=zhiqiang@windy.me" # Set your email for Let's Encrypt
|
||||
- "--certificatesresolvers.myresolver.acme.storage=/certs/acme.json" # Path to store certs
|
||||
- "--entrypoints.web.address=:80" # Entry point for HTTP
|
||||
- "--entrypoints.websecure.address=:443" # Entry point for HTTPS
|
||||
- "--log.level=DEBUG" # Set the log level (optional)
|
||||
ports:
|
||||
- "80:80" # Ensure port 80 is exposed for HTTP challenge
|
||||
- "443:443" # Port 443 for HTTPS
|
||||
- "8080:8080" # Dashboard (Optional)
|
||||
volumes:
|
||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
- "./certs/acme.json:/certs/acme.json"
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
well-known:
|
||||
image: "nginx"
|
||||
restart: "unless-stopped"
|
||||
volumes:
|
||||
- ./well-known:/etc/nginx/conf.d
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.well-known.entrypoints=websecure"
|
||||
- "traefik.http.routers.well-known.rule=Host(`chans.xyz`) && PathPrefix(`/.well-known`)"
|
||||
- "traefik.http.routers.well-known.tls=true"
|
||||
- "traefik.http.routers.well-known.tls.certresolver=myresolver"
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
synapse:
|
||||
image: docker.io/matrixdotorg/synapse
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
|
||||
volumes:
|
||||
- ./data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-z", "db", "5432"]
|
||||
interval: 10s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
timeout: 2s
|
||||
depends_on:
|
||||
- db
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.synapse.rule=Host(`synapse.chans.xyz`)" # Router for synapse.chans.xyz
|
||||
- "traefik.http.routers.synapse.entrypoints=websecure" # HTTPS traffic
|
||||
- "traefik.http.routers.synapse.tls=true" # Enable TLS
|
||||
- "traefik.http.routers.synapse.tls.certresolver=myresolver" # Use Let's Encrypt resolver
|
||||
- "traefik.http.services.synapse.loadbalancer.server.port=8008" # Synapse backend port
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
db:
|
||||
image: docker.io/postgres:14-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- POSTGRES_USER=synapse
|
||||
- POSTGRES_PASSWORD=ucdN6Upc|J,V*J0?
|
||||
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
||||
volumes:
|
||||
- ./db:/var/lib/postgresql/data
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
```
|
||||
|
||||
well-known
|
||||
default.conf
|
||||
```conf
|
||||
location /.well-known/matrix/server {
|
||||
access_log off;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
default_type application/json;
|
||||
return 200 '{"m.server": "matrix.chans.xyz:443"}';
|
||||
}
|
||||
|
||||
location /.well-known/matrix/client {
|
||||
access_log off;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
default_type application/json;
|
||||
return 200 '{"m.homeserver": {"base_url": "https://app.chans.xyz"}}';
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
generate config:
|
||||
|
||||
```bash
|
||||
|
||||
docker run -it --rm --volume ./data:/data -e SYNAPSE_SERVER_NAME=chans.xyz -e SYNAPSE_REPORT_STATS=yes matrixdotorg/synapse generate
|
||||
|
||||
```
|
||||
|
||||
|
||||
homeserver.yml
|
||||
database:
|
||||
|
||||
```yaml
|
||||
name: psycopg2
|
||||
txn_limit: 10000
|
||||
args:
|
||||
user: synapse
|
||||
password: ucdN6Upc|J,V*J0?
|
||||
database: synapse
|
||||
host: synapse_db
|
||||
port: 5432
|
||||
cp_min: 5
|
||||
cp_max: 10
|
||||
|
||||
```
|
||||
|
||||
|
||||
```yaml
|
||||
#
|
||||
# This is a YAML file: see [1] for a quick introduction. Note in particular
|
||||
# that *indentation is important*: all the elements of a list or dictionary
|
||||
# should have the same indentation.
|
||||
#
|
||||
# [1] https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html
|
||||
#
|
||||
# For more information on how to configure Synapse, including a complete accounting of
|
||||
# each option, go to docs/usage/configuration/config_documentation.md or
|
||||
# https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html
|
||||
server_name: "chans.xyz"
|
||||
pid_file: /data/homeserver.pid
|
||||
listeners:
|
||||
- port: 8008
|
||||
tls: false
|
||||
type: http
|
||||
x_forwarded: true
|
||||
resources:
|
||||
- names: [client, federation]
|
||||
compress: false
|
||||
database:
|
||||
name: psycopg2
|
||||
txn_limit: 10000
|
||||
args:
|
||||
user: synapse
|
||||
password: ucdN6Upc|J,V*J0?
|
||||
database: synapse
|
||||
host: synapse_db
|
||||
port: 5432
|
||||
cp_min: 5
|
||||
cp_max: 10
|
||||
log_config: "/data/chans.xyz.log.config"
|
||||
media_store_path: /data/media_store
|
||||
registration_shared_secret: "lTjbS&oVJ7==Co+4YdbDxR,u7.:d+3qgofIR@9c#*1ULc;M2,*"
|
||||
report_stats: true
|
||||
macaroon_secret_key: "fe@vZvVnFFA3j:;hK;DI27;vZk@lHHk~w7foB*Q0D0nd.;tGho"
|
||||
form_secret: "G*bdHINrFR+@,A3^P=IpayYU3aluiAKcI5@L&E-f#Du:s@MgB6"
|
||||
signing_key_path: "/data/chans.xyz.signing.key"
|
||||
trusted_key_servers:
|
||||
- server_name: "matrix.org"
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
sudo certbot --nginx -d chans.xyz -d synapse.chans.xyz
|
||||
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
register_new_matrix_user -c /data/homeserver.yaml http://localhost:8008
|
||||
```
|
||||
|
||||
key:
|
||||
```
|
||||
EsT1 s6mK hgBT 3Cnv iYbW SNBD Bf3C LwPs nPbq dXJ8 cbbg aiEs
|
||||
```
|
||||
|
||||
|
||||
```yaml
|
||||
# The Matrix integration
|
||||
matrix:
|
||||
homeserver: https://chans.xyz
|
||||
username: "@zhiqiang:chans.xyz"
|
||||
password: "vaz6PQV5vjg1aya-mvr"
|
||||
rooms:
|
||||
- "#hass:chans.xyz"
|
||||
commands:
|
||||
- word: testword
|
||||
name: testword
|
||||
rooms:
|
||||
- "#hass:chans.xyz"
|
||||
- expression: "My name is (?P<name>.*)"
|
||||
name: introduction
|
||||
|
||||
notify:
|
||||
- name: matrix_notify
|
||||
platform: matrix
|
||||
default_room: "#hass:chans.xyz"
|
||||
|
||||
automation:
|
||||
- alias: "React to !testword"
|
||||
triggers:
|
||||
- trigger: event
|
||||
event_type: matrix_command
|
||||
event_data:
|
||||
command: testword
|
||||
actions:
|
||||
- action: notify.matrix_notify
|
||||
data:
|
||||
message: "It looks like you wrote !testword"
|
||||
|
||||
- alias: "React to an introduction"
|
||||
triggers:
|
||||
- trigger: event
|
||||
event_type: matrix_command
|
||||
event_data:
|
||||
command: introduction
|
||||
actions:
|
||||
- action: notify.matrix_notify
|
||||
data:
|
||||
message: "Hello {{trigger.event.data.args['name']}}"
|
||||
```
|
||||
|
||||
get token
|
||||
|
||||
```
|
||||
curl -X POST -H "Content-Type: application/json" -d '{
|
||||
"type": "m.login.password",
|
||||
"user": "hass",
|
||||
"password": ".P.fPdJL6.wz77q*9VjD"
|
||||
}' "https://chans.xyz/_matrix/client/r0/login"
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
syt_aGFzcw_cBpXCxWpUSawmWXXmZFL_0v4BCE
|
||||
```
|
||||
|
||||
|
||||
|
||||
new matrix ess recover key
|
||||
```
|
||||
EsTR 895B q1wv 4ibr ZRaK 9KCK 7nLc xHCm XUGX eYjh TcE5 4XSJ
|
||||
```
|
||||
|
||||
|
||||
|
||||
iris account:
|
||||
```
|
||||
Awa5noeW9vzLiPRY
|
||||
```
|
||||
|
||||
|
||||
hass account:
|
||||
```
|
||||
sgHoMmOWn8SkYJf#
|
||||
```
|
||||
|
||||
```
|
||||
kubectl -n ess exec deploy/ess-matrix-authentication-service -- mas-cli manage register-user --yes hass -p "sgHoMmOWn8SkYJf#"
|
||||
Defaulted container "matrix-authentication-service" out of: matrix-authentication-service, render-config (init), db-wait (init), database-migrate (init)
|
||||
User attributes
|
||||
Username: hass
|
||||
Matrix ID: @hass:chans.xyz
|
||||
Password: ********
|
||||
No email address provided, user will be prompted to add one
|
||||
2025-10-22T09:25:36.174135Z WARN mas_cli::commands::manage:818 No email address provided, user will need to add one
|
||||
2025-10-22T09:25:36.209840Z INFO mas_cli::commands::manage:835 User registered user.id=01K85KSXSEB2FB6MJHNKZP0BDV
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
matrix:
|
||||
homeserver: "https://chans.xyz"
|
||||
username: "@hass:chans.xyz"
|
||||
password: "sgHoMmOWn8SkYJf#"
|
||||
rooms:
|
||||
- "#guangzhou:chans.xyz"
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
synapse:
|
||||
additional:
|
||||
config: |
|
||||
auto_join_rooms_for_users_on_first_login: true
|
||||
|
||||
```
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
|
||||
Hi Amin,
|
||||
|
||||
Thanks for posting in the community. We are happy to help you.
|
||||
|
||||
According to your description, the situation on your end is likely caused by your organization's settings/policies (e.g. conditional access policy).
|
||||
|
||||
You can try the following steps, and then check if it still happens or not.
|
||||
|
||||
1. Please sign out your accounts from Office applications, then close all Office applications.
|
||||
|
||||
2. Open File Explorer, paste the following path, and delete all files and folders.
|
||||
|
||||
%localappdata%\Packages\Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy
|
||||
|
||||
3. In the Windows search bar, search for "Access Work or School".
|
||||
|
||||
4. Check if you can see your business account in "Access Work or School".
|
||||
|
||||
- If you don't see it, please select Connect and add your business account.
|
||||
|
||||
|
||||
- If you can see it, please select it and select Disconnect. After that, please click "Connect" and log into your account again to register the device.
|
||||
|
||||
|
||||
5. Run one Office application, such as Word, sign into your account, and check again.
|
||||
|
||||
If the error message still appears after trying the above steps, I recommend you report the situation to your organization admin or IT department.
|
||||
|
||||
We look forward to your response. Thanks for your cooperation.
|
||||
|
||||
Sincerely,
|
||||
|
||||
George | Microsoft Community Moderator
|
||||
|
||||
[Updated by George Jiang MSFT 04:33 AM 08/10 2024 UTC + 8]
|
||||
|
||||
• Beware of Scammers posting fake Support Numbers here.
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
亲,以下是您购买的商品信息。
|
||||
MobaXterm Professional 便携版
|
||||
下载地址https://wwxs.lanzoum.com/ieYNw0s21tab
|
||||
备用地址https://www.987123.xyz/oss/lovemei9/MobaXterm/MobaXterm_Portable_v23.1.zip
|
||||
说明:复制以上地址进行下载,软件包中已经集成授权文件,下载后解压即用。
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
squid:
|
||||
image: sameersbn/squid
|
||||
volumes:
|
||||
- ./squid.conf:/etc/squid/squid.conf:ro
|
||||
- squid_cache:/var/spool/squid
|
||||
ports:
|
||||
- "3128"
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
nghttpx:
|
||||
image: nghttpx/nghttpx
|
||||
command: nghttpx -f /etc/nghttpx/nghttpx.conf
|
||||
volumes:
|
||||
- ./nghttpx.conf:/etc/nghttpx/nghttpx.conf:ro
|
||||
environment:
|
||||
- http_proxy=http://squid:3128
|
||||
- https_proxy=http://squid:3128
|
||||
- no_proxy=localhost,127.0.0.1,172.20.*
|
||||
ports:
|
||||
- "80"
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
|
||||
volumes:
|
||||
squid_cache:
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
name: npm
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
恩山:
|
||||
[OPENWRT专版-恩山无线论坛 - Powered by Discuz! (right.com.cn)](https://www.right.com.cn/FORUM/forum-72-1.html)
|
||||
|
||||
[极简ImmortalWrt及L大原版极简-软路由,x86系统,openwrt(x86),Router OS 等-恩山无线论坛 - Powered by Discuz! (right.com.cn)](https://www.right.com.cn/FORUM/thread-8282522-1-1.html)
|
||||
[https://www.123pan.com/s/bj1ZVv-49UHd.html](https://www.123pan.com/s/bj1ZVv-49UHd.html)
|
||||
@@ -0,0 +1,85 @@
|
||||
|
||||
🎉 **Success!**
|
||||
Your boot time improved from **39 seconds → 9 seconds** — that’s a **~77% speed increase**. 🚀
|
||||
|
||||
Great work applying the fix correctly!
|
||||
|
||||
---
|
||||
|
||||
### ⏱ Boot Profile Now
|
||||
|
||||
|Phase|Before|After|Improvement|
|
||||
|---|---|---|---|
|
||||
|Userspace|~36s|~5.5s|🔥 -30.5s|
|
||||
|Total|~39.4s|~9.0s|👍 -30.4s|
|
||||
|
||||
The system is now performing like a modern openSUSE should.
|
||||
|
||||
---
|
||||
|
||||
### 📌 Next: Confirm SSH Starts Early
|
||||
|
||||
Optional but recommended:
|
||||
|
||||
```bash
|
||||
systemctl status sshd.service
|
||||
```
|
||||
|
||||
It should start **right after network.target**, not waiting for full online connection.
|
||||
|
||||
If SSH still waits too long for DNS, you can also apply:
|
||||
|
||||
```bash
|
||||
sudo sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
|
||||
sudo systemctl restart sshd
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 🧽 Optional Cleanup
|
||||
|
||||
To remove the leftover serial devices delay (3 seconds earlier):
|
||||
|
||||
```bash
|
||||
sudo systemctl mask serial-getty@ttyS0.service
|
||||
sudo systemctl mask serial-getty@ttyS1.service
|
||||
sudo systemctl mask serial-getty@ttyS2.service
|
||||
sudo systemctl mask serial-getty@ttyS3.service
|
||||
```
|
||||
|
||||
If you **don’t** use serial consoles, this is safe and saves another ~3s.
|
||||
|
||||
---
|
||||
|
||||
### 🚀 Want even faster boot?
|
||||
|
||||
I can help optimize:
|
||||
|
||||
- ZRAM for faster paging
|
||||
|
||||
- Disable unnecessary services (Snapper timers, Avahi if not needed)
|
||||
|
||||
- Enable fast boot in GRUB (skip detecting other OS)
|
||||
|
||||
- Parallelize or lazy-load more services
|
||||
|
||||
|
||||
Just share:
|
||||
|
||||
```bash
|
||||
systemctl --failed
|
||||
systemd-analyze blame | head -n 10
|
||||
```
|
||||
|
||||
and I’ll provide a tailored further optimization plan.
|
||||
|
||||
---
|
||||
|
||||
If you'd like, I can also help optimize:
|
||||
|
||||
🟢 Startup applications
|
||||
🟢 Linux network stack speed
|
||||
🟢 SSD mount tuning (discard, noatime)
|
||||
🟢 bootloader timeout & fast initrd
|
||||
|
||||
Would you like a **one-click optimization script** for openSUSE?
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
重要提示【小文件多的不能使用】
|
||||
一年卡号:42cb7b36a5ded34
|
||||
下载地址:https://wwxx.lanzouw.com/D88
|
||||
|
||||
(必须复制到浏览器打开链接) 下载完成 先解压 再右键管理员身份运行(按教程使用)
|
||||
每天有100G下载量
|
||||
图片,音频,小视频 上千小文件禁用
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
|
||||
## dns.windy.lan
|
||||
domain: dns.windy.lan
|
||||
ip: 192.168.66.36
|
||||
root: windyboy
|
||||
user: windy/windyboy
|
||||
@@ -0,0 +1,305 @@
|
||||
|
||||
# 🌀 从 Slave 节点恢复 PowerDNS Authoritative 主节点(5.0.0 + PostgreSQL)
|
||||
|
||||
> 本文记录如何从 PowerDNS 从节点完整恢复主节点,包括数据库重建、Zone 导入、TSIG 同步与 DNSSEC 校验。
|
||||
> 适用于 **PowerDNS Authoritative 5.0.0** + **PostgreSQL gpgsql backend** 环境。
|
||||
|
||||
---
|
||||
|
||||
## 一、系统角色
|
||||
|
||||
|节点|地址|角色|说明|
|
||||
|---|---|---|---|
|
||||
|主节点|154.36.174.161|primary|新建|
|
||||
|从节点|202.91.35.141|secondary|当前持有所有 zone|
|
||||
|数据库|PostgreSQL 15|backend|gpgsql|
|
||||
|TSIG|mykey (hmac-sha512)|用于 AXFR 验证||
|
||||
|
||||
---
|
||||
|
||||
## 二、从 Slave 导出数据
|
||||
|
||||
### 1️⃣ 列出所有 zone
|
||||
|
||||
```bash
|
||||
sudo pdnsutil zone list-all
|
||||
```
|
||||
|
||||
### 2️⃣ 导出 zone 文件(PowerDNS 5.0 无 dump-zone)
|
||||
|
||||
```bash
|
||||
sudo pdnsutil zone list windy.me > /var/tmp/windy.me.zone
|
||||
sudo pdnsutil zone list wsvc.info > /var/tmp/wsvc.info.zone
|
||||
sudo pdnsutil zone list chans.xyz > /var/tmp/chans.xyz.zone
|
||||
```
|
||||
|
||||
### 3️⃣ 导出 TSIG 密钥
|
||||
|
||||
```bash
|
||||
sudo pdnsutil tsigkey list
|
||||
```
|
||||
|
||||
示例:
|
||||
|
||||
```
|
||||
mykey. hmac-sha512. 4es15ROFVNZh76mqbn7sVu1kodAdULYKp8I/jGAWvmH/uyxeyDwqoBiYYBKPro5M+TRkKYn7ulxZKskfKIBKNg==
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 三、部署主节点环境
|
||||
|
||||
### 1️⃣ 目录结构
|
||||
|
||||
```
|
||||
/opt/pdns-primary/
|
||||
├── docker-compose.yml
|
||||
├── pdns.conf
|
||||
└── db-init/
|
||||
└── 01-init.sql
|
||||
```
|
||||
|
||||
### 2️⃣ docker-compose.yml
|
||||
|
||||
```yaml
|
||||
version: "3.8"
|
||||
services:
|
||||
pdns-db:
|
||||
image: postgres:15
|
||||
environment:
|
||||
POSTGRES_USER: pdns
|
||||
POSTGRES_PASSWORD: windyboy2006
|
||||
POSTGRES_DB: pdns
|
||||
volumes:
|
||||
- ./db-init:/docker-entrypoint-initdb.d
|
||||
- pdns-db-data:/var/lib/postgresql/data
|
||||
restart: unless-stopped
|
||||
|
||||
auth:
|
||||
image: powerdns/pdns-auth-50:latest
|
||||
depends_on:
|
||||
- pdns-db
|
||||
volumes:
|
||||
- ./pdns.conf:/etc/powerdns/pdns.conf:ro
|
||||
- ./import:/import:ro
|
||||
ports:
|
||||
- "53:53/tcp"
|
||||
- "53:53/udp"
|
||||
- "8081:8081"
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
pdns-db-data:
|
||||
```
|
||||
|
||||
### 3️⃣ 初始化数据库
|
||||
|
||||
`db-init/01-init.sql`:
|
||||
|
||||
```sql
|
||||
CREATE USER pdns WITH PASSWORD 'windyboy2006';
|
||||
CREATE DATABASE pdns OWNER pdns ENCODING 'UTF8';
|
||||
```
|
||||
|
||||
启动数据库:
|
||||
|
||||
```bash
|
||||
docker compose up -d pdns-db
|
||||
sleep 10
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 四、主节点配置(pdns.conf)
|
||||
|
||||
```ini
|
||||
primary=yes
|
||||
secondary=no
|
||||
launch=gpgsql
|
||||
gpgsql-host=pdns-db
|
||||
gpgsql-port=5432
|
||||
gpgsql-dbname=pdns
|
||||
gpgsql-user=pdns
|
||||
gpgsql-password=windyboy2006
|
||||
gpgsql-dnssec=yes
|
||||
|
||||
local-address=0.0.0.0
|
||||
local-port=53
|
||||
setuid=pdns
|
||||
setgid=pdns
|
||||
loglevel=4
|
||||
version-string=anonymous
|
||||
|
||||
api=yes
|
||||
api-key=SuperSecretKey
|
||||
webserver=yes
|
||||
webserver-address=0.0.0.0
|
||||
webserver-port=8081
|
||||
|
||||
default-soa-edit=INCEPTION-INCREMENT
|
||||
default-soa-edit-signed=INCEPTION-INCREMENT
|
||||
disable-axfr=no
|
||||
```
|
||||
|
||||
✅ 所有字段均为 **5.0.0 有效选项**,无 `default-soa-edit-api`。
|
||||
|
||||
---
|
||||
|
||||
## 五、导入 Zone 数据
|
||||
|
||||
### 1️⃣ 创建空 zone 并设为 master
|
||||
|
||||
```bash
|
||||
docker compose exec auth pdnsutil zone create windy.me
|
||||
docker compose exec auth pdnsutil zone set-kind windy.me master
|
||||
|
||||
docker compose exec auth pdnsutil zone create wsvc.info
|
||||
docker compose exec auth pdnsutil zone set-kind wsvc.info master
|
||||
|
||||
docker compose exec auth pdnsutil zone create chans.xyz
|
||||
docker compose exec auth pdnsutil zone set-kind chans.xyz master
|
||||
```
|
||||
|
||||
### 2️⃣ 导入 zone 文件
|
||||
|
||||
```bash
|
||||
docker compose exec auth pdnsutil zone load windy.me /import/windy.me.zone
|
||||
docker compose exec auth pdnsutil zone load wsvc.info /import/wsvc.info.zone
|
||||
docker compose exec auth pdnsutil zone load chans.xyz /import/chans.xyz.zone
|
||||
```
|
||||
|
||||
### 3️⃣ 如 zone 含有 RRSIG/DNSKEY,设为 presigned
|
||||
|
||||
```bash
|
||||
docker compose exec auth pdnsutil zone set-presigned windy.me
|
||||
docker compose exec auth pdnsutil zone set-presigned wsvc.info
|
||||
docker compose exec auth pdnsutil zone set-presigned chans.xyz
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 六、导入 TSIG 密钥并授权从节点
|
||||
|
||||
### 1️⃣ 导入 TSIG key
|
||||
|
||||
```bash
|
||||
docker compose exec auth pdnsutil tsigkey import "mykey." hmac-sha512 "4es15ROFVNZh76mqbn7sVu1kodAdULYKp8I/jGAWvmH/uyxeyDwqoBiYYBKPro5M+TRkKYn7ulxZKskfKIBKNg=="
|
||||
```
|
||||
|
||||
### 2️⃣ 授权从节点(202.91.35.141)
|
||||
|
||||
```bash
|
||||
docker compose exec auth pdnsutil metadata set windy.me TSIG-ALLOW-AXFR "mykey."
|
||||
docker compose exec auth pdnsutil metadata set windy.me ALLOW-AXFR-FROM "202.91.35.141"
|
||||
docker compose exec auth pdnsutil metadata set windy.me ALSO-NOTIFY "202.91.35.141"
|
||||
|
||||
docker compose exec auth pdnsutil metadata set wsvc.info TSIG-ALLOW-AXFR "mykey."
|
||||
docker compose exec auth pdnsutil metadata set wsvc.info ALLOW-AXFR-FROM "202.91.35.141"
|
||||
docker compose exec auth pdnsutil metadata set wsvc.info ALSO-NOTIFY "202.91.35.141"
|
||||
|
||||
docker compose exec auth pdnsutil metadata set chans.xyz TSIG-ALLOW-AXFR "mykey."
|
||||
docker compose exec auth pdnsutil metadata set chans.xyz ALLOW-AXFR-FROM "202.91.35.141"
|
||||
docker compose exec auth pdnsutil metadata set chans.xyz ALSO-NOTIFY "202.91.35.141"
|
||||
```
|
||||
|
||||
> ⚠️ 不带 `@mykey.`,因为已全局指定 TSIG key。
|
||||
|
||||
---
|
||||
|
||||
## 七、在从节点配置新的主节点
|
||||
|
||||
```bash
|
||||
sudo pdnsutil zone create-secondary windy.me 154.36.174.161
|
||||
sudo pdnsutil metadata set windy.me AXFR-MASTER-TSIG "mykey."
|
||||
|
||||
sudo pdnsutil zone create-secondary wsvc.info 154.36.174.161
|
||||
sudo pdnsutil metadata set wsvc.info AXFR-MASTER-TSIG "mykey."
|
||||
|
||||
sudo pdnsutil zone create-secondary chans.xyz 154.36.174.161
|
||||
sudo pdnsutil metadata set chans.xyz AXFR-MASTER-TSIG "mykey."
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 八、触发 AXFR 同步
|
||||
|
||||
### 主节点发送 NOTIFY
|
||||
|
||||
```bash
|
||||
docker compose exec auth pdns_control notify windy.me
|
||||
docker compose exec auth pdns_control notify wsvc.info
|
||||
docker compose exec auth pdns_control notify chans.xyz
|
||||
```
|
||||
|
||||
### 从节点主动获取
|
||||
|
||||
```bash
|
||||
sudo pdns_control retrieve windy.me
|
||||
sudo pdns_control retrieve wsvc.info
|
||||
sudo pdns_control retrieve chans.xyz
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 九、验证结果
|
||||
|
||||
### 检查 zone 状态
|
||||
|
||||
```bash
|
||||
docker compose exec auth pdnsutil zone list-all
|
||||
```
|
||||
|
||||
### 对比 SOA 序列号
|
||||
|
||||
```bash
|
||||
dig @154.36.174.161 soa windy.me +short
|
||||
dig @202.91.35.141 soa windy.me +short
|
||||
```
|
||||
|
||||
应相同。
|
||||
|
||||
### 查看日志
|
||||
|
||||
主节点:
|
||||
|
||||
```
|
||||
AXFR-out zone 'windy.me', client '202.91.35.141' transfer started/done
|
||||
```
|
||||
|
||||
从节点:
|
||||
|
||||
```
|
||||
AXFR done for 'windy.me'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 十、常见错误与修复
|
||||
|
||||
|日志|原因|修复|
|
||||
|---|---|---|
|
||||
|Signature with TSIG key failed|双方 TSIG secret 不一致|重新导入一致的 key|
|
||||
|Server Not Authoritative / Not Authorized|主节点未授权从节点|执行 metadata set ALLOW-AXFR-FROM|
|
||||
|AXFR-out denied: client has no permission|同上|增加 ALLOW-AXFR-FROM|
|
||||
|Trying to set unknown setting 'default-soa-edit-api'|配置无效|删除该字段|
|
||||
|
||||
---
|
||||
|
||||
## 十一、备份与维护
|
||||
|
||||
### 1️⃣ 数据库备份
|
||||
|
||||
```bash
|
||||
docker compose exec pdns-db pg_dump -U pdns pdns > /backup/pdns-$(date +%F).dump
|
||||
```
|
||||
|
||||
### 2️⃣ 导出所有 zone 文件
|
||||
|
||||
```bash
|
||||
mkdir -p /backup/zones
|
||||
for z in $(docker compose exec auth pdnsutil zone list-all | tr -d '\r'); do
|
||||
docker compose exec auth pdnsutil zone list "$z" > "/backup/zones/$z-$(date +%F).zone"
|
||||
done
|
||||
```
|
||||
|
||||
---
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
gzzn:
|
||||
410 456 544
|
||||
|
||||
password:
|
||||
```
|
||||
w42YyME_y3jVb!qa4X.c
|
||||
```
|
||||
|
||||
|
||||
win vm:
|
||||
```
|
||||
517 010 265
|
||||
```
|
||||
|
||||
password:
|
||||
```
|
||||
uW!g6CU6kteozaHUaJX*
|
||||
```
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
service key:
|
||||
```
|
||||
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFldWRtbGdvc2p2dnJzbWxkY3RrIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc2NTUwMjMyOCwiZXhwIjoyMDgxMDc4MzI4fQ.2rujZwkqatXYyvNwr4hkAWgSGi2q-FqWREicE-5sFBA
|
||||
```
|
||||
|
||||
|
||||
url:
|
||||
```
|
||||
https://qeudmlgosjvvrsmldctk.supabase.co
|
||||
```
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
mount point:
|
||||
/mnt/tank/Downloads
|
||||
|
||||
/mnt/tank/iocage/jails/transmission/root/usr/local/etc/transmission/home/Downloads
|
||||
|
||||
mac:
|
||||
a21d4803aa46 a21d4803aa47
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
|
||||
1、下载简体中文正式版
|
||||
zh-cn_windows_11_enterprise_ltsc_2024_x64_dvd_cff9cd2d.iso
|
||||
链接 hxxps://massgrave.dev/windows_ltsc_links
|
||||
|
||||
2、下载U盘启动工具rufus
|
||||
hxxps://github.com/pbatard/rufus/releases/download/v4.6/rufus-4.6p.exe
|
||||
在制作启动盘前根据图片设置
|
||||
|
||||
3、联网通过MAS激活或taobao购买key激活(约5-10rmb)
|
||||
hxxps://github.com/massgravel/Microsoft-Activation-Scripts
|
||||
|
||||
|
||||
|
||||
安装id
|
||||
```
|
||||
2009504 6265236 2833605 8639124 3459384 0687966 2714276 2063255 5191281
|
||||
```
|
||||
确认
|
||||
```
|
||||
092524 880890 346580 068743 201496 519312 470431 990856
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
自制精简优化Windows 10 LTSC2021简体中文版
|
||||
—————————————————————————————————————————
|
||||
文件名称: WIN10_LTSC2021_X64_ZH-CN_19044.1387.iso
|
||||
文件大小: 3.34 GB (3,592,355,840 字节)
|
||||
修改时间: 2021年11月30日
|
||||
MD5: 9BFFE3984F14CC8F4ACA1F465636F2D3
|
||||
SHA256: B9451EE3383DAAF3C7AC21DF18DA700F9BC9BAEF310A158B4151F668B980C9CF
|
||||
CRC32: C27756CF
|
||||
—————————————————————————————————————————
|
||||
|
||||
KMS激活命令:以管理员身份运行CMD(命令提示符)
|
||||
—————————————————————————————————————————
|
||||
slmgr /skms kms.03k.org
|
||||
slmgr /ato
|
||||
—————————————————————————————————————————
|
||||
|
||||
下载链接
|
||||
—————————————————————————————————————————
|
||||
阿里云盘:https://www.aliyundrive.com/s/rVRSBYc85Xe (下载文件后去掉后缀.PDF)
|
||||
百度云盘:https://pan.baidu.com/s/1Nlh_3A-yvqZW2l6dq0hE2g(提取码: ifbs)
|
||||
—————————————————————————————————————————
|
||||
|
||||
|
||||
激活
|
||||
```
|
||||
KC4NW-4GGX6-MFFGM-RGMFD-4GDGY
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
|
||||
# WSVC
|
||||
|
||||
Client Secret
|
||||
211073924279107589@wsvc.info
|
||||
|
||||
|
||||
wsvc project:
|
||||
211074961312382981@wsvc.info
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
## Docker + firewalld + iptables 关系总结
|
||||
|
||||
### 1. 三者分工
|
||||
|
||||
- **iptables**:内核防火墙引擎,真正执行包过滤和 NAT。
|
||||
- **firewalld**:iptables 的“策略管理层”,按 **zone / service / masquerade** 等抽象生成规则。
|
||||
- **Docker(iptables=true)**:在 iptables 中写入 **容器相关** 的规则:
|
||||
- 容器出网 SNAT(MASQUERADE)
|
||||
- 宿主端口 → 容器端口的 DNAT
|
||||
- 容器网络之间的隔离(DOCKER-ISOLATION)
|
||||
|
||||
三者是“共用 iptables,各管一摊”,不是互相替代。
|
||||
|
||||
---
|
||||
|
||||
### 2. Docker 关键配置项
|
||||
|
||||
`/etc/docker/daemon.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"iptables": true,
|
||||
"ip-masq": true
|
||||
}
|
||||
```
|
||||
|
||||
- `"iptables": true`(默认)
|
||||
- Docker 创建/维护 DOCKER 链、端口映射、容器出网 NAT 等规则。
|
||||
- 必须开启,否则大多数容器网络功能会坏(包括端口映射、bridge 容器出网)。
|
||||
|
||||
- `"iptables": false`
|
||||
- Docker 不再改 iptables,**不再创建 DOCKER/NAT 规则**。
|
||||
- 需要你手工写所有 NAT / 端口映射规则。
|
||||
- 常见现象:宿主机 & `--network host` 容器有网,但所有 bridge 容器出不了网。
|
||||
|
||||
- `"ip-masq": true`
|
||||
- 为 Docker 私网(如 172.17.0.0/16)自动加 MASQUERADE,容器可用宿主 IP 出网。
|
||||
|
||||
---
|
||||
|
||||
### 3. firewalld 与 Docker 的协作方式
|
||||
|
||||
典型做法(推荐):
|
||||
|
||||
1. 保持 Docker 使用 iptables:
|
||||
```json
|
||||
{
|
||||
"iptables": true,
|
||||
"ip-masq": true
|
||||
}
|
||||
```
|
||||
2. 在 firewalld 里:
|
||||
- 为 `docker0`、`br-xxxx` 等网桥分配到 `docker` zone:
|
||||
```bash
|
||||
firewall-cmd --zone=docker --add-interface=docker0 --permanent
|
||||
firewall-cmd --zone=docker --add-interface=br-xxxx --permanent
|
||||
```
|
||||
- 打开 masquerade 与 forward:
|
||||
```bash
|
||||
firewall-cmd --zone=docker --add-masquerade --permanent
|
||||
firewall-cmd --zone=docker --add-forward --permanent
|
||||
firewall-cmd --reload
|
||||
```
|
||||
|
||||
**原则:**
|
||||
|
||||
- Docker 负责:**容器内部路由 + NAT + 端口映射的具体规则**;
|
||||
- firewalld 负责:**哪些接口/zone 允许转发、伪装、对外开放哪些端口**。
|
||||
|
||||
---
|
||||
|
||||
### 4. 典型坑点(本次踩到的)
|
||||
|
||||
- 设置:
|
||||
|
||||
```json
|
||||
{
|
||||
"iptables": false
|
||||
}
|
||||
```
|
||||
|
||||
- 结果:
|
||||
- 宿主机有网;
|
||||
- `--network host` 容器有网;
|
||||
- 所有 bridge 网络容器无外网、访问 LE 超时。
|
||||
- 根因:
|
||||
- Docker 停止管理 iptables,不再生成容器 NAT 规则;
|
||||
- firewalld 只负责 zone 和 masquerade,但**不知道容器网络细节**,无法替 Docker 完成 SNAT/端口映射。
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
|
||||
```
|
||||
create database vaultwarden;
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
CREATE USER vaultwarden WITH ENCRYPTED PASSWORD 'windysecurity';
|
||||
GRANT ALL PRIVILEGES ON DATABASE vaultwarden TO vaultwarden;
|
||||
```
|
||||
|
||||
|
||||
```bitwarden.load
|
||||
LOAD DATABASE
|
||||
FROM sqlite:///opt/vaultwarden/vw-data/db.sqlite3
|
||||
INTO postgresql://vaultwarden:windysecurity@localhost:5432/vaultwarden
|
||||
|
||||
WITH include drop, create tables, create indexes, reset sequences
|
||||
EXCLUDING TABLE NAMES LIKE '__diesel_schema_migrations'
|
||||
ALTER SCHEMA 'main' RENAME TO 'public'
|
||||
;
|
||||
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
pgloader bitwarden.load
|
||||
```
|
||||
|
||||
```
|
||||
-- Grant usage and create permissions on the public schema
|
||||
GRANT USAGE ON SCHEMA public TO vaultwarden;
|
||||
GRANT CREATE ON SCHEMA public TO vaultwarden;
|
||||
|
||||
-- Optionally, grant all permissions on the public schema
|
||||
GRANT ALL ON SCHEMA public TO vaultwarden;
|
||||
|
||||
-- Transfer ownership of the public schema to vaultwarden (optional)
|
||||
ALTER SCHEMA public OWNER TO vaultwarden;
|
||||
|
||||
```
|
||||
|
||||
|
||||
```.env
|
||||
DOMAIN="https://auth.wsvc.info/"
|
||||
DATABASE_URL=postgresql://vaultwarden:windysecurity@172.18.0.1:5432/vaultwarden
|
||||
SMTP_HOST=smtp.windy.me
|
||||
SMTP_FROM=<vnet@windy.me>
|
||||
SMTP_PORT=587
|
||||
SMTP_SECURITY=starttls
|
||||
SMTP_USERNAME=vnet@windy.me
|
||||
SMTP_PASSWORD=windyboy2006
|
||||
```
|
||||
|
||||
```admin token
|
||||
i8aHqBZvgTjCoHKRqMqHxmbFs3JFwWnrzPuub09sUnYKTfwZ7m1VCKXABlSxRkJ6
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
echo -n "VjoM4sndg4.8uCzPmodH" | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1
|
||||
```
|
||||
|
||||
```
|
||||
$argon2id$v=19$m=19456,t=2,p=1$eXhRMTBiVXRjR2pFalpRYStCQys1SmtkaGVONTFJWm9HQmNMVDg2ZGlkVT0$ssdf1xrdTwXP7S7xoRiams1R3nGeSS3dkuKcPD/sO90
|
||||
```
|
||||
|
||||
```
|
||||
ADMIN_TOKEN='$argon2id$v=19$m=65540,t=3,p=4$d3Pa5o/TrvEhaVvj/bypWSnBqIFjU/rqkRV+Th7KmHU$ZDwdhqyIrTTvnAsIAUURjN3t3bgNWJfEh8Mv2cY0gUs'
|
||||
```
|
||||
Executable
+124
@@ -0,0 +1,124 @@
|
||||
|
||||
|
||||
|
||||
|
||||
https://bandwagonhost.com/
|
||||
|
||||
|
||||
**quick-flag-3.localdomain**
|
||||
SPECIAL 80G KVM PROMO V3 - LOS ANGELES - CN2
|
||||
|
||||
23.105.208.126
|
||||
|
||||
2023-07-15
|
||||
Semi-Annually: $100.88
|
||||
matrix.chans.xyz
|
||||
|
||||
|
||||
VM 1719294 — quick-flag-3.localdomain [23.105.208.126]
|
||||
|
||||
root: r90Bai3aQqV0
|
||||
|
||||
port: 27919
|
||||
|
||||
https://manage.hostdare.com/clientarea.php?action=services
|
||||
|
||||
|
||||
new matrix.chans.xyz :
|
||||
https://rhinotech.cc/
|
||||
|
||||
root: 4eFcoxKoC8Gr
|
||||
2core/2g/30g
|
||||
debain 10
|
||||
|
||||
**$139.80 USD** /year
|
||||
|
||||
|
||||
|
||||
|
||||
us4.wsvc.info
|
||||
|
||||
mx2.windy.me
|
||||
|
||||
103.99.115.4
|
||||
|
||||
47 年
|
||||
|
||||
us1.wsvc.info
|
||||
|
||||
ns2.wsvc.info
|
||||
|
||||
32 /年
|
||||
|
||||
323-600-314
|
||||
|
||||
**CKVM1**
|
||||
[us1.wsvc.info](http://us1.wsvc.info/)
|
||||
|
||||
$32.19 USD
|
||||
Annually
|
||||
|
||||
Sunday, February 4th, 2024
|
||||
|
||||
Active
|
||||
|
||||
**CKVM2**
|
||||
[us2.wsvc.info](http://us2.wsvc.info/)
|
||||
|
||||
$76.99 USD
|
||||
Annually
|
||||
|
||||
Saturday, December 16th, 2023
|
||||
|
||||
Active
|
||||
|
||||
**CKVM2**
|
||||
[us4.wsvc.info](http://us4.wsvc.info/)
|
||||
|
||||
$47.59 USD
|
||||
Annually
|
||||
|
||||
Tuesday, November 21st, 2023
|
||||
|
||||
|
||||
|
||||
[https://10g.biz/](https://10g.biz/)
|
||||
|
||||
https://www.rhinotech.cc
|
||||
|
||||
hk2.chans.xyz
|
||||
|
||||
remark.windy.me
|
||||
|
||||
$43.92 USD/year
|
||||
|
||||
reinstall:
|
||||
code: M26JrovIHtgp
|
||||
|
||||
|
||||
https://clients.zgovps.com/index.php?/clientarea/services/special-offer/10527/
|
||||
|
||||
Domain [matrix.chans.xyz](http://matrix.chans.xyz)
|
||||
|
||||
Registration Date 2024-12-24
|
||||
|
||||
Expiry Date 2025-12-24
|
||||
|
||||
---
|
||||
|
||||
First Payment Amount $52.00 USD
|
||||
|
||||
|
||||
|
||||
|
||||
https://app.dartnode.com/
|
||||
|
||||
38.134.41.134
|
||||
|
||||
|
||||
|
||||
|
||||
https://new.contabo.com
|
||||
$4.95
|
||||
194.163.160.244
|
||||
2a02:c207:2284:8258:0000:0000:0000:0001/64
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user