MyNixOS website logo
Description

A service for pull-based continuous deployment based on hydra.

Point hail to a hydra job, set up your nix-daemon to pull from your hydra's cache, and hail will automatically pull the latest results from the job and activate them. See the README for more details.

hail

A service for pull-based continuous deployment based on hydra

Usage

hail --profile PROFILE --job-uri HYDRA_JOB_URI

Optional flags:

  • --netrc-file NETRC_FILE The path to a netrc file specifying credentials for the hydra HTTP access. Defaults to /etc/netrc if it exists.
  • --poll-period PERIOD The period with which to poll the job, in minutes (default: 5)
  • --oneshot Just update once, rather than in a loop.

hail assumes that the nix available in its PATH is set up to pull from its hydra's binary cache.

Operation

hail will regularly poll the latest successful build of the provided HYDRA_JOB_URI. When it changes, it will update /nix/var/nix/profiles/PROFILE to point to the new build and run /nix/var/nix/profiles/PROFILE/bin/activate

If there is already a path at /nix/var/nix/profiles/PROFILE when hail starts up, it will run the activate program immediately.

Step-by-step

  1. Create a hydra jobset with a job that creates the profile for the service in question. The profile should have a program at bin/activate that:
    • Sets up everything needed for the service to run (e.g. adding systemd/init.d services, initializing dbs if needed, etc)
    • Is idempotent
    • Can detect if there is a previous version of the service running and switch as atomically as possible
  2. Set up your nix config to pull from your hydra's binary cache.
  3. Run hail on all machines that should run the latest version of that service (see Bootstrapping)
  4. Enjoy

Bootstrapping

If there are multiple services each managed independently with hail, you probably want to have those hail instances themselves managed by a manager hail instance. See hail-systemd-bootstrap.nix for a way to achieve this on systemd-based systems.

Future work

  • Error reporting in a monitorable way
  • Handle the case where we don't want to update until all of a jobset succeeds
  • Native haskell client to talk to the nix daemon
  • Proper handling of manually-initiated rollbacks etc.
  • Libraries/templates for easily deploying new services
  • A good blue-greening story
  • Handle service removal
  • Incorporate with distro-agnostic service runner.
Metadata

Version

0.2.0.0

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows