Disnix is a distributed deployment extension for Nix, a purely functional package manager.
Nix has various advantages over conventional package managers, such as the option to install multiple versions or variants of components safely next to each other, a declarative language to specify how to build a component, support for complete dependencies and atomic upgrades and rollbacks.
Disnix reuses the Nix package manager for local deployment and extends the deployment concepts to distributed systems.
Like the standard Nix deployment system, Disnix uses the Nix expression language, which is used to write specifications for the deployment of distributed systems.
Disnix requires three models each capturing a specific concern in deploying a distributed system. The services model is used for specifying the components of a distributed system and its inter-dependencies. The infrastructure model is used for specifying the network of machines and their relevant properties. The distribution model is used to map services to machines in the network.
The standard Nix package manager ensures that package dependency specifications are complete on a single system, i.e. intra-dependencies. Components of a distributed system may have dependencies on other components running of different machines in the network, i.e. inter-dependencies.
Disnix also allows you to specify inter-dependencies of distributed system components, which can be used to compose distributed system components into a complete system. If a certain service has an inter-dependency on a different service, and the dependency is missing, Disnix will notice this before deploying the system.
Moreover, Disnix uses inter-dependency specifcations for the installation or upgrade process of a distributed system to ensure that every service is activated or deactivated in the right order and that the system will not fail due to a missing inter-dependency or a broken inter-dependency relationship.
Like the standard Nix package manager, which support atomic upgrades, Disnix uses a two-phase commit variant mapped onto Nix deployment operations to upgrade a distributed system atomically. Since the Nix package manager always stores components next to each other in a Nix store and never overwrites existing files, upgrading a distributed system is also very safe and we can almost always perform a rollback.
The only impure step involved in upgrading is the activation of obsolete services and activation of newly installed services, a phase in which users may observe that the system is changing. To make this process truly atomic, Disnix has an extension mechanism that can be used to temporary queue/block incoming connections until the transition is finished. We developed a simple example with stateful TCP connections to demonstrate this.
Like the standard Nix package manager, Disnix also provides a garbage collector, which safely removes all obsolete components from the machines in the network.
Disnix is, like Nix, supported on several platforms including most Unix flavours such as Linux, FreeBSD, OpenBSD and Mac OS X. It is also supported on Windows using Cygwin.
Except for the portability of Disnix itself, Disnix also allows a user to deploy a distributed system into a heterogeneous network (i.e. a network consisting of various types of machines, running different operating systems). Disnix reuses Nix to automatically build a component for the given target platform.
Since distributed systems can be deployed in heterogeneous networks consisting of various platforms and using various communication protocols, and distributed system components can have basically any form, not all operations can be solved in a generic manner. The architecture of Disnix is therefore very modular and provides a plugin architecture which can be used to integrate custom developed components used for the activation and deactivation of services, and a custom plugin that provides access to deployment operations through a specific interfaces.
Currently, Disnix includes a SSH wrapper which can be used to access remote machines through a SSH connection. A seperate extension that uses SOAP + MTOM is also available. A custom extension can be developed trivially.
Disnix is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. Disnix is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.