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
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -323,6 +323,41 @@ When providing assistance:
323
323
- Provide clear explanations and documentation
324
324
- Consider the migration to Hetzner infrastructure in suggestions
325
325
326
+
#### Command Execution Context
327
+
328
+
Be mindful of the execution context for different types of commands. The project uses several command-line tools that must be run from specific directories:
329
+
330
+
-**`make` commands**: (e.g., `make help`, `make status`) must be run from the project root directory.
331
+
-**OpenTofu commands**: (e.g., `tofu init`, `tofu plan`, `tofu apply`) must be run from the `infrastructure/terraform/` directory.
332
+
-**Docker Compose commands**: (e.g., `docker compose up -d`, `docker compose ps`) are intended to be run _inside the deployed virtual machine_, typically from the `/home/torrust/github/torrust/torrust-tracker-demo/application` directory.
333
+
334
+
**IMPORTANT**: Always be aware of the current working directory. The repository location `~/Documents/git/committer/me/github/torrust/torrust-tracker-demo` is used in documentation as an example, but contributors may have the project cloned elsewhere. Verify the current location before executing commands.
335
+
336
+
#### Working with Remote Terminals
337
+
338
+
When executing commands on the remote VM, be aware of limitations with interactive sessions.
339
+
340
+
-**Problem**: The VS Code integrated terminal may not correctly handle commands that initiate a new interactive shell, such as `ssh torrust@<VM_IP>` or `make ssh`. The connection may succeed, but subsequent commands sent to that shell may not execute as expected, and their output may not be captured.
341
+
342
+
-**Solution**: Prefer executing commands non-interactively whenever possible. Instead of opening a persistent SSH session, pass the command directly to `ssh`.
343
+
344
+
-**Don't do this**:
345
+
346
+
```bash
347
+
# 1. Log in
348
+
make ssh
349
+
# 2. Run command (this might fail or output won't be seen)
350
+
df -H
351
+
```
352
+
353
+
- **Do this instead**:
354
+
```bash
355
+
# Execute the command directly via ssh
356
+
ssh torrust@<VM_IP>'df -H'
357
+
```
358
+
359
+
This ensures that the command is executed and its output is returned to the primary terminal session.
0 commit comments