SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

alphorm.com - Formation proxmoxVE 3
alphorm.com - Formation proxmoxVE 3alphorm.com - Formation proxmoxVE 3
alphorm.com - Formation proxmoxVE 3Alphorm
 
Corrigé TP NoSQL MongoDB (5).pdf
Corrigé TP NoSQL MongoDB (5).pdfCorrigé TP NoSQL MongoDB (5).pdf
Corrigé TP NoSQL MongoDB (5).pdfOumaimaZiat
 
Introduction to Linux
Introduction to Linux Introduction to Linux
Introduction to Linux Harish R
 
Different types of Editors in Linux
Different types of Editors in LinuxDifferent types of Editors in Linux
Different types of Editors in LinuxBhavik Trivedi
 
Développement d'un forum de discussion
Développement d'un forum de discussionDéveloppement d'un forum de discussion
Développement d'un forum de discussionYoussef NIDABRAHIM
 
Common linux ubuntu commands overview
Common linux  ubuntu commands overviewCommon linux  ubuntu commands overview
Common linux ubuntu commands overviewAmeer Sameer
 
P3 listes et elements graphiques avancés
P3 listes et elements graphiques avancésP3 listes et elements graphiques avancés
P3 listes et elements graphiques avancésLilia Sfaxi
 
Créer un moteur de recherche avec des logiciels libres
Créer un moteur de recherche avec des logiciels libresCréer un moteur de recherche avec des logiciels libres
Créer un moteur de recherche avec des logiciels libresRobert Viseur
 
Chp6 - Développement iOS
Chp6 - Développement iOSChp6 - Développement iOS
Chp6 - Développement iOSLilia Sfaxi
 
Estimation de charge d_un projet.pdf
Estimation de charge d_un projet.pdfEstimation de charge d_un projet.pdf
Estimation de charge d_un projet.pdfYasushiTsubakik
 
Speech de PFE de Ahmed Jebali - CM- ISAMM-Encadré par Wafa Bourkhis (Design)...
Speech de PFE de Ahmed Jebali - CM- ISAMM-Encadré par Wafa Bourkhis  (Design)...Speech de PFE de Ahmed Jebali - CM- ISAMM-Encadré par Wafa Bourkhis  (Design)...
Speech de PFE de Ahmed Jebali - CM- ISAMM-Encadré par Wafa Bourkhis (Design)...Wafa Bourkhis
 

Was ist angesagt? (20)

alphorm.com - Formation proxmoxVE 3
alphorm.com - Formation proxmoxVE 3alphorm.com - Formation proxmoxVE 3
alphorm.com - Formation proxmoxVE 3
 
Blended learning et révolution des pratiques pédagogiques
Blended learning et révolution des pratiques pédagogiquesBlended learning et révolution des pratiques pédagogiques
Blended learning et révolution des pratiques pédagogiques
 
Squid
SquidSquid
Squid
 
Corrigé TP NoSQL MongoDB (5).pdf
Corrigé TP NoSQL MongoDB (5).pdfCorrigé TP NoSQL MongoDB (5).pdf
Corrigé TP NoSQL MongoDB (5).pdf
 
Rad
RadRad
Rad
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Introduction to Linux
Introduction to Linux Introduction to Linux
Introduction to Linux
 
PROJET JAVA BD MySQL
PROJET JAVA BD MySQLPROJET JAVA BD MySQL
PROJET JAVA BD MySQL
 
Different types of Editors in Linux
Different types of Editors in LinuxDifferent types of Editors in Linux
Different types of Editors in Linux
 
22410B_03.pptx
22410B_03.pptx22410B_03.pptx
22410B_03.pptx
 
Développement d'un forum de discussion
Développement d'un forum de discussionDéveloppement d'un forum de discussion
Développement d'un forum de discussion
 
Common linux ubuntu commands overview
Common linux  ubuntu commands overviewCommon linux  ubuntu commands overview
Common linux ubuntu commands overview
 
P3 listes et elements graphiques avancés
P3 listes et elements graphiques avancésP3 listes et elements graphiques avancés
P3 listes et elements graphiques avancés
 
Créer un moteur de recherche avec des logiciels libres
Créer un moteur de recherche avec des logiciels libresCréer un moteur de recherche avec des logiciels libres
Créer un moteur de recherche avec des logiciels libres
 
Chp6 - Développement iOS
Chp6 - Développement iOSChp6 - Développement iOS
Chp6 - Développement iOS
 
OpenNMS
OpenNMSOpenNMS
OpenNMS
 
Estimation de charge d_un projet.pdf
Estimation de charge d_un projet.pdfEstimation de charge d_un projet.pdf
Estimation de charge d_un projet.pdf
 
Linux
LinuxLinux
Linux
 
Unix Security
Unix SecurityUnix Security
Unix Security
 
Speech de PFE de Ahmed Jebali - CM- ISAMM-Encadré par Wafa Bourkhis (Design)...
Speech de PFE de Ahmed Jebali - CM- ISAMM-Encadré par Wafa Bourkhis  (Design)...Speech de PFE de Ahmed Jebali - CM- ISAMM-Encadré par Wafa Bourkhis  (Design)...
Speech de PFE de Ahmed Jebali - CM- ISAMM-Encadré par Wafa Bourkhis (Design)...
 

Ähnlich wie 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 DeploymentSander 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 testingSander 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 processesSander 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 declarativelySander 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 NixSander 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 frameworkSander van der Burg
 
Model-driven Distributed Software Deployment
Model-driven Distributed Software DeploymentModel-driven Distributed Software Deployment
Model-driven Distributed Software DeploymentSander 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 managerSander 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.comMathieu Buffenoir
 
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 DockerDocker, 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 DetailsSander 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 2017Takayoshi Tanaka
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 augVincent 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 ComponentsSander van der Burg
 
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
 

Ähnlich wie 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...
 

Mehr von 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 solutionsSander 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 deploymentSander van der Burg
 
Deploying (micro)services with Disnix
Deploying (micro)services with DisnixDeploying (micro)services with Disnix
Deploying (micro)services with DisnixSander 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 BasicsSander 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 DeploymentSander van der Burg
 
Deploying .NET services with Disnix
Deploying .NET services with DisnixDeploying .NET services with Disnix
Deploying .NET services with DisnixSander 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 SystemsSander 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 deploymentSander 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 SystemSander 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 ChallengesSander 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 CloudSander van der Burg
 
Atomic Upgrading of Distributed Systems
Atomic Upgrading of Distributed SystemsAtomic Upgrading of Distributed Systems
Atomic Upgrading of Distributed SystemsSander van der Burg
 
Model-driven Distributed Software Deployment
Model-driven Distributed Software DeploymentModel-driven Distributed Software Deployment
Model-driven Distributed Software DeploymentSander 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 talkSander van der Burg
 

Mehr von 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
 

Kürzlich hochgeladen

High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...
High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...
High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...chandars293
 
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsBiogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsSérgio Sacani
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticssakshisoni2385
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)Areesha Ahmad
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfrohankumarsinghrore1
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .Poonam Aher Patil
 
Unit5-Cloud.pptx for lpu course cse121 o
Unit5-Cloud.pptx for lpu course cse121 oUnit5-Cloud.pptx for lpu course cse121 o
Unit5-Cloud.pptx for lpu course cse121 oManavSingh202607
 
9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Servicenishacall1
 
Chemical Tests; flame test, positive and negative ions test Edexcel Internati...
Chemical Tests; flame test, positive and negative ions test Edexcel Internati...Chemical Tests; flame test, positive and negative ions test Edexcel Internati...
Chemical Tests; flame test, positive and negative ions test Edexcel Internati...ssuser79fe74
 
IDENTIFICATION OF THE LIVING- forensic medicine
IDENTIFICATION OF THE LIVING- forensic medicineIDENTIFICATION OF THE LIVING- forensic medicine
IDENTIFICATION OF THE LIVING- forensic medicinesherlingomez2
 
Pests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdfPests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdfPirithiRaju
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and ClassificationsAreesha Ahmad
 
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedConnaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Seismic Method Estimate velocity from seismic data.pptx
Seismic Method Estimate velocity from seismic  data.pptxSeismic Method Estimate velocity from seismic  data.pptx
Seismic Method Estimate velocity from seismic data.pptxAlMamun560346
 
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑Damini Dixit
 
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts ServiceJustdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Servicemonikaservice1
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryAlex Henderson
 
PSYCHOSOCIAL NEEDS. in nursing II sem pptx
PSYCHOSOCIAL NEEDS. in nursing II sem pptxPSYCHOSOCIAL NEEDS. in nursing II sem pptx
PSYCHOSOCIAL NEEDS. in nursing II sem pptxSuji236384
 

Kürzlich hochgeladen (20)

High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...
High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...
High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...
 
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsBiogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdf
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .
 
Unit5-Cloud.pptx for lpu course cse121 o
Unit5-Cloud.pptx for lpu course cse121 oUnit5-Cloud.pptx for lpu course cse121 o
Unit5-Cloud.pptx for lpu course cse121 o
 
9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 22 (Delhi) Call Girl Service
 
Chemical Tests; flame test, positive and negative ions test Edexcel Internati...
Chemical Tests; flame test, positive and negative ions test Edexcel Internati...Chemical Tests; flame test, positive and negative ions test Edexcel Internati...
Chemical Tests; flame test, positive and negative ions test Edexcel Internati...
 
IDENTIFICATION OF THE LIVING- forensic medicine
IDENTIFICATION OF THE LIVING- forensic medicineIDENTIFICATION OF THE LIVING- forensic medicine
IDENTIFICATION OF THE LIVING- forensic medicine
 
Pests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdfPests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdf
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and Classifications
 
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedConnaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
 
Seismic Method Estimate velocity from seismic data.pptx
Seismic Method Estimate velocity from seismic  data.pptxSeismic Method Estimate velocity from seismic  data.pptx
Seismic Method Estimate velocity from seismic data.pptx
 
Site Acceptance Test .
Site Acceptance Test                    .Site Acceptance Test                    .
Site Acceptance Test .
 
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
 
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts ServiceJustdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
 
Clean In Place(CIP).pptx .
Clean In Place(CIP).pptx                 .Clean In Place(CIP).pptx                 .
Clean In Place(CIP).pptx .
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
 
PSYCHOSOCIAL NEEDS. in nursing II sem pptx
PSYCHOSOCIAL NEEDS. in nursing II sem pptxPSYCHOSOCIAL NEEDS. in nursing II sem pptx
PSYCHOSOCIAL NEEDS. in nursing II sem 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