Infrastructure as Code

Preview:

Citation preview

Sascha Möllering | ZANOX.de AG

Infrastructure as Code

About me

Sascha Mölleringsascha.moellering@zanox.com

Software Engineering Team Lead

ZANOX.de AG

http://www.der-maschinenstuermer.de/

@sascha242

Agenda

• Problem?• VMware and SDKs• Chef• Chef and JBoss• What’s next?• Q&A

Problem?

Problem?

Problem?

VMware and SDKs

VMware and SDKs

• SDKs? More than one?– VMware vSphere Web Services SDK– VMware VI (vSphere) Java API

VMware and SDKs

• VMware vSphere Web Services SDK– Official SDK– Supported by VMware– Complicated– Architecture based on

• managed objects (server)• managed object reference (client)• data objects

vSphere server

VMware and SDKs

VirtualMachineManaged

object

GuestInfodata object

vSphere client application

Managed object reference to a

VirtualMachine

GuestInfodata object

data objects

network connection

VMware and SDKs

• Example: VMWare Event History• Reads the event history from VMWare• > 100 (!!!) lines using vSphere Web

Services SDK

VMware and SDKs

VMware and SDKs

VMware and SDKs

• Same example using VMware VI Java SDK: 28 lines

VMware and SDKs

VMware and SDKs

• VMware VI Java SDK– Open source project created by Steve Jin

from VMware R&D– http://vijava.sourceforge.net/– Simplify the use of VI SDK and improve the

performance– Less lines of code, much faster, and much

more readable code

VMware and SDKs

VMware and SDKs

VMware and SDKs

https://github.com/zanox/viAutomator

VMware and SDKs

• Small service implemented in Java • SOAP-interface• Requires JBoss 5• Add, delete, start, stop, change

network, … etc.• (will be upgraded to use JBoss 7,

REST, Java EE 6 soon)

Chef

"Chef is like a little system admin robot ... you tell it how you want your system configured, and it will do all the dirty work.”

Chef

Chef

• Node:– Any (virtual) server configured to be

maintained by a chef-client– Chef-client runs on each node

Chef

• Workstation:– Computer to run Knife– To synchronize with Chef repo– Interact with single Chef server– Develop Cookbooks and Recipes– Use Knife to upload items from Chef repo

to Chef server

Chef

• Knife– Command-line tool – Provides interface between local Chef repo

and Chef server

Chef

Chef

• Linux-installation1. FAI (http://fai-project.org/) for basic setup

2. Chef for additional APT-packages

3. Chef for middleware installation

Chef and JBoss

Java Magazin 11.12: Automatisierung nach Chef-Rezept Automatisiertes Deployment von JBoss Middleware

Chef and JBoss

• Automatic deployment of JBoss application server using Chef

• Components:• JBoss EAP 5/6 preconfigured in SVN• JBoss Operations Network (JON): Monitoring-

solution for e.g. JBoss• JON Agent: Agent scanning JBoss-processes• Remote-CLI: CLI running JavaScript-files

accessing the JON-API

Chef and JBoss

Chef and JBoss

JON-Server 3.1

Remote-CLI

JBoss EAP 5/6

JON-Agent

Knife

AutodiscoveryQueue

Chef and JBoss

• JON/RHQ has a remote API– JON/RHQ-CLI with JavaScript-files– JON/RHQ-JARs with Java

• Executing JavaScript-files using the CLI:– rhq-cli.sh –f import-servers.js -s ${RHQ_SERVER} –u user –p pwd

Chef and JBoss

1. Import JON-Agent

2. Import JBoss EAP 5/6

3. Change settings

Chef and JBoss

Chef and JBoss

Chef and JBoss

Chef and JBoss

VMware and SDKs

https://github.com/rhq-project/samples/tree/master/cli/autoimport

Chef and JBoss

And Clustering?

Chef and JBoss

• UPD: Just works!• TCP

– Move cluster-config from XML to Properties-file

– Use Chef to modify Properties-file