DrupalCon Portland 2013

Prepara tu entorno Drupal con Chef

Nathen Harvey  · 


Extracto de la transcripción automática del vídeo realizada por YouTube.

so good afternoon all right there's a little bit of energy here this is the like the last session of the conference there's really big names that I'm speaking up against and you guys are here that's totally awesome so thank you for having me

thank you for coming out to drill con how's the conference meant for you guys yeah good stuff awesome so hello my name is Nathan you might notice that my dad misspelled my name so here was the rule in my family long Pixum dad misspells them and he was

consistently misspelling all of our names so I have a brother named Gordon who also ends with an en as does my Nathan I have a sister Adrian also ends with an en and then the sister Meredith my dad tried really really hard to squeeze in another en but he just

couldn't do it but he did misspelled it actually I don't know the proper way to spell Meredith I only know the way to spell Meredith the way my sister does but I know it's wrong and now enough of my family history and all about my siblings I am

a technical community manager at Opscode ops cody is the company behind chef i'm also a co-host on the food fight show which is a podcast it is in fact the podcast where devops chefs to battle so it's a totally fun podcast and I for one think that

everyone in this room should subscribe to that podcast and in fact if you subscribe to that podcast I'll give you a sticker at the end of this talk in fact if you don't i'll still give you a sticker but I'm also a meet-up organizer I organized

a couple of meetup groups in the DC area where I'm based I'm not really based in DC I'm based in Annapolis Maryland which is nearby you can follow me on twitter at Nathan Harvey and if you were fast enough before I click on to the next slide and

went to that speaker deck you can actually get these slides right now so I'm saving you a question at the end where can i get these slides from you can get them from right there right now go all right so opscode who are we opscode like i said is the company

behind chef chef is an open source configuration management framework Opscode is the company behind it we are not chef but we are the main contributors we are the ones that support it osco pays people like me to go and talk about Chef and how awesome it is

so speaking how about awesome it is just what the heck is chef chef is an automation platform it's used by developers systems engineers this admins to model your infrastructure so you're going to define the way that your infrastructure looks in code

so let's just kind of step back for a minute and talk about your business your business is all about applications and I bet I would wager a dollar that everyone in this room or at least ninety eight percent of the people in this room have an application

that's based on Drupal am i right yeah all right so we've got these applications these applications make up your business they run on top of infrastructure so what do we mean when we talk about infrastructure well with chef we really want you to think

about your infrastructure in terms of a collection of resources so your infrastructure is the hardware or the virtual machines the servers that your Drupal application runs on well how does that Drupal application get there and what are the various components

that need to be on that server in order for it to work these are all of the resources that chef will help you model and manage so these resources act together in concert to provide a service and over time that service will evolve so your configuration is going

to change over time so you start off very simply I've got this nice little Drupal application everything is sitting on one application server my database is here my drupal is here all is right with the world everything is beautiful why do I need configuration

management it's just one little box I can handle that no big deal what your business starts to scale you get a lot of good traffic so you decide well we need to improve performance let's move the database off of the application server let's split

it off onto its own dedicated service we can get better performance out of the database and let's make sure that we are have redundancy within our data tier right and now our business is getting better and we're getting more and more so hers and our

application or infrastructure is really just starting to grow and grow and grow and we have to tie all of these various infrastructure components together with configuration so that the load balancer knows which application servers that should talk to that

application servers know which database caches in which database servers they should talk to this is not a simple problem anymore this is now a real thing but of course your infrastructure is a snowflake it doesn't look like this here it looks like this

actually that's a lie everyone in the room is a snowflake and each one of your infrastructures is a beautiful and unique snowflake also i actually don't know what your infrastructure looks like frankly I don't really care but chef will give you

the primitives the resources needed to model your infrastructure and manage it over time of course your complexity is just going to continue to evolve because you've got this great application that you're building out you need something to help solve

this and that's what we call configuration management so let's say you've built all of this infrastructure out and now all of a sudden you have new requirements so this is a pain right I just got a new developer that joined our team I want to get

her up and productive right away how do i do so I might take a week in some shops I need to add new relic monitoring to my application so i can get much better insight into what's going on it doesn't need to be new relic but i think new relic is pretty

freaking awesome so if you don't use them check them out add a new module to the development site I don't want to add this new module to the production site yet just to the development site let's build it make sure it works the way we want and

then we'll roll it out to production so how do we do all of this this all leads to configuration desperation and chef solves that problem but you probably gets them already so chef is infrastructure as code what does it mean when we say infrastructure

is code basically what we mean with infrastructure as code is that we're going to write code that will model your infrastructure and it will manage your infrastructure over time with infrastructure as code you essentially need three things to rebuild your

entire business you need compute resources whether those are bare metal or virtual machines somewhere off in the cloud whatever compute resources you need to backup your data and you need your source code repository because now that we're treating our

infrastructure is code we are of course putting it into a source code repository just like you do with all of the application code that you write write write it all goes into a source code repository very important so we do this in chef by writing programs

these programs allow us to abstract the details of the infrastructure away and really model what that infrastructure looks like programs also allow us to build up our infrastructure in modular pieces so within these programs we have a declarative interface

to our resources so those resources again where things that we saw a couple of slides back things like users or packages or files directories things like this within our programs we're going to define our policy so what should this application server which

should this server have on it what should the characteristics of this server be we will specify what but not how and we'll look at that in just a second but as an example we may say that we want a package installed we won't tell where we won't

say in our program exactly how to install that package should you use young should you use apt we'll just say that the package has to be installed that is our policy and then chef works in a poll not a push model so essentially what you have is on each

one of your servers on each one of your nodes in your infrastructure there's a chef client running it will wake up on a periodic basis check in with the chef server and say hey what's my policy the chef server will send down that policy and the chef

client will bring that node into line with the policy we'll see some examples of that hearing bit okay so here's what those programs might look like of course they don't have the nice pretty drop shadows when you write them in your text editor

well I don't know maybe you're depended but so here's what they look like we've got first a resource that's a package a package resource apache2 so again we're not saying how to install apache2 we're saying that this package must

be on this system next up we have a template so we've installed this package this package exists on the system now I'm going to write out a template file some Apache configuration and then finally I have a service resource and in this surface resource

I'm saying that I want this service to be enabled and started so let me just break down what this is doing the first thing that it does when it says when the chef client sees package apache2 it's going to inspect the system that it's running on

and say does the apache to package exist here has it been installed if it has is just going to move on and go on to the template if it has not yet been installed it will install apache2 and then it will move on to the template the next thing that it sees here

is the template resource and in our template resource we're saying I want to manage this file etsy Apache to apache to calm and in it I want to specify some content and I'm going to use a template file to specify what that content is going to be we're

not going to look at the template right now but you can imagine that it's a template right have some variable substitution in fact we're going to send down a variable called allow override how many of you have said an HTTP you know allowoverride within

their apache conf before yeah just about everybody right and so we're going to say just allowoverride we're going to set that to all will say that as a variable and that will end up in the template and then I'll come back to that next line that

notifies there so the template is now written out of course before the template gets written the first thing that chef will do is verify that the field the file already exists on the system and if it does it's going to inspect the contents of that file

and determine does it need to make a change to that file or not if that file is already in line with policy chef will leave that file alone and then the last thing that it comes to here is the service and we have a service named apache2 and it has two actions

that to it we want to enable it and start it so enable it says when the server reboots Apache should come up automatically and I want to start apache so again chef is going to inspect the system and say hey is Apache to already in check config or whatever

system you're using to make sure that things come up when your system reboots if it is I take no action he's Apache running right now if so I take no action otherwise I will start it for you and then if we go back to the template in the instance when

[ ... ]

Nota: se han omitido las otras 5.716 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.