| Crates.io | cargo-shipit |
| lib.rs | cargo-shipit |
| version | 0.1.0 |
| created_at | 2025-08-20 11:56:47.912457+00 |
| updated_at | 2025-08-20 11:56:47.912457+00 |
| description | Cargo subcommand for building and deploying Rust binaries to Linux targets via SSH. Ship it! |
| homepage | https://github.com/PixmaNts/cargo-shipit |
| repository | https://github.com/PixmaNts/cargo-shipit |
| max_upload_size | |
| id | 1803287 |
| size | 73,160 |
A Cargo subcommand for building and deploying Rust binaries to Linux targets via SSH.
cargo install cargo-shipit
Or build from source:
git clone <repository-url>
cd cargo-shipit
cargo install --path .
# Initialize a config file
cargo shipit --init shipit.json
# Edit shipit.json with your target details, then deploy
cargo shipit
# Or specify options directly
cargo shipit --host 192.168.1.100 --username root --key ~/.ssh/id_rsa
Cargo subcommand for building and deploying Rust binaries to Linux targets via SSH. Ship it!
Usage: cargo-shipit [OPTIONS]
Options:
-c, --config <CONFIG> The path to the configuration file [default: shipit.json]
-b, --binaries <BINARIES> The binary files to upload to the Linux target (auto-detected from Cargo.toml if not specified)
-d, --debug Enable debug mode
-r, --remote-folder <REMOTE_FOLDER> The remote directory path on the Linux target
-H, --host <HOST> Hostname or IP address of the Linux target
-U, --username <USERNAME> SSH username for the Linux target
-P, --password <PASSWORD> SSH password for the Linux target
-k, --key <KEY> Path to SSH private key file for authentication
-p, --port <PORT> SSH port of the Linux target [default: 22]
-t, --target <TARGET> Rust target triple for cross-compilation (e.g., 'armv7-unknown-linux-gnueabihf', 'aarch64-unknown-linux-gnu')
-T, --target-folder <TARGET_FOLDER> Local cargo target directory path
-i, --init <INIT> Initialize a new configuration file at the specified path
-B, --build Build the project before uploading (auto-detected if not specified)
--profile <PROFILE> Build profile to use (debug, release, or custom profile name) [default: release]
-h, --help Print help
-V, --version Print version
Create a configuration file to avoid specifying connection details every time:
cargo shipit --init embedded.json
This creates a template configuration file:
{
"host": "pi5.lan",
"port": 22,
"username": "pi",
"password": null,
"key": "~/.ssh/id_rsa",
"target_folder": "./target/",
"target": "aarch64-unknown-linux-gnu",
"remote_folder": "/home/pi/apps/",
"profile": "release"
}
Configuration supports:
Then use it:
cargo shipit --config embedded.json --binaries my_app --build
cargo-shipit supports both password and SSH key-based authentication:
cargo shipit --host 192.168.1.100 --username root --password mypass --binaries my_app
# Using SSH private key
cargo shipit --host 192.168.1.100 --username root --key ~/.ssh/id_rsa --binaries my_app
Or in configuration file:
{
"host": "192.168.1.100",
"username": "root",
"key": "/home/user/.ssh/id_rsa",
"target": "armv7-unknown-linux-gnueabihf"
}
Note: When using SSH keys, cargo-shipit will look for both the private key file and its corresponding .pub public key file in the same directory.
Before using cargo-shipit, ensure you have the appropriate Rust target installed:
# For ARM embedded Linux (e.g., Raspberry Pi, BeagleBone)
rustup target add armv7-unknown-linux-gnueabihf
# For ARM64 embedded Linux
rustup target add aarch64-unknown-linux-gnu
# For x86_64 embedded Linux
rustup target add x86_64-unknown-linux-gnu
You may also need to configure a cross-compilation toolchain in your .cargo/config.toml:
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
cargo-shipit supports different build profiles:
--debug flag or --profile debug for debug builds (faster compilation, larger binaries)Cargo.tomlDefine a custom profile in your Cargo.toml:
[profile.release-strip]
inherits = "release"
strip = true
lto = true
codegen-units = 1
Then use it:
cargo shipit --profile release-strip --binaries my_app --build
Or save it in your configuration:
{
"profile": "release-strip"
}
cargo shipit --init shipit.json
# Edit shipit.json with your Pi's details
cargo shipit
cargo shipit --host 192.168.1.100 --username pi --key ~/.ssh/id_rsa
This project is licensed under either of
at your option.
Contributions are welcome! Please feel free to submit a Pull Request.