netalertx-idempotent-setup
GitHub重置 devcontainer 运行时环境,强制重启服务、重建 tmpfs 和日志,保留持久化数据。用于环境损坏、脚本修改后或需要重置状态时执行。
Trigger Scenarios
Install
npx skills add netalertx/NetAlertX --skill netalertx-idempotent-setup -g -y
SKILL.md
Frontmatter
{
"name": "netalertx-idempotent-setup",
"description": "Reprovision and reset the devcontainer environment. Use this when asked to re-run startup, reprovision, setup devcontainer, fix permissions, or reset runtime state."
}
Devcontainer Setup
The setup script forcefully resets all runtime state (services, tmpfs ramdisks, symlinks, log files) unconditionally on every run. Persistent DB/config content under /data is the one exception - it's preserved by default; see step 7 below.
Command
/workspaces/NetAlertX/.devcontainer/scripts/setup.sh
What It Does
- Kills all services (php-fpm, nginx, crond, python3)
- Mounts tmpfs ramdisks for
/tmp/log,/tmp/api,/tmp/run,/tmp/nginx - Creates critical subdirectories
- Links
/entrypoint.dand/appsymlinks - Creates
/data,/data/config,/data/dbdirectories - Creates all log files
- Runs
/entrypoint.shto start services - by default this preserves existing DB/config content;entrypoint.d/25-first-run-db.shand20-first-run-config.shonly wipe them whenALWAYS_FRESH_INSTALL=trueis set in the environment - Writes version to
.VERSION
When to Use
- After modifying setup scripts
- After container rebuild
- When environment is in broken state
- To pick up a database/config reset done another way (setup.sh itself won't reset them - see step 7)
Philosophy
Runtime state (services, tmpfs, symlinks, logs) has no conditional logic - everything is recreated unconditionally, every run. DB/config are the one deliberate exception, gated behind ALWAYS_FRESH_INSTALL. If something in runtime state doesn't work, run setup again.
Version History
-
a686a01
Current 2026-09-03 06:47
增强环境设置的健壮性与脚手架功能;明确运行时状态无条件重置及持久化数据保留逻辑。
- 8aec57b 2026-07-24 22:14


