Skip to content
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

Rename deploy-rs to yeet #110

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: deploy-rs
Upstream-Name: yeet
Upstream-Contact: Serokell <https://serokell.io/>
Source: https://github.com/serokell/deploy-rs
Source: https://github.com/serokell/yeet

# Sample paragraph, commented out:
#
Expand Down
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MPL-2.0

[package]
name = "deploy-rs"
name = "yeet"
version = "0.1.0"
authors = ["notgne2 <[email protected]>", "Serokell <[email protected]>"]
edition = "2018"
Expand All @@ -30,10 +30,10 @@ yn = "0.1"

# smol_str is required by rnix, but 0.1.17 doesn't build on rustc
# 1.45.2 (shipped in nixos-20.09); it requires rustc 1.46.0. See
# <https://github.com/serokell/deploy-rs/issues/27>:
# <https://github.com/serokell/yeet/issues/27>:
smol_str = "=0.1.16"


[lib]
name = "deploy"
name = "yeet"
path = "src/lib.rs"
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,42 @@ SPDX-FileCopyrightText: 2021 Yannik Sander <[email protected]>
SPDX-License-Identifier: MPL-2.0
-->

![deploy-rs logo](./docs/logo.svg "deploy-rs")
![yeet logo](./docs/logo.svg "yeet")

---

A Simple, multi-profile Nix-flake deploy tool.

Questions? Need help? Join us on Matrix: [`#deploy-rs:matrix.org`](https://matrix.to/#/#deploy-rs:matrix.org)
Questions? Need help? Join us on Matrix: [`#yeet:nixos.org`](https://matrix.to/#/#yeet:nixos.org)

## Usage

Basic usage: `deploy [options] <flake>`.
Basic usage: `yeet [options] <flake>`.

Using this method all profiles specified in the given `<flake>` will be deployed (taking into account the [`profilesOrder`](#node)).

Optionally the flake can be constrained to deploy just a single node (`my-flake#my-node`) or a profile (`my-flake#my-node.my-profile`).

If your profile or node name has a . in it, simply wrap it in quotes, and the flake path in quotes (to avoid shell escaping), for example 'my-flake."myserver.com".system'.

Any "extra" arguments will be passed into the Nix calls, so for instance to deploy an impure profile, you may use `deploy . -- --impure` (note the explicit flake path is necessary for doing this).
Any "extra" arguments will be passed into the Nix calls, so for instance to deploy an impure profile, you may use `yeet . -- --impure` (note the explicit flake path is necessary for doing this).

You can try out this tool easily with `nix run`:
- `nix run github:serokell/deploy-rs your-flake`
- `nix run github:serokell/yeet your-flake`

In you want to deploy multiple flakes or a subset of profiles with one invocation, instead of calling `deploy <flake>` you can issue `deploy --targets <flake> [<flake> ...]` where `<flake>` is supposed to take the same format as discussed before.
In you want to deploy multiple flakes or a subset of profiles with one invocation, instead of calling `yeet <flake>` you can issue `yeet --targets <flake> [<flake> ...]` where `<flake>` is supposed to take the same format as discussed before.

Running in this mode, if any of the deploys fails, the deploy will be aborted and all successful deploys rolled back. `--rollback-succeeded false` can be used to override this behavior, otherwise the `auto-rollback` argument takes precedent.

If you require a signing key to push closures to your server, specify the path to it in the `LOCAL_KEY` environment variable.

Check out `deploy --help` for CLI flags! Remember to check there before making one-time changes to things like hostnames.
Check out `yeet --help` for CLI flags! Remember to check there before making one-time changes to things like hostnames.

There is also an `activate` binary though this should be ignored, it is only used internally (on the deployed system) and for testing/hacking purposes.

## Ideas

`deploy-rs` is a simple Rust program that will take a Nix flake and use it to deploy any of your defined profiles to your nodes. This is _strongly_ based off of [serokell/deploy](https://github.com/serokell/deploy), designed to replace it and expand upon it.
`yeet` is a simple Rust program that will take a Nix flake and use it to deploy any of your defined profiles to your nodes. This is _strongly_ based off of [serokell/deploy](https://github.com/serokell/deploy), designed to replace it and expand upon it.

### Multi-profile

Expand All @@ -54,48 +54,48 @@ There is a built-in feature to prevent you making changes that might render your

### Overall usage

`deploy-rs` is designed to be used with Nix flakes (this currently requires an unstable version of Nix to work with). There is a Flake-less mode of operation which will automatically be used if your available Nix version does not support flakes, however you will likely want to use a flake anyway, just with `flake-compat` (see [this wiki page](https://nixos.wiki/wiki/Flakes) for usage).
`yeet` is designed to be used with Nix flakes (this currently requires an unstable version of Nix to work with). There is a Flake-less mode of operation which will automatically be used if your available Nix version does not support flakes, however you will likely want to use a flake anyway, just with `flake-compat` (see [this wiki page](https://nixos.wiki/wiki/Flakes) for usage).

`deploy-rs` also outputs a `lib` attribute, with tools used to make your definitions simpler and safer, including `deploy-rs.lib.${system}.activate` (see later section "Profile"), and `deploy-rs.lib.${system}.deployChecks` which will let `nix flake check` ensure your deployment is defined correctly.
`yeet` also outputs a `lib` attribute, with tools used to make your definitions simpler and safer, including `yeet.lib.${system}.activate` (see later section "Profile"), and `yeet.lib.${system}.deployChecks` which will let `nix flake check` ensure your deployment is defined correctly.

There are full working deploy-rs Nix expressions in the [examples folder](./examples), and there is a JSON schema [here](./interface.json) which is used internally by the `deployChecks` mentioned above to validate your expressions.
There are full working yeet Nix expressions in the [examples folder](./examples), and there is a JSON schema [here](./interface.json) which is used internally by the `deployChecks` mentioned above to validate your expressions.

A basic example of a flake that works with `deploy-rs` and deploys a simple NixOS configuration could look like this
A basic example of a flake that works with `yeet` and deploys a simple NixOS configuration could look like this

```nix
{
description = "Deployment for my server cluster";

# For accessing `deploy-rs`'s utility Nix functions
inputs.deploy-rs.url = "github:serokell/deploy-rs";
# For accessing `yeet`'s utility Nix functions
inputs.yeet.url = "github:serokell/yeet";

outputs = { self, nixpkgs, deploy-rs }: {
outputs = { self, nixpkgs, yeet }: {
nixosConfigurations.some-random-system = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ ./some-random-system/configuration.nix ];
};

deploy.nodes.some-random-system.profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.some-random-system;
path = yeet.lib.x86_64-linux.activate.nixos self.nixosConfigurations.some-random-system;
};

# This is highly advised, and will prevent many possible mistakes
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) yeet.lib;
};
}
```

### Profile

This is the core of how `deploy-rs` was designed, any number of these can run on a node, as any user (see further down for specifying user information). If you want to mimic the behaviour of traditional tools like NixOps or Morph, try just defining one `profile` called `system`, as root, containing a nixosSystem, and you can even similarly use [home-manager](https://github.com/nix-community/home-manager) on any non-privileged user.
This is the core of how `yeet` was designed, any number of these can run on a node, as any user (see further down for specifying user information). If you want to mimic the behaviour of traditional tools like NixOps or Morph, try just defining one `profile` called `system`, as root, containing a nixosSystem, and you can even similarly use [home-manager](https://github.com/nix-community/home-manager) on any non-privileged user.

```nix
{
# A derivation containing your required software, and a script to activate it in `${path}/deploy-rs-activate`
# For ease of use, `deploy-rs` provides a function to easily add the required activation script to any derivation
# A derivation containing your required software, and a script to activate it in `${path}/yeet-activate`
# For ease of use, `yeet` provides a function to easily add the required activation script to any derivation
# Both the working directory and `$PROFILE` will point to `profilePath`
path = deploy-rs.lib.x86_64-linux.activate.custom pkgs.hello "./bin/hello";
path = yeet.lib.x86_64-linux.activate.custom pkgs.hello "./bin/hello";

# An optional path to where your profile should be installed to, this is useful if you want to use a common profile name across multiple users, but would have conflicts in your node's profile list.
# This will default to `"/nix/var/nix/profiles/$PROFILE_NAME` if `user` is root (see: generic options), and `/nix/var/nix/profiles/per-user/$USER/$PROFILE_NAME` if it is not.
Expand All @@ -115,7 +115,7 @@ This defines a single node/server, and the profiles you intend it to run.
hostname = "my.server.gov";

# An optional list containing the order you want profiles to be deployed.
# This will take effect whenever you run `deploy` without specifying a profile, causing it to deploy every profile automatically.
# This will take effect whenever you run `yeet` without specifying a profile, causing it to deploy every profile automatically.
# Any profiles not in this list will still be deployed (in an arbitrary order) after those which are listed
profilesOrder = [ "something" "system" ];

Expand Down Expand Up @@ -151,7 +151,7 @@ This is a set of options that can be put in any of the above definitions, with t

```nix
{
# This is the user that deploy-rs will use when connecting.
# This is the user that yeet will use when connecting.
# This will default to your own username if not specified anywhere
sshUser = "admin";

Expand All @@ -174,16 +174,16 @@ This is a set of options that can be put in any of the above definitions, with t
# This defaults to `true`
magicRollback = true;

# The path which deploy-rs will use for temporary files, this is currently only used by `magicRollback` to create an inotify watcher in for confirmations
# The path which yeet will use for temporary files, this is currently only used by `magicRollback` to create an inotify watcher in for confirmations
# If not specified, this will default to `/tmp`
# (if `magicRollback` is in use, this _must_ be writable by `user`)
tempPath = "/home/someuser/.deploy-rs";
tempPath = "/home/someuser/.yeet";
}
```

## About Serokell

deploy-rs is maintained and funded with ❤️ by [Serokell](https://serokell.io/).
yeet is maintained and funded with ❤️ by [Serokell](https://serokell.io/).
The names and logo for Serokell are trademark of Serokell OÜ.

We love open source software! See [our other projects](https://serokell.io/community?utm_source=github) or [hire us](https://serokell.io/hire-us?utm_source=github) to design, develop and grow your idea!
8 changes: 4 additions & 4 deletions examples/simple/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions examples/simple/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
{
description = "Deploy GNU hello to localhost";

inputs.deploy-rs.url = "github:serokell/deploy-rs";
inputs.yeet.url = "github:serokell/yeet";

outputs = { self, nixpkgs, deploy-rs }: {
outputs = { self, nixpkgs, yeet }: {
deploy.nodes.example = {
hostname = "localhost";
profiles.hello = {
user = "balsoft";
path = deploy-rs.lib.x86_64-linux.setActivate nixpkgs.legacyPackages.x86_64-linux.hello "./bin/hello";
path = yeet.lib.x86_64-linux.setActivate nixpkgs.legacyPackages.x86_64-linux.hello "./bin/hello";
};
};

checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) yeet.lib;
};
}
2 changes: 1 addition & 1 deletion examples/system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ This is an example of how to deploy a full nixos system with a separate user uni
1. Run bare system from `.#nixosConfigurations.bare`
- `nix build .#nixosConfigurations.bare.config.system.build.vm`
- `QEMU_NET_OPTS=hostfwd=tcp::2221-:22 ./result/bin/run-bare-system-vm`
2. `nix run github:serokell/deploy-rs`
2. `nix run github:serokell/yeet`
3. ???
4. PROFIT!!!
8 changes: 4 additions & 4 deletions examples/system/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions examples/system/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
{
description = "Deploy a full system with hello service as a separate profile";

inputs.deploy-rs.url = "github:serokell/deploy-rs";
inputs.yeet.url = "github:serokell/yeet";

outputs = { self, nixpkgs, deploy-rs }: {
outputs = { self, nixpkgs, yeet }: {
nixosConfigurations.example-nixos-system = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ ./configuration.nix ];
Expand All @@ -30,17 +30,17 @@
system = {
sshUser = "admin";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.example-nixos-system;
yeet.lib.x86_64-linux.activate.nixos self.nixosConfigurations.example-nixos-system;
user = "root";
};
hello = {
sshUser = "hello";
path = deploy-rs.lib.x86_64-linux.activate.custom self.defaultPackage.x86_64-linux "./bin/activate";
path = yeet.lib.x86_64-linux.activate.custom self.defaultPackage.x86_64-linux "./bin/activate";
user = "hello";
};
};
};

checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) yeet.lib;
};
}
Loading