Skip to content

Commit d2f8636

Browse files
committed
update supervisor readme with route changes
1 parent 5aeeb7d commit d2f8636

File tree

1 file changed

+46
-8
lines changed

1 file changed

+46
-8
lines changed

apps/supervisor/README.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ curl -sS \
1919
-d "{\"name\": \"$wg_name\"}"
2020
```
2121

22+
If the worker group is newly created, the response will include a `token` field. If the group already exists, no token is returned.
23+
2224
2. Create `.env` and set the worker token
2325

2426
```sh
@@ -43,25 +45,61 @@ pnpm exec trigger deploy --self-hosted
4345
pnpm exec trigger deploy --self-hosted --network host
4446
```
4547

46-
## Additional worker groups
48+
## Worker group management
4749

48-
When adding more worker groups you might also want to make them the default for a specific project. This will allow you to test it without having to change the global default:
50+
### Shared variables
4951

5052
```sh
5153
api_url=http://localhost:3030
54+
admin_pat=tr_pat_... # edit this
55+
```
56+
57+
- These are used by all commands
58+
59+
### Create a worker group
60+
61+
```sh
5262
wg_name=my-worker
5363

54-
# edit these
55-
admin_pat=tr_pat_...
64+
curl -sS \
65+
-X POST \
66+
"$api_url/admin/api/v1/workers" \
67+
-H "Authorization: Bearer $admin_pat" \
68+
-H "Content-Type: application/json" \
69+
-d "{\"name\": \"$wg_name\"}"
70+
```
71+
72+
- If the worker group already exists, no token will be returned
73+
74+
### Set a worker group as default for a project
75+
76+
```sh
77+
wg_name=my-worker
78+
project_id=clsw6q8wz...
79+
80+
curl -sS \
81+
-X POST \
82+
"$api_url/admin/api/v1/workers" \
83+
-H "Authorization: Bearer $admin_pat" \
84+
-H "Content-Type: application/json" \
85+
-d "{\"name\": \"$wg_name\", \"projectId\": \"$project_id\", \"makeDefaultForProject\": true}"
86+
```
87+
88+
- If the worker group doesn't exist, yet it will be created
89+
- If the worker group already exists, it will be attached to the project as default. No token will be returned.
90+
91+
### Remove the default worker group from a project
92+
93+
```sh
5694
project_id=clsw6q8wz...
5795

5896
curl -sS \
5997
-X POST \
6098
"$api_url/admin/api/v1/workers" \
6199
-H "Authorization: Bearer $admin_pat" \
62100
-H "Content-Type: application/json" \
63-
-d "{
64-
\"name\": \"$wg_name\",
65-
\"makeDefaultForProjectId\": \"$project_id\"
66-
}"
101+
-d "{\"projectId\": \"$project_id\", \"removeDefaultFromProject\": true}"
67102
```
103+
104+
- The project will then use the global default again
105+
- When `removeDefaultFromProject: true` no other actions will be performed

0 commit comments

Comments
 (0)