We have a number of examples cases available, which demonstrate various features of Disnix. The example cases can be freely used under the MIT license and obtained through the download page.

Deploying in heterogeneous networks

There are various ways to try these examples. The first option is to deploy the system in a heterogeneous network, which also takes the most effort. This requires you to manually install a network of machines, configure system services (such as a DBMS and web server), install Disnix and to write an infrastructure model matching the properties of the systems in the network.

Services in a heterogeneous network can be deployed by running:

$ disnix-env -s services.nix -i infrastructure.nix -d distribution.nix

Deploying in a NixOS network using NixOps

Another option is to install a network of NixOS machines running the Disnix service. The DisnixOS extension can be used to automatically upgrade the underlying infrastructure to support the services.

With the following command you can use NixOps to deploy a network of VirtualBox machines, and deploy the services with Disnix to them:

$ nixops create ./network.nix ./network-virtualbox.nix -d vbox
$ nixops deploy -d vbox
$ export NIXOPS_DEPLOYMENT=vbox
$ disnixos-env -s services.nix -n network.nix -d distribution.nix --use-nixops

Deploying in a NixOS network with the NixOS test driver

The most convenient way of trying these examples, is by using the NixOS test driver integration feature of DisnixOS. This tool can be used on any Linux distribution (not just NixOS) using the Nix package manager and KVM. It will automatically generate a network running NixOS instances.

Running the following command automatically generates a network of QEMU virtual machines and deploys the services inside them:

$ disnixos-vm-env -s services.nix -n network.nix -d distribution.nix

Examples

Currently, we have the following example systems available:

StaffTracker (PHP/MySQL version)

This example is a PHP/MySQL web application system to manage staff of a university department. The system is composed of various databases; one to store zip codes, another to store room numbers and one to store the staff members. A PHP web application front-end allows users to view and modify staff members.

StaffTracker (Web services version)

A more complex variant of the previous example implemented in Java. In this variant access to the databases is provided by web services. Moreover, a Geolocation service is included using GeoIP to determine a staff members' location from an IP address.

StaffTracker.NET (Web services version)

A port of the previous web services example to .NET technologies, such as C#, WCF, ADO.NET and SQL server.

ViewVC

A system running ViewVC, a web-based CVS and Subversion repository viewer. In this example we automatically deploy the ViewVC web application front-end, a MySQL database storing commit records, and an arbitrary number of Subversion repositories.

Hello World example

A trivial example composed of web services, which show various ways to combine services together. In this example four different compositions are shown, such as a dynamic variant using a lookup service and a load balancer. This example can be used as a reference for designing services and to make them better deployable.

Disnix proxy example

A trivial example composed of two processes communicating with other through a TCP socket. A proxy can be used to drain connections during the upgrade phase, which makes the upgrade process completely atomic.

Virtual hosts example

An example that delegates requests per virtual hosts to specific web applications hosted on a machine. It uses target-specific services to optimize the deployment process.