DEVMINISTRATION
DRUPAL SHOW AND TELL, LONDON, 18TH JULY 2013
/Darren Mothersele @mothersele
DELIVERING SaaS
Software errosion
Automated provisioning
Scalability
Availability
THE TWELVE-FACTOR APP
THE DEVOPS MANIFESTO?
Codebase
Dependencies
Config
Backing Services
Build, release, run
Process
Port...
“For practice DevOps I recommend first
follow cloud expert and devops expert on
Twitter. Next step is automate bulls shit ...
MACHINE NAME, OR ROLE?
“I can, within about 10 minutes of
conversation, decide if someones existing
system design is flawe...
SERVERS = CATTLE, NOT PETS
SCALE UP
Give them a cute name
Each one is unique
When they get sick, nurse back to
health
SCAL...
DEVMINISTRATION
“Stop administering your infrastructure,
and start developing it!”
1. Provision server via API call
2. Boo...
PROVISION SERVER
linode.create()
linode.ip.addprivate()
linode.disk.createfromstackscript()
linode.boot()
STACKSCRIPTS?
Bare distro by default
StackScript runs on first boot
UDF - User defined fields
PUPPET BOOTSTRAP STACKSCRIPT
1. Set hostname and timezone
2. Configure static networking
3. Add Puppet server to /etc/host...
PUPPET
PUPPET NETWORKING
Being a Puppet Master http://slidesha.re/n1DG8o
PUPPET MANIFESTS
Puppet programs are called manifests
Based on Resource declarations
Resource declation = desired state of...
EXAMPLE RESOURCE
file { 'testfile':
path => '/tmp/testfile',
ensure => present,
mode => 0640,
content => "I'm a test file....
PUPPET TYPES
Files & Directories
Users & Groups
Packages
Services
Crontabs
Mount points
Nagios
Databases
SSH Keys
Software...
BASIC PUPPET: PACKAGE, FILE, SERVICE
package { 'ntp':
ensure => installed,
}
file { '/etc/ntp.conf':
ensure => file,
sourc...
PUPPET MODULES
Manifests
Files
Templates
Libraries
EXAMPLE: MODULES/MARIADB/INIT.PP
class mariadb {
apt::source { 'mariadb' :
location => "http://mirror.stshosting.co.uk/mar...
EXAMPLE: MODULES/MARIADB/CONFIG.PP
class mariadb::config (
$root_password = 'UNSET',
...
) inherits mariadb::params {
...
...
EXAMPLE: MODULES/MARIADB/DB.PP
define mariadb::db (
$user,
$password,
$charset = 'utf8',
$host = 'localhost',
...
) {
...
...
EXAMPLE NODE
node "db01.example.com" {
include core
class { 'mariadb::server':
bind_address => '192.168.195.56',
config_ha...
SUMMARY
Develop configuration as code
Use Puppet modules, and commit to Git repo
Use same configuration on dev as prod (Va...
Upcoming SlideShare
Loading in …5
×

Drupal Devministration

570 views
533 views

Published on

Presentation from Drupal Show and Tell event on 19th July 2013 where I talked about the work I had been doing on Cloud DevOps with Drupal. Examples include Puppet, Linode, MariaDB.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
570
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Drupal Devministration

  1. 1. DEVMINISTRATION DRUPAL SHOW AND TELL, LONDON, 18TH JULY 2013 /Darren Mothersele @mothersele
  2. 2. DELIVERING SaaS Software errosion Automated provisioning Scalability Availability
  3. 3. THE TWELVE-FACTOR APP THE DEVOPS MANIFESTO? Codebase Dependencies Config Backing Services Build, release, run Process Port binding Concurrency Disposability Dev/prod parity Logs Admin processes http://www.12factor.net/
  4. 4. “For practice DevOps I recommend first follow cloud expert and devops expert on Twitter. Next step is automate bulls shit out of everything.” @DEVOPS_BORAT http://bit.ly/ea42yy
  5. 5. MACHINE NAME, OR ROLE? “I can, within about 10 minutes of conversation, decide if someones existing system design is flawed based on a very simple observation... do they spend lots of time mentioning machines by name instead of role?” Benjamin Knauss http://bit.ly/151fE0c
  6. 6. SERVERS = CATTLE, NOT PETS SCALE UP Give them a cute name Each one is unique When they get sick, nurse back to health SCALE OUT Number them When they get sick, shoot them attr: Bill Baker (formerly Microsoft)
  7. 7. DEVMINISTRATION “Stop administering your infrastructure, and start developing it!” 1. Provision server via API call 2. Boot server and let it configure itself
  8. 8. PROVISION SERVER linode.create() linode.ip.addprivate() linode.disk.createfromstackscript() linode.boot()
  9. 9. STACKSCRIPTS? Bare distro by default StackScript runs on first boot UDF - User defined fields
  10. 10. PUPPET BOOTSTRAP STACKSCRIPT 1. Set hostname and timezone 2. Configure static networking 3. Add Puppet server to /etc/hosts 4. Install Puppet client 5. Request a certificate from Puppet server 6. sign certificate? 7. Run Puppet
  11. 11. PUPPET
  12. 12. PUPPET NETWORKING Being a Puppet Master http://slidesha.re/n1DG8o
  13. 13. PUPPET MANIFESTS Puppet programs are called manifests Based on Resource declarations Resource declation = desired state of a resource Make decisions based on provided variables or Facts
  14. 14. EXAMPLE RESOURCE file { 'testfile': path => '/tmp/testfile', ensure => present, mode => 0640, content => "I'm a test file.", }
  15. 15. PUPPET TYPES Files & Directories Users & Groups Packages Services Crontabs Mount points Nagios Databases SSH Keys Software repos /etc/hosts Exec etc... and more from modules...
  16. 16. BASIC PUPPET: PACKAGE, FILE, SERVICE package { 'ntp': ensure => installed, } file { '/etc/ntp.conf': ensure => file, source => '/root/example/ntp.conf', owner => 'root', group => 'root', mode => '0444', require => Package['ntp'], notify => Service['ntp'], } service { 'ntp': ensure => 'running', enable => 'true', }
  17. 17. PUPPET MODULES Manifests Files Templates Libraries
  18. 18. EXAMPLE: MODULES/MARIADB/INIT.PP class mariadb { apt::source { 'mariadb' : location => "http://mirror.stshosting.co.uk/mariadb/repo/5.5/ubuntu" , repos => 'main', key => '1BB943DB', key_server => 'keyserver.ubuntu.com', include_src => true, } package { 'mariadb-server': ensure => installed, require => Apt::Source['mariadb'], } }
  19. 19. EXAMPLE: MODULES/MARIADB/CONFIG.PP class mariadb::config ( $root_password = 'UNSET', ... ) inherits mariadb::params { ... # manage root password if it is set if $root_password != 'UNSET' { ... exec { 'set_mysql_rootpw': command => "mysqladmin -u root ${old_pw} password '${root_passwo rd}'", ... require => File['/etc/mysql/conf.d'], } } ... file { '/etc/mysql/my.cnf': content => template('mariadb/my.cnf.erb'), mode => '0644', } }
  20. 20. EXAMPLE: MODULES/MARIADB/DB.PP define mariadb::db ( $user, $password, $charset = 'utf8', $host = 'localhost', ... ) { ... # create database if it does not exist exec { "mariadb-create-db-${title}": ... command => "/usr/bin/mysql -uroot -p${root_password} -e 'CREATE DATABASE IF NOT EXISTS ${title};' ", require => Class['mariadb::server'], } ... exec { "mariadb-grant-${title}-${user}": ... command => "/usr/bin/mysql -uroot -p${root_password} -e "GRANT ALL PRIVILEGES ON ${title}.* TO ' ${user}'@'${host}' IDENTIFIED BY '${password}';"", require => Class['mariadb::server'], ... } }
  21. 21. EXAMPLE NODE node "db01.example.com" { include core class { 'mariadb::server': bind_address => '192.168.195.56', config_hash => { 'root_password' => '...', }, } mariadb::db { 'example_database': user => 'example', password => 'password', host => '192.168.%', } }
  22. 22. SUMMARY Develop configuration as code Use Puppet modules, and commit to Git repo Use same configuration on dev as prod (Vagrant uses Puppet) Automatically generate node configurations and provision Servers no longer have names, they have a role and number

×