Root cause:
gateway binary was built before SwarmJoinNodeViaSSH was added → 404 on
/api/swarm/join-node → tRPC threw 'Gateway unavailable' error.
Gateway fixes:
- Rebuilt gateway image (golang:1.23-alpine + go mod tidy → clean go.sum)
- SwarmJoinNodeViaSSH now live in binary (was already coded, not compiled)
- NEW: POST /api/swarm/ssh-test handler (SwarmSSHTest)
• Dials SSH with 10s timeout
• Runs 'docker version' on remote to check Docker availability
• Returns {ok, sshOk, dockerOk, dockerVersion, error, step}
- Route registered: r.Post("/swarm/ssh-test", h.SwarmSSHTest)
Server fixes:
- gateway-proxy.ts: added testSSHConnection() → POST /api/swarm/ssh-test
- routers.ts: added nodes.sshTest mutation (input: host/port/user/password)
UI (client/src/pages/Nodes.tsx) — AddNodeDialog rewritten:
- Separate state for testResult and joinResult (two independent panels)
- NEW: yellow 'Test Connection' button → calls nodes.sshTest
shows SSH OK + Docker version, or human-readable error
- 'Join Swarm' button remains independent
- Human-readable error messages per step:
ssh_connect → 'Cannot connect — check IP, port, SSH running'
docker_join → 'docker swarm join failed: ...'
trpc → 'Gateway unavailable — check gateway container'
- Input changes clear stale test/join results
- ✕ close button in dialog header
- Disabled state unified (busy || joinDone)
17 lines
329 B
Modula-2
17 lines
329 B
Modula-2
module git.softuniq.eu/UniqAI/GoClaw/gateway
|
|
|
|
go 1.23.4
|
|
|
|
require (
|
|
github.com/go-chi/chi/v5 v5.2.1
|
|
github.com/go-chi/cors v1.2.1
|
|
github.com/go-sql-driver/mysql v1.8.1
|
|
github.com/joho/godotenv v1.5.1
|
|
golang.org/x/crypto v0.37.0
|
|
)
|
|
|
|
require (
|
|
filippo.io/edwards25519 v1.1.0 // indirect
|
|
golang.org/x/sys v0.32.0 // indirect
|
|
)
|