| name | fly-ssh |
| description | Use when asked to run "fly ssh console", SSH into Fly.io machines, inspect files on production machines, check processes on Fly.io, or examine deployed machine state. Covers critical pitfalls like no shell support and Debian vs macOS command differences. |
Fly SSH Console Usage
Critical Considerations
1. Machine Must Be Running
Fly.io machines may be stopped. Before using fly ssh console, ensure a machine is running:
Option A: Start machine explicitly
fly machines list -a smooth-nav
fly machine start <machine-id> -a smooth-nav
Option B: Wake machine with HTTP request
curl -I https://smooth-nav.fly.dev/
2. No Shell - Direct Command Execution Only
fly ssh console executes commands directly, not through a shell. This means:
❌ Don't use:
- Pipes:
ps aux | grep puma
- Redirection:
echo "test" > file.txt
- Shell operators:
&&, ||, ;
- Shell expansions:
*.txt, ~, $HOME
✅ Do use:
- Direct commands:
ps auxww
- Multiple separate
fly ssh console calls for complex operations
- Command-specific options instead of pipes
Example - Wrong vs Right:
fly ssh console -a smooth-nav -C "ps aux | grep puma"
fly ssh console -a smooth-nav -C "ps auxww" | grep puma
fly ssh console -a smooth-nav -C "ps -C puma -o pid,user,%mem,%cpu,command"
3. Debian Linux Commands (Not macOS)
The Fly.io machines run Debian Linux, which has different command options than macOS.
Common Differences
ps command:
fly ssh console -a smooth-nav -C "ps auxww -o %mem"
fly ssh console -a smooth-nav -C "ps auxww"
fly ssh console -a smooth-nav -C "ps -eo pid,user,%mem,%cpu,command"
fly ssh console -a smooth-nav -C "ps -C navigator -o pid,%mem,command"
Memory inspection:
fly ssh console -a smooth-nav -C "ps auxww"
fly ssh console -a smooth-nav -C "ps -C navigator -o pid,user,%mem,vsz,rss,command"
fly ssh console -a smooth-nav -C "ps aux --sort=-%mem | head -20"
File operations:
fly ssh console -a smooth-nav -C "ls -lah /data/db"
fly ssh console -a smooth-nav -C "cat /rails/config/navigator.yml"
fly ssh console -a smooth-nav -C "df -h"
Common Use Cases
Memory Usage Analysis
fly ssh console -a smooth-nav -C "ps auxww"
fly ssh console -a smooth-nav -C "ps auxww" | grep -E 'navigator|puma|redis'
fly ssh console -a smooth-nav -C "ps -C navigator -o pid,user,%mem,vsz,rss,command"
Understanding ps memory columns:
%MEM - Percentage of physical RAM used
VSZ - Virtual memory size (KB)
RSS - Resident Set Size (actual physical memory in KB)
Process Inspection
fly ssh console -a smooth-nav -C "ps auxww"
fly ssh console -a smooth-nav -C "ps -C puma -o pid,command"
fly ssh console -a smooth-nav -C "ps auxwwf"
fly ssh console -a smooth-nav -C "ps aux" | grep -c puma
File and Directory Inspection
fly ssh console -a smooth-nav -C "ls -lh /data/db/*.sqlite3"
fly ssh console -a smooth-nav -C "cat /rails/config/navigator.yml"
fly ssh console -a smooth-nav -C "tail -100 /data/log/production.log"
fly ssh console -a smooth-nav -C "df -h /data"
Network and Port Inspection
fly ssh console -a smooth-nav -C "netstat -tlnp"
fly ssh console -a smooth-nav -C "netstat -tlnp" | grep 28080
Region-Specific Commands
fly ssh console -a smooth-nav -r iad -C "ps auxww"
fly regions list -a smooth-nav
Multi-Application Commands
fly ssh console -a smooth-nav -C "ps auxww" | grep -E 'navigator|puma|redis'
fly ssh console -a smooth -C "ps auxww" | grep -E 'navigator|puma|redis'
Debugging Tips
Check if machine is accessible
fly ssh console -a smooth-nav -C "echo ok"
Check Navigator status
fly ssh console -a smooth-nav -C "ps -C navigator -o pid,user,command"
fly ssh console -a smooth-nav -C "navigator --version"
Check Rails processes
fly ssh console -a smooth-nav -C "ps auxww" | grep "cable/config.ru"
fly ssh console -a smooth-nav -C "ps auxww" | grep "rails/config.ru"
Verify environment
fly ssh console -a smooth-nav -C "cat /proc/1/environ" | tr '\0' '\n'
Performance Considerations
- Each
fly ssh console call incurs network latency
- For complex analysis, consider multiple separate calls rather than trying to use shell features
- Filter output locally (on your machine) rather than trying to filter remotely
Example Workflows
Analyze memory after deployment
curl -I https://smooth-nav.fly.dev/
sleep 5
fly ssh console -a smooth-nav -C "ps auxww" > /tmp/smooth-nav-ps.txt
grep -E 'navigator|puma|redis' /tmp/smooth-nav-ps.txt
Compare memory usage across apps
fly ssh console -a smooth-nav -C "ps auxww" > /tmp/nav-ps.txt
fly ssh console -a smooth -C "ps auxww" > /tmp/smooth-ps.txt
echo "=== smooth-nav ==="
grep -E 'navigator|puma|redis' /tmp/nav-ps.txt
echo "=== smooth ==="
grep -E 'navigator|puma|redis' /tmp/smooth-ps.txt
Check if Action Cable is running
fly ssh console -a smooth-nav -C "ps auxww" | grep -q "cable/config.ru" && echo "Action Cable running" || echo "Action Cable NOT running"
Common Errors and Solutions
Error: "no machines available"
Solution: Machine is stopped. Start it with fly machine start or trigger with HTTP request.
Error: "connection refused"
Solution: Machine might be starting. Wait 10-30 seconds and retry.
Error: "command not found"
Solution: Verify the command exists in Debian. Check available commands with:
fly ssh console -a smooth-nav -C "which <command>"
Pipe or redirection doesn't work
Solution: Don't use shell operators in -C argument. Filter/redirect on your local machine instead.