Skip to content

feat: Optimize the OpenResty module compilation logic.#13355

Merged
wanghe-fit2cloud merged 2 commits into
dev-v2from
pr@dev-v2@feature
Jul 23, 2026
Merged

feat: Optimize the OpenResty module compilation logic.#13355
wanghe-fit2cloud merged 2 commits into
dev-v2from
pr@dev-v2@feature

Conversation

@zhengkunwang223

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 23, 2026 08:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +216 to +222
runtimeTarget := target
runtimeTarget.BuilderDigest = ""
setNginxModuleTargetKey(&runtimeTarget)
runtimeTargetErr := targetErr
if runtimeTarget.OpenRestyVersion != "" {
runtimeTargetErr = nil
}
Comment on lines +879 to +886
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,
})
@wanghe-fit2cloud
wanghe-fit2cloud merged commit 7c95bec into dev-v2 Jul 23, 2026
4 checks passed
@wanghe-fit2cloud
wanghe-fit2cloud deleted the pr@dev-v2@feature branch July 23, 2026 08:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +879 to +881
if !state.Custom {
return nil, fmt.Errorf("OpenResty module state %s is missing from the module catalog", state.Name)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

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.

3 participants