feat: Optimize the OpenResty module compilation logic.#13355
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors 1Panel’s OpenResty dynamic-module management and build/upgrade flow, and updates the UI to match the simplified module model (custom vs built-in, dynamic vs static).
Changes:
- Refactors the agent’s OpenResty module state model (separating catalog from persisted state) and tightens built-in module immutability.
- Updates upgrade/build flows to stage/activate module catalogs and capture OpenResty install snapshots for rollback safety.
- Updates the frontend module UI (adds “View”, removes compatibility/dynamicSupport concepts, adjusts table sizing) and cleans up related i18n/doc tooling.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/openresty-modules/test-builder.sh | Removes the builder integration test script. |
| scripts/openresty-modules/README.md | Updates documentation to focus on installed-instance diagnostics. |
| frontend/src/views/website/website/nginx/module/operate/index.vue | Adds view-only mode and aligns form behavior with new module model. |
| frontend/src/views/website/website/nginx/module/index.vue | Adjusts module list operations (view/edit/delete visibility) and removes compatibility UI. |
| frontend/src/lang/modules/zh.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/zh-Hant.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/tr.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/ru.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/pt-br.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/ms.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/lo.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/ko.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/ja.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/fa.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/es-es.ts | Removes compatibility-related translation keys. |
| frontend/src/lang/modules/en.ts | Removes compatibility-related translation keys. |
| frontend/src/components/table/TableOperations.vue | Adds support for width="auto" with min-width handling. |
| frontend/src/api/interface/nginx.ts | Updates Nginx module interface (adds custom, removes auto, compatibility, dynamicSupport). |
| agent/app/service/nginx.go | Updates module reporting and centralizes module update logic. |
| agent/app/service/nginx_module.go | Major refactor: new module state file format, catalog staging/activation, static/dynamic build tracking changes. |
| agent/app/service/nginx_module_test.go | Updates/expands tests for new state/catelog behavior and upgrade helpers. |
| agent/app/service/app_utils.go | Refactors OpenResty upgrade flow to stage/activate catalog and improve rollback behavior. |
| agent/app/dto/response/nginx.go | Updates API response shape for modules (adds custom, removes compatibility/dynamicSupport). |
| agent/app/dto/request/nginx.go | Tightens buildMode validation to `dynamic |
| agent/app/dto/nginx.go | Updates stored DTO model (adds custom, removes deleted and dynamicSupport, adds buildMode to builds). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| runtimeTarget := target | ||
| runtimeTarget.BuilderDigest = "" | ||
| setNginxModuleTargetKey(&runtimeTarget) | ||
| runtimeTargetErr := targetErr | ||
| if runtimeTarget.OpenRestyVersion != "" { | ||
| runtimeTargetErr = nil | ||
| } |
| if !state.Custom { | ||
| return nil, fmt.Errorf("OpenResty module state %s is missing from the module catalog", state.Name) | ||
| } | ||
| modules = append(modules, dto.NginxModule{ | ||
| Name: state.Name, Custom: true, Script: state.Script, Packages: state.Packages, Params: state.Params, | ||
| Enable: state.Enable, BuildMode: state.BuildMode, Provider: state.Provider, LoadOrder: state.LoadOrder, | ||
| Builds: state.Builds, LastError: state.LastError, | ||
| }) |
3f06a01 to
82afa74
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c95becfeb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if !state.Custom { | ||
| return nil, fmt.Errorf("OpenResty module state %s is missing from the module catalog", state.Name) | ||
| } |
There was a problem hiding this comment.
Handle legacy custom module state entries
When a user already has a custom OpenResty module created before this schema split, its build/module.json entry will not contain custom: true because that field did not exist and the old code persisted dto.NginxModule directly. If the custom module name is not in the new catalog, this branch now rejects it as a missing catalog entry, causing loadNginxModules callers such as the module page, module updates, builds, and OpenResty upgrade preparation to fail for those installations. Please migrate legacy orphan entries to custom modules (or infer custom from the legacy definition fields) before enforcing this catalog-orphan error.
Useful? React with 👍 / 👎.
No description provided.