Skip to content

Add Docker Compose examples for username routing and Lua publickey Git routing#742

Merged
tg123 merged 9 commits intomasterfrom
copilot/create-example-folder-ssh-piper
Apr 23, 2026
Merged

Add Docker Compose examples for username routing and Lua publickey Git routing#742
tg123 merged 9 commits intomasterfrom
copilot/create-example-folder-ssh-piper

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 22, 2026

This PR adds Docker Compose-based onboarding examples under examples/ and incorporates follow-up fixes from review feedback.

What’s included

  • Added example demos for:
    • examples/username-routing
    • examples/lua-publickey-git-routing
  • Pinned rockstorm/git-server image references in the Lua Git routing compose file for reproducibility.
  • Clarified the Lua example behavior in README: routing happens during publickey auth based on SSH username, and client key content is not validated.
  • Updated the username-routing example docs/config so the upstream SSH port is explicitly handled for the demo.
  • Added a link in the root README.md to the examples/ folder for discoverability.

Validation

  • Ran targeted compose validation for updated example files using docker compose config.
  • Addressed review feedback and pushed follow-up commits.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 22, 2026 10:14
Co-authored-by: tg123 <170430+tg123@users.noreply.github.com>
Co-authored-by: tg123 <170430+tg123@users.noreply.github.com>
Copilot AI changed the title [WIP] Create example folder for demoing sshpiper with Docker Compose Add Docker Compose examples for username routing and Lua publickey Git routing Feb 22, 2026
Copilot AI requested a review from tg123 February 22, 2026 10:19
@tg123 tg123 marked this pull request as ready for review February 22, 2026 10:55
Copilot AI review requested due to automatic review settings February 22, 2026 10:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new examples/ directory containing two Docker Compose demonstrations to help new users get started with sshpiper. The examples showcase different routing approaches: a simple username-based routing pattern and a more complex Lua-scripted publickey routing for Git operations.

Changes:

  • Added examples directory structure with README index
  • Created username-routing demo showing target+username syntax
  • Created lua-publickey-git-routing demo with two isolated Git repositories demonstrating deterministic routing

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
examples/README.md Index page linking to the two demo examples
examples/username-routing/docker-compose.yml Defines sshd and sshpiper services for username routing demo
examples/username-routing/README.md Instructions for running the username routing demo
examples/lua-publickey-git-routing/docker-compose.yml Defines two Git servers, init containers, and sshpiper with Lua plugin
examples/lua-publickey-git-routing/lua/routing.lua Lua script routing repo-a and repo-b users to different Git servers with embedded demo keys
examples/lua-publickey-git-routing/README.md Instructions for running the Lua Git routing demo
examples/lua-publickey-git-routing/git-a/authorized_keys Public key for git-a upstream authentication
examples/lua-publickey-git-routing/git-b/authorized_keys Public key for git-b upstream authentication
examples/lua-publickey-git-routing/keys/.gitkeep Placeholder to track keys directory in git

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,86 @@
services:
repo-a-init:
image: rockstorm/git-server:latest
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Docker image tag latest can cause reproducibility issues. Consider pinning to a specific version tag (e.g., rockstorm/git-server:2.0 or similar) to ensure the example works consistently over time. The latest tag can change unexpectedly and break the example.

Copilot uses AI. Check for mistakes.
- repo_a_data:/repo

repo-b-init:
image: rockstorm/git-server:latest
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Docker image tag latest can cause reproducibility issues. Consider pinning to a specific version tag to ensure the example works consistently over time.

Copilot uses AI. Check for mistakes.
- repo_b_data:/repo

git-a:
image: rockstorm/git-server:latest
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Docker image tag latest can cause reproducibility issues. Consider pinning to a specific version tag to ensure the example works consistently over time.

Copilot uses AI. Check for mistakes.
condition: service_completed_successfully

git-b:
image: rockstorm/git-server:latest
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Docker image tag latest can cause reproducibility issues. Consider pinning to a specific version tag to ensure the example works consistently over time.

Copilot uses AI. Check for mistakes.
GIT_SSH_COMMAND='ssh -i ./keys/client_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222' \
git clone ssh://repo-b@127.0.0.1:2222/srv/git/repo.git ./clone-repo-b
```

Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions tell users to generate a client key, but the Lua script doesn't actually validate or check the client's public key - it only routes based on username. Any public key will be accepted. Consider clarifying in the README that this example demonstrates username-based routing during publickey authentication, not key-based authorization. For example, add a note: "Note: This example accepts any public key and routes based solely on the SSH username. The client key content is not validated."

Suggested change
Note: This example accepts any public key during publickey authentication and routes based solely on the SSH username. The client key content is not validated.

Copilot uses AI. Check for mistakes.
@tg123
Copy link
Copy Markdown
Owner

tg123 commented Apr 23, 2026

@copilot apply changes based on the comments in this thread

Copilot AI requested review from Copilot and removed request for Copilot April 23, 2026 06:18
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 23, 2026

@copilot apply changes based on the comments in this thread

Applied the requested review-thread updates in 007b392: pinned rockstorm/git-server image references in examples/lua-publickey-git-routing/docker-compose.yml and clarified in the README that routing is username-based during publickey auth and the client key content is not validated.

Copilot AI review requested due to automatic review settings April 23, 2026 17:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread examples/username-routing/README.md Outdated
@tg123
Copy link
Copy Markdown
Owner

tg123 commented Apr 23, 2026

@copilot add example link to root readme

Copilot AI requested review from Copilot and removed request for Copilot April 23, 2026 17:31
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 23, 2026

@copilot add example link to root readme

Added the root README link to the examples folder in f006504 (README.md, new “More examples” section linking to examples/).

@tg123 tg123 merged commit 1753aee into master Apr 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants