SlideShare a Scribd company logo
1 of 30
Download to read offline
Dysnomia: complementing Nix deployments with
state deployment
Sander van der Burg
October 26, 2018
Sander van der Burg Dysnomia
The Nix project: Declarative deployment
Nix – declarative specification of package build procedures
(including their dependencies)
NixOS – declarative specification of system aspects
NixOps – declarative specification of a network of machines
Disnix – declarative specifications of services, machines and
distribution of services over machines
Deployment activities are implicit – a user writes or adapts a deploy-
ment specification, and the tools will carry out the required activities,
such as building, transfering, activating, and deactivating.
Sander van der Burg Dysnomia
The Nix project: Non-functional properties
Automated deployment using declarative specifications with the
following properties:
Generic. Can be used with many programming languages,
component technologies, and operating systems.
Reproducible. (Almost) no impurities – if inputs are the same,
result should be the same regardless of its location
Reliable. Dependency completeness, (almost) atomic
upgrades and rollbacks.
Efficient. Only the required deployment activities are
executed.
Sander van der Burg Dysnomia
Deploying a NixOS configuration
{ pkgs, ... }:
{
services.mysql = {
enable = true;
package = pkgs.mysql;
};
services.httpd = {
enable = true;
documentRoot = "/var/www";
adminAddr = "admin@localhost";
enablePHP = true;
};
...
}
$ nixos-rebuild switch
Sander van der Burg Dysnomia
Deploying a NixOS configuration
{ pkgs, ... }:
{
services.mysql = {
enable = true;
package = pkgs.mysql;
};
services.httpd = {
enable = true;
documentRoot = "/var/www";
adminAddr = "admin@localhost";
enablePHP = true;
};
...
}
$ nixos-rebuild switch
Sander van der Burg Dysnomia
Deploying NixOS
With a NixOS configuration file, we can reproduce the exact
same configuration elsewhere.
Managing state
But, what about my databases?
Nix only manages the static parts of a system, not any state.
Sander van der Burg Dysnomia
Managing service-oriented systems with Disnix
Service-oriented systems may have many database components:
Sander van der Burg Dysnomia
Managing service-oriented systems with Disnix
To be flexible, we must redeploy regularly respond to events, such
as:
Load increases → distribute services over more machines
Load decreases → consolidate servers and retire obsolete
machines
A machine crashes → redistribute missing services
Sander van der Burg Dysnomia
Managing service-oriented systems with Disnix
To be able to migrate state, automation is required!
Sander van der Burg Dysnomia
Dysnomia: providing complementary state deployment
Sander van der Burg Dysnomia
Dysnomia: Concepts
Mutable component. A unit of state.
Container. An environment that can host one or more
mutable components.
Dysnomia module. An executable implementing deployment
activities for a given component type.
Sander van der Burg Dysnomia
Dysnomia: Components
Component configurations capture the (static) initial state of a
component in a container. Examples:
mysql-database: DDL instructions that set up the database
schema
tomcat-webapplication: a Java web application archive (WAR
file)
process: An executable in the bin/ sub folder that should be
launched on startup
Initial state can be generated by a Nix expression.
Sander van der Burg Dysnomia
Dysnomia: Example component configuration
˜/testdb
create table author
( AUTHOR_ID INTEGER NOT NULL,
FirstName VARCHAR(255) NOT NULL,
LastName VARCHAR(255) NOT NULL,
PRIMARY KEY(AUTHOR_ID)
);
create table books
( ISBN VARCHAR(255) NOT NULL,
Title VARCHAR(255) NOT NULL,
AUTHOR_ID INTEGER NOT NULL,
PRIMARY KEY(ISBN),
FOREIGN KEY(AUTHOR_ID) REFERENCES author(AUTHOR_ID)
ON UPDATE CASCADE ON DELETE CASCADE
);
Sander van der Burg Dysnomia
Dysnomia: Containers
A key = value pair configuration file describing the properties of a
container:
˜/mysql-prod
type=mysql-database
mysqlUsername=root
mysqlPassword=verysecret
One mandatory property: type that refers to Dysnomia
module that executes deployment activities.
Remainder of the properties are arbitrary. They are exposed as
environment variables to the Dysnomia module that executes
deployment activities.
Sander van der Burg Dysnomia
Dysnomia: Modules
An executable that takes two command-line parameters:
Activity to execute
Path to the initial state of the component
There are no restrictions imposed on what modules can do.
Modules follow conventions.
Sander van der Burg Dysnomia
Dysnomia: Modules
#!/bin/bash -e
case "$1" in
activate)
echo "Echo module: Activate service: $2"
;;
deactivate)
echo "Echo module: Deactivate service: $2"
;;
snapshot)
echo "Echo module: Snapshot state of service: $2"
;;
restore)
echo "Echo module: Restore state of service: $2"
;;
collect-garbage)
echo "Echo module: Collect garbage of service: $2"
;;
esac
Sander van der Burg Dysnomia
Dysnomia: executing deployment activities generically
Create and initialize a database:
$ dysnomia --operation activate 
--component ~/testdb 
--container ~/mysql-prod
Take a snapshot of a database’s current state:
$ dysnomia --operation snapshot 
--component ~/testdb 
--container ~/mysql-prod
Mark a database as obsolete:
$ dysnomia --operation deactivate 
--component ~/testdb 
--container ~/mysql-prod
Sander van der Burg Dysnomia
Dysnomia: executing deployment activities generically
Delete a database that has been marked as obsolete:
$ dysnomia --operation collect-garbage 
--component ~/testdb 
--container ~/mysql-prod
Create and initialize a database again:
$ dysnomia --operation activate 
--component ~/testdb 
--container ~/mysql-prod
Restore the last database snapshot:
$ dysnomia --operation restore 
--component ~/testdb 
--container ~/mysql-prod
Sander van der Burg Dysnomia
Dysnomia: managing snapshots
Dysnomia provides a snapshot store that manages multiple genera-
tions of snapshots:
$ dysnomia-snapshots --query-all
mysql-production/testdb/9b0c3562b57dafd00e480c6b3a...
mysql-production/testdb/1df326254d596dd31d9d9db30e...
mysql-production/testdb/330232eda02b77c3629a4623b4...
Each component type follows its own naming convention for
snapshots
The MySQL module computes the SHA256 hash of the
output and uses it as the snapshot name
Sander van der Burg Dysnomia
Dysnomia: managing snapshots
We can automatically delete obsolete snapshots:
$ dysnomia-snapshots --gc --keep 3
The above command keeps the last 3 snapshot generations and
removes the remainder.
Sander van der Burg Dysnomia
Deploying a NixOS configuration with state
{ pkgs, ... }:
{
services = {
mysql = {
enable = true;
package = pkgs.mysql;
};
httpd = {
enable = true;
documentRoot = "/var/www";
adminAddr = "admin@localhost";
enablePHP = true;
};
dysnomia = {
enable = true;
components.mysql-database.testdb = ./testdb;
};
};
}
$ nixos-rebuild switch
$ dysnomia-containers --deploy
Sander van der Burg Dysnomia
Enabling state deployment in Disnix
{distribution, invDistribution, pkgs, system}:
let
customPkgs = import ../top-level/all-packages.nix {
inherit pkgs system;
};
in
rec {
portaldb = {
name = "portaldb";
pkg = customPkgs.portaldb;
type = "mysql-database";
deployState = true;
};
...
}
State deployment is disabled by default
Annotate each relevant service with deployState = true;
Enable globally by providing the --deploy-state parameter
or by setting the DISNIX DEPLOY STATE environment variable
Sander van der Burg Dysnomia
Migrating databases with Disnix
{infrastructure}:
{
usersdb = [ infrastructure.test1 ];
cmsdb = [ infrastructure.test2 ];
cmsgallerydb = [ infrastructure.test1 ];
homeworkdb = [ infrastructure.test2 ];
literaturedb = [ infrastructure.test1 ];
portaldb = [ infrastructure.test2 ];
}
$ disnix-env -s services.nix -i infrastructure.nix -d distribution.nix
Updating the location of a database in the distribution model and
redeploying the system also migrates state from one machine to
another.
Sander van der Burg Dysnomia
Disnix: snapshots and restores
It is also possible to use Dysnomia as a primitive backup tool.
To take a snapshot of all deployed mutable components, run:
$ disnix-snapshot
To restore an individual database’s state:
$ disnix-restore --component portaldb
Sander van der Burg Dysnomia
Demo
Sander van der Burg Dysnomia
Is the state deployment problem solved?
Sander van der Burg Dysnomia
Drawbacks
Not all state can be managed by Dysnomia. It only works
with well separated units of state.
Impractical to e.g. manage user accounts and groups
Dysnomia relies on exporting and syncing state to the
filesystem.
May be too expensive (in terms of storage) and time
consuming for large data sets
Impractical to use on a system level in a network.
A snapshot of the entire system is taken. Difficult to manage
components individually.
Dysnomia works well for (large) collections of small data.
It is possible to manage ˜100 MongoDB databases with sizes
between several megabytes/several gigabytes
Sander van der Burg Dysnomia
Alternative approaches
Filesystem-level snapshots:
An experimental version of Nix called S-Nix has been developed
using Ext3COW (2008): http://www.cs.uu.nl/education/
scripties/scriptie.php?SID=INF/SCR-2007-053
Faster, cheaper
Difficult to guarantee portability and consistency.
Partition-level snapshots:
NixOps is capable of taking EBS snapshots
Faster, cheaper
Works on system-level. Hard to manage individual databases.
Use database replication engines:
More efficient, no additional storage required beyond the
binary log
Hard to generalize in a framework.
Sander van der Burg Dysnomia
Availability
Dysnomia can be used as an independent tool:
https://github.com/svanderburg/dysnomia
Does not require Nix or any Nix-related tools
Integrated in NixOS, by enabling the
services.dysnomia.enable = true; setting
All relevant Dysnomia modules and container configurations
are configured automatically
Integrated in Disnix
Dysnomia should be considered an advanced prototype tool!
Sander van der Burg Dysnomia
Questions
Sander van der Burg Dysnomia

More Related Content

What's hot

Windows server 2012 failover clustering new features
Windows server 2012 failover clustering new featuresWindows server 2012 failover clustering new features
Windows server 2012 failover clustering new features
Joseph D'Antoni
 
Operations, Consistency, Failover for Multi-DC Clusters (Alexander Dejanovski...
Operations, Consistency, Failover for Multi-DC Clusters (Alexander Dejanovski...Operations, Consistency, Failover for Multi-DC Clusters (Alexander Dejanovski...
Operations, Consistency, Failover for Multi-DC Clusters (Alexander Dejanovski...
DataStax
 

What's hot (20)

DTraceCloud2012
DTraceCloud2012DTraceCloud2012
DTraceCloud2012
 
Apache Cassandra and DataStax Enterprise Explained with Peter Halliday at Wil...
Apache Cassandra and DataStax Enterprise Explained with Peter Halliday at Wil...Apache Cassandra and DataStax Enterprise Explained with Peter Halliday at Wil...
Apache Cassandra and DataStax Enterprise Explained with Peter Halliday at Wil...
 
High Availability with Novell Cluster Services for Novell Open Enterprise Ser...
High Availability with Novell Cluster Services for Novell Open Enterprise Ser...High Availability with Novell Cluster Services for Novell Open Enterprise Ser...
High Availability with Novell Cluster Services for Novell Open Enterprise Ser...
 
Containers and Namespaces in the Linux Kernel
Containers and Namespaces in the Linux KernelContainers and Namespaces in the Linux Kernel
Containers and Namespaces in the Linux Kernel
 
Introduction to Cassandra: Replication and Consistency
Introduction to Cassandra: Replication and ConsistencyIntroduction to Cassandra: Replication and Consistency
Introduction to Cassandra: Replication and Consistency
 
Namespaces and cgroups - the basis of Linux containers
Namespaces and cgroups - the basis of Linux containersNamespaces and cgroups - the basis of Linux containers
Namespaces and cgroups - the basis of Linux containers
 
Advanced Namespaces and cgroups
Advanced Namespaces and cgroupsAdvanced Namespaces and cgroups
Advanced Namespaces and cgroups
 
Namespaces in Linux
Namespaces in LinuxNamespaces in Linux
Namespaces in Linux
 
Linux cgroups and namespaces
Linux cgroups and namespacesLinux cgroups and namespaces
Linux cgroups and namespaces
 
Automating Your CloudStack Cloud with Puppet
Automating Your CloudStack Cloud with PuppetAutomating Your CloudStack Cloud with Puppet
Automating Your CloudStack Cloud with Puppet
 
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
 
Presentation
PresentationPresentation
Presentation
 
Implementing dr w. hyper v clustering
Implementing dr w. hyper v clusteringImplementing dr w. hyper v clustering
Implementing dr w. hyper v clustering
 
Beginning Operations: 7 Deadly Sins for Apache Cassandra Ops
Beginning Operations: 7 Deadly Sins for Apache Cassandra OpsBeginning Operations: 7 Deadly Sins for Apache Cassandra Ops
Beginning Operations: 7 Deadly Sins for Apache Cassandra Ops
 
An Overview of Apache Cassandra
An Overview of Apache CassandraAn Overview of Apache Cassandra
An Overview of Apache Cassandra
 
DTrace in the Non-global Zone
DTrace in the Non-global ZoneDTrace in the Non-global Zone
DTrace in the Non-global Zone
 
Windows server 2012 failover clustering new features
Windows server 2012 failover clustering new featuresWindows server 2012 failover clustering new features
Windows server 2012 failover clustering new features
 
BACD July 2012 : The Xen Cloud Platform
BACD July 2012 : The Xen Cloud Platform BACD July 2012 : The Xen Cloud Platform
BACD July 2012 : The Xen Cloud Platform
 
Operations, Consistency, Failover for Multi-DC Clusters (Alexander Dejanovski...
Operations, Consistency, Failover for Multi-DC Clusters (Alexander Dejanovski...Operations, Consistency, Failover for Multi-DC Clusters (Alexander Dejanovski...
Operations, Consistency, Failover for Multi-DC Clusters (Alexander Dejanovski...
 
Securing your cloud with Xen's advanced security features
Securing your cloud with Xen's advanced security featuresSecuring your cloud with Xen's advanced security features
Securing your cloud with Xen's advanced security features
 

Similar to Dysnomia: complementing Nix deployments with state deployment

Drupalcamp es 2013 drupal with lxc docker and vagrant
Drupalcamp es 2013  drupal with lxc docker and vagrant Drupalcamp es 2013  drupal with lxc docker and vagrant
Drupalcamp es 2013 drupal with lxc docker and vagrant
Ricardo Amaro
 

Similar to Dysnomia: complementing Nix deployments with state deployment (20)

The Nix project
The Nix projectThe Nix project
The Nix project
 
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
 
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
 
Deploying .NET services with Disnix
Deploying .NET services with DisnixDeploying .NET services with Disnix
Deploying .NET services with Disnix
 
Nagios Conference 2011 - William Leibzon - Nagios In Cloud Computing Environm...
Nagios Conference 2011 - William Leibzon - Nagios In Cloud Computing Environm...Nagios Conference 2011 - William Leibzon - Nagios In Cloud Computing Environm...
Nagios Conference 2011 - William Leibzon - Nagios In Cloud Computing Environm...
 
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
 
Unleash software architecture leveraging on docker
Unleash software architecture leveraging on dockerUnleash software architecture leveraging on docker
Unleash software architecture leveraging on docker
 
Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...
 
Deploying (micro)services with Disnix
Deploying (micro)services with DisnixDeploying (micro)services with Disnix
Deploying (micro)services with Disnix
 
DevOps: Cooking Drupal Deployment
DevOps: Cooking Drupal DeploymentDevOps: Cooking Drupal Deployment
DevOps: Cooking Drupal 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
 
Model-driven Distributed Software Deployment
Model-driven Distributed Software DeploymentModel-driven Distributed Software Deployment
Model-driven Distributed Software Deployment
 
With one click
With one clickWith one click
With one click
 
Automating Mendix application deployments with Nix
Automating Mendix application deployments with NixAutomating Mendix application deployments with Nix
Automating Mendix application deployments with Nix
 
The Nix project
The Nix projectThe Nix project
The Nix project
 
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
 
Fully fault tolerant real time data pipeline with docker and mesos
Fully fault tolerant real time data pipeline with docker and mesos Fully fault tolerant real time data pipeline with docker and mesos
Fully fault tolerant real time data pipeline with docker and mesos
 
Deploying .NET applications with the Nix package manager
Deploying .NET applications with the Nix package managerDeploying .NET applications with the Nix package manager
Deploying .NET applications with the Nix package manager
 
Omaha (Google Update) server
Omaha (Google Update) serverOmaha (Google Update) server
Omaha (Google Update) server
 
Drupalcamp es 2013 drupal with lxc docker and vagrant
Drupalcamp es 2013  drupal with lxc docker and vagrant Drupalcamp es 2013  drupal with lxc docker and vagrant
Drupalcamp es 2013 drupal with lxc docker and vagrant
 

More from 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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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

Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Sheetaleventcompany
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
sexy call girls service in goa
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
Diya Sharma
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 

Recently uploaded (20)

Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 

Dysnomia: complementing Nix deployments with state deployment

  • 1. Dysnomia: complementing Nix deployments with state deployment Sander van der Burg October 26, 2018 Sander van der Burg Dysnomia
  • 2. The Nix project: Declarative deployment Nix – declarative specification of package build procedures (including their dependencies) NixOS – declarative specification of system aspects NixOps – declarative specification of a network of machines Disnix – declarative specifications of services, machines and distribution of services over machines Deployment activities are implicit – a user writes or adapts a deploy- ment specification, and the tools will carry out the required activities, such as building, transfering, activating, and deactivating. Sander van der Burg Dysnomia
  • 3. The Nix project: Non-functional properties Automated deployment using declarative specifications with the following properties: Generic. Can be used with many programming languages, component technologies, and operating systems. Reproducible. (Almost) no impurities – if inputs are the same, result should be the same regardless of its location Reliable. Dependency completeness, (almost) atomic upgrades and rollbacks. Efficient. Only the required deployment activities are executed. Sander van der Burg Dysnomia
  • 4. Deploying a NixOS configuration { pkgs, ... }: { services.mysql = { enable = true; package = pkgs.mysql; }; services.httpd = { enable = true; documentRoot = "/var/www"; adminAddr = "admin@localhost"; enablePHP = true; }; ... } $ nixos-rebuild switch Sander van der Burg Dysnomia
  • 5. Deploying a NixOS configuration { pkgs, ... }: { services.mysql = { enable = true; package = pkgs.mysql; }; services.httpd = { enable = true; documentRoot = "/var/www"; adminAddr = "admin@localhost"; enablePHP = true; }; ... } $ nixos-rebuild switch Sander van der Burg Dysnomia Deploying NixOS With a NixOS configuration file, we can reproduce the exact same configuration elsewhere.
  • 6. Managing state But, what about my databases? Nix only manages the static parts of a system, not any state. Sander van der Burg Dysnomia
  • 7. Managing service-oriented systems with Disnix Service-oriented systems may have many database components: Sander van der Burg Dysnomia
  • 8. Managing service-oriented systems with Disnix To be flexible, we must redeploy regularly respond to events, such as: Load increases → distribute services over more machines Load decreases → consolidate servers and retire obsolete machines A machine crashes → redistribute missing services Sander van der Burg Dysnomia
  • 9. Managing service-oriented systems with Disnix To be able to migrate state, automation is required! Sander van der Burg Dysnomia
  • 10. Dysnomia: providing complementary state deployment Sander van der Burg Dysnomia
  • 11. Dysnomia: Concepts Mutable component. A unit of state. Container. An environment that can host one or more mutable components. Dysnomia module. An executable implementing deployment activities for a given component type. Sander van der Burg Dysnomia
  • 12. Dysnomia: Components Component configurations capture the (static) initial state of a component in a container. Examples: mysql-database: DDL instructions that set up the database schema tomcat-webapplication: a Java web application archive (WAR file) process: An executable in the bin/ sub folder that should be launched on startup Initial state can be generated by a Nix expression. Sander van der Burg Dysnomia
  • 13. Dysnomia: Example component configuration ˜/testdb create table author ( AUTHOR_ID INTEGER NOT NULL, FirstName VARCHAR(255) NOT NULL, LastName VARCHAR(255) NOT NULL, PRIMARY KEY(AUTHOR_ID) ); create table books ( ISBN VARCHAR(255) NOT NULL, Title VARCHAR(255) NOT NULL, AUTHOR_ID INTEGER NOT NULL, PRIMARY KEY(ISBN), FOREIGN KEY(AUTHOR_ID) REFERENCES author(AUTHOR_ID) ON UPDATE CASCADE ON DELETE CASCADE ); Sander van der Burg Dysnomia
  • 14. Dysnomia: Containers A key = value pair configuration file describing the properties of a container: ˜/mysql-prod type=mysql-database mysqlUsername=root mysqlPassword=verysecret One mandatory property: type that refers to Dysnomia module that executes deployment activities. Remainder of the properties are arbitrary. They are exposed as environment variables to the Dysnomia module that executes deployment activities. Sander van der Burg Dysnomia
  • 15. Dysnomia: Modules An executable that takes two command-line parameters: Activity to execute Path to the initial state of the component There are no restrictions imposed on what modules can do. Modules follow conventions. Sander van der Burg Dysnomia
  • 16. Dysnomia: Modules #!/bin/bash -e case "$1" in activate) echo "Echo module: Activate service: $2" ;; deactivate) echo "Echo module: Deactivate service: $2" ;; snapshot) echo "Echo module: Snapshot state of service: $2" ;; restore) echo "Echo module: Restore state of service: $2" ;; collect-garbage) echo "Echo module: Collect garbage of service: $2" ;; esac Sander van der Burg Dysnomia
  • 17. Dysnomia: executing deployment activities generically Create and initialize a database: $ dysnomia --operation activate --component ~/testdb --container ~/mysql-prod Take a snapshot of a database’s current state: $ dysnomia --operation snapshot --component ~/testdb --container ~/mysql-prod Mark a database as obsolete: $ dysnomia --operation deactivate --component ~/testdb --container ~/mysql-prod Sander van der Burg Dysnomia
  • 18. Dysnomia: executing deployment activities generically Delete a database that has been marked as obsolete: $ dysnomia --operation collect-garbage --component ~/testdb --container ~/mysql-prod Create and initialize a database again: $ dysnomia --operation activate --component ~/testdb --container ~/mysql-prod Restore the last database snapshot: $ dysnomia --operation restore --component ~/testdb --container ~/mysql-prod Sander van der Burg Dysnomia
  • 19. Dysnomia: managing snapshots Dysnomia provides a snapshot store that manages multiple genera- tions of snapshots: $ dysnomia-snapshots --query-all mysql-production/testdb/9b0c3562b57dafd00e480c6b3a... mysql-production/testdb/1df326254d596dd31d9d9db30e... mysql-production/testdb/330232eda02b77c3629a4623b4... Each component type follows its own naming convention for snapshots The MySQL module computes the SHA256 hash of the output and uses it as the snapshot name Sander van der Burg Dysnomia
  • 20. Dysnomia: managing snapshots We can automatically delete obsolete snapshots: $ dysnomia-snapshots --gc --keep 3 The above command keeps the last 3 snapshot generations and removes the remainder. Sander van der Burg Dysnomia
  • 21. Deploying a NixOS configuration with state { pkgs, ... }: { services = { mysql = { enable = true; package = pkgs.mysql; }; httpd = { enable = true; documentRoot = "/var/www"; adminAddr = "admin@localhost"; enablePHP = true; }; dysnomia = { enable = true; components.mysql-database.testdb = ./testdb; }; }; } $ nixos-rebuild switch $ dysnomia-containers --deploy Sander van der Burg Dysnomia
  • 22. Enabling state deployment in Disnix {distribution, invDistribution, pkgs, system}: let customPkgs = import ../top-level/all-packages.nix { inherit pkgs system; }; in rec { portaldb = { name = "portaldb"; pkg = customPkgs.portaldb; type = "mysql-database"; deployState = true; }; ... } State deployment is disabled by default Annotate each relevant service with deployState = true; Enable globally by providing the --deploy-state parameter or by setting the DISNIX DEPLOY STATE environment variable Sander van der Burg Dysnomia
  • 23. Migrating databases with Disnix {infrastructure}: { usersdb = [ infrastructure.test1 ]; cmsdb = [ infrastructure.test2 ]; cmsgallerydb = [ infrastructure.test1 ]; homeworkdb = [ infrastructure.test2 ]; literaturedb = [ infrastructure.test1 ]; portaldb = [ infrastructure.test2 ]; } $ disnix-env -s services.nix -i infrastructure.nix -d distribution.nix Updating the location of a database in the distribution model and redeploying the system also migrates state from one machine to another. Sander van der Burg Dysnomia
  • 24. Disnix: snapshots and restores It is also possible to use Dysnomia as a primitive backup tool. To take a snapshot of all deployed mutable components, run: $ disnix-snapshot To restore an individual database’s state: $ disnix-restore --component portaldb Sander van der Burg Dysnomia
  • 25. Demo Sander van der Burg Dysnomia
  • 26. Is the state deployment problem solved? Sander van der Burg Dysnomia
  • 27. Drawbacks Not all state can be managed by Dysnomia. It only works with well separated units of state. Impractical to e.g. manage user accounts and groups Dysnomia relies on exporting and syncing state to the filesystem. May be too expensive (in terms of storage) and time consuming for large data sets Impractical to use on a system level in a network. A snapshot of the entire system is taken. Difficult to manage components individually. Dysnomia works well for (large) collections of small data. It is possible to manage ˜100 MongoDB databases with sizes between several megabytes/several gigabytes Sander van der Burg Dysnomia
  • 28. Alternative approaches Filesystem-level snapshots: An experimental version of Nix called S-Nix has been developed using Ext3COW (2008): http://www.cs.uu.nl/education/ scripties/scriptie.php?SID=INF/SCR-2007-053 Faster, cheaper Difficult to guarantee portability and consistency. Partition-level snapshots: NixOps is capable of taking EBS snapshots Faster, cheaper Works on system-level. Hard to manage individual databases. Use database replication engines: More efficient, no additional storage required beyond the binary log Hard to generalize in a framework. Sander van der Burg Dysnomia
  • 29. Availability Dysnomia can be used as an independent tool: https://github.com/svanderburg/dysnomia Does not require Nix or any Nix-related tools Integrated in NixOS, by enabling the services.dysnomia.enable = true; setting All relevant Dysnomia modules and container configurations are configured automatically Integrated in Disnix Dysnomia should be considered an advanced prototype tool! Sander van der Burg Dysnomia
  • 30. Questions Sander van der Burg Dysnomia