Skip to content

Commit b9a0f09

Browse files
author
vsilent
committed
create the local pipe from the concrete discovered source/target operation
1 parent 39dfa72 commit b9a0f09

50 files changed

Lines changed: 2628 additions & 721 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ All notable changes to this project will be documented in this file.
88

99
- **`stacker target [local|cloud|server]`** — switch deployment target mode; persists in `.stacker/active-target`
1010
- **Local pipe creation**`stacker pipe create` works without a cloud deployment (`deployment_hash` is now optional, `is_local` flag on PipeInstance/PipeExecution)
11-
- **Local scanning**`stacker pipe scan` discovers containers via `docker ps` in local mode
11+
- **Local scanning**`stacker pipe scan` now performs local endpoint/resource discovery on matched containers instead of only listing Docker inventory
12+
- **Explicit scan modes**`stacker pipe scan --containers [FILTER]` for local container discovery + probing and `stacker pipe scan --app <APP> [--container <NAME>]` for remote endpoint probing
1213
- **Local triggering**`stacker pipe trigger` executes via `docker exec` / HTTP against local containers
1314
- **`stacker pipe deploy <id> --deployment <hash>`** — promote a local pipe to a remote deployment (clones config to new remote instance)
1415
- **`GET /api/v1/pipes/instances/local`** — list local pipe instances for the authenticated user
@@ -484,4 +485,4 @@ stacker init --with-ai # no Ollama running → template fallback
484485
- Casbin reload is guarded to avoid blocking request handling and re-applies route matching after reload.
485486

486487
### Fixed
487-
- Status panel command updates query uses explicit bindings to avoid SQLx type inference errors.
488+
- Status panel command updates query uses explicit bindings to avoid SQLx type inference errors.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ The end-user tool. No server required for local deploys.
160160
| `stacker agent configure-proxy` | Configure Nginx Proxy Manager via the agent |
161161
| `stacker agent history` | Show recent command execution history |
162162
| `stacker agent exec` | Execute a raw agent command with JSON parameters |
163-
| `stacker pipe scan <app>` | Discover API endpoints on a running container |
163+
| `stacker pipe scan` | Discover local endpoints/resources from running containers (when target is `local`) |
164+
| `stacker pipe scan --containers [filter]` | Discover local endpoints/resources for matching containers |
165+
| `stacker pipe scan --app <app>` | Probe a remote app for API endpoints |
164166
| `stacker pipe create <src> <tgt>` | Create a data pipe between two containers (interactive) |
165167
| `stacker pipe list` | List pipe instances for the current deployment |
166168
| `stacker pipe activate <id>` | Activate a pipe (start listening for triggers) |

docs/DAG_PIPES_PART1_CLI_GUIDE.md

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ stacker status
4141
### Step 1 — Scan your services
4242

4343
```bash
44-
# See what APIs your website exposes
45-
stacker pipe scan website
44+
# Remote deployment: probe app endpoints
45+
stacker pipe scan --app website
4646

4747
# See what APIs are available with sample data
48-
stacker pipe scan website --capture-samples
48+
stacker pipe scan --app website --capture-samples
4949
```
5050

5151
Output:
@@ -67,7 +67,7 @@ stacker pipe create website telegram
6767
```
6868

6969
The wizard will:
70-
1. Scan both apps for endpoints
70+
1. Scan both apps/containers for endpoints
7171
2. Let you pick source endpoint (POST /api/contact)
7272
3. Let you pick target endpoint (sendMessage)
7373
4. Auto-match fields (`name` → text, `email` → text)
@@ -205,7 +205,9 @@ stacker pipe trigger <slack-pipe-id> \
205205

206206
| Command | What it does |
207207
|---------|-------------|
208-
| `stacker pipe scan <app>` | Discover what APIs an app exposes |
208+
| `stacker pipe scan` | Discover local Docker containers |
209+
| `stacker pipe scan --containers [filter]` | Discover local containers by name |
210+
| `stacker pipe scan --app <app>` | Discover what APIs a remote app exposes |
209211
| `stacker pipe create <source> <target>` | Create a pipe (interactive wizard) |
210212
| `stacker pipe list` | Show all pipes for your deployment |
211213
| `stacker pipe activate <id>` | Start the pipe (begin listening) |
@@ -274,15 +276,19 @@ stacker target
274276
# Output: Active target: local
275277

276278
# All pipe commands now show [local] prefix
277-
stacker pipe scan website
279+
stacker pipe scan
278280
# [local] ✓ 3 containers discovered
281+
# [local] ✓ 7 endpoints/resources discovered
279282
```
280283

281284
### Local Workflow
282285

283286
```bash
284-
# 1. Discover local containers (uses docker ps)
285-
stacker pipe scan website
287+
# 1. Discover local endpoints/resources from running containers
288+
stacker pipe scan
289+
290+
# Optional: narrow to matching container names
291+
stacker pipe scan --containers website
286292

287293
# 2. Create a pipe — no deployment hash needed
288294
stacker pipe create website telegram
@@ -314,7 +320,9 @@ stacker target # show current
314320

315321
| Command | Local Behavior |
316322
|---------|---------------|
317-
| `pipe scan` | Runs `docker ps` to discover containers |
323+
| `pipe scan` | Discovers local endpoints/resources from running containers |
324+
| `pipe scan --containers [filter]` | Filters matching containers, then probes their endpoints/resources |
325+
| `pipe scan --app <app>` | Not used locally — use container discovery instead |
318326
| `pipe create` | Creates pipe with `is_local=true`, no deployment hash |
319327
| `pipe list` | Shows your local pipes only |
320328
| `pipe trigger` | Executes via `docker exec` / HTTP |
@@ -323,6 +331,47 @@ stacker target # show current
323331
| `pipe activate/deactivate` | Remote only (use after deploy) |
324332
| `pipe replay` | Remote only |
325333

334+
### Scan Semantics
335+
336+
- **Local target** → scan works with **containers**
337+
- **Remote target** → scan works with **apps**, optionally narrowed by `--container`
338+
339+
```bash
340+
# Local
341+
stacker pipe scan
342+
stacker pipe scan --containers upload
343+
344+
# Remote
345+
stacker pipe scan --app website
346+
stacker pipe scan --app website --container website-web-1
347+
```
348+
349+
Legacy `stacker pipe scan <ARG>` still works during the transition:
350+
351+
- in **local mode** it is treated as a container name filter
352+
- in **remote mode** it is treated as an app code
353+
354+
When local scan succeeds, expect output like:
355+
356+
```text
357+
[local] ✓ 1 container(s) discovered
358+
359+
Containers matched: 1
360+
local-device-api-1 [syncopia] syncopia/device-api:local
361+
addresses: 172.18.0.20:5050
362+
363+
App: device-api
364+
Protocols detected: openapi, postgres
365+
366+
[openapi] http://172.18.0.20:5050/openapi.json
367+
GET /devices
368+
fields: [id, name]
369+
370+
Resources:
371+
[postgres] postgres://172.18.0.10:5432/app (local-postgres-1)
372+
table public.devices -- CDC candidate
373+
```
374+
326375
---
327376

328377
## What's Next?

docs/PIPING.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,36 @@ Data piping connects containerized apps in a deployment, routing data from one s
2828

2929
1. **CLI** (`stacker pipe`) - user-facing commands
3030
2. **Server** (`/api/v1/pipes`) - REST API, validation, persistence
31-
3. **Agent** (status-panel) - runs on the deployment, probes containers, executes pipe triggers
31+
3. **Agent** (status-panel) - runs on the deployment, probes app/container endpoints, executes pipe triggers
3232

33-
> **Local mode**: When `stacker target local` is active, scan uses `docker ps` and trigger uses `docker exec` — no agent required. Pipes are stored with `is_local=true` and no `deployment_hash`.
33+
> **Local mode**: When `stacker target local` is active, scan starts with Docker discovery (`docker ps` + `docker inspect`) and then probes matched containers for endpoints/resources locally — no remote agent required. Pipes are stored with `is_local=true` and no `deployment_hash`.
34+
35+
> **Scan semantics**: local scan is **container-first**; remote scan is **app-first** with optional `--container` narrowing.
3436
3537
## Quick Start
3638

3739
### 1. Scan for connectable endpoints
3840

3941
```bash
40-
# Discover what APIs wordpress exposes
41-
stacker pipe scan wordpress
42+
# Local target: discover endpoints/resources from running containers
43+
stacker pipe scan
44+
45+
# Filter local containers by name, then probe them
46+
stacker pipe scan --containers wordpress
4247

43-
# With sample response capture (shows actual data)
44-
stacker pipe scan wordpress --capture-samples
48+
# Remote target: probe a deployed app for endpoints
49+
stacker pipe scan --app wordpress --capture-samples
4550

4651
# Scan specific protocols
47-
stacker pipe scan wordpress --protocols openapi,html_forms,rest
52+
stacker pipe scan --app wordpress --protocols openapi,html_forms,rest
4853
```
4954

5055
Output:
5156
```
57+
Containers matched: 1
58+
local-wordpress-1 [blog] wordpress:latest
59+
addresses: 172.18.0.8:80
60+
5261
App: wordpress
5362
Protocols detected: openapi
5463
@@ -205,8 +214,8 @@ When `--capture-samples` is enabled during scanning, the agent:
205214

206215
```bash
207216
# 1. Scan both services
208-
stacker pipe scan wordpress --capture-samples
209-
stacker pipe scan mailchimp --capture-samples
217+
stacker pipe scan --app wordpress --capture-samples
218+
stacker pipe scan --app mailchimp --capture-samples
210219

211220
# 2. Create the pipe
212221
stacker pipe create wordpress mailchimp
@@ -290,7 +299,7 @@ All endpoints require authentication. Pipe instance access is verified through d
290299

291300
| Command | Direction | Description |
292301
|---------|-----------|-------------|
293-
| `probe_endpoints` | Server -> Agent | Discover API endpoints on a container |
302+
| `probe_endpoints` | Server -> Agent | Discover API endpoints for an app, optionally narrowed to a container |
294303
| `activate_pipe` | Server -> Agent | Start webhook listener or poll scheduler |
295304
| `deactivate_pipe` | Server -> Agent | Stop listener/scheduler |
296305
| `trigger_pipe` | Server -> Agent | One-shot pipe execution |

src/bin/agent_executor.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ use tokio::signal;
1919
use tokio::sync::Notify;
2020
use tracing::{error, info};
2121

22-
use stacker::models::agent_protocol::{routing, RetryPolicy, StepCommand, StepResultMsg, StepStatus};
22+
use stacker::models::agent_protocol::{
23+
routing, RetryPolicy, StepCommand, StepResultMsg, StepStatus,
24+
};
2325
use stacker::services::resilience_engine::{
2426
execute_with_resilience, CircuitBreakerConfig, InMemoryCircuitBreaker,
2527
};
@@ -28,7 +30,11 @@ use stacker::services::resilience_engine::{
2830
#[command(name = "agent-executor", about = "Pipe step executor agent")]
2931
struct Args {
3032
/// AMQP connection URL
31-
#[arg(long, env = "AMQP_URL", default_value = "amqp://guest:guest@localhost:5672")]
33+
#[arg(
34+
long,
35+
env = "AMQP_URL",
36+
default_value = "amqp://guest:guest@localhost:5672"
37+
)]
3238
amqp_url: String,
3339

3440
/// Deployment hash to scope this executor to

0 commit comments

Comments
 (0)