vibed-infra 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,7 +19,7 @@ git add dist && git commit && git push
19
19
 
20
20
  ## Operator flow (VPS)
21
21
 
22
- Non-root agent prep (SSH, Docker group, uid 1000 data dirs): [`skills/agent-vps-prep/SKILL.md`](skills/agent-vps-prep/SKILL.md).
22
+ Non-root agent prep (SSH, Docker group, one-time uid-1000 operator or ~/services ACL): [`skills/agent-vps-prep/SKILL.md`](skills/agent-vps-prep/SKILL.md).
23
23
 
24
24
  ```bash
25
25
  # 1) DNS — paste dist/DNS-SKILL.md into AU browser agent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibed-infra",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Product-agnostic VPS packager: wget install, Docker Compose, TLS/nginx, auto-update",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -2,7 +2,7 @@
2
2
  name: agent-vps-prep
3
3
  description: >-
4
4
  Prepare a fresh VPS for vibed-infra installs run by an automation agent
5
- (cloud_agent): SSH key, sudoers, Docker group, data-dir ownership, firewall.
5
+ (cloud_agent): SSH key, sudoers, Docker group, one-time uid-1000/ACL ownership, firewall.
6
6
  ---
7
7
 
8
8
  # Prepare a VPS for vibed-infra (agent operator)
@@ -14,10 +14,17 @@ Non-root user (e.g. `cloud_agent`) that will run `wget …/dist/install-*.sh | b
14
14
 
15
15
  ## 1. Create the operator user
16
16
 
17
- (as root)
17
+ **Preferred (configure once):** create the operator as **uid/gid 1000** so bind mounts match typical `USER node` images — no chown, no ACL, no per-app commands forever.
18
+
19
+ (as root — only if uid/gid 1000 are free: `getent passwd 1000`; `getent group 1000`)
18
20
 
19
21
  ```bash
20
- adduser --disabled-password --gecos "" cloud_agent
22
+ adduser --disabled-password --gecos "" --uid 1000 cloud_agent
23
+ # if group 1000 already named "node", either:
24
+ # adduser --uid 1000 --gid 1000 ...
25
+ # or rename/reuse that group carefully
26
+ groupmod -n cloud_agent node 2>/dev/null || true # only if appropriate on that host
27
+
21
28
  mkdir -p /home/cloud_agent/.ssh
22
29
  chmod 700 /home/cloud_agent/.ssh
23
30
  # paste agent public key:
@@ -26,6 +33,11 @@ chmod 600 /home/cloud_agent/.ssh/authorized_keys
26
33
  chown -R cloud_agent:cloud_agent /home/cloud_agent/.ssh
27
34
  ```
28
35
 
36
+ If `adduser --uid 1000` fails because 1000 is taken by a `node` user from a package:
37
+
38
+ - **Option A:** use that existing uid-1000 user as the agent (add docker group + SSH key to it)
39
+ - **Option B:** create `cloud_agent` with a different uid and use the **ACL fallback** in §5
40
+
29
41
  ## 2. SSH from the agent machine
30
42
 
31
43
  Generate a key if needed, then connect with `StrictHostKeyChecking=accept-new`:
@@ -55,38 +67,41 @@ sudo chown -R cloud_agent:cloud_agent /home/cloud_agent
55
67
 
56
68
  vibed-infra defaults: `~/services/gateway`, `~/services/vibed-infra`, product dirs under `~/services/<app>/`.
57
69
 
58
- ## 5. Container data directory ownership (uid 1000)
70
+ ## 5. Bind-mount ownership (uid 1000) — configure once
59
71
 
60
- Product images often run as `node` (uid/gid **1000**). Bind-mounted `./data` and `./logs` created by `cloud_agent` (e.g. uid 1001) cause `SQLITE_CANTOPEN` / `EACCES`.
72
+ Product images often run as `node` (uid/gid **1000**). If the operator creates `./data` / `./logs` as a *different* uid, containers hit `SQLITE_CANTOPEN` / `EACCES`. Fix this **once on the host**, not after every product install.
61
73
 
62
- **One-shot after first install (or before first start), as root/sudo:**
74
+ ### Preferred: operator is already uid 1000
63
75
 
64
- ```bash
65
- # Trustless Commerce / typical vibed apps — adjust paths to your INSTALL_DIRs
66
- sudo chown -R 1000:1000 \
67
- /home/cloud_agent/services/*/api/data \
68
- /home/cloud_agent/services/*/api/persist-logs \
69
- /home/cloud_agent/services/*/nodes/logs
70
- ```
76
+ If §1 created `cloud_agent` as uid/gid 1000, new trees under `~/services` are already writable by the container user. Nothing else to do.
77
+
78
+ ### Fallback (configure once on `~/services`): default ACL
71
79
 
72
- Or per product:
80
+ When the operator is **not** uid 1000, grant uid 1000 rwx on every new file under services regardless of who creates it. Requires the `acl` package.
73
81
 
74
82
  ```bash
75
- sudo chown -R 1000:1000 ~/services/tctest/api/data ~/services/tctest/api/persist-logs
76
- sudo chown -R 1000:1000 ~/services/tcmain/api/data ~/services/tcmain/api/persist-logs
77
- sudo chown -R 1000:1000 ~/services/tctest/nodes/logs ~/services/tcmain/nodes/logs
83
+ # as root, once after creating cloud_agent (any uid)
84
+ apt-get install -y acl
85
+ install -d -o cloud_agent -g cloud_agent /home/cloud_agent/services
86
+ setfacl -m u:1000:rwx /home/cloud_agent/services
87
+ setfacl -d -m u:1000:rwx /home/cloud_agent/services
88
+ # also grant the operator full access via ACL defaults
89
+ setfacl -m u:cloud_agent:rwx /home/cloud_agent/services
90
+ setfacl -d -m u:cloud_agent:rwx /home/cloud_agent/services
78
91
  ```
79
92
 
80
- Optional: allow passwordless chown for the agent (tight sudoers):
93
+ ### Recovery only
94
+
95
+ If someone already created wrong-owned dirs **before** uid-1000 or ACL setup:
81
96
 
82
97
  ```bash
83
- # /etc/sudoers.d/cloud_agent-chown
84
- cloud_agent ALL=(root) NOPASSWD: /usr/bin/chown -R 1000\:1000 /home/cloud_agent/services/*
98
+ sudo chown -R 1000:1000 \
99
+ /home/cloud_agent/services/*/api/data \
100
+ /home/cloud_agent/services/*/api/persist-logs \
101
+ /home/cloud_agent/services/*/nodes/logs
85
102
  ```
86
103
 
87
- Prefer the explicit one-shot; sudoers is optional.
88
-
89
- Note: start scripts may try `sudo chown` or a docker alpine chown — host sudo still helps for empty dirs created as the operator user.
104
+ Do not rely on per-product `chown` as ongoing ops. Prefer fixing the host model above.
90
105
 
91
106
  ## 6. Ports + DNS
92
107
 
@@ -114,6 +129,6 @@ wget -qO- https://raw.githubusercontent.com/ORG/REPO/main/deploy/.../dist/instal
114
129
  - [ ] `ssh cloud_agent@VPS` works with key only
115
130
  - [ ] `docker ps` works without sudo
116
131
  - [ ] `$HOME` owned by `cloud_agent`
117
- - [ ] uid 1000 chown on data/logs after first mkdir/install
132
+ - [ ] operator uid is 1000 **OR** `~/services` has default ACL for `u:1000` (and `u:cloud_agent` if needed)
118
133
  - [ ] DNS → VPS IP
119
134
  - [ ] install-gateway + setup-tls + start-gateway
@@ -66,7 +66,7 @@ Host `00-default.conf` (HTTP) and each app `sites.conf` (HTTPS) proxy `/_vibed/h
66
66
 
67
67
  ## Pitfalls
68
68
 
69
- - Operator user / Docker / uid 1000 data dirs: [agent-vps-prep](../agent-vps-prep/SKILL.md).
69
+ - Operator user / Docker / one-time uid-1000 or ACL (not per-app chown): [agent-vps-prep](../agent-vps-prep/SKILL.md).
70
70
  - Do not run a second standalone nginx on 80/443.
71
71
  - Container names in `sites.conf` must match running API/UI names on `vps-edge`.
72
72
  - After cert renewal or `setup-tls.sh`, reload happens automatically when the gateway container is already running.