2018-01-04 22:02:30 +00:00
|
|
|
# Cargo Remote
|
|
|
|
|
2018-01-09 21:18:11 +00:00
|
|
|
***Use with caution, I didn't test this software well and it is a really hacky
|
|
|
|
(at least for now). If you want to test it please create a VM or at least a separate
|
|
|
|
user on your build host***
|
2018-01-04 22:02:30 +00:00
|
|
|
|
2018-01-09 21:18:11 +00:00
|
|
|
## Why I built it
|
2018-01-04 22:02:30 +00:00
|
|
|
One big annoyance when working on rust projects on my notebook are the compile
|
|
|
|
times. Since I'm using rust nightly for some of my projects I have to recompile
|
|
|
|
rather often. Currently there seem to be no good remote-build integrations for
|
|
|
|
rust, so I decided to build one my own.
|
|
|
|
|
|
|
|
## Planned capabilities
|
2018-01-09 21:18:11 +00:00
|
|
|
This first version is very simple (could have been a bash script), but I intend to
|
2018-01-04 22:02:30 +00:00
|
|
|
enhance it to a point where it detects compatibility between local and remote
|
|
|
|
versions, allows (nearly) all cargo commands and maybe even load distribution
|
|
|
|
over multiple machines.
|
|
|
|
|
2018-01-09 21:18:11 +00:00
|
|
|
## Usage
|
|
|
|
For now only `cargo remote [FLAGS] [OPTIONS] <command>` works: it copies the
|
|
|
|
current project to a temporary directory (`~/remote-builds/<project_name>`) on
|
|
|
|
the remote server, calls `cargo <command>` remotely and optionally (`-c`) copies
|
|
|
|
back the resulting target folder. This assumes that server and client are running
|
|
|
|
the same rust version and have the same processor architecture. On the client `ssh`
|
|
|
|
and `rsync` need to be installed.
|
|
|
|
|
2018-01-10 16:20:18 +00:00
|
|
|
If you want to pass remote flags you have to end the options/flags section using
|
2019-10-17 19:50:23 +00:00
|
|
|
`--`. E.g. to build in release mode and copy back the result use:
|
2018-01-10 16:20:18 +00:00
|
|
|
```bash
|
|
|
|
cargo remote -c -- build --release
|
|
|
|
```
|
|
|
|
|
2018-01-09 21:18:11 +00:00
|
|
|
### Configuration
|
2018-01-11 22:24:32 +00:00
|
|
|
You can place a config file called `.cargo-remote.toml` in the same directory as your
|
|
|
|
`Cargo.toml` or at `~/.config/cargo-remote/cargo-remote.toml`. There you can define a
|
|
|
|
default remote build host and user. It can be overridden by the `-r` flag.
|
2018-01-09 21:18:11 +00:00
|
|
|
|
2018-01-11 22:24:32 +00:00
|
|
|
Example config file:
|
2018-01-09 21:18:11 +00:00
|
|
|
```toml
|
|
|
|
remote = "builds@myserver"
|
|
|
|
```
|
|
|
|
|
|
|
|
### Flags and options
|
|
|
|
```
|
|
|
|
USAGE:
|
2019-10-17 19:50:23 +00:00
|
|
|
cargo remote [FLAGS] [OPTIONS] <command> [remote options]...
|
2018-01-09 21:18:11 +00:00
|
|
|
|
|
|
|
FLAGS:
|
2019-10-17 19:50:23 +00:00
|
|
|
-c, --copy-back Transfer the target folder back to the local machine
|
2018-01-09 21:18:11 +00:00
|
|
|
--help Prints help information
|
2019-10-17 19:50:23 +00:00
|
|
|
-h, --transfer-hidden Transfer hidden files and directories to the build server
|
2018-01-09 21:18:11 +00:00
|
|
|
-V, --version Prints version information
|
|
|
|
|
|
|
|
OPTIONS:
|
2019-10-17 19:50:23 +00:00
|
|
|
-b, --build-env <build_env> Set remote environment variables. RUST_BACKTRACE, CC, LIB, etc. [default:
|
|
|
|
RUST_BACKTRACE=1]
|
|
|
|
-e, --env <env> Environment profile. default_value = /etc/profile [default: /etc/profile]
|
|
|
|
--manifest-path <manifest_path> Path to the manifest to execute [default: Cargo.toml]
|
|
|
|
-r, --remote <remote> Remote ssh build server
|
|
|
|
-d, --rustup-default <rustup_default> Rustup default (stable|beta|nightly) [default: stable]
|
2018-01-09 21:18:11 +00:00
|
|
|
|
|
|
|
ARGS:
|
2019-10-17 19:50:23 +00:00
|
|
|
<command> cargo command that will be executed remotely
|
|
|
|
<remote options>... cargo options and flags that will be applied remotely
|
|
|
|
|
2018-01-09 21:18:11 +00:00
|
|
|
```
|
|
|
|
|
2018-01-04 22:02:30 +00:00
|
|
|
|
|
|
|
## How to install
|
|
|
|
```bash
|
|
|
|
git clone https://github.com/sgeisler/cargo-remote.git
|
|
|
|
cd cargo-remote
|
|
|
|
cargo install
|
2018-01-09 21:18:11 +00:00
|
|
|
```
|