You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| `detached` | Run in the background (see below) | false |
182
+
| `logfile` | File path to write stdout/stderr when `detached` is true | None |
201
183
202
184
### Background Processes
203
185
204
-
To start a server that keeps running, end the command with `&`:
186
+
To start a long-running process like a dev server, use `detached: true`. This runs the command in the background so subsequent commands can execute immediately:
205
187
206
188
```yaml
207
189
commands:
208
-
- name: Start server
209
-
run: npm run dev &
190
+
- name: Install
191
+
run: npm install
192
+
- name: Start dev server
193
+
run: npm run dev
194
+
detached: true
195
+
logfile: /tmp/dev-server.log
196
+
```
197
+
198
+
When `detached` is true, the command runs via `nohup` and the worker moves on after confirming the process started. If `logfile` is set, stdout and stderr are written to that path — useful for debugging startup issues.
199
+
200
+
### Automatic Tool Installation
201
+
202
+
If a repository contains a `.tool-versions` file (used by [mise](https://mise.jdx.dev/) / asdf), Roo Code Cloud automatically runs `mise install` after cloning. This installs the correct versions of tools like Node.js, Python, Ruby, Go, or any other runtime your project requires — before any of your setup commands execute.
203
+
204
+
```
205
+
# .tool-versions
206
+
nodejs 20.11.0
207
+
python 3.12.1
210
208
```
211
209
212
210
## Services
@@ -276,7 +274,9 @@ repositories:
276
274
env:
277
275
VITE_API_URL: ${ROO_API_HOST}
278
276
- name: Serve
279
-
run: npx serve -s dist -l 3000 &
277
+
run: npx serve -s dist -l 3000
278
+
detached: true
279
+
logfile: /tmp/storefront.log
280
280
281
281
- repository: acme/api
282
282
commands:
@@ -285,7 +285,9 @@ repositories:
285
285
- name: Migrate
286
286
run: npm run db:push
287
287
- name: Start
288
-
run: npm run start &
288
+
run: npm run start
289
+
detached: true
290
+
logfile: /tmp/api.log
289
291
env:
290
292
ALLOWED_ORIGINS: ${ROO_WEB_HOST}
291
293
@@ -294,7 +296,9 @@ repositories:
294
296
- name: Install
295
297
run: npm install
296
298
- name: Start
297
-
run: npm run start &
299
+
run: npm run start
300
+
detached: true
301
+
logfile: /tmp/worker.log
298
302
299
303
ports:
300
304
- name: WEB
@@ -315,75 +319,80 @@ env:
315
319
316
320
After the environment starts, you'll get unique URLs for each port. Visit the WEB URL to access your running application.
317
321
318
-
## Tips
322
+
## Common Issues
319
323
320
-
### 1. Always Use Environment Variables for URLs
324
+
### CORS Errors
321
325
322
-
Don't hardcode URLs between services:
326
+
In a preview environment, your frontend and backend run on different domains (e.g., `https://abc123.vercel.run` and `https://def456.vercel.run`). Browsers block cross-origin requests by default, so your backend needs to explicitly allow the frontend's domain.
323
327
324
-
```typescript
325
-
// Bad - breaks in preview environments
326
-
const apiUrl = 'http://localhost:3001';
328
+
Use the `ROO_WEB_HOST` variable to configure your backend's CORS policy:
Then in your environment config, make sure both ports are defined so the variables get injected:
370
359
371
360
```yaml
372
-
# Good - clear and consistent
373
361
ports:
374
362
- name: WEB
375
363
port: 3000
376
364
- name: API
377
365
port: 3001
378
-
- name: ADMIN
379
-
port: 3002
366
+
```
380
367
381
-
# Avoid - inconsistent naming
382
-
ports:
383
-
- name: frontend
384
-
port: 3000
385
-
- name: BACKEND_API
386
-
port: 3001
387
-
- name: Admin_Panel
388
-
port: 3002
368
+
### Managing Frontend API URLs with `.env` Files
369
+
370
+
Frontends typically need the API URL at build time. If your project already uses `.env` files (via dotenv, dotenvx, or framework built-ins like Vite's `.env.local`), you can write the injected `ROO_API_HOST` into a `.env` file as a setup command — no code changes needed:
This approach keeps your environment config simple and avoids modifying application code.
394
+
395
+
## Tips
396
+
397
+
- **Use `ROO_*_HOST` variables, not hardcoded URLs.** Always fall back to localhost for local dev: `process.env.ROO_API_HOST || 'http://localhost:3001'`.
398
+
- **Use consistent uppercase port names.** `WEB`, `API`, `ADMIN` — not `frontend`, `BACKEND_API`, `Admin_Panel`.
0 commit comments