SlideShare a Scribd company logo
Deploying .NET applications with the Nix package
manager
Sander van der Burg
Delft University of Technology, EEMCS,
Department of Software Technology
Philips Healthcare, Philips Informatics Infrastructure (PII),
Best
June 15, 2010
Sander van der Burg Deploying .NET applications with the Nix package manager
Nix deployment system
Nix is a package manager, with some distinct features:
Stores components in isolation from each other
Allows using multiple variants/versions safely next to each
other
Builds components from declarative specifications
Reproducibility
Supports atomic upgrades and rollbacks
Garbage collection
Safely removes obsolete components
Sander van der Burg Deploying .NET applications with the Nix package manager
Nix deployment system
About 2500 open-source/free software packages are supported
(Nixpkgs)
Used as a basis for the NixOS GNU/Linux distribution
Sander van der Burg Deploying .NET applications with the Nix package manager
Hydra
Continuous build & integration server
Built upon the Nix package manager
Used at TU Delft for building, integration and testing of
several projects on multiple platforms
Sander van der Burg Deploying .NET applications with the Nix package manager
Disnix
Distributed deployment extension for Nix
Manages inter-dependencies
Builds, distributes, activates services in a network of machines
Sander van der Burg Deploying .NET applications with the Nix package manager
The Nix store
All components are stored in isolation in a Nix store
In Nix every component name consists of a hash code and
component name:
/nix/store/30v58jznlaxnr4bca3hiz64wlb43mgpx-hello-2.5
Hash is generated from all the input arguments of the build
function: compilers, libraries, build scripts etc.
Multiple variants/versions can be kept safely next to each
other
Can be used for any type of component
Sander van der Burg Deploying .NET applications with the Nix package manager
The Nix store
/nix/store
44ef921582e840dae...-glibc-2.9
lib
libc.so
a1v58jz2la6nr7bcr...-glibc-2.11.1
lib
libc.so
30v58jznlaxnr4bca...-hello-2.5
bin
hello
0a4d829298227c98c...-hello-2.5
bin
hello
Sander van der Burg Deploying .NET applications with the Nix package manager
Global Assembly Cache (GAC)
.NET Global Assembly Cache (GAC) only supports strong-named
library assemblies (DLLs):
Other types of components are not supported (executables,
native DLLs, compilers)
Strong name is created from name, version, culture and
signing with a public-private key pair
Creating strong-names is sometimes painful
Possible to produce a different assembly with same
strong-name
Sander van der Burg Deploying .NET applications with the Nix package manager
Nix expressions
{stdenv, fetchurl}:
stdenv.mkDerivation {
name = "hello-2.5";
src = fetchurl {
url = ftp://ftp.gnu.org/gnu/hello/hello-2.5.tar.gz;
sha256 = "0in467phypnis2ify1gkmvc5l2fxyz3s4xss7g74gwk279ylm4r2";
};
meta = {
description = "A program that produces a familiar, friendly greeting";
homepage = http://www.gnu.org/software/hello/manual/;
license = "GPLv3+";
};
}
Specifies how the hello component should be built.
Sander van der Burg Deploying .NET applications with the Nix package manager
Nix expressions
rec {
stdenv = ...
curl = ...
openssl = ...
fetchurl = import ../build-support/fetchurl {
inherit curl openssl;
};
hello = import ../applications/misc/hello {
inherit stdenv fetchurl;
};
}
The hello build function is called with its arguments
Sander van der Burg Deploying .NET applications with the Nix package manager
Nix expressions
To build the Hello package:
$ nix-build all-packages.nix -A hello
Will recursively build hello and its dependencies and produces hello
in:
/nix/store/30v58jznlaxnr4bca3hiz64wlb43mgpx-hello-2.5
Sander van der Burg Deploying .NET applications with the Nix package manager
Runtime dependencies
Nix detects runtime dependencies of a build
Nix scans all files of a component for hash-codes of a
dependency, e.g. RPATH defined in a ELF header
Uses a notion of closures to guarantee completeness:
If a specific component needs to be deployed, all its runtime
dependencies are deployed first
Sander van der Burg Deploying .NET applications with the Nix package manager
Runtime dependencies
/nix/store
44ef921582e840dae...-glibc-2.9
lib
libc.so
a1v58jz2la6nr7bcr...-glibc-2.11.1
lib
libc.so
30v58jznlaxnr4bca...-hello-2.5
bin
hello
0a4d829298227c98c...-hello-2.5
bin
hello
Sander van der Burg Deploying .NET applications with the Nix package manager
Supporting .NET applications with Nix
Nix is designed for use on UNIX like systems, e.g. GNU/Linux,
FreeBSD, Mac OS X
Sander van der Burg Deploying .NET applications with the Nix package manager
Requirements
Buildtime support:
Compile Visual Studio solutions and produce assemblies
Invoke MSBuild.exe with right parameters
The build process must find its buildtime dependencies
Runtime support:
Assemblies must find its runtime dependencies
Integrate .NET CLR dependency resolver with Nix
Sander van der Burg Deploying .NET applications with the Nix package manager
Windows support
Nix is supported on Windows through Cygwin:
Offers UNIX implementation on top of Windows
Allows combining UNIX and Windows utilities
Sander van der Burg Deploying .NET applications with the Nix package manager
Windows support
Several Cygwin utilities map Windows concepts to UNIX concepts
and vica versa:
Can be used to glue UNIX tooling to Windows processes
cygpath, UNIX path names <=> Windows path names
Sander van der Burg Deploying .NET applications with the Nix package manager
Implementing build support
A .NET Nix build function dotnetenv.buildSolution is
implemented:
Takes source code of a Visual Studio C# solution
Produces output of the solution into a unique store path,
based on the input arguments of this function
Sander van der Burg Deploying .NET applications with the Nix package manager
Build function implementation
{stdenv, dotnetfx}:
{ name, src, slnFile, targets ? "ReBuild"
, options ? "/p:Configuration=Debug;Platform=Win32"
, assemblyInputs ? []
}:
stdenv.mkDerivation {
inherit name src;
buildInputs = [ dotnetfx ];
installPhase = ’’
for i in ${toString assemblyInputs}; do
windowsPath=$(cygpath --windows $i)
AssemblySearchPaths="$AssemblySearchPaths;$windowsPath"
done
export AssemblySearchPaths
ensureDir $out
outPath=$(cygpath --windows $out)
MSBuild.exe ${slnFile} /nologo /t:${targets} 
/p:OutputPath=$outPath ${options} ...
’’;
}
Sander van der Burg Deploying .NET applications with the Nix package manager
Example usage
{dotnetenv, MyAssembly1, MyAssembly2}:
dotnetenv.buildSolution {
name = "My.Test.Assembly";
src = /path/to/source/code;
slnFile = "Assembly.sln";
assemblyInputs = [
dotnetenv.assembly20Path
MyAssembly1
MyAssembly2
];
}
Specifies how a Visual Studio solution should be built.
Sander van der Burg Deploying .NET applications with the Nix package manager
Example usage
rec {
dotnetfx = ...
stdenv = ...
dotnetenv = import ../dotnetenv {
inherit stdenv dotnetfx;
};
MyAssembly1 = import ../MyAssembly1 {
inherit dotnetenv;
};
MyAssembly2 = import ../MyAssembly1 {
inherit dotnetenv;
};
MyTestAssembly = import ../MyTestAssembly {
inherit dotnetenv MyAssembly1 MyAssembly2;
};
}
The MyTestAssembly function is called with its arguments
Sander van der Burg Deploying .NET applications with the Nix package manager
Example usage
To build the My.Test.Assembly component:
$ nix-build all-packages.nix -A MyTestAssembly
Recursively builds My.Test.Assembly and its dependencies, i.e.
MyAssembly1, MyAssembly2, MyTestAssembly and produces
output in:
/nix/store/ri0zzm2hmwg01w2wi0g4a3rnp0z24r8p-My.Test.Assembly
Sander van der Burg Deploying .NET applications with the Nix package manager
Implementing runtime support
.NET runtime locaties assemblies:
Determines the correct version of the assembly (strong-named
assemblies only)
Checks whether the assembly has been bound before
(strong-named assemblies only)
If so, it uses this version
Shares same assemblies in memory between applications
Checks the Global Assembly Cache (GAC) (strong-named
assemblies only)
Probes the assembly
Checking the <codebase> element in the application .config
Probing heuristics
Sander van der Burg Deploying .NET applications with the Nix package manager
Assembly probing
A <codebase> element in the application .config file can specify
its own assembly references:
Private assemblies can only reside in the directory or a
subdirectory of the executable
Strong-named assemblies can be invoked from an arbitrary
location, including remote locations
Referenced assembly is cached, therefore a strong-name is
required
Sander van der Burg Deploying .NET applications with the Nix package manager
Implementing runtime support in Nix
Not very trivial, 3 options:
Copy dependent assemblies into the same Nix store path as
the executable
Generate an application .config file with <codebase>
section
Symlink dependent assemblies into the same Nix store path as
the executable
Sander van der Burg Deploying .NET applications with the Nix package manager
Copy dependent assemblies
Copy dependent assemblies into the same Nix store path as the
executable:
Essentially static linking
Expensive in terms of disk space
Expensive in terms of memory usage
Works with private and strong-named assemblies
Works on Windows 2000, XP
Sander van der Burg Deploying .NET applications with the Nix package manager
Copy dependent assemblies
/nix/store
99bed1970e5e459bc...-My.Assembly1
My.Assembly1.dll
f4e5d4c96f95c5887...-My.Assembly2
My.Assembly2.dll
ri0zzm2hmwg01w2wi...-My.Test.Assembly
My.Assembly1.dll
My.Assembly2.dll
My.Test.Assembly.exe
Sander van der Burg Deploying .NET applications with the Nix package manager
Generate an application config file
Generate an application config file with <codebase> section:
References assemblies in other Nix store paths
Nix scans and detects runtime dependencies due to unique
store paths
Cheap in terms of disk space
Allows efficient upgrading of a system (i.e. only replacing
updated parts)
Only works with strong-named assemblies
Cheap in terms of memory usage (sharing in memory)
Sander van der Burg Deploying .NET applications with the Nix package manager
Generate an application config file
/nix/store
99bed1970e5e459bc...-My.Assembly1
My.Assembly1.dll
f4e5d4c96f95c5887...-My.Assembly2
My.Assembly2.dll
ri0zzm2hmwg01w2wi...-My.Test.Assembly
My.Test.Assembly.exe
My.Test.Assembly.exe.config
Sander van der Burg Deploying .NET applications with the Nix package manager
Symlink dependent assemblies
Symlink dependent assemblies into the same Nix store path as the
executable:
References assemblies in other Nix store paths
Nix scans and detects runtime dependencies due to unique
store paths
Cheap in terms of disk space
Works with private and strong-named assemblies
Allows efficient upgrading of a system (i.e. only replacing
updated parts)
Expensive in terms of memory usage (no sharing)
NTFS symlinks are only supported in Windows Vista+,
Windows Server 2008+
Sander van der Burg Deploying .NET applications with the Nix package manager
Symlink dependent assemblies
/nix/store
99bed1970e5e459bc...-My.Assembly1
My.Assembly1.dll
f4e5d4c96f95c5887...-My.Assembly2
My.Assembly2.dll
ri0zzm2hmwg01w2wi...-My.Test.Assembly
My.Assembly1.dll
My.Assembly2.dll
My.Test.Assembly.exe
Sander van der Burg Deploying .NET applications with the Nix package manager
Result
With this implementation we can build and run .NET software
with Nix, some caveats:
.NET framework and Visual Studio tools are not managed by
Nix
.NET framework has dependencies which must be in the GAC
and registry
Registry is not managed
Do not use of registry for configuration settings
Some UNIX properties are not enforced when invoking native
Windows processes:
e.g. chroot
Makes it slightly harder to guarantee purity
Sander van der Burg Deploying .NET applications with the Nix package manager
Possible applications
Use Nix for deployment of .NET applications
Offers the benefits of Nix (e.g. atomic upgrading) for .NET
applications
Allows the deployment of complete systems
No need to create your own installers
Hydra, http://nixos.org/hydra
Continuous integration & testing of .NET applications
Build and test components for multiple architectures
Disnix, http://nixos.org/disnix
Distributed deployment of .NET services into a network of
machines
Sander van der Burg Deploying .NET applications with the Nix package manager
References
Nix, Nixpkgs, Hydra, NixOS, Disnix, http://nixos.org
Cygwin, http://www.cygwin.com
Demystifying the .NET Global Assembly Cache, http:
//www.codeproject.com/kb/dotnet/demystifygac.aspx
Common MSBuild Project Properties, http:
//msdn.microsoft.com/en-us/library/bb629394.aspx
Sander van der Burg Deploying .NET applications with the Nix package manager
References
How the Runtime Locates Assemblies,
http://msdn.microsoft.com/en-us/library/yx7xezcf%
28VS.71%29.aspx
Locating the Assembly through Codebases or Probing,
http://msdn.microsoft.com/en-us/library/15hyw9x3%
28VS.71%29.aspx
Assembly Searching Sequence, http://msdn.microsoft.
com/en-us/library/aa374224%28VS.85%29.aspx
Sander van der Burg Deploying .NET applications with the Nix package manager
Questions
Sander van der Burg Deploying .NET applications with the Nix package manager

More Related Content

What's hot

1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
apnwebdev
 
Orientação a Objetos em Python
Orientação a Objetos em PythonOrientação a Objetos em Python
Orientação a Objetos em Python
Luciano Ramalho
 
File handling in Python
File handling in PythonFile handling in Python
Introdução ao CSS
Introdução ao CSSIntrodução ao CSS
Introdução ao CSS
Leonardo Soares
 
Linux Package Management.pptx
Linux Package Management.pptxLinux Package Management.pptx
Linux Package Management.pptx
HussienEndris1
 
javascript objects
javascript objectsjavascript objects
javascript objects
Vijay Kalyan
 
Curso de Python e Django
Curso de Python e DjangoCurso de Python e Django
Curso de Python e Django
Osvaldo Santana Neto
 
Structure in c#
Structure in c#Structure in c#
Structure in c#
Dr.Neeraj Kumar Pandey
 
JavaScript Objects
JavaScript ObjectsJavaScript Objects
JavaScript Objects
Reem Alattas
 
Regular expressions and php
Regular expressions and phpRegular expressions and php
Regular expressions and php
David Stockton
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
Kumar
 
Django
DjangoDjango
Tipos de dados em MySQL
Tipos de dados em MySQLTipos de dados em MySQL
Tipos de dados em MySQL
Daniel Brandão
 
Scope of variables
Scope of variablesScope of variables
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
Jussi Pohjolainen
 
Multiprocessing in python
Multiprocessing in pythonMultiprocessing in python
File handling and Dictionaries in python
File handling and Dictionaries in pythonFile handling and Dictionaries in python
File handling and Dictionaries in python
nitamhaske
 
Xhtml
XhtmlXhtml
Algoritmos e Estrutura de Dados - Aula 02
Algoritmos e Estrutura de Dados - Aula 02Algoritmos e Estrutura de Dados - Aula 02
Algoritmos e Estrutura de Dados - Aula 02
thomasdacosta
 

What's hot (20)

1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
Orientação a Objetos em Python
Orientação a Objetos em PythonOrientação a Objetos em Python
Orientação a Objetos em Python
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
 
Introdução ao CSS
Introdução ao CSSIntrodução ao CSS
Introdução ao CSS
 
Linux Package Management.pptx
Linux Package Management.pptxLinux Package Management.pptx
Linux Package Management.pptx
 
javascript objects
javascript objectsjavascript objects
javascript objects
 
Curso de Python e Django
Curso de Python e DjangoCurso de Python e Django
Curso de Python e Django
 
Structure in c#
Structure in c#Structure in c#
Structure in c#
 
Css
CssCss
Css
 
JavaScript Objects
JavaScript ObjectsJavaScript Objects
JavaScript Objects
 
Regular expressions and php
Regular expressions and phpRegular expressions and php
Regular expressions and php
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
 
Django
DjangoDjango
Django
 
Tipos de dados em MySQL
Tipos de dados em MySQLTipos de dados em MySQL
Tipos de dados em MySQL
 
Scope of variables
Scope of variablesScope of variables
Scope of variables
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
 
Multiprocessing in python
Multiprocessing in pythonMultiprocessing in python
Multiprocessing in python
 
File handling and Dictionaries in python
File handling and Dictionaries in pythonFile handling and Dictionaries in python
File handling and Dictionaries in python
 
Xhtml
XhtmlXhtml
Xhtml
 
Algoritmos e Estrutura de Dados - Aula 02
Algoritmos e Estrutura de Dados - Aula 02Algoritmos e Estrutura de Dados - Aula 02
Algoritmos e Estrutura de Dados - Aula 02
 

Similar to Deploying .NET applications with the Nix package manager

A Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software DeploymentA Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software Deployment
Sander van der Burg
 
Using NixOS for declarative deployment and testing
Using NixOS for declarative deployment and testingUsing NixOS for declarative deployment and testing
Using NixOS for declarative deployment and testing
Sander van der Burg
 
Techniques and lessons for improvement of deployment processes
Techniques and lessons for improvement of deployment processesTechniques and lessons for improvement of deployment processes
Techniques and lessons for improvement of deployment processes
Sander van der Burg
 
The Nix project
The Nix projectThe Nix project
The Nix project
Sander van der Burg
 
The NixOS project and deploying systems declaratively
The NixOS project and deploying systems declarativelyThe NixOS project and deploying systems declaratively
The NixOS project and deploying systems declaratively
Sander van der Burg
 
Automating Mendix application deployments with Nix
Automating Mendix application deployments with NixAutomating Mendix application deployments with Nix
Automating Mendix application deployments with Nix
Sander van der Burg
 
nix-processmgmt: An experimental Nix-based process manager-agnostic framework
nix-processmgmt: An experimental Nix-based process manager-agnostic frameworknix-processmgmt: An experimental Nix-based process manager-agnostic framework
nix-processmgmt: An experimental Nix-based process manager-agnostic framework
Sander van der Burg
 
Model-driven Distributed Software Deployment
Model-driven Distributed Software DeploymentModel-driven Distributed Software Deployment
Model-driven Distributed Software Deployment
Sander van der Burg
 
The Nix project
The Nix projectThe Nix project
The Nix project
Sander van der Burg
 
Deploying NPM packages with the Nix package manager
Deploying NPM packages with the Nix package managerDeploying NPM packages with the Nix package manager
Deploying NPM packages with the Nix package manager
Sander van der Burg
 
2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com
Mathieu Buffenoir
 
Getting Native with NDK
Getting Native with NDKGetting Native with NDK
Getting Native with NDK
ナム-Nam Nguyễn
 
DockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with Docker
Docker, Inc.
 
Hydra: Continuous Integration and Testing for Demanding People: The Details
Hydra: Continuous Integration and Testing for Demanding People: The DetailsHydra: Continuous Integration and Testing for Demanding People: The Details
Hydra: Continuous Integration and Testing for Demanding People: The Details
Sander van der Burg
 
Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript
Serge van den Oever
 
20170321 docker with Visual Studio 2017
20170321 docker with Visual Studio 201720170321 docker with Visual Studio 2017
20170321 docker with Visual Studio 2017
Takayoshi Tanaka
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 aug
Vincent De Smet
 
A Generic Approach for Deploying and Upgrading Mutable Software Components
A Generic Approach for Deploying and Upgrading Mutable Software ComponentsA Generic Approach for Deploying and Upgrading Mutable Software Components
A Generic Approach for Deploying and Upgrading Mutable Software Components
Sander van der Burg
 
Dockerized maven
Dockerized mavenDockerized maven
Dockerized maven
Matthias Bertschy
 
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Patrick Chanezon
 

Similar to Deploying .NET applications with the Nix package manager (20)

A Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software DeploymentA Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software Deployment
 
Using NixOS for declarative deployment and testing
Using NixOS for declarative deployment and testingUsing NixOS for declarative deployment and testing
Using NixOS for declarative deployment and testing
 
Techniques and lessons for improvement of deployment processes
Techniques and lessons for improvement of deployment processesTechniques and lessons for improvement of deployment processes
Techniques and lessons for improvement of deployment processes
 
The Nix project
The Nix projectThe Nix project
The Nix project
 
The NixOS project and deploying systems declaratively
The NixOS project and deploying systems declarativelyThe NixOS project and deploying systems declaratively
The NixOS project and deploying systems declaratively
 
Automating Mendix application deployments with Nix
Automating Mendix application deployments with NixAutomating Mendix application deployments with Nix
Automating Mendix application deployments with Nix
 
nix-processmgmt: An experimental Nix-based process manager-agnostic framework
nix-processmgmt: An experimental Nix-based process manager-agnostic frameworknix-processmgmt: An experimental Nix-based process manager-agnostic framework
nix-processmgmt: An experimental Nix-based process manager-agnostic framework
 
Model-driven Distributed Software Deployment
Model-driven Distributed Software DeploymentModel-driven Distributed Software Deployment
Model-driven Distributed Software Deployment
 
The Nix project
The Nix projectThe Nix project
The Nix project
 
Deploying NPM packages with the Nix package manager
Deploying NPM packages with the Nix package managerDeploying NPM packages with the Nix package manager
Deploying NPM packages with the Nix package manager
 
2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com
 
Getting Native with NDK
Getting Native with NDKGetting Native with NDK
Getting Native with NDK
 
DockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with Docker
 
Hydra: Continuous Integration and Testing for Demanding People: The Details
Hydra: Continuous Integration and Testing for Demanding People: The DetailsHydra: Continuous Integration and Testing for Demanding People: The Details
Hydra: Continuous Integration and Testing for Demanding People: The Details
 
Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript
 
20170321 docker with Visual Studio 2017
20170321 docker with Visual Studio 201720170321 docker with Visual Studio 2017
20170321 docker with Visual Studio 2017
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 aug
 
A Generic Approach for Deploying and Upgrading Mutable Software Components
A Generic Approach for Deploying and Upgrading Mutable Software ComponentsA Generic Approach for Deploying and Upgrading Mutable Software Components
A Generic Approach for Deploying and Upgrading Mutable Software Components
 
Dockerized maven
Dockerized mavenDockerized maven
Dockerized maven
 
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
 

More from Sander van der Burg

The Monitoring Playground
The Monitoring PlaygroundThe Monitoring Playground
The Monitoring Playground
Sander van der Burg
 
Using Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutionsUsing Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutions
Sander van der Burg
 
Dysnomia: complementing Nix deployments with state deployment
Dysnomia: complementing Nix deployments with state deploymentDysnomia: complementing Nix deployments with state deployment
Dysnomia: complementing Nix deployments with state deployment
Sander van der Burg
 
Deploying (micro)services with Disnix
Deploying (micro)services with DisnixDeploying (micro)services with Disnix
Deploying (micro)services with Disnix
Sander van der Burg
 
Hydra: Continuous Integration and Testing for Demanding People: The Basics
Hydra: Continuous Integration and Testing for Demanding People: The BasicsHydra: Continuous Integration and Testing for Demanding People: The Basics
Hydra: Continuous Integration and Testing for Demanding People: The Basics
Sander van der Burg
 
A Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software DeploymentA Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software Deployment
Sander van der Burg
 
Deploying .NET services with Disnix
Deploying .NET services with DisnixDeploying .NET services with Disnix
Deploying .NET services with Disnix
Sander van der Burg
 
A Self-Adaptive Deployment Framework for Service-Oriented Systems
A Self-Adaptive Deployment Framework for Service-Oriented SystemsA Self-Adaptive Deployment Framework for Service-Oriented Systems
A Self-Adaptive Deployment Framework for Service-Oriented Systems
Sander van der Burg
 
Pull Deployment of Services
Pull Deployment of ServicesPull Deployment of Services
Pull Deployment of Services
Sander van der Burg
 
Disnix: A toolset for distributed deployment
Disnix: A toolset for distributed deploymentDisnix: A toolset for distributed deployment
Disnix: A toolset for distributed deployment
Sander van der Burg
 
Automated Deployment of Hetergeneous Service-Oriented System
Automated Deployment of Hetergeneous Service-Oriented SystemAutomated Deployment of Hetergeneous Service-Oriented System
Automated Deployment of Hetergeneous Service-Oriented System
Sander van der Burg
 
Pull Deployment of Services: Introduction, Progress and Challenges
Pull Deployment of Services: Introduction, Progress and ChallengesPull Deployment of Services: Introduction, Progress and Challenges
Pull Deployment of Services: Introduction, Progress and Challenges
Sander van der Burg
 
Software Deployment in a Dynamic Cloud
Software Deployment in a Dynamic CloudSoftware Deployment in a Dynamic Cloud
Software Deployment in a Dynamic Cloud
Sander van der Burg
 
Atomic Upgrading of Distributed Systems
Atomic Upgrading of Distributed SystemsAtomic Upgrading of Distributed Systems
Atomic Upgrading of Distributed Systems
Sander van der Burg
 
Model-driven Distributed Software Deployment
Model-driven Distributed Software DeploymentModel-driven Distributed Software Deployment
Model-driven Distributed Software Deployment
Sander van der Burg
 
Model-driven Distributed Software Deployment laymen's talk
Model-driven Distributed Software Deployment laymen's talkModel-driven Distributed Software Deployment laymen's talk
Model-driven Distributed Software Deployment laymen's talk
Sander van der Burg
 

More from Sander van der Burg (16)

The Monitoring Playground
The Monitoring PlaygroundThe Monitoring Playground
The Monitoring Playground
 
Using Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutionsUsing Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutions
 
Dysnomia: complementing Nix deployments with state deployment
Dysnomia: complementing Nix deployments with state deploymentDysnomia: complementing Nix deployments with state deployment
Dysnomia: complementing Nix deployments with state deployment
 
Deploying (micro)services with Disnix
Deploying (micro)services with DisnixDeploying (micro)services with Disnix
Deploying (micro)services with Disnix
 
Hydra: Continuous Integration and Testing for Demanding People: The Basics
Hydra: Continuous Integration and Testing for Demanding People: The BasicsHydra: Continuous Integration and Testing for Demanding People: The Basics
Hydra: Continuous Integration and Testing for Demanding People: The Basics
 
A Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software DeploymentA Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software Deployment
 
Deploying .NET services with Disnix
Deploying .NET services with DisnixDeploying .NET services with Disnix
Deploying .NET services with Disnix
 
A Self-Adaptive Deployment Framework for Service-Oriented Systems
A Self-Adaptive Deployment Framework for Service-Oriented SystemsA Self-Adaptive Deployment Framework for Service-Oriented Systems
A Self-Adaptive Deployment Framework for Service-Oriented Systems
 
Pull Deployment of Services
Pull Deployment of ServicesPull Deployment of Services
Pull Deployment of Services
 
Disnix: A toolset for distributed deployment
Disnix: A toolset for distributed deploymentDisnix: A toolset for distributed deployment
Disnix: A toolset for distributed deployment
 
Automated Deployment of Hetergeneous Service-Oriented System
Automated Deployment of Hetergeneous Service-Oriented SystemAutomated Deployment of Hetergeneous Service-Oriented System
Automated Deployment of Hetergeneous Service-Oriented System
 
Pull Deployment of Services: Introduction, Progress and Challenges
Pull Deployment of Services: Introduction, Progress and ChallengesPull Deployment of Services: Introduction, Progress and Challenges
Pull Deployment of Services: Introduction, Progress and Challenges
 
Software Deployment in a Dynamic Cloud
Software Deployment in a Dynamic CloudSoftware Deployment in a Dynamic Cloud
Software Deployment in a Dynamic Cloud
 
Atomic Upgrading of Distributed Systems
Atomic Upgrading of Distributed SystemsAtomic Upgrading of Distributed Systems
Atomic Upgrading of Distributed Systems
 
Model-driven Distributed Software Deployment
Model-driven Distributed Software DeploymentModel-driven Distributed Software Deployment
Model-driven Distributed Software Deployment
 
Model-driven Distributed Software Deployment laymen's talk
Model-driven Distributed Software Deployment laymen's talkModel-driven Distributed Software Deployment laymen's talk
Model-driven Distributed Software Deployment laymen's talk
 

Recently uploaded

Katherine Romanak - Geologic CO2 Storage.pdf
Katherine Romanak - Geologic CO2 Storage.pdfKatherine Romanak - Geologic CO2 Storage.pdf
Katherine Romanak - Geologic CO2 Storage.pdf
Texas Alliance of Groundwater Districts
 
THEMATIC APPERCEPTION TEST(TAT) cognitive abilities, creativity, and critic...
THEMATIC  APPERCEPTION  TEST(TAT) cognitive abilities, creativity, and critic...THEMATIC  APPERCEPTION  TEST(TAT) cognitive abilities, creativity, and critic...
THEMATIC APPERCEPTION TEST(TAT) cognitive abilities, creativity, and critic...
Abdul Wali Khan University Mardan,kP,Pakistan
 
NuGOweek 2024 Ghent programme overview flyer
NuGOweek 2024 Ghent programme overview flyerNuGOweek 2024 Ghent programme overview flyer
NuGOweek 2024 Ghent programme overview flyer
pablovgd
 
GBSN - Biochemistry (Unit 6) Chemistry of Proteins
GBSN - Biochemistry (Unit 6) Chemistry of ProteinsGBSN - Biochemistry (Unit 6) Chemistry of Proteins
GBSN - Biochemistry (Unit 6) Chemistry of Proteins
Areesha Ahmad
 
aziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobelaziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobel
İsa Badur
 
Eukaryotic Transcription Presentation.pptx
Eukaryotic Transcription Presentation.pptxEukaryotic Transcription Presentation.pptx
Eukaryotic Transcription Presentation.pptx
RitabrataSarkar3
 
Authoring a personal GPT for your research and practice: How we created the Q...
Authoring a personal GPT for your research and practice: How we created the Q...Authoring a personal GPT for your research and practice: How we created the Q...
Authoring a personal GPT for your research and practice: How we created the Q...
Leonel Morgado
 
ESR spectroscopy in liquid food and beverages.pptx
ESR spectroscopy in liquid food and beverages.pptxESR spectroscopy in liquid food and beverages.pptx
ESR spectroscopy in liquid food and beverages.pptx
PRIYANKA PATEL
 
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
Sérgio Sacani
 
Applied Science: Thermodynamics, Laws & Methodology.pdf
Applied Science: Thermodynamics, Laws & Methodology.pdfApplied Science: Thermodynamics, Laws & Methodology.pdf
Applied Science: Thermodynamics, Laws & Methodology.pdf
University of Hertfordshire
 
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
vluwdy49
 
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
Leonel Morgado
 
Immersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths ForwardImmersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths Forward
Leonel Morgado
 
(June 12, 2024) Webinar: Development of PET theranostics targeting the molecu...
(June 12, 2024) Webinar: Development of PET theranostics targeting the molecu...(June 12, 2024) Webinar: Development of PET theranostics targeting the molecu...
(June 12, 2024) Webinar: Development of PET theranostics targeting the molecu...
Scintica Instrumentation
 
The binding of cosmological structures by massless topological defects
The binding of cosmological structures by massless topological defectsThe binding of cosmological structures by massless topological defects
The binding of cosmological structures by massless topological defects
Sérgio Sacani
 
20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx
Sharon Liu
 
Compexometric titration/Chelatorphy titration/chelating titration
Compexometric titration/Chelatorphy titration/chelating titrationCompexometric titration/Chelatorphy titration/chelating titration
Compexometric titration/Chelatorphy titration/chelating titration
Vandana Devesh Sharma
 
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdfMending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
Selcen Ozturkcan
 
The cost of acquiring information by natural selection
The cost of acquiring information by natural selectionThe cost of acquiring information by natural selection
The cost of acquiring information by natural selection
Carl Bergstrom
 
23PH301 - Optics - Optical Lenses.pptx
23PH301 - Optics  -  Optical Lenses.pptx23PH301 - Optics  -  Optical Lenses.pptx
23PH301 - Optics - Optical Lenses.pptx
RDhivya6
 

Recently uploaded (20)

Katherine Romanak - Geologic CO2 Storage.pdf
Katherine Romanak - Geologic CO2 Storage.pdfKatherine Romanak - Geologic CO2 Storage.pdf
Katherine Romanak - Geologic CO2 Storage.pdf
 
THEMATIC APPERCEPTION TEST(TAT) cognitive abilities, creativity, and critic...
THEMATIC  APPERCEPTION  TEST(TAT) cognitive abilities, creativity, and critic...THEMATIC  APPERCEPTION  TEST(TAT) cognitive abilities, creativity, and critic...
THEMATIC APPERCEPTION TEST(TAT) cognitive abilities, creativity, and critic...
 
NuGOweek 2024 Ghent programme overview flyer
NuGOweek 2024 Ghent programme overview flyerNuGOweek 2024 Ghent programme overview flyer
NuGOweek 2024 Ghent programme overview flyer
 
GBSN - Biochemistry (Unit 6) Chemistry of Proteins
GBSN - Biochemistry (Unit 6) Chemistry of ProteinsGBSN - Biochemistry (Unit 6) Chemistry of Proteins
GBSN - Biochemistry (Unit 6) Chemistry of Proteins
 
aziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobelaziz sancar nobel prize winner: from mardin to nobel
aziz sancar nobel prize winner: from mardin to nobel
 
Eukaryotic Transcription Presentation.pptx
Eukaryotic Transcription Presentation.pptxEukaryotic Transcription Presentation.pptx
Eukaryotic Transcription Presentation.pptx
 
Authoring a personal GPT for your research and practice: How we created the Q...
Authoring a personal GPT for your research and practice: How we created the Q...Authoring a personal GPT for your research and practice: How we created the Q...
Authoring a personal GPT for your research and practice: How we created the Q...
 
ESR spectroscopy in liquid food and beverages.pptx
ESR spectroscopy in liquid food and beverages.pptxESR spectroscopy in liquid food and beverages.pptx
ESR spectroscopy in liquid food and beverages.pptx
 
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...
 
Applied Science: Thermodynamics, Laws & Methodology.pdf
Applied Science: Thermodynamics, Laws & Methodology.pdfApplied Science: Thermodynamics, Laws & Methodology.pdf
Applied Science: Thermodynamics, Laws & Methodology.pdf
 
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
在线办理(salfor毕业证书)索尔福德大学毕业证毕业完成信一模一样
 
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...
 
Immersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths ForwardImmersive Learning That Works: Research Grounding and Paths Forward
Immersive Learning That Works: Research Grounding and Paths Forward
 
(June 12, 2024) Webinar: Development of PET theranostics targeting the molecu...
(June 12, 2024) Webinar: Development of PET theranostics targeting the molecu...(June 12, 2024) Webinar: Development of PET theranostics targeting the molecu...
(June 12, 2024) Webinar: Development of PET theranostics targeting the molecu...
 
The binding of cosmological structures by massless topological defects
The binding of cosmological structures by massless topological defectsThe binding of cosmological structures by massless topological defects
The binding of cosmological structures by massless topological defects
 
20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx
 
Compexometric titration/Chelatorphy titration/chelating titration
Compexometric titration/Chelatorphy titration/chelating titrationCompexometric titration/Chelatorphy titration/chelating titration
Compexometric titration/Chelatorphy titration/chelating titration
 
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdfMending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
Mending Clothing to Support Sustainable Fashion_CIMaR 2024.pdf
 
The cost of acquiring information by natural selection
The cost of acquiring information by natural selectionThe cost of acquiring information by natural selection
The cost of acquiring information by natural selection
 
23PH301 - Optics - Optical Lenses.pptx
23PH301 - Optics  -  Optical Lenses.pptx23PH301 - Optics  -  Optical Lenses.pptx
23PH301 - Optics - Optical Lenses.pptx
 

Deploying .NET applications with the Nix package manager

  • 1. Deploying .NET applications with the Nix package manager Sander van der Burg Delft University of Technology, EEMCS, Department of Software Technology Philips Healthcare, Philips Informatics Infrastructure (PII), Best June 15, 2010 Sander van der Burg Deploying .NET applications with the Nix package manager
  • 2. Nix deployment system Nix is a package manager, with some distinct features: Stores components in isolation from each other Allows using multiple variants/versions safely next to each other Builds components from declarative specifications Reproducibility Supports atomic upgrades and rollbacks Garbage collection Safely removes obsolete components Sander van der Burg Deploying .NET applications with the Nix package manager
  • 3. Nix deployment system About 2500 open-source/free software packages are supported (Nixpkgs) Used as a basis for the NixOS GNU/Linux distribution Sander van der Burg Deploying .NET applications with the Nix package manager
  • 4. Hydra Continuous build & integration server Built upon the Nix package manager Used at TU Delft for building, integration and testing of several projects on multiple platforms Sander van der Burg Deploying .NET applications with the Nix package manager
  • 5. Disnix Distributed deployment extension for Nix Manages inter-dependencies Builds, distributes, activates services in a network of machines Sander van der Burg Deploying .NET applications with the Nix package manager
  • 6. The Nix store All components are stored in isolation in a Nix store In Nix every component name consists of a hash code and component name: /nix/store/30v58jznlaxnr4bca3hiz64wlb43mgpx-hello-2.5 Hash is generated from all the input arguments of the build function: compilers, libraries, build scripts etc. Multiple variants/versions can be kept safely next to each other Can be used for any type of component Sander van der Burg Deploying .NET applications with the Nix package manager
  • 8. Global Assembly Cache (GAC) .NET Global Assembly Cache (GAC) only supports strong-named library assemblies (DLLs): Other types of components are not supported (executables, native DLLs, compilers) Strong name is created from name, version, culture and signing with a public-private key pair Creating strong-names is sometimes painful Possible to produce a different assembly with same strong-name Sander van der Burg Deploying .NET applications with the Nix package manager
  • 9. Nix expressions {stdenv, fetchurl}: stdenv.mkDerivation { name = "hello-2.5"; src = fetchurl { url = ftp://ftp.gnu.org/gnu/hello/hello-2.5.tar.gz; sha256 = "0in467phypnis2ify1gkmvc5l2fxyz3s4xss7g74gwk279ylm4r2"; }; meta = { description = "A program that produces a familiar, friendly greeting"; homepage = http://www.gnu.org/software/hello/manual/; license = "GPLv3+"; }; } Specifies how the hello component should be built. Sander van der Burg Deploying .NET applications with the Nix package manager
  • 10. Nix expressions rec { stdenv = ... curl = ... openssl = ... fetchurl = import ../build-support/fetchurl { inherit curl openssl; }; hello = import ../applications/misc/hello { inherit stdenv fetchurl; }; } The hello build function is called with its arguments Sander van der Burg Deploying .NET applications with the Nix package manager
  • 11. Nix expressions To build the Hello package: $ nix-build all-packages.nix -A hello Will recursively build hello and its dependencies and produces hello in: /nix/store/30v58jznlaxnr4bca3hiz64wlb43mgpx-hello-2.5 Sander van der Burg Deploying .NET applications with the Nix package manager
  • 12. Runtime dependencies Nix detects runtime dependencies of a build Nix scans all files of a component for hash-codes of a dependency, e.g. RPATH defined in a ELF header Uses a notion of closures to guarantee completeness: If a specific component needs to be deployed, all its runtime dependencies are deployed first Sander van der Burg Deploying .NET applications with the Nix package manager
  • 14. Supporting .NET applications with Nix Nix is designed for use on UNIX like systems, e.g. GNU/Linux, FreeBSD, Mac OS X Sander van der Burg Deploying .NET applications with the Nix package manager
  • 15. Requirements Buildtime support: Compile Visual Studio solutions and produce assemblies Invoke MSBuild.exe with right parameters The build process must find its buildtime dependencies Runtime support: Assemblies must find its runtime dependencies Integrate .NET CLR dependency resolver with Nix Sander van der Burg Deploying .NET applications with the Nix package manager
  • 16. Windows support Nix is supported on Windows through Cygwin: Offers UNIX implementation on top of Windows Allows combining UNIX and Windows utilities Sander van der Burg Deploying .NET applications with the Nix package manager
  • 17. Windows support Several Cygwin utilities map Windows concepts to UNIX concepts and vica versa: Can be used to glue UNIX tooling to Windows processes cygpath, UNIX path names <=> Windows path names Sander van der Burg Deploying .NET applications with the Nix package manager
  • 18. Implementing build support A .NET Nix build function dotnetenv.buildSolution is implemented: Takes source code of a Visual Studio C# solution Produces output of the solution into a unique store path, based on the input arguments of this function Sander van der Burg Deploying .NET applications with the Nix package manager
  • 19. Build function implementation {stdenv, dotnetfx}: { name, src, slnFile, targets ? "ReBuild" , options ? "/p:Configuration=Debug;Platform=Win32" , assemblyInputs ? [] }: stdenv.mkDerivation { inherit name src; buildInputs = [ dotnetfx ]; installPhase = ’’ for i in ${toString assemblyInputs}; do windowsPath=$(cygpath --windows $i) AssemblySearchPaths="$AssemblySearchPaths;$windowsPath" done export AssemblySearchPaths ensureDir $out outPath=$(cygpath --windows $out) MSBuild.exe ${slnFile} /nologo /t:${targets} /p:OutputPath=$outPath ${options} ... ’’; } Sander van der Burg Deploying .NET applications with the Nix package manager
  • 20. Example usage {dotnetenv, MyAssembly1, MyAssembly2}: dotnetenv.buildSolution { name = "My.Test.Assembly"; src = /path/to/source/code; slnFile = "Assembly.sln"; assemblyInputs = [ dotnetenv.assembly20Path MyAssembly1 MyAssembly2 ]; } Specifies how a Visual Studio solution should be built. Sander van der Burg Deploying .NET applications with the Nix package manager
  • 21. Example usage rec { dotnetfx = ... stdenv = ... dotnetenv = import ../dotnetenv { inherit stdenv dotnetfx; }; MyAssembly1 = import ../MyAssembly1 { inherit dotnetenv; }; MyAssembly2 = import ../MyAssembly1 { inherit dotnetenv; }; MyTestAssembly = import ../MyTestAssembly { inherit dotnetenv MyAssembly1 MyAssembly2; }; } The MyTestAssembly function is called with its arguments Sander van der Burg Deploying .NET applications with the Nix package manager
  • 22. Example usage To build the My.Test.Assembly component: $ nix-build all-packages.nix -A MyTestAssembly Recursively builds My.Test.Assembly and its dependencies, i.e. MyAssembly1, MyAssembly2, MyTestAssembly and produces output in: /nix/store/ri0zzm2hmwg01w2wi0g4a3rnp0z24r8p-My.Test.Assembly Sander van der Burg Deploying .NET applications with the Nix package manager
  • 23. Implementing runtime support .NET runtime locaties assemblies: Determines the correct version of the assembly (strong-named assemblies only) Checks whether the assembly has been bound before (strong-named assemblies only) If so, it uses this version Shares same assemblies in memory between applications Checks the Global Assembly Cache (GAC) (strong-named assemblies only) Probes the assembly Checking the <codebase> element in the application .config Probing heuristics Sander van der Burg Deploying .NET applications with the Nix package manager
  • 24. Assembly probing A <codebase> element in the application .config file can specify its own assembly references: Private assemblies can only reside in the directory or a subdirectory of the executable Strong-named assemblies can be invoked from an arbitrary location, including remote locations Referenced assembly is cached, therefore a strong-name is required Sander van der Burg Deploying .NET applications with the Nix package manager
  • 25. Implementing runtime support in Nix Not very trivial, 3 options: Copy dependent assemblies into the same Nix store path as the executable Generate an application .config file with <codebase> section Symlink dependent assemblies into the same Nix store path as the executable Sander van der Burg Deploying .NET applications with the Nix package manager
  • 26. Copy dependent assemblies Copy dependent assemblies into the same Nix store path as the executable: Essentially static linking Expensive in terms of disk space Expensive in terms of memory usage Works with private and strong-named assemblies Works on Windows 2000, XP Sander van der Burg Deploying .NET applications with the Nix package manager
  • 28. Generate an application config file Generate an application config file with <codebase> section: References assemblies in other Nix store paths Nix scans and detects runtime dependencies due to unique store paths Cheap in terms of disk space Allows efficient upgrading of a system (i.e. only replacing updated parts) Only works with strong-named assemblies Cheap in terms of memory usage (sharing in memory) Sander van der Burg Deploying .NET applications with the Nix package manager
  • 29. Generate an application config file /nix/store 99bed1970e5e459bc...-My.Assembly1 My.Assembly1.dll f4e5d4c96f95c5887...-My.Assembly2 My.Assembly2.dll ri0zzm2hmwg01w2wi...-My.Test.Assembly My.Test.Assembly.exe My.Test.Assembly.exe.config Sander van der Burg Deploying .NET applications with the Nix package manager
  • 30. Symlink dependent assemblies Symlink dependent assemblies into the same Nix store path as the executable: References assemblies in other Nix store paths Nix scans and detects runtime dependencies due to unique store paths Cheap in terms of disk space Works with private and strong-named assemblies Allows efficient upgrading of a system (i.e. only replacing updated parts) Expensive in terms of memory usage (no sharing) NTFS symlinks are only supported in Windows Vista+, Windows Server 2008+ Sander van der Burg Deploying .NET applications with the Nix package manager
  • 32. Result With this implementation we can build and run .NET software with Nix, some caveats: .NET framework and Visual Studio tools are not managed by Nix .NET framework has dependencies which must be in the GAC and registry Registry is not managed Do not use of registry for configuration settings Some UNIX properties are not enforced when invoking native Windows processes: e.g. chroot Makes it slightly harder to guarantee purity Sander van der Burg Deploying .NET applications with the Nix package manager
  • 33. Possible applications Use Nix for deployment of .NET applications Offers the benefits of Nix (e.g. atomic upgrading) for .NET applications Allows the deployment of complete systems No need to create your own installers Hydra, http://nixos.org/hydra Continuous integration & testing of .NET applications Build and test components for multiple architectures Disnix, http://nixos.org/disnix Distributed deployment of .NET services into a network of machines Sander van der Burg Deploying .NET applications with the Nix package manager
  • 34. References Nix, Nixpkgs, Hydra, NixOS, Disnix, http://nixos.org Cygwin, http://www.cygwin.com Demystifying the .NET Global Assembly Cache, http: //www.codeproject.com/kb/dotnet/demystifygac.aspx Common MSBuild Project Properties, http: //msdn.microsoft.com/en-us/library/bb629394.aspx Sander van der Burg Deploying .NET applications with the Nix package manager
  • 35. References How the Runtime Locates Assemblies, http://msdn.microsoft.com/en-us/library/yx7xezcf% 28VS.71%29.aspx Locating the Assembly through Codebases or Probing, http://msdn.microsoft.com/en-us/library/15hyw9x3% 28VS.71%29.aspx Assembly Searching Sequence, http://msdn.microsoft. com/en-us/library/aa374224%28VS.85%29.aspx Sander van der Burg Deploying .NET applications with the Nix package manager
  • 36. Questions Sander van der Burg Deploying .NET applications with the Nix package manager