-
Notifications
You must be signed in to change notification settings - Fork 62
Introduce thing-flinger
#534
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
793c082
Introduce `thing-flinger`
andrewjstone dd958e0
fix clippy
andrewjstone 8d4d4aa
some more fixes for review
andrewjstone ea613a6
branch update for testing
andrewjstone b4331af
Use $HOME instead of ~
andrewjstone d49618c
Fixes for review by Luqman
andrewjstone b07c3c2
slight update to comment in deployment-example.toml
andrewjstone 402d6d5
Merge branch 'main' into thing-flinger2
andrewjstone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| Omicron is a complex piece of software consisting of many build and install-time dependencies. It's | ||
| intended to run primarily on illumos based systems, and as such is built to use runtime facilities | ||
| of illumos, such as https://illumos.org/man/5/smf[SMF]. Furthermore, Omicron is fundamentally a | ||
| distributed system, with its components intended to run on multiple servers communicating over the | ||
| network. In order to secure the system, certain cryptographic primitives, such as asymmetric key | ||
| pairs and shared secrets are required. Due to the nature of these cryptographic primitives, there is | ||
| a requirement for the distribution or creation of files unique to a specific server, such that no | ||
| other server has access to those files. Examples of this are private keys, and threshold key | ||
| shares, although other non-cryptographic unique files may also become necessary over time. | ||
|
|
||
| In order to satisfy the above requirements of building and deploying a complex distributed system | ||
| consisting of unique, private files, two CLI tools have been created: | ||
|
|
||
| . link:src/bin/omicron-package.rs[omicron-package] - build, package, install on local machine | ||
| . link:src/bin/thing-flinger.rs[thing-flinger] - build, package, deploy to remote machines | ||
|
|
||
|
|
||
| If a user is working on their local illumos based machine, and only wants to run | ||
| omicron in single node mode, they should follow the install instruction in | ||
| the link:../README.adoc[Omicron README] and use `omicron-package`. If the user | ||
| wishes for a more complete workflow, where they can code on their local laptop, | ||
| use a remote build machine, and install to multiple machines for a more realistic | ||
| deployment, they should use `thing-flinger`. | ||
|
|
||
| The remainder of this document will describe a typical workflow for using | ||
| thing-flinger, pointing out room for improvement. | ||
|
|
||
| == Environment and Configuration | ||
|
|
||
|
|
||
| +------------------+ +------------------+ | ||
| | | | | | ||
| | | | | | ||
| | Client |----------------> Builder | | ||
| | | | | | ||
| | | | | | ||
| +------------------+ +------------------+ | ||
| | | ||
| | | ||
| | | ||
| | | ||
| +---------------------------+--------------------------+ | ||
| | | | | ||
| | | | | ||
| | | | | ||
| +--------v---------+ +---------v--------+ +---------v--------+ | ||
| | | | | | | | ||
| | | | | | | | ||
| | Deployed Server | | Deployed Server | | Deployed Server | | ||
| | | | | | | | ||
| | | | | | | | ||
| +------------------+ +------------------+ +------------------+ | ||
|
|
||
|
|
||
| `thing-flinger` defines three types of nodes: | ||
|
|
||
| * Client - Where a user typically edits their code and runs thing-flinger. This can run any OS. | ||
| * Builder - A Helios box where Omicron is built and packaged | ||
| * Deployed Server - Helios machines where Omicron will be installed and run | ||
|
|
||
| It's not at all necessary for these to be separate nodes. For example, a client and builder can be | ||
| the same machine, as long as it's a Helios box. Same goes for Builder and a deployment server. The | ||
| benefit of this separation though, is that it allows editing on something like a laptop, without | ||
| having to worry about setting up a development environment on an illumos based host. | ||
|
|
||
| Machine topology is configured in a `TOML` file that is passed on the command line. All illumos | ||
| machines are listed under `servers`, and just the names are used for configuring a builder and | ||
| deployment servers. An link:src/bin/deployment-example.toml[example] is provided. | ||
|
|
||
| Thing flinger works over SSH, and so the user must have the public key of their client configured | ||
| for their account on all servers. SSH agent forwarding is used to prevent the need for the keys of | ||
| the builder to also be on the other servers, thus minimizing needed server configuration. | ||
|
|
||
| == Typical Workflow | ||
|
|
||
| === Prerequisites | ||
|
|
||
| Ensure you have an account on all illumos boxes, with the client public key in | ||
| `~/.ssh/authorized_keys`. | ||
|
|
||
| .The build machine must have Rust and cargo installed, as well as | ||
| all the dependencies for Omicron installed. Following the *prerequisites* in the | ||
| https://github.com/oxidecomputer/omicron/#build-and-run[Build and run] section of the main Omicron | ||
| README is probably a good idea. | ||
|
|
||
| === Command Based Workflow | ||
|
|
||
| ==== Build thing-flinger on client | ||
| `thing-flinger` is part of the `omicron-package` crate. | ||
|
|
||
| `cargo build -p omicron-package` | ||
|
|
||
| ==== sync | ||
| Copy your source code to the builder. Note that this copies over your `.git` subdirectory on purpose so | ||
| that a branch can be configured for building with the `git_treeish` field in the toml `builder` | ||
| table. | ||
|
|
||
| `./target/debug/thing-flinger -c <CONFIG.toml> sync` | ||
|
|
||
| ==== build-minimal | ||
| Build necessary parts of omicron on the builder, required for future use by thing-flinger. | ||
|
|
||
| `./target/debug/thing-flinger -c <CONFIG> build-minimal` | ||
|
|
||
| ==== package | ||
| Build and package omicron using `omicron-package` on the builder. | ||
|
|
||
| `./target/debug/thing-flinger -c <CONFIG> package` | ||
|
|
||
| ==== overlay | ||
| Create files that are unique to each deployment server. | ||
|
|
||
| `./target/debug/thing-flinger -c <CONFIG> overlay` | ||
|
|
||
| ==== install | ||
| Install omicron to all machines, in parallel. This consists of copying the packaged omicron tarballs | ||
| along with overlay files, and omicron-package and its manifest to a `staging` directory on each | ||
| deployment server, and then running omicron-package, installing overlay files, and restarting | ||
| services. | ||
|
|
||
| `./target/debug/thing-flinger -c <CONFIG> install` | ||
|
|
||
| === Current Limitations | ||
|
|
||
| `thing-flinger` is an early prototype. It has served so far to demonstrate that unique files, | ||
| specifically secret shares, can be created and distributed over ssh, and that omicron can be | ||
| installed remotely using `omicron-package`. It is not currently complete enough to fully test a | ||
| distributed omicron setup, as the underlying dependencies are not configured yet. Specifically, | ||
| `CockroachDB` and perhaps `Clickhouse`, need to be configured to run in multiple server mode. It's | ||
| anticipated that the `overlay` feature of `thing-flinger` can be used to generate and distribute | ||
| configs for this. | ||
|
|
||
| === Design rationale | ||
|
|
||
| `thing-flinger` is a command line program written in rust. It was written this way to build upon | ||
| `omicron-package`, which is also in rust, as that is our default language of choice at Oxide. | ||
| `thing-flinger` is based around SSH, as that is the minimal viable requirement for a test tool such | ||
| as this. Additionally, it provides for the most straightforward implementation, and takes the least | ||
| effort to use securely. This particular implementation wraps the openssh ssh client via | ||
| `std::process::Command`, rather than using the `ssh2` crate, because ssh2, as a wrapper around | ||
| `libssh`, does not support agent-forwarding. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # This manifest describes the servers that omicron will be installed to, along | ||
| # with any ancillary information specific to a given server. | ||
| # | ||
| # It is ingested by the `thing-flinger` tool. | ||
|
|
||
| # This must be an absolute path | ||
| local_source = "/Users/ajs/oxide/omicron" | ||
|
|
||
| [builder] | ||
| # `server` must refer to one of the `servers` in the servers table | ||
| server = "atrium" | ||
|
|
||
| # This must be an absolute path | ||
| omicron_path = "/home/andrew/oxide/omicron" | ||
|
|
||
| # Git branch, sha, etc... | ||
| git_treeish = "thing-flinger2" | ||
|
|
||
| [deployment] | ||
| servers = ["sock", "buskin"] | ||
| rack_secret_threshold = 2 | ||
|
|
||
| # Location where files to install will be placed before running | ||
| # `omicron-package install` | ||
| # | ||
| # This must be an absolute path | ||
| # We specifically allow for $HOME in validating the absolute path | ||
| staging_dir = "$HOME/omicron_staging" | ||
|
|
||
| [servers.tarz] | ||
| username = "ajs" | ||
| addr = "tarz.local" | ||
|
|
||
| [servers.atrium] | ||
| username = "andrew" | ||
| addr = "atrium.eng.oxide.computer" | ||
|
|
||
| [servers.sock] | ||
| username = "andrew" | ||
| addr = "sock.eng.oxide.computer" | ||
|
|
||
| [servers.buskin] | ||
| username = "andrew" | ||
| addr = "buskin.eng.oxide.computer" | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.