All Projects → rafikk → Nix Aurora

rafikk / Nix Aurora

Nix on Aurora on Mesos

Labels

Projects that are alternatives of or similar to Nix Aurora

Marathon Lb
Marathon-lb is a service discovery & load balancing tool for DC/OS
Stars: ✭ 449 (+7383.33%)
Mutual labels:  mesos
Go Health
Library for enabling asynchronous health checks in your service
Stars: ✭ 588 (+9700%)
Mutual labels:  mesos
Nix Darwin
nix modules for darwin
Stars: ✭ 700 (+11566.67%)
Mutual labels:  nix
Mesos
Apache Mesos
Stars: ✭ 4,824 (+80300%)
Mutual labels:  mesos
Mesos Go
Go language bindings for Apache Mesos
Stars: ✭ 550 (+9066.67%)
Mutual labels:  mesos
Dotfiles
Zsh, Karabiner, VS Code, Sublime, Neovim, Nix
Stars: ✭ 634 (+10466.67%)
Mutual labels:  nix
Ansible Playbooks
Ansible playbook collection that have been written for Ubuntu. Some of the playbooks are Elasticsearch, Mesos, AWS, MySql, Sensu, Nginx etc..
Stars: ✭ 429 (+7050%)
Mutual labels:  mesos
Nixpkgs
Nix Packages collection
Stars: ✭ 8,322 (+138600%)
Mutual labels:  nix
Hnix
A Haskell re-implementation of the Nix expression language
Stars: ✭ 573 (+9450%)
Mutual labels:  nix
Simple Twitter
A bare-bones Twitter clone implemented in a single file
Stars: ✭ 698 (+11533.33%)
Mutual labels:  nix
Awesome Mesos
Everything about Apache Mesos
Stars: ✭ 532 (+8766.67%)
Mutual labels:  mesos
Scope
Monitoring, visualisation & management for Docker & Kubernetes
Stars: ✭ 5,247 (+87350%)
Mutual labels:  mesos
Niv
Easy dependency management for Nix projects
Stars: ✭ 669 (+11050%)
Mutual labels:  nix
Chronos
Fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules
Stars: ✭ 4,303 (+71616.67%)
Mutual labels:  mesos
Toil
A scalable, efficient, cross-platform (Linux/macOS) and easy-to-use workflow engine in pure Python.
Stars: ✭ 733 (+12116.67%)
Mutual labels:  mesos
Nix
Nix, the purely functional package manager
Stars: ✭ 5,291 (+88083.33%)
Mutual labels:  nix
Reflex Platform
A curated package set and set of tools that let you build Haskell packages so they can run on a variety of platforms. reflex-platform is built on top of the nix package manager.
Stars: ✭ 602 (+9933.33%)
Mutual labels:  nix
Nix Config
My Nix configuration files
Stars: ✭ 5 (-16.67%)
Mutual labels:  nix
Singularity
Scheduler (HTTP API and webapp) for running Mesos tasks—long running processes, one-off tasks, and scheduled jobs. #hubspot-open-source
Stars: ✭ 793 (+13116.67%)
Mutual labels:  mesos
Fractalide
Reusable Reproducible Composable Software
Stars: ✭ 670 (+11066.67%)
Mutual labels:  nix

nix-aurora

This repo is a proof-of-concept for integrating Apache Aurora with the Nix expression language, package manager, and build system.

What's the idea?

The idea is to define Aurora job configurations using Nix expressions. Each Nix expression defines a single Aurora Job (using the typical Task/Process/Constraint/Resources/etc. schema) where the build result is a JSON configuration file that can be passed to the Aurora CLI. Since the job is defined and built using Nix, all referenced packages and dependencies are built transparently. This means you can avoid defining extra processes for versioning and initialization. If your process depends on a software package, simply reference the package in cmdline and Nix will build the package and provide a reference to the dependency in the Nix store. For example, if you want to run an Nginx process, you can create a process with cmdline = "${pkgs.nginx}/bin/nginx ...". When the job is built, Nix will build Nginx and interpolate the path into the configuration. Further, since the Nix store path is composed of a cryptographic hash of the package and its dependencies, updating a package automatically updates the configuration, so you can avoid versioning "tricks". Any time a dependency is changed, the config is changed.

How does this work?

An Aurora job is composed of a Task which consists of one or more Processes. In addition to building the Job as a Nix derivation, every Process is also built as a Nix derivation (the output is a bash script with cmdline as its contents). The JSON configuration creates an "init" process for each Process specified in the Job which ensures this bash script exists in the Nix store. Since referenced packages are dependencies of the Process derivation, those packages then also exist in the Nix store. The configuration then adds a Constraint for each process that ensures its init process completes before the corresponding Process is launched.

Steps to run

  1. Start the Aurora Vagrant VM. Directions here.
  2. Install Nix using curl https://nixos.org/nix/install | sh and source /home/vagrant/.nix-profile/etc/profile.d/nix.sh
  3. git clone https://github.com/rafikk/nix-aurora.git
  4. Run aurora job create --read-json devcluster/vagrant/devel/hello_world $(nix-build --no-out-link examples/hello_world) to start the job

If you would just like to see the JSON configuration, install Nix and run cat $(nix-build ./nix-aurora/examples/hello_world --no-out-link) | python -m json.tool. Here's the output running on my Mac laptop:

{
    "cluster": "devcluster",
    "environment": "devel",
    "name": "hello_world",
    "role": "vagrant",
    "service": true,
    "task": {
        "constraints": [
            {
                "order": [
                    "nix_init_hello_world",
                    "hello_world"
                ]
            }
        ],
        "name": "hello_world",
        "processes": [
            {
                "cmdline": ". /home/vagrant/.nix-profile/etc/profile.d/nix.sh\nnix-store --add-root .gc/hello_world --indirect -r /nix/store/4c6z04825b9a49vlsp2mk0rg19ybyd5f-aurora-process-devcluster-vagrant-devel-hello_world-hello_world\n",
                "name": "nix_init_hello_world"
            },
            {
                "cmdline": "/nix/store/q41nkp3p684xyjlnv02f8hnid234z4n8-python-2.7.10/bin/python2.7 /nix/store/53fxpfg3nkkjvzfvh54r8ccms2b3l7iz-hello_world.py/hello_world.py",
                "name": "hello_world"
            }
        ],
        "resources": {
            "cpu": 1,
            "disk": 8388608,
            "ram": 1048576
        }
    }
}

Limitations

  1. Currently this only works on a single-node Vagrant cluster. In order to run this on a multi-node production cluster, Nix must be running in multi-user daemon mode, and a binary cache (or another distribution mechanism) would be required.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].