docs: keep Docker setup simple and cross-platform (#129)

Co-authored-by: dadachann <[email protected]>
This commit is contained in:
Hyu
2026-09-08 02:43:10 +08:00
committed by GitHub
co-authored by dadachann
parent e55f402c70
commit a86ecb4e97
4 changed files with 72 additions and 136 deletions
+17 -15
View File
@@ -1,4 +1,4 @@
"""Keep the beginner Docker guide ordered and actionable in every locale."""
"""Keep the beginner Docker guide portable, short, and ordered."""
import re
import unittest
from pathlib import Path
@@ -13,31 +13,33 @@ class DockerDeploymentFlowTests(unittest.TestCase):
text = (ROOT / locale / "deploy/langbot/docker.mdx").read_text()
headings = re.findall(r"^## (\d+)\. .+$", text, re.MULTILINE)
self.assertEqual(headings, ["1", "2", "3", "4"])
download = "cd /opt\ngit clone https://github.com/langbot-app/LangBot\ncd LangBot/docker"
download = "git clone https://github.com/langbot-app/LangBot\ncd LangBot/docker"
start = "docker compose --profile all up -d"
mirror = "docker.langbot.app/langbot-public/rockchin/langbot:latest"
self.assertIn(download, text)
self.assertNotIn("&&", text)
self.assertEqual(text.count(start), 1)
self.assertLess(text.index(download), text.index(mirror))
self.assertLess(text.index(mirror), text.index(start))
self.assertLess(text.index(start), text.index("http://127.0.0.1:5300"))
self.assertIn("`/root`", text)
self.assertLess(text.index(start), text.index("http://localhost:5300"))
self.assertLess(text.index("`/root`"), text.index(download))
self.assertIn("`/etc`", text)
self.assertNotIn("seekdb", text.lower())
self.assertNotIn("LANGBOT_BOX_ROOT", text)
for removed in ("seekdb", "langbot_box_root", "openssl", "control_token", "<accordion"):
self.assertNotIn(removed, text.lower())
def test_optional_security_precedes_start_without_extra_start_commands(self):
def test_common_commands_are_editable_and_not_linux_only(self):
for locale in ("zh", "en", "ja"):
with self.subTest(locale=locale):
text = (ROOT / locale / "deploy/langbot/docker.mdx").read_text()
accordion = re.search(r"<Accordion\b[^>]*>(.*?)</Accordion>", text, re.DOTALL)
assert accordion is not None, f"{locale}: missing optional security section"
content = accordion.group(1)
for value in (".env", "openssl rand -hex 32", "LANGBOT_PLUGIN_RUNTIME_CONTROL_TOKEN", "LANGBOT_BOX_CONTROL_TOKEN"):
self.assertIn(value, content)
self.assertNotIn("docker compose", content)
self.assertLess(accordion.end(), text.index("docker compose --profile all up -d"))
for platform in ("Windows", "macOS", "Linux", "PowerShell", "Docker Desktop"):
self.assertIn(platform, text)
commands = re.findall(r"```bash\n(.*?)\n```", text, re.DOTALL)
self.assertEqual(commands, [
"git clone https://github.com/langbot-app/LangBot\ncd LangBot/docker",
"docker compose --profile all up -d",
])
for nonportable in ("&&", "cd /opt", "export ", "sudo "):
self.assertNotIn(nonportable, "\n".join(commands))
self.assertLess(text.index("<Note>"), text.index("docker compose --profile all up -d"))
for target in ("usage/models/readme", "usage/platforms/readme"):
self.assertIn(f"/{locale}/{target}", text)