How To Write A Distributed Deployment System On Nix (Programming)



Similar documents
The Nix project. Sander van der Burg. June 24, Delft University of Technology, EEMCS, Department of Software Technology

A Reference Architecture for Distributed Software Deployment

Using NixOS for declarative deployment and testing

Automated Deployment of a Heterogeneous Service-Oriented System

The Nix Build Farm: A Declarative Approach to Continuous Integration

Service Configuration Management

Service Configuration Management

Pull Deployment of Services

Hydra: A Declarative Approach to Continuous Integration 1

Demo: Controlling.NET Windows Forms from a Java Application. Version 7.3

To install Multifront you need to have familiarity with Internet Information Services (IIS), Microsoft.NET Framework and SQL Server 2008.

.NET Overview. Andreas Schabus Academic Relations Microsoft Österreich GmbH

CLOUD COMPUTING & WINDOWS AZURE

CrossPlatform ASP.NET with Mono. Daniel López Ridruejo

SIEMENS. Teamcenter Windows Server Installation PLM

CrownPeak Java Web Hosting. Version 0.20

Creating a Java application using Perfect Developer and the Java Develo...

How to use PDFlib products with PHP

WEB APPLICATION DEVELOPMENT. UNIT I J2EE Platform 9

A Reference Architecture for Distributed Software Deployment

Middleware Lou Somers

Developing Web Services with Eclipse and Open Source. Claire Rogers Developer Resources and Partner Enablement, HP February, 2004

Developing a Web Server Platform with SAPI Support for AJAX RPC using JSON

CSC230 Getting Starting in C. Tyler Bletsch

Web Services for Management Perl Library VMware ESX Server 3.5, VMware ESX Server 3i version 3.5, and VMware VirtualCenter 2.5

TIBCO ActiveMatrix BusinessWorks Plug-in for TIBCO Managed File Transfer Software Installation

Programming with the Microsoft.NET Framework Using Microsoft Visual Studio 2005 (VB)

Improving software quality with an automated build process

Using the Adobe Access Server for Protected Streaming

Objectif. Participant. Prérequis. Remarque. Programme. C# 3.0 Programming in the.net Framework. 1. Introduction to the.

MarkLogic Server. Connector for SharePoint Administrator s Guide. MarkLogic 8 February, 2015

Web Services with ASP.NET. Asst. Prof. Dr. Kanda Saikaew Department of Computer Engineering Khon Kaen University

ASP &.NET. Microsoft's Solution for Dynamic Web Development. Mohammad Ali Choudhry Milad Armeen Husain Zeerapurwala Campbell Ma Seul Kee Yoon

Braindumps.C questions

Jonathan Worthington Scarborough Linux User Group

Dynamic Web Programming BUILDING WEB APPLICATIONS USING ASP.NET, AJAX AND JAVASCRIPT

C# and Other Languages

OpenMake Dynamic DevOps Suite 7.5 Road Map. Feature review for Mojo, Meister, CloudBuilder and Deploy+

Creating Form Rendering ASP.NET Applications

Application Development,.NET

SAML v1.1 for.net Developer Guide

Introducing the.net Framework 4.0

HYDRA: TOP-NOTCH CONTINUOUS INTEGRATION FOR DEMANDING PEOPLE

XIA Configuration Server

Integrating SharePoint Sites within WebSphere Portal

PEtALS Quick Start. PEtALS Team Roland NAUDIN - February

Quartz.Net Scheduler in Depth

Developing Microsoft SharePoint Server 2013 Advanced Solutions. Version: Demo. Page <<1/8>>

Installing & Customizing the OHMS Viewer Eric Weig

Outside In Image Export Technology SDK Quick Start Guide

Developing Microsoft Azure Solutions 20532B; 5 Days, Instructor-led

24x7 Scheduler Multi-platform Edition 5.2

EJB 3.0 and IIOP.NET. Table of contents. Stefan Jäger / stefanjaeger@bluewin.ch

Greenstone Documentation

A standards-based approach to application integration

BEST WEB PROGRAMMING LANGUAGES TO LEARN ON YOUR OWN TIME

i2b2 Installation Guide

Supported platforms & compilers Required software Where to download the packages Geant4 toolkit installation (release 9.6)

Cross-Platform ASP.NET 5 For the Cloud. Anthony Sneed

Installation Guide of the Change Management API Reference Implementation

Installing the ASP.NET VETtrak APIs onto IIS 5 or 6

inforouter V8.0 Server & Client Requirements

Programmabilty. Programmability in Microsoft Dynamics AX Microsoft Dynamics AX White Paper

The Microsoft Way: COM, OLE/ActiveX, COM+ and.net CLR. Chapter 15

Programming on the Web(CSC309F) Tutorial: Servlets && Tomcat TA:Wael Aboelsaadat

LabStats 5 System Requirements

MS 10978A Introduction to Azure for Developers

Analytics Configuration Reference

HP Fortify Static Code Analyzer

Oracle WebLogic Server

Oracle Tools and Bindings with languages

StreamServe Persuasion SP5 StreamStudio

MS Enterprise Library 5.0 (Logging Application Block)

Beginners Shell Scripting for Batch Jobs

TCH Forecaster Installation Instructions

ARM-BASED PERFORMANCE MONITORING FOR THE ECLIPSE PLATFORM

SCAAS: A Secure Authentication and Access Control System for Web Application Development

Oracle EXAM - 1Z Oracle Weblogic Server 11g: System Administration I. Buy Full Product.

Developing Applications Using Continuous Integration 12c (12.2.1)

Developing, Deploying, and Debugging Applications on Windows Embedded Standard 7

Programming in C# with Microsoft Visual Studio 2010

Managing and Maintaining Windows Server 2008 Servers

OpenEyes - Windows Server Setup. OpenEyes - Windows Server Setup

Export Server Object Extension and Export Task Install guide. (V1.1) Author: Domenico Ciavarella ( )

WCF WINDOWS COMMUNICATION FOUNDATION OVERVIEW OF WCF, MICROSOFTS UNIFIED COMMUNICATION FRAMEWORK FOR.NET APPLICATIONS

Data Sheet VISUAL COBOL WHAT S NEW? COBOL JVM. Java Application Servers. Web Tools Platform PERFORMANCE. Web Services and JSP Tutorials

Developer s Setup Guide VMware vsphere Web Services SDK 4.1

MICROSOFT EXAM QUESTIONS & ANSWERS MICROSOFT EXAM QUESTIONS & ANSWERS

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

IBM WebSphere ILOG Rules for.net

Filestream Ltd. File Stream Document Management Integration Overview

Automating Linux Malware Analysis Using Limon Sandbox Monnappa K A monnappa22@gmail.com

Migration Guide. Sentinel HASP to Sentinel LDK

c360 Portal Installation Guide

Transcription:

Delft University of Technology, EEMCS, Department of Software Technology Philips Healthcare, Philips Informatics Infrastructure (PII), Best February 2, 2012

Service Oriented Computing The Service Oriented Computing (SOC) paradigm is very popular to build distributed applications.

Service Oriented Computing Systems are composed of distributable components (or services), working together to achieve a common goal.

Deployment Deployment of Service Oriented Systems is complex: Many types of components. Various operating systems. Multiple variants.

Deployment Deployment of Service Oriented Systems is labourious:

Deployment Deployment of Service Oriented systems is error-prone Upgrading is even harder

Deployment Deployment of Service Oriented systems is error-prone Upgrading is even harder

Deployment Deployment of Service Oriented systems is error-prone Upgrading is even harder Upgrading How to make upgrades safe and reliable? What to do with incoming connections? Rollbacks?

Example case: StaffTracker

Disnix A toolset for distributed deployment of service-oriented systems: Model-driven Component-agnostic Supported on multiple platforms: Linux, FreeBSD, Mac OS X, Windows (through Cygwin)

Disnix Disnix is built on top of the Nix package manager: Nix expression language to declaratively specify build actions Ability to store multiple versions and variants simultaneously Complete dependencies Reliable and atomic upgrades and rollbacks Garbage collector to safely remove components no longer in use

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

Disnix expressions { stdenv, fetchurl, unzip, apacheant }: { staff }: stdenv.mkderivation { name = "StaffService"; src = fetchurl { url = http://.../staffservice-0.1.zip; sha256 = "0fpjlr3bfind0y94bk442x2p..."; }; buildinputs = [ unzip apacheant ]; buildcommand = unzip $src ant webapp mkdir -p $out/webapps cp *.war $out/webapps cat > $out/conf/catalina/staffservice.xml <<EOF <Context> <Resource name="jdbc/staff" auth="container" type="javax.sql.datasource" url="jdbc:mysql://${staff.target.hostname}/${staff.name}"... /> </Context> EOF ; }

Disnix expressions { stdenv, fetchurl, unzip, apacheant }: { staff }: stdenv.mkderivation { name Disnix = "StaffService"; expression src = fetchurl { url = Builds http://.../staffservice-0.1.zip; and configures a component from its sha256 = "0fpjlr3bfind0y94bk442x2p..."; intra-dependencies and inter-dependencies }; buildinputs Any = build [ unzip tool apacheant can be invoked ]; as long as it is pure buildcommand = For example: Apache Ant, Perl, Python projects are unzip $src ant webapp also supported mkdir -p $out/webapps You can also deploy binary software, by patching it cp *.war $out/webapps Output is produced in a unique directory in the Nix store cat > $out/conf/catalina/staffservice.xml <<EOF <Context> <Resource name="jdbc/staff" auth="container" type="javax.sql.datasource" url="jdbc:mysql://${staff.target.hostname}/${staff.name}"... /> </Context> EOF ; }

Intra-dependency composition {pkgs, system}: rec { apacheant =... stdenv =... staff = import../pkgs/staff { inherit stdenv; }; StaffService = import../pkgs/staffservice { inherit stdenv fetchurl unzip apacheant; }; StaffTracker = import../pkgs/stafftracker { inherit stdenv fetchurl unzip apacheant; };... } Composes components locally, by calling functions with intra-dependency arguments.

Service model {distribution, pkgs, system}: rec { staff = { name = "staff"; pkg = pkgs.staff; type = "mysql-database"; }; StaffService = { name = "StaffService"; pkg = pkgs.staffservice; dependson = { inherit staff; }; type = "tomcat-webapplication"; }; StaffTracker = { name = "StaffTracker"; pkg = pkgs.stafftracker; dependson = { inherit StaffService...; }; type = "tomcat-webapplication"; };... }

Service model {distribution, pkgs, system}: rec { staff = { name = "staff"; pkg = pkgs.staff; type = "mysql-database"; }; Service model StaffService = { name = "StaffService"; pkg = pkgs.staffservice; dependson = { inherit staff; }; type = "tomcat-webapplication"; }; StaffTracker = { name = "StaffTracker"; pkg = pkgs.stafftracker; dependson = { inherit StaffService...; }; type = "tomcat-webapplication"; };... } Defines the distributable components (or services) Refers to the intra-dependency closure of each service Composes components from its inter-dependencies Specifies component types for activation/deactivation

Infrastructure model { test1 = { hostname = "test1.net"; tomcatport = 8080; mysqluser = "user"; mysqlpassword = "secret"; mysqlport = 3306; targetepr = http://test1.net/.../disnixservice; system = "i686-linux"; }; test2 = { hostname = "test2.net"; tomcatport = 8080;... targetepr = http://test2.net/.../disnixservice; system = "x86_64-linux"; }; } Captures machines in the network and their relevant properties and capabilities.

Distribution model {infrastructure}: { staff = [ infrastructure.test1 ]; StaffService = [ infrastructure.test2 ]; StaffTracker = [ infrastructure.test1 infrastructure.test2 ];... } Maps services to machines

Disnix: Deployment Complete deployment process is derived from the models: Building services from source code Optionally, build can be delegated to a capable machine Transferring services (and intra-dependencies) to target machines Deactivation of obsolete services and activation of new services in the right order Optionally, incoming connections can be blocked/queued

Building services Main idea: store all packages in isolation from each other: /nix/store/rpdqxnilb0cg... -firefox-3.5.4 Paths contain a 160-bit cryptographic hash of all inputs used to build the package: Sources Libraries Compilers Build scripts... /nix/store l9w6773m1msy...-openssh-4.6p1 bin ssh sbin sshd smkabrbibqv7...-openssl-0.9.8e lib libssl.so.0.9.8 c6jbqm2mc0a7...-zlib-1.2.3 lib libz.so.1.2.3 im276akmsrhv...-glibc-2.5 lib libc.so.6

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

Runtime dependencies /nix/store nqapqr5cyk...-glibc-2.9 lib libc.so.6 ccayqylscm...-jre-1.6.0 16 bin java n7s283c5yg...-sds2util share java SDS2Util.jar y2ssvzcd86...-sds2eventgenerator bin SDS2EventGenerator share java SDS2EventGenerator.jar

Transferring closures Copy services and intra-dependencies to target machines in the network Only components missing on target machines are transferred Always safe. Files are never overwritten/removed

Transition phase Inter-dependency graph is derived from specifications Deactivate obsolete services (none, if activating new configuration) Activate new services Derive order and dependencies from dependency-graph

Service activation Every service has a type: mysql-database, tomcat-webapplication, process,... Types are attached to external processes, which take 2 arguments activate or deactivate Nix store component Infrastructure model properties are passed as environment variables

Atomic upgrading Two-phase commit protocol mapped onto Nix primitives Commit-request-phase (distribution phase): Build sources Transfer service closures Commit-phase (transition phase): Deactivating/activating services Optionally block/queue connections from end-users

Atomic upgrading In case of failure during commit-request: system is not affected No files overwritten Will be removed by garbage collector In case of failure during commit: Rollback (transition to previous configuration)

Disnix: Examples Example cases: Staff Tracker. Toy SOA system which comes in two variants (PHP/MySQL and Webservices/Java). ViewVC. Open-source web based Subversion repository viewer (http://viewvc.tigris.org). SDS2. Industrial SOA case study from Philips Research. Java EE based.

Deploying.NET services So far, Disnix case studies are deployed on UNIX-like systems, using portable component technologies Deployment of.net services on a Windows infrastructure is challenging because of the underlying purely functional deployment model of Nix and its UNIX heritage.

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 Activation support: Activate web application components in IIS Activate databases in Microsoft SQL server

Disnix extensions How to extend Disnix to support.net service deployment?

Windows support Nix is supported on Windows through Cygwin: Offers UNIX implementation on top of Windows Allows combining UNIX and Windows utilities

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

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

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}... ; }

Disnix expression {dotnetenv}: {zipcodes}: dotnetenv.buildsolution { name = "ZipcodeService"; src =../../../../services/webservices/zipcodeservice; basedir = "ZipcodeService"; slnfile = "ZipcodeService.csproj"; targets = "Package"; prebuild = sed -e s.\sqlexpress ${zipcodes.target.hostname}\sqlexpress \ -e s Initial Catalog=zipcodes Initial catalog=${zipcodes.name} \ -e s User ID=sa User ID=${zipcodes.target.msSqlUsername} \ -e s Password=admin123$ Password=${zipcodes.target.msSqlPassword} \ Web.config ; } Builds and configures a Visual Studio ASP.NET project

Runtime dependencies The.NET runtime has complicated means to locate runtime dependencies.

Resolving runtime dependencies.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

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

Resolving runtime dependencies You can only automatically resolve runtime dependencies in the basedir as an executable..net reflection API can load private assemblies from any location.net CLR fires an AssemblyResolve event if a dependency cannot be found Can be used to load a private runtime assembly from arbitrary locations, e.g. the Nix store

Wrapper class namespace HelloWorldWrapper { class HelloWorldWrapper { private String[] AssemblySearchPaths = { @"C:\cygwin\nix\store\23ga...-ALibrary", @"C:\cygwin\nix\store\833p...-BLibrary" }; private String ExePath = @"C:\cygwin\nix\store\27f2...-Executable\Executable.exe"; private String MainClassName = "SomeExecutable.Executable"; public HelloWorldWrapper(string[] args) { AppDomain currentdomain = AppDomain.CurrentDomain; currentdomain.assemblyresolve += new ResolveEventHandler(MyResolveEventHandler); } Assembly exeassembly = Assembly.LoadFrom(ExePath); Type mainclass = exeassembly.gettype(mainclassname); MethodInfo mainmethod = mainclass.getmethod("main"); mainmethod.invoke(this, new Object[] {args}); static void Main(string[] args) { new HelloWorldWrapper(args); }

Wrapper class private Assembly MyResolveEventHandler(object sender, ResolveEventArgs args) { Assembly MyAssembly; String assemblypath = ""; String requestedassemblyname = args.name.substring(0, args.name.indexof(",")); foreach (String curassemblypath in AssemblySearchPaths) { assemblypath = curassemblypath + "/" + requestedassemblyname + ".dll"; } if (File.Exists(assemblyPath)) break; MyAssembly = Assembly.LoadFrom(assemblyPath); } return MyAssembly;

Wrapper function {dotnetenv, MyAssembly1, MyAssembly2}: dotnetenv.buildwrapper { name = "My.Test.Assembly"; src = /path/to/source/code; slnfile = "Assembly.sln"; assemblyinputs = [ dotnetenv.assembly20path MyAssembly1 MyAssembly2 ]; namespace = "TestNamespace"; mainclassname = "MyTestApplication"; mainclassfile = "MyTestApplication.cs"; } Builds a Visual Studio project and creates a wrapper around the executable

Activation scripts Activation scripts for mssql-database and iis-webapplication must be provided mssql-database invokes OSQL.EXE to automatically create a database and to import table definitions iis-webapplication invokes MSDeploy.exe to deploy web applications on a IIS server

Example case: StaffTracker.NET Ported from Java / Apache Axis2 to.net / C# / WCF

Demo

Conclusion With a number of Disnix extensions it s possible to automatically deploy a service-oriented system using.net technology

Limitations Disnix only manages service components, not infrastructure Microsoft Windows, SQL server and IIS must be installed by other means.net framework is not deployed by Nix/Disnix.NET deployment features are relatively new and untested

References Nix, Nixpkgs, Hydra, NixOS, Disnix, http://nixos.org. Cygwin, http://www.cygwin.com StaffTracker.NET example, http://nixos.org/disnix/examples.html.

Questions