Infrastructure as Code

44
Sascha Möllering | ZANOX.de AG Infrastructure as Code

Transcript of Infrastructure as Code

Page 1: Infrastructure as Code

Sascha Möllering | ZANOX.de AG

Infrastructure as Code

Page 2: Infrastructure as Code

About me

Sascha Mö[email protected]

Software Engineering Team Lead

ZANOX.de AG

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

@sascha242

Page 3: Infrastructure as Code

Agenda

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

Page 4: Infrastructure as Code

Problem?

Page 5: Infrastructure as Code

Problem?

Page 6: Infrastructure as Code

Problem?

Page 7: Infrastructure as Code
Page 8: Infrastructure as Code

VMware and SDKs

Page 9: Infrastructure as Code

VMware and SDKs

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

Page 10: Infrastructure as Code

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

Page 11: Infrastructure as Code

vSphere server

VMware and SDKs

VirtualMachineManaged

object

GuestInfodata object

vSphere client application

Managed object reference to a

VirtualMachine

GuestInfodata object

data objects

network connection

Page 12: Infrastructure as Code

VMware and SDKs

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

Services SDK

Page 13: Infrastructure as Code

VMware and SDKs

Page 14: Infrastructure as Code

VMware and SDKs

Page 15: Infrastructure as Code

VMware and SDKs

• Same example using VMware VI Java SDK: 28 lines

Page 16: Infrastructure as Code

VMware and SDKs

Page 17: Infrastructure as Code

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

Page 18: Infrastructure as Code

VMware and SDKs

Page 19: Infrastructure as Code

VMware and SDKs

Page 20: Infrastructure as Code

VMware and SDKs

https://github.com/zanox/viAutomator

Page 21: Infrastructure as Code

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)

Page 22: Infrastructure as Code
Page 23: Infrastructure as Code

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.”

Page 24: Infrastructure as Code

Chef

Page 25: Infrastructure as Code

Chef

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

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

Page 26: Infrastructure as Code

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

Page 27: Infrastructure as Code

Chef

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

and Chef server

Page 28: Infrastructure as Code

Chef

Page 29: Infrastructure as Code

Chef

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

2. Chef for additional APT-packages

3. Chef for middleware installation

Page 30: Infrastructure as Code

Chef and JBoss

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

Page 31: Infrastructure as Code

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

Page 32: Infrastructure as Code

Chef and JBoss

Page 33: Infrastructure as Code

Chef and JBoss

JON-Server 3.1

Remote-CLI

JBoss EAP 5/6

JON-Agent

Knife

AutodiscoveryQueue

Page 34: Infrastructure as Code

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

Page 35: Infrastructure as Code

Chef and JBoss

1. Import JON-Agent

2. Import JBoss EAP 5/6

3. Change settings

Page 36: Infrastructure as Code

Chef and JBoss

Page 37: Infrastructure as Code

Chef and JBoss

Page 38: Infrastructure as Code

Chef and JBoss

Page 39: Infrastructure as Code

Chef and JBoss

Page 40: Infrastructure as Code

VMware and SDKs

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

Page 41: Infrastructure as Code

Chef and JBoss

And Clustering?

Page 42: Infrastructure as Code

Chef and JBoss

• UPD: Just works!• TCP

– Move cluster-config from XML to Properties-file

– Use Chef to modify Properties-file

Page 43: Infrastructure as Code
Page 44: Infrastructure as Code