Automatic Kamailio Deployments With Puppet
-
Upload
giacomo-vacca -
Category
Internet
-
view
450 -
download
3
description
Transcript of Automatic Kamailio Deployments With Puppet
![Page 1: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/1.jpg)
Automatic Kamailio Deployments with Puppet
Giacomo VaccaSenior Network Applications Developer
![Page 2: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/2.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
“He’s seen more SIP transactions than some SBCs in the market” (cit.)
- Leads Network Dev Team at Truphone Labs
- Hacking Kamailio, Asterisk, FreeSWITCH for 10+ ys
- Hacking ejabberd, more recently
@giavac
![Page 3: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/3.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
Truphone
![Page 4: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/4.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
labs.truphone.com
![Page 5: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/5.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
“You know you’re in trouble when...
you realize you’ve become good at 3-way diffs”
The Problem
![Page 6: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/6.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
• Deploy and customize in-place
• Extract variables into included defines file
• A debian package with config per host
No (automatic) documentation!
The Problem – in the past
![Page 7: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/7.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
• Open Source configuration management tool
• Defines the final status (‘what’, not ‘how’)
• Idempotent (i.e. safely run multiple times)
puppetlabs.com
The Solution - Puppet
![Page 8: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/8.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
• Puppet code is contained in MANIFESTS
• Puppet functionalities are organized in MODULES
• “Compiled” manifests are CATALOGUES
The Solution - Puppet
![Page 9: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/9.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
Master/Slave vs Standalone
![Page 10: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/10.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
# nodes.pp
node ‘k01.domain.com’ {
include ‘kamailio’
}
• As many environments as you want
–Each environment defines a Site
•A Site defines a group of Nodes
– Every host is a Node
PuppetEnvironments, Sites, Nodes
![Page 11: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/11.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
• Simple manifests
• Independent from data
• Extract data into nodes definition
PuppetSeparate logic from data
![Page 12: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/12.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
https://github.com/trulabs/puppet-kamailio
1. Deploy pre-requisites
2. Install packages (deb, rpm)
3. Set configuration files (kamailio.cfg, tls.cfg)
4. Define ‘service’ (“should be running”)
Kamailio with Puppet
![Page 13: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/13.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
Kamailio with PuppetThe system around Kamailio
Other areas (see 3rd party modules at PuppetForge):
• apt/yum
• TCP keepalives
• Firewall (iptables)
• monit
• nagios
• fail2ban
• logrotate
• sec
• SSL certificates
• Swappiness» What else? Tell me at the Q&A session.
Useful tools:
Check your modules against Best
Practices with ‘puppet-lint’.
http://puppet-lint.com/
![Page 14: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/14.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
Video: http://vimeo.com/giavac/akdp
1. Build VM
2. SSH into VM
3. git clone Puppet repo
4. Run Puppet NOOP mode
5. Run Puppet
Build and deploy a new instance
![Page 15: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/15.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
Summary
Automation is easy
Deployments MUST be automated
Deployments SHOULD be boring
Deployments MAY be fun
Puppet does the job
(Diagram source: http://info.puppetlabs.com/2013-state-of-devops-report.html)
![Page 16: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/16.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
Q&A
@giavac
https://labs.truphone.com/about/
![Page 17: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/17.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
ADDITIONAL SLIDES
![Page 18: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/18.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
Kamailio with PuppetKamailio module – repo/apt.pp
class kamailio::repo::apt inherits kamailio::repo {
include '::apt'
# Note the 40!
apt::source { 'kamailio40_wheezy':
location => 'http://deb.kamailio.org/kamailio40',
release => 'wheezy',
repos => 'main',
required_packages => 'debian-keyring debian-archive-keyring',
key => '07D5C01D',
key_server => 'http://deb.kamailio.org/kamailiodebkey.gpg',
include_src => true,
}
Apt::Source['kamailio40_wheezy'] -> Package<|tag == 'kamailio'|>
}
![Page 19: Automatic Kamailio Deployments With Puppet](https://reader034.fdocuments.in/reader034/viewer/2022052410/554f9792b4c905ad218b46ff/html5/thumbnails/19.jpg)
© 2013 Truphone Limited. All Rights Reserved. 03 April 2014
Kamailio with PuppetKamailio module – config.pp
• Manages configuration files
• Can install from files or templates
Example: templatize a kamailio.cfg define
<% if with_tls %>#!define WITH_TLS<% end %>