Skip to content

Fix telepresence local dev flow and dependency resolution - #4

Open
phenix3443 wants to merge 11 commits into
perfect-panel:mainfrom
phenix3443:main
Open

phenix3443 wants to merge 11 commits into
perfect-panel:mainfrom
phenix3443:main

Conversation

@phenix3443

@phenix3443 phenix3443 commented Apr 15, 2026

Copy link
Copy Markdown

Summary

  • make telepresence.sh resolve the real k3s ppanel-server dependency config from ppanel-secret instead of assuming hardcoded local MySQL and Redis endpoints
  • port-forward the k3s MySQL and Redis services for the local replacement runtime, validate connectivity before startup, and keep up frontend routed to the k3s backend through same-domain /api requests
  • print clearer startup information, including the active admin account, while separating frontend-vs-server dependency output to match the real dependency graph
  • automatically lower Telepresence traffic-agent resource defaults so intercepts can fit within the ppanel-dev quota, and document the new behavior in both READMEs

Root Cause

The previous script mixed together frontend and backend dependency assumptions, hardcoded MySQL and Redis targets, and inherited frontend API settings that could point at 127.0.0.1:8080 even in up frontend mode. In the tested cluster, default Telepresence traffic-agent CPU limits also exceeded the remaining quota, which blocked intercept creation.

Validation

  • ran bash -n telepresence.sh
  • ran ./telepresence.sh up both --frontend admin
  • verified the script resolved MySQL and Redis from the k3s ppanel-secret and port-forwarded them locally before starting the local server
  • verified the script printed the active admin account from cluster config and kept up frontend semantics aligned with same-domain /api routing to the k3s backend
  • verified telepresence helm upgrade applied reduced traffic-agent resources and that both ppanel-server and ppanel-admin-web reached ACTIVE intercept state afterward

Impact

  • up frontend now behaves like a true frontend-only replacement
  • up server and up both now reuse the actual k3s dependencies by default instead of requiring separately prepared local database endpoints
  • Telepresence-based local development is more reliable in the constrained ppanel-dev environment

@phenix3443
phenix3443 marked this pull request as ready for review April 15, 2026 07:44
@phenix3443 phenix3443 changed the title [codex] sync fork main with telepresence script updates Fix telepresence local intercept workflow for frontend and server Apr 16, 2026
@phenix3443 phenix3443 changed the title Fix telepresence local intercept workflow for frontend and server Fix telepresence local dev flow and dependency resolution Apr 17, 2026
* docs: update branch strategy

* ignore local agent instruction files
telepresence.sh 写死了 k3s 上的 ppanel-dev 命名空间。那个命名空间已经随
development overlay 一起删除,脚本现在指向不存在的东西,是坏的。

环境模型收敛成 develop / test / production 三个:develop 落在开发机的
compose.yaml 上,全部走 localhost、无域名、镜像只拉不推、数据库独立;
test 在 k3s 的 ppanel 命名空间,由 womenlia/ppanel-deploy 管。
本地前端接管 k3s 流量这种跨环境调试不再保留。

- 删 telepresence.sh(我们自己加的,上游没有)
- 两份 README 的 Telepresence 小节换成 develop 环境说明

只推 origin。upstream 从来没有过这个文件,不涉及上游。
chore: 废弃 telepresence 联调,develop 环境改用 compose
* feat(compose): develop 栈切 PostgreSQL,和 test 对齐

上游的 pg 支持是靠方言分支实现的(db.Dialector.Name() 散布在各 repo),
本机跑 MySQL 就复现不了 test 上的方言问题——而那正是本机栈存在的意义。

- ppanel-db 换成 postgres:17.11-alpine(和 test 同版本),端口 5432
- config/ppanel.yaml 的 MySQL: 换成 Database:,Driver/Config 照抄 test 上
  已经跑通的那份。上游把 MySQL: 标为 Deprecated,仍能读但走兼容路径
- README 两版都标注:./db 里是 MySQL 数据目录,Postgres 拒绝往非空目录
  初始化,升上来要先删掉

* feat(compose): 从本地源码构建,修好前端端口映射

接着切 Postgres 那个提交,把 develop 配成真正能开发的环境。

- 三个服务都改成 build 相邻仓库的源码(PPANEL_SERVER_PATH /
  PPANEL_FRONTEND_PATH 可覆盖),不再拉上游 ppanel/*:latest——那些镜像里
  没有我们 fork 的任何东西,拿它开发等于没跑
- 前端端口 3000 → 80:从 Next.js 迁到 Vite + nginx 之后容器里监听的是 80,
  这两行一直没跟着改。表现是容器 Up 着但端口不通,日志里没有任何错误
- 删掉 NEXT_PUBLIC_API_URL:Next 时代的遗留,Vite 是构建期内联 VITE_*,
  运行时设它没有任何作用

实测(docker 已启动):整栈起来,迁移跑完、管理员建好、8080 监听,
三个入口 200,登录拿到 token,fork 独有的 /v1/admin/server/node/versions
返回 200 且带 min_self_manageable——证明跑的是我们的代码不是上游。
CORS 放行 localhost:3001,preflight 204。

* chore: 把误提交的 Postgres 数据目录移出版本控制

上一个提交里混进了 db/——docker compose up 生成的 Postgres 数据目录,
1940 个文件,还包含库里的真实数据。.gitignore 里没有它,一个 git add -A
就全带进去了。

同时补上 db/ 和 cache/ 两条忽略规则,避免再次发生。

(本分支是 squash 合并,这些文件不会进入 main 的历史。)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant