Upload
postrational
View
1.110
Download
0
Tags:
Embed Size (px)
DESCRIPTION
A talk outlining the use of Vagrant, Puppet and Webmin, practical tools for programmers, administrators and DevOps.
Citation preview
DEVOPS TOOLS FOR EVERYONE: VAGRANT, PUPPET AND WEBMIN
!Michał Karzyński, DevCon 2014
TALK OUTLINE
1. Vagrant - create#
2. Puppet - configure#
3. Webmin - administer
[email protected] DevCon 2014
YOURS TRULYMichał Karzyński#
• project manager at Politechnika Gdańska#
• freelance developer and consultant#
• polyglot, currently: Python and JavaScript#
• author#
• web developer since 1996#
• @postrational http://michal.karzynski.pl#[email protected] DevCon 2014
What does a webapp look like?
LAMP
Apache
Linux
MySQL
PHP
Nginx
Linux
PostgreSQL
Python
Virtualenv
Gunicorn
Nginx
Linux
PostgreSQL
Python
Virtualenv
Gunicorn
Varnish
Redis
Nginx
Linux
PostgreSQL
Python
Virtualenv
Gunicorn
Varnish
Redis MongoDB
Celery
Postfix
RabbitMQ
Vagrant
$ vagrant up
$ git clone git://.../development.git$ cd development$ vagrant up
HOW DOES IT WORK?
VAGRANTFILE_API_VERSION = "2"!!Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|! config.vm.box = "debian-wheezy-64"! config.vm.box_url = "https://.../debian-wheezy-64.box"! config.vm.hostname = "wheezy-vm"!end
Vagrantfile
• Ease of use#
• Many pre-configured boxes available#
• Support for multiple machines#
• Local support for VirtualBox or VMware#
• Build remote clouds on AWS, RackSpace, etc.#
• Provisioning using: Ansible, Chef, Docker, Puppet, etc.
FEATURES
http://www.vagrantup.com
PUPPET PROVISIONINGVagrant.configure(VAGRANTFILE_API_VERSION) do |config|! config.vm.box = "debian-wheezy-64"! config.vm.box_url = "https://www.dropbox.com/s/foj5mml4ft3b363/debian-wheezy-64.box?dl=1"! config.vm.hostname = "wheezy-vm"!! # Install puppet modules! config.vm.provision :shell do |shell|! shell.inline = "# Install modules from Puppet Forge! mkdir -p /etc/puppet/modules;! puppet module install puppetlabs/apt;! ! # Install Puppet modules from GitHub! aptitude -y install git;! cd /etc/puppet/modules;! git clone git://github.com/stankevich/puppet-python.git python;! "! end! ! # Use Puppet to provision server configuration! config.vm.provision "puppet" do |puppet|! puppet.manifests_path = "manifests"! end!!end
Vagrantfile
Puppet
INSTALLING A PACKAGE
$ vim /etc/apt/sources.list!!deb http://download.webmin.com/download/repository sarge contrib!!$ wget -qO - http://www.webmin.com/jcameron-key.asc | sudo apt-key add -!$ sudo aptitude update!$ sudo aptitude install webmin!
WITH PUPPETinclude 'apt'!!apt::source { 'webmin':! location => 'http://download.webmin.com/download/repository/',! release => 'sarge',! repos => 'contrib',! key => '11F63C51',! include_src => false,!}!!apt::key { 'webmin':! key => '11F63C51',! key_source => 'http://www.webmin.com/jcameron-key.asc',!}!!exec { "apt-update-webmin":! command => "/usr/bin/aptitude -y update",! require => [Apt::Source['webmin'], Apt::Key['webmin']],!}!!package { ! 'webmin': ! ensure => present,! require => Exec['apt-update-webmin'],!}
webmin.pp
SET UP A DATABASE# Install the Postgres server!class { 'postgresql::server':! ensure => 'present',! listen_addresses => 'localhost',! encoding => 'UTF8',! manage_firewall => true,!}!!# Install PostgreSQL client!class { 'postgresql::client': }!!# And development libraries!class { 'postgresql::lib::devel': }!!!# Set up a PostgreSQL database named 'hello' !# and user named 'hello_django' with a long passphrase!postgresql::server::db { 'hello':! user => 'hello_django',! password => postgresql_password('hello_django', 'xxxxxxxxxxxxx'),!}
database.pp
ADDING A USERpackage { ! 'sudo': ensure => present;! 'zsh': ensure => present;! 'git': ensure => present;!}!!user { 'michal':! password => 'xxxxxxxxxxxxx',! groups => ['staff', 'sudo'],! ensure => 'present',! managehome => 'true',! shell => '/usr/bin/zsh',! require => Package['zsh'],!}!!ssh_authorized_key{ 'michal@silver':! user => 'michal',! ensure => 'present', ! type => 'ssh-rsa', ! key => 'xxxxxxxxxxxxx', ! require => User['michal'],!}
my_account.pp
FEATURES• Store server configuration in text files (manifests)#
• Automatically configure packages, user accounts, services, etc.#
• Declarative language to describe machines#
• Store configuration of multiple machines on a central Puppet master server#
• Update configuration when manifest file changes
http://puppetlabs.com
MASTER OF PUPPETS
Master
Puppet Puppet Puppet Puppet
Webmin
YOUR SERVER GUI
https://my-server :10000
YOUR SERVER GUI
PROCESSES
INIT SCRIPTS
NETWORKING
FIREWALL
SERVICES
DATABASES
FEATURES• Graphically manage packages, user accounts, services#
• Install and configure server software#
• Monitor server activity and log files#
• Tweak and test settings#
• Execute commands and access files through the browser#
• Support for MySQL, PostgreSQL, Apache, PHP and many, many others
http://webmin.com
SHAMELESS PLUG
DEVOPS TOOLS FOR EVERYONE
1. Vagrant - create#
2. Puppet - configure#
3. Webmin - administer
[email protected] DevCon 2014
THANK YOU
• http://www.ikea.com/us/en/catalog/products/60148701/#
• http://www.globtroter.pl/zdjecia/44393,norwegia,brak,latarnia,morska,w,lindesnes,x.html
[email protected] DevCon 2014
IMAGE CREDITS: