Files
MemRelay/projects/d1932ed6-07d3-4463-a224-8534ffd69a07/curated/NextOffice – Decisions.md
T

103 lines
4.4 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: NextOffice – Decisions
type: curated
permalink: main/projects/d1932ed6-07d3-4463-a224-8534ffd69a07/curated/next-office-decisions
stable_id: 0e9212b9-cfcf-4ba6-8022-5e0a30440b78
scope: project
project_id: d1932ed6-07d3-4463-a224-8534ffd69a07
workspace_type: development
usage_profile_id: null
preference_context: development
document_type: decisions
revision: 1
source_memory_ids:
- 1588ca3e-58fe-48b9-ad34-3e660324d24e
- e01606b2-f7b3-43e4-9510-8f81a0f68b4e
source_checkpoint_ids:
- d21e13e3-c1d0-47c2-85d6-13700478a0de
source_file_ids: []
source_git_commit: null
source_git_commits: []
source_agent_sync_ids: []
model_connection: Sub2API
model_name: git-restore
source_count: 25
source_revisions:
memory:34447199-6c5e-437d-a1a1-8ba9fbf916ad: '1'
memory:b5e9162b-d6c3-4593-9b7c-790af4145192: '1'
memory:98857cff-874e-476a-97c3-9c9c0c09b077: '1'
memory:df7b18f9-490f-415f-a388-2332d1b7df87: '1'
memory:e01606b2-f7b3-43e4-9510-8f81a0f68b4e: '2'
memory:39ed36d1-e58a-4b64-88e6-165e006c0a41: '1'
memory:b3034d8a-1155-4165-a8c5-cec0d9e27e18: '1'
memory:f42fc721-886f-4d6d-85a4-1611d7bc2cf1: '1'
memory:68deebdd-e5d1-4bc6-8e70-e4342e72f986: '1'
memory:d21e13e3-c1d0-47c2-85d6-13700478a0de: '1'
source_dispositions:
processed: 25
unchanged: 0
unsupported: 0
skipped: 0
cited_source_ids:
- curated_baseline:0e9212b9-cfcf-4ba6-8022-5e0a30440b78
- memory:d21e13e3-c1d0-47c2-85d6-13700478a0de
- memory:b5e9162b-d6c3-4593-9b7c-790af4145192
- memory:98857cff-874e-476a-97c3-9c9c0c09b077
- memory:df7b18f9-490f-415f-a388-2332d1b7df87
- memory:e01606b2-f7b3-43e4-9510-8f81a0f68b4e
- memory:39ed36d1-e58a-4b64-88e6-165e006c0a41
- memory:b3034d8a-1155-4165-a8c5-cec0d9e27e18
- memory:f42fc721-886f-4d6d-85a4-1611d7bc2cf1
- memory:68deebdd-e5d1-4bc6-8e70-e4342e72f986
- git:.gitignore
- memory:34447199-6c5e-437d-a1a1-8ba9fbf916ad
job_cited_source_ids:
- curated_baseline:0e9212b9-cfcf-4ba6-8022-5e0a30440b78
- memory:d21e13e3-c1d0-47c2-85d6-13700478a0de
conflicts: []
supersedes:
- summary: '`configure_access_urls` 实现取代旧的手动 `occ config:system:set trusted_domains`
方式。'
current_source_ids:
- memory:b3034d8a-1155-4165-a8c5-cec0d9e27e18
superseded_source_ids:
- memory:f42fc721-886f-4d6d-85a4-1611d7bc2cf1
preferences: []
source_cursor: 321
source_hash: 488b570478ddac0dc8856b8a61aa39d07673cd0d786f9d16da5034e83bde2a9d
prompt_version: 2026-08-12.3
schema_version: '3'
curation_job_id: null
created_at: '2026-09-02T04:06:42.326837+00:00'
updated_at: '2026-09-23T15:05:05.304651+00:00'
tags:
- decisions
- NextOffice
- development
restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2
---
# 决策概览
## 1. 主机端口冲突检查实现
- 在 `deploy.py` 中新增 `docker_published_ports()`, `port_holder()`, `choose_port()` 与 `check_configured_ports()`,实现对宿主机已占用 TCP 端口的检测,并在交互模式下自动建议下一个可用端口(上限 200)。
- `manage.py reconfigure` 复用同一套逻辑,实现对 `--nextcloud-port` / `--onlyoffice-port` 的校验与自动提示。
- 实现遵循 **KISS & YAGNI**(`memory:68deebdd-e5d1-4bc6-8e70-e4342e72f986`)。
## 2. `deploy.py` / `manage.py` 对 Python 3.6 的兼容改造
- 移除 `from __future__ import annotations`,改用 `typing` 注解,删除 3.7+ 语法(如 `subprocess.CompletedProcess[str]`、`Path.write_text(newline=…)`、`argparse.add_subparsers(required=True)`)。
- 通过本地 `ast.parse(..., feature_version=(3,6))` 与真实 3.6.8 环境验证,确保脚本在目标服务器上可直接运行。
## 3. `reconfigure` 覆盖 `trusted_domains` 的问题与修复
- **问题**:`manage.py reconfigure` 只写入 `trusted_domains 0`,导致原有正则通配被覆盖,访问受限。
- **修复**:抽出 `configure_access_urls(host, nextcloud_port, onlyoffice_port)`,统一写入 4 条 `trusted_domains`(索引 0‑3),并同步 `overwrite.cli.url` 与 `onlyoffice DocumentServerUrl`。`manage.py reconfigure` 现在调用同一函数并在容器重启后重新执行 `occ`,实现完整重写。
## 4. 待办事项(需用户确认后在目标服务器执行)
1. 实现 `manage.py restore`(文档已提及但脚本缺失)。
2. 离线镜像包导出命令实现。
3. HTTPS 一键切换功能开发。
4. `upgrade` 与 `backup --keep` 选项完善。
5. ONLYOFFICE `DocumentServerUrl` 相对路径方案待用户确认并实现。
---
*本节引用的所有来源已列于 `source_ids`。*