aboutsummaryrefslogtreecommitdiff
path: root/src/bin/activate.rs (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-12-11[#245] Return non-zero exit code in case of confirmation timeoutRoman Melnikov1-23/+9
Problem: When profile activation confirmation fails due to confirmation timeout and performs a rollback, zero exit code is returned. Such a behavior is confusing since rollback usually means something went wrong during deployment and it shouldn't return successful exit code. Solution: Explicitly return confirmation waiting error instead of printing it and silently signalizing success.
2023-11-02[Chore] Make activation wait timeout configurableRoman Melnikov1-3/+7
Problem: Currently profile activation waiting timeout is hardcoded to 240 seconds, see https://github.com/serokell/deploy-rs/pull/48. In some cases, this timeout can be exceeded (e.g. activation performs a heavy DB migration and waits for it to finish before considering the profile activation succesful). Solution: Make this timeout configurable via 'activationTimeout' deploy attribute or corresponding '--activation-timeout' CLI option. For the sake of backward compatibility, the new 'wait' subcommand '--activation-timeout' option is made optional and defaults to 240 seconds if it wasn't provided.
2023-09-12[#201] Deduce profile directory during activationRoman Melnikov1-13/+97
Problem: Since https://github.com/NixOS/nix/pull/5226 nix profiles for users are stored in 'XDG_STATE_HOME' or 'HOME' directory. However, 'deploy-rs' still expects profiles to be present in '/nix/var/nix/profiles/per-user'. As a result, an attempt to deploy a profile with newer nix may fail with an error about non-existing files. Solution: Instead of deducing the profile path prior to ssh'ing and actual activation, deduce the path to the profile during as a part of 'activate-rs' invocation. Now if the profile path is not specified explicitly as an attribute in profile within the deploy flake, the path to the profile is determined based on the user to which the profile belongs and on the values of 'XDG_STATE_HOME' and 'HOME' variables. Additionally, if the old profile directory (in '/nix/var/nix/profiles/per-user') for a given user already exists, it is used instead for the sake of backward compatibility.
2023-04-20[Chore] Handle 'temp_path' as an actual 'Path' instead of 'String'Roman Melnikov1-11/+16
Problem: 'temp_path' and 'lock_path' are handled as 'String'. This can be a problem when the 'temp_path' directory is a symlink on the target system, e.g. this is the case with the default '/tmp' and macOS, where this directory is actually a symlink to '/private/tmp'. Solution: Handle 'temp_path' and 'lock_path' as actual Paths. Also, canonicalize 'temp_path' to avoid canary file path mismatches when checking filesystem events. As a side effect, also update the 'notify' dependency to the latest stable version.
2022-10-09Add new activation strategy `boot` as equivalent to `nixos-rebuild boot`Maximilian Bosch1-1/+8
This can be useful when e.g. deploying a kernel update to a target host. You usually plan a reboot (or kexec) after that to activate the new kernel. However you don't want to wait for services to be restarted first since these will be "restarted" anyways on the reboot. In cases like GitLab or the Atlassian stack this actually makes a difference. This patch changes the following things: * If `--boot` is provided, `nix-env -p profile-to-activate --set` is called for each deployed profile to make sure that it is activated automatically after a reboot. * However, the actual activation (e.g. `switch-to-configuration switch`) is skipped. Instead: * For NixOS, `switch-to-configuration boot` is called to set the new profile as default in the bootloader. * For everything else, nothing else is done. The profile is already the new default (and thus picked up on the next boot).
2021-08-12General code cleanupnotgne21-48/+40
2021-06-22Cargo fmtAlexander Bantyev1-1/+5
2021-06-22Add multi node supportYannik Sander1-6/+34
Run multiple deployments in sequence Resolve targets later Extend context by deployed flake Apply clippy suggestions Add revoke command builder Track succeeded deploys Add revoke function Register revoke error as deploy error Prepare revoke command in activate Extend logger to handle revoke Implement revoke command client side Run revoke on previously suceeded Control whether to override by flag Adhere profile configuration auto_rollback setting Cargo fmt Correctly provide profile path to activation script when revoking Document multi flake mode in README Resolve a typo in README.md Co-authored-by: notgne2 <gen2@gen2.space> Use existing teminology rename revoke_suceeded -> rollback_suceeded Use more open CLI argument name `targets` instead of `flakes` Document name changes in README Add sudo command support for revokes Call run_deploy with `dry_active` flag Test revoke commands contains sudo Set default temp_path in activate binary Require temp_path for wait and activate subcommands Add copyright comment Address review change requests Fix typo in README Co-authored-by: Alexander Bantyev <balsoft@balsoft.ru>
2021-04-30Use correct path to `deploy-rs-activate` binary when using `dry_activate`notgne21-3/+5
Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
2021-04-16Apply notgne2 suggestions.Oleg Pykhalov1-2/+2
2021-04-07Add dry activate argument.Oleg Pykhalov1-42/+53
2021-01-26changed: remove 2015-style extern crateBernardo Meurer1-4/+1
2021-01-08Fix trivial lint issuesnotgne21-2/+1
2021-01-08Restructure projectnotgne21-9/+9
2020-12-30Modify activation logic to keep SSH connection alive for magic-rollback and ↵notgne21-41/+141
avoid forking or disconnecting std{out,err}
2020-12-27Fix log dir/file mismatchnotgne21-1/+1
2020-12-27Use error log macro more in activate.rsnotgne21-7/+3
2020-12-27Replace logger, add more logging options including filesnotgne21-7/+9
2020-12-15Simplify the types involved a littleAndreas Fuchs1-4/+4
The cursed match is still cursed, but at least we're not sending useless data across channels anymore.
2020-12-15Use notify crate to learn about deletion of the activation sentinelAndreas Fuchs1-33/+39
We should now be able to deploy to non-Linux systems, and build all the required binaries too.
2020-11-22Use `/tmp` as temp directory, not `/tmp/deploy-rs` (resolves #8 by deprecation)notgne21-1/+1
2020-11-21fixup! Check auto-rollback flag before deactivatingChristian Höppner1-3/+1
2020-11-21Check auto-rollback flag before deactivatingChristian Höppner1-4/+12
2020-11-07Remove bootstrapnotgne21-43/+0
2020-11-07Unmute some more outputs, document the remaining mutesnotgne21-7/+0
2020-11-02Mildly improve loggingnotgne21-1/+2
2020-10-30Tweak error messages a littlenotgne21-1/+1
2020-10-29Remove last remaining inappropriate panicsnotgne21-6/+29
2020-10-29Make all the errors work correctly (I am so so sorry)notgne21-91/+172
2020-10-29Make lock hash clearer (at apparently no expense)notgne21-1/+1
2020-10-29Set correct author on activate binarynotgne21-2/+5
2020-10-25Fail correctly if initial activation failsnotgne21-6/+8
2020-10-13Clean up some CLI arguments, make magic rollback optionalnotgne21-11/+28
2020-10-13Auto rollback if deployment is not confirmednotgne21-72/+173
2020-10-11Set working directory during activation to the profile pathnotgne21-0/+2
2020-10-11Move activate script location, use buildEnv for setActivatenotgne21-2/+2
2020-10-02General improvements, deprecate `activate` profile option in favor of ↵notgne21-86/+82
executing $PROFILE/activate (Wrap It Yourself) to ensure successful rollback activations
2020-10-01Handle more command exits correctlynotgne21-10/+29
2020-09-29Add license information, reformat Nix files, clean upnotgne21-0/+4
2020-09-29Move all activation logic to activate.rs (the unused warnings got annoying)notgne21-1/+109
2020-09-28use separate binary for activation, more cleanupnotgne21-0/+54