-
Notifications
You must be signed in to change notification settings - Fork 19
Add jumpstarter-driver-ssh-mount package for remote filesystem mounting #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2f57133
102d337
b9d8473
133978b
b221596
e1d1d66
9f20741
058cf54
9feb62e
35ddb82
4d3f152
0bea7c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../../packages/jumpstarter-driver-ssh-mount/README.md | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| __pycache__/ | ||
| .coverage | ||
| coverage.xml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| # SSHMount Driver | ||
|
|
||
| `jumpstarter-driver-ssh-mount` provides remote filesystem mounting via sshfs. It allows you to mount remote directories from a target device to your local machine using SSHFS (SSH Filesystem). | ||
|
|
||
| ## Installation | ||
|
|
||
| ```shell | ||
| pip3 install --extra-index-url https://pkg.jumpstarter.dev/simple/ jumpstarter-driver-ssh-mount | ||
| ``` | ||
|
|
||
| You also need `sshfs` installed on the client machine: | ||
|
|
||
| - **Fedora/RHEL**: `sudo dnf install fuse-sshfs` | ||
| - **Debian/Ubuntu**: `sudo apt-get install sshfs` | ||
| - **macOS**: Install macFUSE from https://macfuse.github.io/ and then install | ||
| sshfs from source, as Homebrew has removed sshfs support. | ||
|
|
||
| ## Configuration | ||
|
|
||
| The SSHMount driver references an existing SSH driver to inherit credentials | ||
| (username, identity key) and TCP connectivity. No duplicate configuration is needed. | ||
|
|
||
| Example exporter configuration: | ||
|
|
||
| ```yaml | ||
| export: | ||
| ssh: | ||
| type: jumpstarter_driver_ssh.driver.SSHWrapper | ||
| config: | ||
| default_username: "root" | ||
| # ssh_identity_file: "/path/to/ssh/key" | ||
| children: | ||
| tcp: | ||
| type: jumpstarter_driver_network.driver.TcpNetwork | ||
| config: | ||
| host: "192.168.1.100" | ||
| port: 22 | ||
| mount: | ||
| type: jumpstarter_driver_ssh_mount.driver.SSHMount | ||
| children: | ||
| ssh: | ||
| ref: "ssh" | ||
| ``` | ||
|
|
||
| ## CLI Usage | ||
|
|
||
| Inside a `jmp shell` session: | ||
|
|
||
| ```shell | ||
| # Mount remote filesystem (spawns a subshell; type 'exit' to unmount) | ||
| j mount /local/mountpoint | ||
| j mount /local/mountpoint -r /remote/path | ||
| j mount /local/mountpoint --direct | ||
|
|
||
| # Mount in foreground mode (blocks until Ctrl+C) | ||
| j mount /local/mountpoint --foreground | ||
|
|
||
| # Unmount an orphaned mount | ||
| j mount --umount /local/mountpoint | ||
| j mount --umount /local/mountpoint --lazy | ||
| ``` | ||
mangelajo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| By default, `j mount` runs sshfs in foreground mode and spawns a subshell | ||
| with a modified prompt. The mount stays active while the subshell is running. | ||
| When you type `exit` (or press Ctrl+D), sshfs is terminated and all resources | ||
| (port forwards, temporary identity files) are cleaned up automatically. | ||
|
|
||
| Use `--foreground` to skip the subshell and block directly on sshfs. Press | ||
| Ctrl+C to unmount. | ||
|
|
||
| The `--umount` flag is available as a fallback for mounts that were orphaned | ||
| (e.g., if the process was killed without cleanup). | ||
|
|
||
| ## API Reference | ||
|
|
||
| ### SSHMountClient | ||
|
|
||
| - `mount(mountpoint, *, remote_path="/", direct=False, foreground=False, extra_args=None)` - Mount remote filesystem locally via sshfs | ||
| - `umount(mountpoint, *, lazy=False)` - Unmount an sshfs filesystem (fallback for orphaned mounts) | ||
|
|
||
| ### CLI | ||
|
|
||
| The driver registers as `mount` in the exporter config. When used in a `jmp shell` session, the CLI is a single command with a `--umount` flag for unmounting. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: jumpstarter.dev/v1alpha1 | ||
| kind: ExporterConfig | ||
| metadata: | ||
| namespace: default | ||
| name: demo | ||
| endpoint: grpc.jumpstarter.192.168.0.203.nip.io:8082 | ||
| token: "<token>" | ||
| export: | ||
| ssh: | ||
| type: jumpstarter_driver_ssh.driver.SSHWrapper | ||
| config: | ||
| default_username: "root" | ||
| # ssh_identity_file: "/path/to/key" | ||
| children: | ||
| tcp: | ||
| type: jumpstarter_driver_network.driver.TcpNetwork | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to use here an SSH driver instead, in that way the ssh_identity file and other settings are already provided and we don't need to do that here as well.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done -- updated the exporter config to reference the SSH driver directly via |
||
| config: | ||
| host: "192.168.1.100" | ||
| port: 22 | ||
| mount: | ||
| type: jumpstarter_driver_ssh_mount.driver.SSHMount | ||
| children: | ||
| ssh: | ||
| ref: "ssh" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to add this one to the driver index or docs compilation will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done -- added
ssh-mount.mdto both the Utility Drivers listing and thetoctreedirective in the drivers index.