Skip to content

Commit 8c2470d

Browse files
committed
fix: Update installation scripts and docs for inventory path
- Create /var/lib/systemmanager directory in install scripts - Add /var/lib/systemmanager to ReadWritePaths in systemd service - Update all documentation to use correct inventory path - Add ProtectHome=yes to systemd service for consistency - Update README.md, docs/inventory.md, INVENTORY_IMPLEMENTATION.md - Fixes deployment issue where inventory couldn't be saved This ensures the inventory feature works correctly on fresh installations.
1 parent 225418c commit 8c2470d

File tree

5 files changed

+35
-11
lines changed

5 files changed

+35
-11
lines changed

INVENTORY_IMPLEMENTATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ Knows what needs to be moved and where data is stored.
263263

264264
### Inventory Storage
265265

266-
**File:** `/opt/systemmanager/inventory.json`
266+
**File:** `/var/lib/systemmanager/inventory.json`
267267

268268
**Format:**
269269
```json
@@ -368,7 +368,7 @@ print(response.json())
368368
EOF
369369

370370
# 4. View inventory file
371-
ssh root@dev1.tailf9480.ts.net "cat /opt/systemmanager/inventory.json"
371+
ssh root@dev1.tailf9480.ts.net "cat /var/lib/systemmanager/inventory.json"
372372
```
373373

374374
---

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ When managing multiple LXC containers with a single AI:
360360
1. Each system gets a unique identifier: `hostname-containerID` (e.g., `dev1-103`)
361361
2. The inventory tracks what's running on each system
362362
3. AI provides context-aware suggestions based on what you have installed
363-
4. Inventory stored in `/opt/systemmanager/inventory.json` per system
363+
4. Inventory stored in `/var/lib/systemmanager/inventory.json` per system
364364

365365
### Benefits
366366

ct/install.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,30 @@ fi
146146
chmod 600 $INSTALL_DIR/.env
147147
msg_ok "Configured Authentication ($AUTH_MODE)"
148148

149+
msg_info "Creating Inventory Directory"
150+
mkdir -p /var/lib/systemmanager
151+
chown root:root /var/lib/systemmanager
152+
chmod 755 /var/lib/systemmanager
153+
msg_ok "Created Inventory Directory"
154+
149155
msg_info "Creating Systemd Service"
150156
cat > /etc/systemd/system/systemmanager-mcp.service << EOF
151157
[Unit]
152-
Description=SystemManager MCP Server
158+
Description=SystemManager MCP Server with OAuth/OIDC
159+
Documentation=https://github.com/mdlmarkham/SystemManager
153160
After=network-online.target docker.service
154161
Wants=network-online.target
155162
156163
[Service]
157164
Type=simple
158165
User=root
166+
Group=root
159167
WorkingDirectory=$INSTALL_DIR
160168
Environment="PATH=$INSTALL_DIR/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
169+
170+
# Load secrets from protected environment file
161171
EnvironmentFile=$INSTALL_DIR/.env
172+
162173
ExecStart=$INSTALL_DIR/venv/bin/python -m src.mcp_server
163174
Restart=on-failure
164175
RestartSec=10
@@ -168,7 +179,8 @@ StandardError=journal
168179
# Security hardening
169180
PrivateTmp=yes
170181
ProtectSystem=strict
171-
ReadWritePaths=$INSTALL_DIR
182+
ProtectHome=yes
183+
ReadWritePaths=$INSTALL_DIR /var/lib/systemmanager
172184
NoNewPrivileges=true
173185
174186
[Install]

docs/inventory.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ add_application_to_inventory(
190190

191191
## Inventory File Format
192192

193-
The inventory is stored as JSON at `/opt/systemmanager/inventory.json`:
193+
The inventory is stored as JSON at `/var/lib/systemmanager/inventory.json`:
194194

195195
```json
196196
{
@@ -275,7 +275,7 @@ Get complete inventory (system identity + applications + stacks).
275275
},
276276
"applications": {...},
277277
"stacks": {...},
278-
"inventory_path": "/opt/systemmanager/inventory.json"
278+
"inventory_path": "/var/lib/systemmanager/inventory.json"
279279
}
280280
```
281281

@@ -458,12 +458,12 @@ add_application_to_inventory(name="app-name", version="correct-version", ...)
458458

459459
### Multiple Systems Using Same Inventory File
460460

461-
Each SystemManager instance should have its own inventory file. By default, it's stored at `/opt/systemmanager/inventory.json` on each LXC container.
461+
Each SystemManager instance should have its own inventory file. By default, it's stored at `/var/lib/systemmanager/inventory.json` on each LXC container.
462462

463463
If running multiple instances on the same host (not recommended), set different paths:
464464

465465
```bash
466-
export SYSTEMMANAGER_INVENTORY="/opt/systemmanager/inventory-dev1.json"
466+
export SYSTEMMANAGER_INVENTORY="/var/lib/systemmanager/inventory-dev1.json"
467467
```
468468

469469
## Future Enhancements

install.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,30 @@ fi
146146
chmod 600 $INSTALL_DIR/.env
147147
msg_ok "Configured Authentication ($AUTH_MODE)"
148148

149+
msg_info "Creating Inventory Directory"
150+
mkdir -p /var/lib/systemmanager
151+
chown root:root /var/lib/systemmanager
152+
chmod 755 /var/lib/systemmanager
153+
msg_ok "Created Inventory Directory"
154+
149155
msg_info "Creating Systemd Service"
150156
cat > /etc/systemd/system/systemmanager-mcp.service << EOF
151157
[Unit]
152-
Description=SystemManager MCP Server
158+
Description=SystemManager MCP Server with OAuth/OIDC
159+
Documentation=https://github.com/mdlmarkham/SystemManager
153160
After=network-online.target docker.service
154161
Wants=network-online.target
155162
156163
[Service]
157164
Type=simple
158165
User=root
166+
Group=root
159167
WorkingDirectory=$INSTALL_DIR
160168
Environment="PATH=$INSTALL_DIR/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
169+
170+
# Load secrets from protected environment file
161171
EnvironmentFile=$INSTALL_DIR/.env
172+
162173
ExecStart=$INSTALL_DIR/venv/bin/python -m src.mcp_server
163174
Restart=on-failure
164175
RestartSec=10
@@ -168,7 +179,8 @@ StandardError=journal
168179
# Security hardening
169180
PrivateTmp=yes
170181
ProtectSystem=strict
171-
ReadWritePaths=$INSTALL_DIR
182+
ProtectHome=yes
183+
ReadWritePaths=$INSTALL_DIR /var/lib/systemmanager
172184
NoNewPrivileges=true
173185
174186
[Install]

0 commit comments

Comments
 (0)