Top Banner
Constructing Software Environments Production and User Environments in Grid’5000 Joseph Emeras Olivier Richard
62

Constructing Software Environments

Dec 18, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Constructing Software Environments

Constructing Software EnvironmentsProduction and User Environments in Grid’5000

Joseph Emeras Olivier Richard

Page 2: Constructing Software Environments

Virtual Machines Environments in Clouds (and Grids)

Noeud 1

Xen

NIC1

MV

NIC2

Noeud 1

Xen

NIC1

MV

NIC2

Noeud 1

Xen

NIC1

MV

NIC2

Noeud 1

Xen

NIC1

MV

NIC2

NAS/SAN (Stockage de binaires

et de données)

Poste utilisateur

Machine virtuelle (MV)

Lien dédié à la gestion de MVs

Lien dédié aux MVs

Bac

kend

(Ser

veur

Ope

nNeb

ula)

Internet/Réseau

Frontal

...

Switch NAS/SAN Switch Ethernet

Base des Environnements(Stockage d'images de MVs)

INRIA MESCAL TEAM ALADDIN-GRID’5000 2 / 46

Page 3: Constructing Software Environments

Software Environment Images

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

Network

Hardware(or Hypervisor)

Services

Software Environment

INRIA MESCAL TEAM ALADDIN-GRID’5000 3 / 46

Page 4: Constructing Software Environments

Outline

1 Environment Images

2 State of the ArtCFEnginePuppetChefJujuUForgeKameleonOthers

3 The Grid’5000 CaseGrid’5000 PresentationGrid’5000 environments management

4 Conclusion

INRIA MESCAL TEAM ALADDIN-GRID’5000 4 / 46

Page 5: Constructing Software Environments

Outline

1 Environment Images

2 State of the ArtCFEnginePuppetChefJujuUForgeKameleonOthers

3 The Grid’5000 CaseGrid’5000 PresentationGrid’5000 environments management

4 Conclusion

INRIA MESCAL TEAM ALADDIN-GRID’5000 Environment Images 5 / 46

Page 6: Constructing Software Environments

Environment Images

Why?

I Portability on heterogeneous platforms

I Security

I Experiments reproducibility

How?

Different approaches:

I construct from scratch

I converge from existing

What?

I Softwares

I Configurations

I Files

I Versions, Data Provenance?

INRIA MESCAL TEAM ALADDIN-GRID’5000 Environment Images 6 / 46

Page 7: Constructing Software Environments

Environment Images

Why?

I Portability on heterogeneous platforms

I Security

I Experiments reproducibility

How?

Different approaches:

I construct from scratch

I converge from existing

What?

I Softwares

I Configurations

I Files

I Versions, Data Provenance?

INRIA MESCAL TEAM ALADDIN-GRID’5000 Environment Images 6 / 46

Page 8: Constructing Software Environments

Environment Images

Why?

I Portability on heterogeneous platforms

I Security

I Experiments reproducibility

How?

Different approaches:

I construct from scratch

I converge from existing

What?

I Softwares

I Configurations

I Files

I Versions, Data Provenance?

INRIA MESCAL TEAM ALADDIN-GRID’5000 Environment Images 6 / 46

Page 9: Constructing Software Environments

Environment Images

Virtual Machines but also physical machines.

The Grid’5000 case:

I Production environments (compute nodes)

I User environments

I Service Machines environments

INRIA MESCAL TEAM ALADDIN-GRID’5000 Environment Images 7 / 46

Page 10: Constructing Software Environments

Outline

1 Environment Images

2 State of the ArtCFEnginePuppetChefJujuUForgeKameleonOthers

3 The Grid’5000 CaseGrid’5000 PresentationGrid’5000 environments management

4 Conclusion

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 8 / 46

Page 11: Constructing Software Environments

CFEngine

Concepts

I Configuration Management System

I From a policy specification: automate configuration andmaintenance of computers

I Operating System-independent interface

I Describe the FINAL state rather than the changes chainI PromiseI system will end up with a predictable result whatever its initial stateI need to describe everything required in the system

I Possible actions: file operations, install package, execute command

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 9 / 46

Page 12: Constructing Software Environments

CFEngine

Concepts

I Configuration Management System

I From a policy specification: automate configuration andmaintenance of computers

I Operating System-independent interface

I Describe the FINAL state rather than the changes chainI PromiseI system will end up with a predictable result whatever its initial stateI need to describe everything required in the system

I Possible actions: file operations, install package, execute command

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 9 / 46

Page 13: Constructing Software Environments

CFEngine

Concepts

I Configuration Management System

I From a policy specification: automate configuration andmaintenance of computers

I Operating System-independent interface

I Describe the FINAL state rather than the changes chainI PromiseI system will end up with a predictable result whatever its initial stateI need to describe everything required in the system

I Possible actions: file operations, install package, execute command

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

CFEngine

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 9 / 46

Page 14: Constructing Software Environments

Puppet

I Automated machines configuration managementI Centralized environment specificationI Automatic clients resynchronization

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 10 / 46

Page 15: Constructing Software Environments

Puppet

Concepts

I Same base concept as in CFEngine: focus on the final state

I RAL: Resource Abstraction Layer (Puppet DSL)I configuration in high-level terms: users, services and packagesI platform independent languageI support for Ruby

I Manifests: declaration of the conditions the environment requires

I Inheritance and dependencies

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 11 / 46

Page 16: Constructing Software Environments

Puppet

Concepts

I Same base concept as in CFEngine: focus on the final state

I RAL: Resource Abstraction Layer (Puppet DSL)I configuration in high-level terms: users, services and packagesI platform independent languageI support for Ruby

I Manifests: declaration of the conditions the environment requires

I Inheritance and dependencies

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 11 / 46

Page 17: Constructing Software Environments

Puppet

Concepts

I Same base concept as in CFEngine: focus on the final state

I RAL: Resource Abstraction Layer (Puppet DSL)I configuration in high-level terms: users, services and packagesI platform independent languageI support for Ruby

I Manifests: declaration of the conditions the environment requires

I Inheritance and dependencies

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

Puppet

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 11 / 46

Page 18: Constructing Software Environments

Chef

Concepts

I Both High-Level and more Technical vision

I Describe the “changes chain”

I Files, users, packages management operations simplified

I Powerful Ruby based recipes:I platform independent

I some operations are, some notI recipes can “make themselves” platform independent (see next slide examples)

I use of codeI (re-)configurable/definable DSL

I Client/Server + Solo mode

I “Recipes” are grouped into “Cookbooks”

I Chef loads a cookbook as a git repository archive (can be remote)

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 12 / 46

Page 19: Constructing Software Environments

Chef Examples

Example: High-level

case node[:platform]when "ubuntu", "debian"

include_recipe "setup::apt"end

Example: execute a command

execute "apt-get-update" docommand "apt-get update"

end

Example: install packages

%w{oar-common oar-doc oar-libs oar-node}.each do |pkg|package pkg do

action :installversion "2.2.16-2"options "--force-yes"

endend

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 13 / 46

Page 20: Constructing Software Environments

Chef Examples

Example: High-level

case node[:platform]when "ubuntu", "debian"

include_recipe "setup::apt"end

Example: execute a command

execute "apt-get-update" docommand "apt-get update"

end

Example: install packages

%w{oar-common oar-doc oar-libs oar-node}.each do |pkg|package pkg do

action :installversion "2.2.16-2"options "--force-yes"

endend

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 13 / 46

Page 21: Constructing Software Environments

Chef Examples

Example: High-level

case node[:platform]when "ubuntu", "debian"

include_recipe "setup::apt"end

Example: execute a command

execute "apt-get-update" docommand "apt-get update"

end

Example: install packages

%w{oar-common oar-doc oar-libs oar-node}.each do |pkg|package pkg do

action :installversion "2.2.16-2"options "--force-yes"

endend

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 13 / 46

Page 22: Constructing Software Environments

Chef

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 14 / 46

Page 23: Constructing Software Environments

Chef

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

Chef

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 15 / 46

Page 24: Constructing Software Environments

Juju (formerly Ensemble)

In traditional West African religion, use of objects (charms) to perform witchcraft.

Concepts

I Package management on a higher level, around services

I Automate services deployment and configuration (cloud targeted)

I Link the services between themselves

I Ubuntu specific: Personal Package Archive (PPA)

I Charms (formulas) manage the services install/configuration part

Charms

I Description of a service integration and reaction to juju events(services linking)

I MetadataI info, versionI dependencies

I Hooks (code)I install, start, stopI relation management (services linking)

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 16 / 46

Page 25: Constructing Software Environments

Juju (formerly Ensemble)

In traditional West African religion, use of objects (charms) to perform witchcraft.

Concepts

I Package management on a higher level, around services

I Automate services deployment and configuration (cloud targeted)

I Link the services between themselves

I Ubuntu specific: Personal Package Archive (PPA)

I Charms (formulas) manage the services install/configuration part

Charms

I Description of a service integration and reaction to juju events(services linking)

I MetadataI info, versionI dependencies

I Hooks (code)I install, start, stopI relation management (services linking)

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 16 / 46

Page 26: Constructing Software Environments

Juju

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 17 / 46

Page 27: Constructing Software Environments

Juju

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

Juju

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 18 / 46

Page 28: Constructing Software Environments

UShareSoft UForge

Concepts

I Commercial solution (but a restricted free account is available)

I Generate software appliances for several OS in several outputformats

I CentOS, Debian, Ubuntu, Fedora . . .I Amazon, cloud.com, KVM, raw, VirtualBox, Xen, VMWare, iso . . .

I 2 ways:I online: simple default image generatorI UForge: custom image generator (choose applications to install)

I REST API for automating and streamlining software build

I Custom bootscripts + auto or custom environmental configuration

I Software image templates: update, clone and share

I Easy but blackbox

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 19 / 46

Page 29: Constructing Software Environments

UForge

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 20 / 46

Page 30: Constructing Software Environments

UForge

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

UForge

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 21 / 46

Page 31: Constructing Software Environments

Kameleon

Concepts

I Model the software environment: recreate it in the same way

I From scratch or from an existing “basis” environment

I Kameleon describes the “changes chain”

Entities

I Recipe (environment description: high level, semantic, YAML)

I combination of steps that lead to environment construction

I Steps (low level, technical, shell code)

I one technical action (software installation, configuration . . . )

More about Kameleon

I Recipes and steps for Debian, OAR, SLURM, G5K

I Output formats: KVM, Grid’5000, Xen, VirtualBox, raw, iso

I Able to load, modify and save a UForge image

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 22 / 46

Page 32: Constructing Software Environments

Kameleon

Concepts

I Model the software environment: recreate it in the same way

I From scratch or from an existing “basis” environment

I Kameleon describes the “changes chain”

Entities

I Recipe (environment description: high level, semantic, YAML)

I combination of steps that lead to environment construction

I Steps (low level, technical, shell code)

I one technical action (software installation, configuration . . . )

More about Kameleon

I Recipes and steps for Debian, OAR, SLURM, G5K

I Output formats: KVM, Grid’5000, Xen, VirtualBox, raw, iso

I Able to load, modify and save a UForge image

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 22 / 46

Page 33: Constructing Software Environments

Kameleon

Concepts

I Model the software environment: recreate it in the same way

I From scratch or from an existing “basis” environment

I Kameleon describes the “changes chain”

Entities

I Recipe (environment description: high level, semantic, YAML)

I combination of steps that lead to environment construction

I Steps (low level, technical, shell code)

I one technical action (software installation, configuration . . . )

More about Kameleon

I Recipes and steps for Debian, OAR, SLURM, G5K

I Output formats: KVM, Grid’5000, Xen, VirtualBox, raw, iso

I Able to load, modify and save a UForge image

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 22 / 46

Page 34: Constructing Software Environments

Kameleon

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 23 / 46

Page 35: Constructing Software Environments

Kameleon

KERNEL

Operating System

Libs Services User Apps

Conf

ConfConf

Softs

Conf

Kameleon

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 24 / 46

Page 36: Constructing Software Environments

Other tools

Difficult to know them all!

I Quattor (CERN)

I RBuilder (CernVM)

I VMBuilder (Ubuntu)

I Kiwi (OpenSuse - http://kiwi.berlios.de/)

I Probably more than we may imagine. . .

INRIA MESCAL TEAM ALADDIN-GRID’5000 State of the Art 25 / 46

Page 37: Constructing Software Environments

Outline

1 Environment Images

2 State of the ArtCFEnginePuppetChefJujuUForgeKameleonOthers

3 The Grid’5000 CaseGrid’5000 PresentationGrid’5000 environments management

4 Conclusion

INRIA MESCAL TEAM ALADDIN-GRID’5000 The Grid’5000 Case 26 / 46

Page 38: Constructing Software Environments

A nation-wide platform9 sites

Sites

Bordeaux, Grenoble, Lille, Lyon, Nancy, Orsay, Rennes, Sophia, Toulouse(+Brazil and Luxembourg)

INRIA MESCAL TEAM ALADDIN-GRID’5000 The Grid’5000 Case 27 / 46

Page 39: Constructing Software Environments

Grid’5000 Basic Design Concepts

I Research Platform dedicated to Experiments

I Large-Scale and distributed

I Heterogeneous hardware resources

I Dedicated network links between sitesI isolate Grid’5000 from the rest of the InternetI let packets fly inside Grid’5000 without limitation

I Deep reconfiguration mechanism for experiments on all layers ofthe software stack

I User has full control of the reserved experimental resources:deployable environments

INRIA MESCAL TEAM ALADDIN-GRID’5000 The Grid’5000 Case 28 / 46

Page 40: Constructing Software Environments

Management of the environments

Users can use:

I Default production environment

I One of the environments provided by the staff

I An environment created by another user

I An environment they created themselves

Applications

OS(Linux, FreeBSD,...)

EnvironmentMiddleware

Hardware Network

SpecifiableToolsDistro

Configurable

INRIA MESCAL TEAM ALADDIN-GRID’5000 The Grid’5000 Case 29 / 46

Page 41: Constructing Software Environments

Grid’5000 environments management by the Tech Team

Service Nodes Environments

I Services: NFS, Mysql, OAR, Kadeploy. . .

I Configured with Puppet.

I Deployed with Capistrano (tool for deploying web applications, basically:

Makefile+ssh).

Compute Nodes Environments

Production environments: environment installed on the compute nodes.User environment: special environments deployable on the computenodes.Management: on a node of the platform itself

I manual bootstrap

I chroot, ruby and Chef install

I configuration via Chef

I different recipes for different environment “flavors”

INRIA MESCAL TEAM ALADDIN-GRID’5000 The Grid’5000 Case 30 / 46

Page 42: Constructing Software Environments

Grid’5000 environments management by the Tech Team

Service Nodes Environments

I Services: NFS, Mysql, OAR, Kadeploy. . .

I Configured with Puppet.

I Deployed with Capistrano (tool for deploying web applications, basically:

Makefile+ssh).

Compute Nodes Environments

Production environments: environment installed on the compute nodes.User environment: special environments deployable on the computenodes.Management: on a node of the platform itself

I manual bootstrap

I chroot, ruby and Chef install

I configuration via Chef

I different recipes for different environment “flavors”

INRIA MESCAL TEAM ALADDIN-GRID’5000 The Grid’5000 Case 30 / 46

Page 43: Constructing Software Environments

Example

Grenoble Production environment

{"grid5000": { "site": "grenoble" },"kaenv": {

"version": "1.0","name": "prod","site": "grenoble","description": "Debian 6. Production environment. Generated with Chef.","author": "[email protected]","kernel": "/boot/vmlinuz-2.6.32-5-amd64","initrd": "/boot/initrd.img-2.6.32-5-amd64","postinstall": "/grid5000/postinstalls/userpostinstall-prod.tgz|tgz| \

traitement.ash /rambin"},"oar": { "version": "2.4" },"recipes": [ "setup", "oar", "g5kchecks", "ganglia", "kernel", "nvidia", \

"fastnetwork::infiniband", "fastnetwork::openmpi" , \"g5kcode" , "g5ksubnets", "drivers::initramfs-up" ]

}

INRIA MESCAL TEAM ALADDIN-GRID’5000 The Grid’5000 Case 31 / 46

Page 44: Constructing Software Environments

Other option: Kameleon

Full Kameleon

I Use of Kameleon to generate environment from scratch.

I Customize it.

I Output format: Grid’5000.

I Bootstrap, chroot and export as deployable image is managed byKameleon.

Mix Chef-Kameleon

I Use of Kameleon to manage minimal distrib install.

I Step for installing Chef.

I Retrieve Grid’5000 cookbooks.

I Apply Chef cookbooks inside Kameleon run (chroot).

INRIA MESCAL TEAM ALADDIN-GRID’5000 The Grid’5000 Case 32 / 46

Page 45: Constructing Software Environments

Other option: Kameleon

Full Kameleon

I Use of Kameleon to generate environment from scratch.

I Customize it.

I Output format: Grid’5000.

I Bootstrap, chroot and export as deployable image is managed byKameleon.

Mix Chef-Kameleon

I Use of Kameleon to manage minimal distrib install.

I Step for installing Chef.

I Retrieve Grid’5000 cookbooks.

I Apply Chef cookbooks inside Kameleon run (chroot).

INRIA MESCAL TEAM ALADDIN-GRID’5000 The Grid’5000 Case 32 / 46

Page 46: Constructing Software Environments

Outline

1 Environment Images

2 State of the ArtCFEnginePuppetChefJujuUForgeKameleonOthers

3 The Grid’5000 CaseGrid’5000 PresentationGrid’5000 environments management

4 Conclusion

INRIA MESCAL TEAM ALADDIN-GRID’5000 Conclusion 33 / 46

Page 47: Constructing Software Environments

Questions, thoughts and problems risen

Cloud computing pushes towards using virtual machines.Grid has default configured environment.Use provided software environments.

Environment is Black Box

I Loose control/knowledge

I Loose efficiency

I Reproducibility impacted?

I Debug is harder

Make it crystal clear to the user

I Give the access to the environment construction

I Even if the user can’t modify it, he will understand its behavior

I Paranoia from the users too. . . (Tony Cass’ “trusted images” talk)

INRIA MESCAL TEAM ALADDIN-GRID’5000 Conclusion 34 / 46

Page 48: Constructing Software Environments

Questions, thoughts and problems risen

Cloud computing pushes towards using virtual machines.Grid has default configured environment.Use provided software environments.

Environment is Black Box

I Loose control/knowledge

I Loose efficiency

I Reproducibility impacted?

I Debug is harder

Make it crystal clear to the user

I Give the access to the environment construction

I Even if the user can’t modify it, he will understand its behavior

I Paranoia from the users too. . . (Tony Cass’ “trusted images” talk)

INRIA MESCAL TEAM ALADDIN-GRID’5000 Conclusion 34 / 46

Page 49: Constructing Software Environments

Questions, thoughts and problems risen

Cloud computing pushes towards using virtual machines.Grid has default configured environment.Use provided software environments.

Environment is Black Box

I Loose control/knowledge

I Loose efficiency

I Reproducibility impacted?

I Debug is harder

Make it crystal clear to the user

I Give the access to the environment construction

I Even if the user can’t modify it, he will understand its behavior

I Paranoia from the users too. . . (Tony Cass’ “trusted images” talk)

INRIA MESCAL TEAM ALADDIN-GRID’5000 Conclusion 34 / 46

Page 50: Constructing Software Environments

Questions, thoughts and problems risen

Cloud computing pushes towards using virtual machines.Grid has default configured environment.Use provided software environments.

Environment is Black Box

I Loose control/knowledge

I Loose efficiency

I Reproducibility impacted?

I Debug is harder

Make it crystal clear to the user

I Give the access to the environment construction

I Even if the user can’t modify it, he will understand its behavior

I Paranoia from the users too. . . (Tony Cass’ “trusted images” talk)

Reproducibility

INRIA MESCAL TEAM ALADDIN-GRID’5000 Conclusion 34 / 46

Page 51: Constructing Software Environments

Thank you for your attention

INRIA MESCAL TEAM ALADDIN-GRID’5000 Conclusion 35 / 46

Page 52: Constructing Software Environments

Bonus

Examples

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 36 / 46

Page 53: Constructing Software Environments

CFEngine

Entities:

Promises

promiser:

CFEngine_word => user_defined_value;

Bodies

body CFEngine_word user_defined_value

{

CFEngine_word => user_defined_value;

CFEngine_word => user_defined_value;

}

Bundles

Set of Promises

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 37 / 46

Page 54: Constructing Software Environments

CFEngine file management and code execution

files:

"/tmp/promiser"

perms => myexample;

body perms myexample

{

mode => "644";

owners => { "mark", "sarah", "angel" };

groups => { "users", "sysadmins", "mythical_beasts" };

#And Command Execution:

cfruncommand => "$(sys.workdir)/root/myscript.sh";

}

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 38 / 46

Page 55: Constructing Software Environments

CFEngine packages install

control:

any::

actionsequence = ( packages )

DefaultPkgMgr = ( rpm )

RPMcommand = ( /bin/rpm )

RPMInstallCommand = ( "/usr/bin/yum -y install %s" )

packages:

any::

ganglia-gmond action=install

grid::

lcg-CA action=install

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 39 / 46

Page 56: Constructing Software Environments

Puppet

class kadeploy::server inherits kadeploy {

package {

["kadeploy-server", "tftpd-hpa", "syslinux"]:

ensure => installed,

require => [User["deploy"], File["source kadeploy"],

Exec["sources update"]];

}

file {

"/var/lib/tftpboot/kernels":

ensure => directory,

mode => 775, owner => root, group => deploy,

require => Package["tftpd-hpa"];

"/var/lib/tftpboot/pxelinux.cfg":

ensure => directory,

mode => 775, owner => root, group => deploy,

require => Package["tftpd-hpa"];

}

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 40 / 46

Page 57: Constructing Software Environments

Chef

execute "apt-get update" do

command "apt-get update"

end

%w{ oar-common oar-node }.each do |pkg|

package pkg do

action :install

version "2.4.0"

options "--force-yes"

end

end

execute "usermod -U oar" do

command "usermod -U oar"

end

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 41 / 46

Page 58: Constructing Software Environments

Juju Metadata

name: drupal

revision: 1

summary: "Drupal CMS"

description: |

Installs the drupal CMS system, relates to the mysql charm

provided in examples directory. Can be scaled to multiple

web servers

requires:

db:

interface: mysql

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 42 / 46

Page 59: Constructing Software Environments

Juju Hooks: install

#!/bin/bash

set -eux # -x for verbose logging to juju debug-log

juju-log "Installing drush,apache2,php via apt-get"

apt-get -y install drush apache2 php5-gd libapache2-mod-php5 \

php5-cgi mysql-client-core-5.1 a2enmod php5

/etc/init.d/apache2 restart

juju-log "Using drush to download latest Drupal"

cd /var/www && drush dl drupal --drupal-project-rename=juju

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 43 / 46

Page 60: Constructing Software Environments

Juju Hooks: relation-changed

#!/bin/bash

set -eux # -x for verbose logging to juju debug-log

hooksdir=$PWD

user=‘relation-get user‘

password=‘relation-get password‘

host=‘relation-get host‘

database=‘relation-get database‘

# All values are set together, so checking on a single

# value is enough

# If $user is not set, DB is still setting itself up,

# we exit awaiting next run

[ -z "$user" ] && exit 0

juju-log "Setting up Drupal for the first time"

cd /var/www/juju && drush site-install -y standard \

--db-url=mysql://$user:$password@$host/$database \

--site-name=juju --clean-url=0

cd /var/www/juju && chown www-data sites/default/settings.php

open-port 80/tcp

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 44 / 46

Page 61: Constructing Software Environments

Kameleon Recipe

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 45 / 46

Page 62: Constructing Software Environments

Kameleon Steps

INRIA MESCAL TEAM ALADDIN-GRID’5000 Bonus 46 / 46