The app as a systemd user service, reloaded by a VS Code task
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8fa555f43b
commit
0a862758fb
3 files changed
+32
No files matched your search
Vendored
+7
@@ -8,6 +8,13 @@
|
|||||||
"command": "{ [ -d .venv ] || { python3 -m venv .venv && .venv/bin/pip install -q -r app/requirements.txt; }; } && (cd app/web && { [ -d node_modules ] || npm install; } && npm run build) && .venv/bin/python app/server/server.py",
|
"command": "{ [ -d .venv ] || { python3 -m venv .venv && .venv/bin/pip install -q -r app/requirements.txt; }; } && (cd app/web && { [ -d node_modules ] || npm install; } && npm run build) && .venv/bin/python app/server/server.py",
|
||||||
"isBackground": true,
|
"isBackground": true,
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Reload the service",
|
||||||
|
"detail": "After a change of the code: rebuilds the page and relaunches the systemd service aimsight-app on http://127.0.0.1:8770 (README.md, Run as a service)",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "systemctl --user restart aimsight-app && systemctl --user is-active aimsight-app && echo http://127.0.0.1:8770 || { journalctl --user -u aimsight-app -n 30 --no-pager; exit 1; }",
|
||||||
|
"problemMatcher": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -44,6 +44,16 @@ cd app/web && npm install && npm run build && cd ../..
|
|||||||
|
|
||||||
The page opens on `http://127.0.0.1:8770`. `claude` (Claude Code, logged in to the subscription) must be on the `PATH` for the Analysis tab.
|
The page opens on `http://127.0.0.1:8770`. `claude` (Claude Code, logged in to the subscription) must be on the `PATH` for the Analysis tab.
|
||||||
|
|
||||||
|
### Run as a service
|
||||||
|
|
||||||
|
Without VS Code, the app runs as a systemd user service of WSL (`app/aimsight-app.service`, with `systemd=true` in `/etc/wsl.conf`), started with WSL; the page stays on `http://127.0.0.1:8770`. Once:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl --user enable --now ~/aimsight-app/app/aimsight-app.service
|
||||||
|
```
|
||||||
|
|
||||||
|
After a change of the code, a restart rebuilds the page and relaunches the server: `systemctl --user restart aimsight-app`. The log: `journalctl --user -u aimsight-app -f`. Stop it before launching the VS Code task **Run app** (same port).
|
||||||
|
|
||||||
## Pump the data
|
## Pump the data
|
||||||
|
|
||||||
The pumping is in the `~/aimsight-data` repository (`extraction/`, VS Code tasks **pump** and **pump a range**); user guide `~/aimsight-data/extraction/README.md`.
|
The pumping is in the `~/aimsight-data` repository (`extraction/`, VS Code tasks **pump** and **pump a range**); user guide `~/aimsight-data/extraction/README.md`.
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# The app as a systemd user service (WSL), without VS Code: README.md, "Run as a service".
|
||||||
|
[Unit]
|
||||||
|
Description=AIMsight diagnostic app (http://127.0.0.1:8770)
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory=%h/aimsight-app
|
||||||
|
# claude (Claude Code, subscription) is in ~/.local/bin, which a service does not get from the shell
|
||||||
|
Environment=PATH=%h/.local/bin:/usr/local/bin:/usr/bin:/bin
|
||||||
|
# a restart rebuilds the page, so a change of the code needs only: systemctl --user restart aimsight-app
|
||||||
|
ExecStartPre=/bin/sh -c 'cd app/web && npm run build'
|
||||||
|
ExecStart=%h/aimsight-app/.venv/bin/python app/server/server.py --no-browser
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
Reference in new issue
Block a user