cropscode worker
cropscode workerDescription
Section titled “Description”The worker command handles tenant selection (if needed) and starts the worker daemon.
On first run, it walks you through setup:
- Checks that you’re logged in (prompts to run
cropscode loginif not) - Fetches your available tenants from the orchestrator
- If you have multiple tenants, lets you pick one
- Saves the configuration to
~/.cropscode/worker.json - Starts the worker daemon
On subsequent runs, it reads the saved config and starts the worker immediately.
What Happens on Start
Section titled “What Happens on Start”- Reads worker config from
~/.cropscode/worker.json - Connects outbound to the orchestrator via WebSocket
- Reports system info (hostname, CPU, RAM)
- Begins sending heartbeats every 10 seconds
- Listens for container commands (create, stop, terminal)
Connection
Section titled “Connection”The worker connects outbound — no inbound ports, no firewall rules, works behind NAT. If the connection drops, it reconnects with exponential backoff (1s → 2s → 4s → … up to 30s).
Worker Configuration
Section titled “Worker Configuration”Running cropscode worker for the first time stores:
- Worker ID (randomly generated UUID)
- Tenant ID and name
- Orchestrator WebSocket URL
These are saved in ~/.cropscode/worker.json.