MoltWorld Dashboard Deploy
Standardize this workflow to make moltworld-dashboard easy to run and operate safely.
Runtime requirements
Required binaries:
- - npm
- docker
- docker-compose
Optional (privileged persistence path only):
Safety gates (mandatory)
- 1. Treat project dependencies as untrusted until reviewed.
- Before package install, inspect
package.json and lockfile for suspicious scripts/deps. - Ask for explicit approval before any privileged/persistent action (
sudo, systemctl enable, writing under /etc/systemd/system). - Prefer non-privileged runtime paths first (local run or Docker Compose without host-level service install).
- Never use
curl | bash or equivalent remote script execution.
Workflow
- 1. Verify baseline project files exist (
server.mjs, public/). - Add/shareability files if missing:
-
package.json (start script)
-
.env.example
-
.nvmrc
-
.gitignore
-
README.md
- 3. Add deployment files if requested:
-
Dockerfile
-
docker-compose.yml
-
moltworld-dashboard.service (systemd, only with explicit approval)
- 4. Validate startup and confirm HTTP 200 on
http://localhost:8787/. - Validate restart behavior and long-running stability.
- Confirm accessibility via localhost or host IP.
- Document runbook steps for operators.
Required file conventions
- - Keep runtime state out of git (
data/state.json, logs, pids). - Keep secrets out of git (
.env). - Default runtime port:
8787. - README must include:
- local quick start
- Docker run
- Docker Compose run
- systemd install/enable instructions marked as privileged/optional
Runtime stability checks
Use these checks when service becomes unreachable:
CODEBLOCK0
If process is down, restart with a supervisor (Docker Compose or approved systemd service) instead of ad-hoc foreground runs.
Troubleshooting quick checks
- - Service down: verify listener on
:8787. - Loop timeouts: increase API timeout and add retries in
postJson. - Process died after exec session: restart with supervisor.
References
- - Deployment/runbook command snippets: INLINECODE22
MoltWorld Dashboard 部署
标准化此工作流程,使 moltworld-dashboard 易于运行且安全操作。
运行时要求
必需二进制文件:
- - npm
- docker
- docker-compose
可选(仅限特权持久化路径):
安全门控(强制要求)
- 1. 在审查之前,将项目依赖视为不可信。
- 在安装包之前,检查 package.json 和锁文件中是否存在可疑的脚本/依赖。
- 在执行任何特权/持久化操作(sudo、systemctl enable、写入 /etc/systemd/system)前,需获得明确批准。
- 优先使用非特权运行时路径(本地运行或无需主机级服务安装的 Docker Compose)。
- 切勿使用 curl | bash 或等效的远程脚本执行方式。
工作流程
- 1. 验证基础项目文件是否存在(server.mjs、public/)。
- 如果缺少以下文件,则添加/共享文件:
- package.json(启动脚本)
- .env.example
- .nvmrc
- .gitignore
- README.md
- 3. 如有要求,添加部署文件:
- Dockerfile
- docker-compose.yml
- moltworld-dashboard.service(systemd,仅需明确批准)
- 4. 验证启动,并确认 http://localhost:8787/ 返回 HTTP 200。
- 验证重启行为及长期运行稳定性。
- 确认可通过 localhost 或主机 IP 访问。
- 为运维人员记录操作手册步骤。
必需文件约定
- - 将运行时状态排除在 git 之外(data/state.json、日志、PID)。
- 将密钥排除在 git 之外(.env)。
- 默认运行时端口:8787。
- README 必须包含:
- 本地快速启动
- Docker 运行
- Docker Compose 运行
- systemd 安装/启用说明(标记为特权/可选)
运行时稳定性检查
当服务不可达时,使用以下检查:
bash
ss -ltnp | grep :8787 || true
curl -I --max-time 5 http://localhost:8787/
如果进程已关闭,使用监督程序(Docker Compose 或已批准的 systemd 服务)重启,而非临时前台运行。
故障快速排查
- - 服务关闭:验证监听 :8787。
- 循环超时:增加 API 超时时间,并在 postJson 中添加重试机制。
- 执行会话后进程终止:使用监督程序重启。
参考
- - 部署/操作手册命令片段:references/commands.md