drupal devministration
DESCRIPTION
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.TRANSCRIPT
![Page 1: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/1.jpg)
DEVMINISTRATIONDRUPAL SHOW AND TELL, LONDON, 18TH JULY 2013
/ Darren Mothersele @mothersele
![Page 2: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/2.jpg)
DELIVERING SaaSSoftware errosionAutomated provisioningScalabilityAvailability
![Page 3: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/3.jpg)
THE TWELVE-FACTOR APPTHE DEVOPS MANIFESTO?
CodebaseDependenciesConfigBacking ServicesBuild, release, runProcess
Port bindingConcurrencyDisposabilityDev/prod parityLogsAdmin processes
http://www.12factor.net/
![Page 4: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/4.jpg)
“For practice DevOps I recommend firstfollow cloud expert and devops expert on
Twitter. Next step is automate bulls shit outof everything.”
@DEVOPS_BORAT http://bit.ly/ea42yy
![Page 5: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/5.jpg)
MACHINE NAME, OR ROLE?“I can, within about 10 minutes of
conversation, decide if someones existingsystem 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
![Page 6: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/6.jpg)
SERVERS = CATTLE, NOT PETSSCALE UP
Give them a cute nameEach one is uniqueWhen they get sick, nurse back tohealth
SCALE OUTNumber themWhen they get sick, shoot them
attr: Bill Baker (formerly Microsoft)
![Page 7: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/7.jpg)
DEVMINISTRATION“Stop administering your infrastructure,
and start developing it!”
1. Provision server via API call2. Boot server and let it configure itself
![Page 8: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/8.jpg)
PROVISION SERVERlinode.create()linode.ip.addprivate()linode.disk.createfromstackscript()linode.boot()
![Page 9: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/9.jpg)
STACKSCRIPTS?Bare distro by defaultStackScript runs on first bootUDF - User defined fields
![Page 10: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/10.jpg)
PUPPET BOOTSTRAP STACKSCRIPT1. Set hostname and timezone2. Configure static networking3. Add Puppet server to /etc/hosts4. Install Puppet client5. Request a certificate from Puppet server6. sign certificate?7. Run Puppet
![Page 11: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/11.jpg)
PUPPET
![Page 13: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/13.jpg)
PUPPET MANIFESTSPuppet programs are called manifestsBased on Resource declarationsResource declation = desired state of a resourceMake decisions based on provided variables or Facts
![Page 14: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/14.jpg)
EXAMPLE RESOURCEfile { 'testfile': path => '/tmp/testfile', ensure => present, mode => 0640, content => "I'm a test file.",}
![Page 15: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/15.jpg)
PUPPET TYPESFiles & DirectoriesUsers & GroupsPackagesServicesCrontabsMount points
NagiosDatabasesSSH KeysSoftware repos/etc/hostsExec
etc... and more from modules...
![Page 16: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/16.jpg)
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', }
![Page 17: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/17.jpg)
PUPPET MODULESManifestsFilesTemplatesLibraries
![Page 18: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/18.jpg)
EXAMPLE: MODULES/MARIADB/INIT.PPclass 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'], }}
![Page 19: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/19.jpg)
EXAMPLE: MODULES/MARIADB/CONFIG.PPclass 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_password}'", ... require => File['/etc/mysql/conf.d'], } } ... file { '/etc/mysql/my.cnf': content => template('mariadb/my.cnf.erb'), mode => '0644', }}
![Page 20: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/20.jpg)
EXAMPLE: MODULES/MARIADB/DB.PPdefine 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'], ... }}
![Page 21: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/21.jpg)
EXAMPLE NODEnode "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.%', }}
![Page 22: Drupal Devministration](https://reader033.vdocuments.site/reader033/viewer/2022052523/55560420d8b42a8a5f8b5662/html5/thumbnails/22.jpg)
SUMMARYDevelop configuration as codeUse Puppet modules, and commit to Git repoUse same configuration on dev as prod (Vagrant usesPuppet)Automatically generate node configurations and provisionServers no longer have names, they have a role and number