 Hi, welcome everybody. How are we doing today? Are we excited to be at work at Antwerp? Yes, I like to hear that first and foremost. I like to thank my colleague Brecht who is taking nice footage of me right now I left Hent where I work yesterday I came to Antwerp slept in a hotel opened my laptop back so that everything was there besides my laptop So he was kindly enough to borrow his stuff. So thank you brecht. I hope it doesn't break on me This talk is called Docker for WordPress developers and when I talk about Docker, I obviously do not mean the Dacia Docker I was standing in front of traffic lights not that far from me And I was still in my head preparing my talk and I saw a Dacia Docker and it was meant to be it was meant to be like That but then again Docker is the container technology We all love to love or hate to hate who's heard of Docker keep your hands in the air who then who uses Docker in production We all agree that it's it's very hot on the hype scale and To that extent that I'm every single place I go it's Docker Docker Docker Docker Docker and it will wear out on me I'm still it's still a novelty for a lot of people. I'm still cool with it But I think looking in the future three or four years in the future will get sick and tired of the term but it goes broader than that the entire container ecosystem has terms like swarm and Kubernetes and Moby and Rancher and rocket and Coro is and it's CD and flannel and Prometheus and helm You get the picture, right? It's kind of confusing. This is just only a small small aspect of the entire Container community and I get it that you're confused and if you dive deeper and dig deeper You'll see a lot and a lot a lot of tools and it's you could compare it a bit like the JavaScript community every five seconds There's a new framework. Well, that obviously applies to the container Communities as well now that container ecosystem as I explained is quite broad But we can extrapolate it even more and call it the cloud native landscape Because as technology evolves as the stacks that we use evolve These tools are are primarily invented to solve problems that are defined by the term cloud And I've deliberately put in a slide with really really really small images Just to show you the vast Coverage of terms and technologies that we use when we talk about cloud I do a lot of cloud presentations and when I do cloud presentations I talk about these things and not about the sauce pass yes fluff That being said hi welcome. My name is days I am taste free on Twitter and that's a good place to find me afterwards or to heckle me or banter me right now I'm cool with that. It's okay, and I'm a technical evangelist at a web hosting company called combo We are a gold sponsor at the event Thanks to the word camp crew. Well, you see a couple of familiar faces of the word camp crew for having us both as a speaker There's three speakers of combo here prect me and Diana. Where's Diana? So three speakers were very fortunate. I'm a I'm a technical evangelist. I do a lot of speaking I also do a lot of I write I'm a I wrote this book the Getting started with varnish cash published by O'Reilly So I'm not only passionate about containers and about cloud automation But also about caching and reverse caching proxies now Why do we use the term containers now this image should sketch it all because we want to Contain software that's one aspect and because we want to ship Software so hence the metaphor but imagine if we could go away from IT and from softwares and shipping software components And go into the realm of actual traditional Shipment and the city of Antwerp and the port of Antwerp is great for here I think it's meant to be and I'm here talking about container technology is imagine you have imagine this boat is docked in in China, and we have a couple of hundred thousand iPhones that need to be shipped to Europe and some of it is for this Apple store and others from that other Apple store and again This product maybe there's some Samsung's that are shipped from Korea as well that are probably built in China too Have to be go go there and go there and go there Do you drop them all in the bow of this boat and then figure it out when you get there? Probably not you're gonna contain it You're gonna have a component that is destined for this country and a little container that is built for another country So you're compartmentalizing everything all your little bits and pieces on one big ship So let's say that the ship is your server or your server platform So we're containing it nicely and this is definition the problem with putting text on slides And people actually breeds the text and I'm trying to avoid that now by just highlighting the things that matter What matters is that container technology is lightweight It's not like a heavy VM that has a full blown operating system and a full blown hypervisor and a full blown kernel You don't really have these kinds of things. It's really light and it's just and I'm reading it literally here an executable package of a piece of software that contains Everything and that's what matters it contains everything it contains your application code your runtime your libraries your binaries The Fulcher bang it's it's all in there and it's lightweight and you can isolate new environments And it's a very portable thing you could say that it's a new approach to virtualization Whereas virtualization has separate VMs and separate operating systems. This has a single Linux kernel But with multiple isolated Linux systems You can have let's say a Debian system on which you install Docker And you can have an Alpine or in Ubuntu or a Susie or or a Sentos You can have all these systems because it uses and I'm gonna go into this because this is far beyond the scope of this presentation But in fact you can have you can use this kernel namespaces shrooting. So ownership and locking Unprivileged user yalla yalla yalla. Let me show it graphically. I think that works far better This is our traditional setup where you have your bare metal Always a cool word bare metal. I was like bare metal your bare metal infrastructure on which you put a hypervisor It could be VMware KVM that could be hyper V all these kinds of systems And then you have your VM with a guest OS with binaries with libraries with apps That comes out quite heavily whereas if you use Docker which is kind of like you just have your infrastructure your bare metal and Your host operating system your Docker and then you have all these tiny components that are easy to ship And if you run them on your laptop just take seconds to spin up a full-blown machine Number one question. Why would we use these kind of things? Why as WordPress developer? Should we care or not care? And the answer is if you have lots of moving parts It is fairly ideal if you have lots of components in your stack that are tough to manage if you have your server And there's tons of components there to manage it makes sense to use it and Hence the very controversial slide I'm putting here If you just want to host a single WordPress site Docker is not for you Bummer. Yeah, okay. That was it. That was it now. Yeah, all right again if this gets too technical or too boring I will not get offended if you want to wait because there's drinks here. There's tech here make your pick But it however it is ideal for local development So if you want to find a way to eliminate the vagrants of this world or even worse I like vagrant but vagrants quite heavy on your system tools like Wamp or Mamp No, we're among friends here. So who uses Wamp or Mamp. There is a way back It's awesome in a way in a way But Docker will help you a lot more because you're running Linux natively you you can tear it up Spin it up tear it down quite easily can have multiple versions without the slightest of overhead full configurability And it's it's also great for continuous integration and continuous delivery Let's say that you're in a CI CD stream and you want to do automated testing and automated builds You always want that machine that disposable machine that you could boot up very quickly do your built do a set of tests and then tear it down and it's done Docker is ideal for that and Final reason why you should do it is because we can technology is there And we're all developers or sys admins or people from the broader IT community if it's shiny and it's new We probably like it want to use it and we find a way to justify it to management Okay, let's get down to brass tacks. Let's show it how it works You start off with a docker file in which you define in a sort of Infrastructure as code style what your virtual machine your container should look like you build an image You store it locally and then you run the image if you're in a more distributed setup on the one hand in the building States you can build an image that is just ready to run that contains everything and you push it through a registry Which is hosted in the cloud you have the official docker hub Which is like the github of docker images? You just put it there and other people could use it or it could be a private one that is protected And then in the running stage you pull it using docker pull command and you run it So it's actually infrastructure as code style Infrastructure as code meaning you have a regular application quote your php code JavaScript HTML code which is very human readable in which makes sense while setting up your infrastructure could be a similar thing You have a descriptive language in which you define what your infrastructure should look like and you commit it next to your code And it's good to go and we're going to do that today and we're going to define a lamp stack Sorry for the cheesy pictures, but we're going to define a lamp stack being linux batchy my skull php No surprises right and we're going to use a docker file We're going to create a docker file ourselves, and I've like most of this presentation is oversimplification of the facts We only have X amount of minutes, so we have to make it count So this is I'm going to stand sideways so you can see it This is the simplest of simple docker files in which we install php and Apache. How do we do that? We need a base image. So the from specifies what we need and we want a basic Debian operating system and Besides the colon, there's another term stretch That's the tag so you can have an image and the tagged version and the tagged version is stretch stretch for those Who are unaware is Debian version 9 that's just a Linux system a barrel Linux system And then we say the directory from which we want to work is far Html that's your basic Apache root where your php files are going to be and then you're going to use the package manager of your operating system If you use Debian or Ubuntu that will be apt get so you'll do an update and then you'll install Apache PHP 7 and the bridge between the PHP process space and Apache merge that together You run Apache on the foreground You expose it on port 80 and you're good to go and this is your image definition This is your docker file and this is going to be hosted next to your or put in the git repository next to the rest of your Code, that's just it now one of the definitions or one of the the conventions rather of docker is that? Docker container could only by best practices only runs a single service So if you have PHP Anapache that belongs together or if you have a redis have my SQL you have other systems these are all separate containers We're not going to mix them together It's a sense of simplicity that a container only has a single task and because they are so lightweight We don't have to really be concerned about the impact of those on their system So we're going to do docker builds minus T and then you give it a name That's the name of our image called my WordPress We use the dots to specify the current directory and it builds and when you're done you could do docker images On your Linux on your Windows computer on your Mac if you have the tool set installed and you'll see that we created a my WordPress image That contains the I'm going to show you what it contains It contains a debian stretch with Apache with PHP and when you boot it up Apache will be running Plistic we'll get there there is that there are slides and then I'm going to call you out as soon as we're there Right hold tight Yeah, because my SQL should you should need to be hosted elsewhere What you could do what you could assume in this in this stage is that you'll have an external connection string to a database system That is hosted elsewhere could be could be the case not necessarily the case and then you need to run it once you have your image You need to run that image You need to spin your infra up on your local computer think from the context of local development Docker run you give your container a name We name it my WordPress and the next thing we do is expose the port in our definition of our docker file We had expose 80 that meant that the web server is exposing itself on port 80 What we're doing here is binding port 80 of our container to port 80 of our local machine This is basically a port forwarding strategy that allows us if we go to the browser and type a local host We'll hit the docker container We will hit this very docker container by doing 80 colon 80 minus D allows us to detach it so that it's not in the foreground of our Terminal it's in the background we can continue working and then we do minus V to mount volumes And that is essentially how we get our WordPress code that is hosted locally on our system and that we're Modifying using our favorite editor or IDE that we mount everything that is in the present working directory PWD got one level up in my case then go to the code folder where my code is hosted for his presentation and Mounted to Vard up that page TML So if our WordPress code our code base is in code It will be attached to our docker container and we're ready to run it in a lightweight fashion And what do we use we use my WordPress and the latest stack? I didn't specify latest anywhere That's the automatic attack. It gets when you don't tag release If you want to tag it you can do Docker tag you give it The source name and then you provide a destination what I've done here is I prefixed it with a username my username on the Docker hub Taste free and when I do Docker push taste free in slash WordPress It is going to by default get pushed to the public repository and if I go there you'll see it This is my image and I'm able to share it with you So implicitly it's already available there and you can do Docker pull taste free in slash WordPress and you'll get that image and don't try it because I've already deleted this one It's nothing really special about this. You'll just have an Apache nothing really worth using but if you continue on this trend on the fact that there's a public library of Sometimes really reliable images Why don't we just skip building it ourselves and just use the public images because we want PHP, right? Well, there's an official PHP channel Here it is. It contains a whole bunch of versions So what we do Does this thing have a laser pointer? Yes? PHP Apache and We don't have to build it ourselves. We just rely on something that is maintained officially by the PHP community and you have PHP and we take the Apache tag. So that means that it's not PHP FPM It's not have it doesn't have to be linked to engine X It's just PHP and Apache as I defined myself but maintained by the community with a lot more features but then We all know this run, right? I forgot to install my SQL and there are components to install my skill It's quite easy, but let's take it one step further. Let's go to the next level and just use the wordpress one. There's an official wordpress Docker image that is ready to roll with tons of options. It's quite good So these are all the different kinds of versions of the Docker container depending on the version of Docker The version of wordpress that you want and depending on the version of PHP that you want and the PHP implementation So there's something for everyone Do this in a very similar fashion Wordpress latest I want the latest version of wordpress and when you run it you'll get this the installation page You notice that in the Docker run. I didn't put in a minus V so I didn't mount my volumes So it just installs it downloads the latest version of wordpress and it gives you the installation page Ready to roll install boom done Yeah, because local host is also yeah, he is a clever guy. He said look at the fave icon Yes, that is the git lab fave icon because in a previous example I ran a Docker container containing git lab on my local host and stored the fave icon there very perceptive of you So what we're gonna do we're gonna change that and we're gonna mount our own code And then you have your own little wordpress code base nicely linked to it And you do Docker PS and you see that there's a running Docker container Containing port 80 that is mounted and when you're sick and tired of it or when you're done in your dance Do docker stop and then docker RM and it's gone and it's so simple and it's so lightweight But then people ask the question. What about my SQL, right? What about my SQL? Well? I'm a bit weary of running my SQL within containers because containers have this idea of the fact that it's quite disposable you You boot up Container and it can crash on you and then you reboot it and it's all fine and dandy But my SQL and the data that is stored in my SQL is a bit more tricky Now there are ways to make it more durable and there is an official my SQL container And as you can see it the versions are a bit less I'm going for the 5.7 and you could run it like that Allow me to go through the different options so that it makes sense to you We start up a docker container and it's my SQL tag 5.7 So the 5.7 version and you see minus e minus e stands for environment variables So we're passing along environment variables from our own system to the docker container Containing specific values and these values will be used at the bootstrapping phase and will allow us and it's no secret Let's let's give it a shot my SQL root password. What will that do? pop quiz it will It will Come on play along it will Set the root password. Yes. Thank you And my school database will create a custom database that we like Followed by a user and it's password So what you're doing is instantiating the my SQL server from the run using simple environment variables and then you're giving it a name and you're exposing 3306 Which is the standard my SQL port and you detach it and then you do for the sake of safety Attach a local data folder to var lip my SQL So that means if your container dies the data structures the data files of your my SQL database server are still on your local computer So as soon as you restart WordPress all the day or restart the my SQL container all the data is still there so from a local development perspective if you've Set up a certain structure. It is still there and you can have multiple versions of that Maybe you have multiple projects. Well, I'm gonna boot step another project and another project and the data will be there You can also make it a bit simpler And have just dump files and this is what I'm doing right here I have a DB SQL folder and it gets mounted on the container This is just a convention to entry points in a DB dot D and that's a folder and Upon loading my SQL that folder will be read and if it sees an SQL file It will load that SQL file if it sees an SH file a shell file it will execute that shell file So that's a great way to implement your database structure or to load some seed data or to run some scripts So Yes, it does but you can use secrets as well Docker secrets and that will read it from a file and put strap it that way But I was just too lazy to do that and I just wanted to show you the basics And I picked a very very basic password. So it's easy to guess no point hiding it Next question. So we did the Definition of our containers images in an infrastructure as code style So why not do the running of those services because a lot this is not that convenient Can like if I show this to you 10 seconds, can you reiterate that from heart? Entirely no, yeah, you could yeah, you could but it's it's kind of hard So why not don't we use another system? It's called Docker compose and it's yet another format a file format in Docker compose YAML that allows us to do all that in a single file and that file could also be part of our code base and would allow us to set up both a my SQL and The web server all in one move What you've seen in the Docker run commands is what is reflected here Let me go over two services a DB service a WordPress service an image name Image name Volumes volumes environment variables that set all the passwords. It's all there in a single file And then you just do Docker compose up Minus D to detach to the background and it's there and you have your stack ready single command and You do logs minus F to follow the logs Then you see a bunch of logs that make total sense, right? And if you care about the processes that one you could do Docker compose stop And you see that there's a single my SQL process in the my SQL container It probably uses threading for Multiprocessing strategies or parallelism strategies rather patchy uses process forking you see user zero That's probably the root user it forks an Apache or it loads an Apache and an Apache on another user has five child processes So you're exactly seeing what happens if you're done do docker compose down and it all gets torn down No questions asked What if we want to add some extra services Like CLI and Redis we've heard a lot about WordPress CLI its convenient tool I like it why not put it as part of the stack and why not have a red is there to do some object caching You can define them there and you it's surprisingly easy. It's a two-liner Redis image red is for done. You have red is CLI Just a bit more dependencies and also a dependency on the file system. You want to make sure that your file System is right there amount of our WDW HTML so that it can read it It can extract the database parameters and you can go ahead and do some CLI stuff Oh, another thing that is fairly important entry point WP because that's the name of the binary right WP And then you can do WP plug-in list. Well, if you specify that as your entry point You don't have to mention it again when you run it when we do this docker compose run Minus minus RM so that it destroys it when the commands got run CLI the name of our service plug-in list And that runs that command Let's say you have a Mac it runs it on your Mac But it runs it within the container and that container has the The file system attached so it can read all your WordPress files It could do all the maintenance commands and then you could just go ahead and say docker compose run CLI plug-in activate Redis cache boom installed done on Your local machine on a multi VM setup Try doing that in map Next up continuous integration and continuous delivery and also makes sense I've promised you that it makes sense there again We're gonna oversimplify the situation and let's say you don't want to do an integration test You've set up a WordPress and at the end of the road You want to make sure as an assertion that the title of your WordPress installation is docker just another WordPress site. I Think there's a typo there just another WordPress site Apparently there is a binary called pup that does sort of Inspection of your DOM layer and by using this syntax We can get the text of the title and it should match and then you just do a local host curl So imagine in your WordPress image in a testing situation You just figure out what's on local host and make sure that the title of your WordPress is Docker just another WordPress site. You don't want to be running that manually You want to make sure whenever your time you commit some new code that test is run This is of course oversimplification But you get the point right you can do integration tests and you can match the output and see what happens and make assertions there And if that fails if that test assertion fails, you stop the build you don't do an automatic deploy There's far better tools for like PHP unit to do unit testing and codeception to do a mixture of unit testing and acceptance testing and functional testing or be had can also do deployment using a CICD street and the point I'm trying to make is that get lap I'm going to use this as an example is a great example of Docker integration in CICD systems This is what it looks like. It's fairly familiar to to get up It's a competing product of get up with that difference is that the open source version can be hosted on premise So if you want to have a local git setup you can use git lab for that and it has a CICD Pipeline in it so if you deploy a specific file if you put that in your git repository and you push it to a git remote that is hosted on That CICD server a set of tasks is going to get executed a pipeline building unit testing integration testing reviewing deploying to staging Deploying to production now the point. I'm trying to make is that git lab Uses the Docker syntax out of the box. This is the git lab ci.yml file that definition file that defines your pipelines and This sounds fairly familiar right image WordPress latest So what it does is for that run as soon as you commit your code for that run It will bootstrap that docker image run it perform all the tasks you want it to do automated tests build tasks Deployment tasks and when you're done it tears it down and we can use similar services to to do the automation here Services name MySQL 5.7 sounds very familiar, right? We're going to alias that to DB so that we can use that as our database host within our testing environment All the environment variables that we need for authentication purposes You've seen it twice now in docker compose on the command line via docker run. You're seeing it here now in a CICD platform Do apt get install from some extra stuff like the MySQL client to import our SQL file a Golang runtime so that we can get that pup binary And then when all of that is done we install or we run Apache and then in the end We do the actual testing test curl minus as local hosts do the pup of the title text And it should be docker just another WordPress site and when that fails the build fails when that succeeds the build succeeds And you can do some extra stuff like automatic deployment to staging or do a click-based Deployment like a manual interaction to deploy to production all of this using docker logic So the point I was trying to make is that when you do a git push origin master and master then is your git lab server It will start these Pipelines have a failed pipeline a pipeline that has succeeded and then a pipeline that contains jobs that are currently running And it will do all that in a docker fashion. It will install all the packages. You need it will use that image And then in the end you'll have an integration test that is fully successful Just another example of how docker makes sense from development to CICD and Then you do deployment as well. How do you how do you do deployments like? What's how's your way of deploying WordPress sites? Let's let's I see that you're all a little bit. Chow. You're not shy And boyer that's that's a way of doing it. It's a good way of doing it. Does anyone use ftp? SFTP or ftp Not my favorite protocol not that secure as ftp. However uses as it is a bit safer if you can use as ftp who uses scp Who uses our sink? Like our sink it's easy if not all the files have changed not everything is transmitted sometimes right or you could use git or whatever Let's translate that traditional mindset to the wonderful world of Docker Let's do it here Docker run. This is the command that we use How do we? Make that secure for deployment to the cloud Let's say you have a cloud environment where there's dockers containers running Well, you can use custom images and a private registry Let's go back to the idea of GitLab GitLab also has a registry a private registry that is protected in which you can host Docker images custom Docker images that shouldn't necessarily be exposed to the outside world because We're afraid that it might contain sensitive stuff So what you could do is again, we have that little our first example We're gonna push that because it contains very sensitive data or not It's up to you to decide but this is the example And what we're gonna do is docker login and we're gonna log into a private repository and that's I've redacted domain That's one of our domains. I've redacted that and again at a namespace for the the namespace I have in my GitLab and the name of the project and build it there and push it there And then I could just run it and we'll connect on that port to our GitLab instance will fetch that image and that's the way you could deploy with Docker But manually deploying Docker images and manually running Docker on a production system can be a very very very slippery slope For example containers Just like that's the idea of these lightweight cloud instances as well that Amazon and Azure and Google advocates It's it could die on you every single second. It's like don't assume these things are gonna run That's a problem, right? If your Docker container crashes, what are you gonna do? Install a supervisor process that just boots it up every single time What if you have multiple services that all battle for the same ports or we have this WordPress installation and because it's so light We're gonna have a second WordPress, but wait a minute. Both of them are bound to port 80. How are we gonna solve that problem? Or if you have so much services Whereas everything hosted What how do you do service discovery? How do you do high availability when a Docker container should if it dies on you? Should become available or should immediately be ready on another system or? What if you just have a single container, which is kind of useless? Why would you have one single container on a system in those situations? You'll need orchestration and Default orchestrator up to recently from the Docker community itself was Docker swarm it's a way to orchestrate in the clouds and you could test that locally if you have Docker installed on your computer you can use your Docker compose file and orchestrate that locally in a Docker swarm stack Here's how you do that Docker stack deploy and you just specify that Docker compose file that contained our WordPress installation our Database and it will boot up the stack and if you want to you can check the services and You have the database and the red is and the WordPress and this one is exposed on port 80 So you can go on your laptop you do local host you'll have it and you do Docker a less of the stack and you see the stack with the number of services and it goes on and on and on You can remove your stack your WordPress stack quite simple But the thing is that swarm is getting out competed by Kubernetes. Who has heard of Kubernetes before? ranks super high on the hype scale it's hype and it's now also it was at Docker come last year in Copenhagen and Docker is very much in its own ecosystem want to do wants to do things its own way and it had to admit that it was so Impressed but what happened in the Kubernetes world that the Docker tools in the next stable version of Docker will contain a built-in Kubernetes now Kubernetes is an open-source container orchestration project managed by Google and It's gonna be in there if you install the edge version of Docker This is on my Mac you go to that tab and you enable Kubernetes You'll have a local Kubernetes on your system that will replace Docker swarm if you're planning to use Kubernetes in production Which is one of the strategies? I would advise if you're planning to run Docker in production you can do that Docker stack deploy in a very similar way but it won't be hosted on swarm but on the local Kubernetes installation and This is more or less how it works This is how Kubernetes works have to explain a couple of terms and I see that we only have 10 minutes left So let's keep it flowing You have service definitions and the service definitions is more of a networking way It's a way to expose the ports that you need like my SQL like WordPress We start at the low at the lower level with a container by now We're reaching the end of the presentation. You should know what a container is well that container is Incubinettes is hosted in a pod and I know it's very specific terminology And it took me a while to wrap my head around it a pod is a collection of containers and also takes care of the high Availability that means if you want to orchestrate multiple replicas of the container It's all hosted in a single pot containers that are hosted in the same pot are in the same little local network The other networking beyond like this is a container in a pot. That's a separate pot These have to use a sort of software defined network to communicate with one another We have volumes and that's something that is important as well We did the binding of the volumes from our local disk on our computer to the container While in production you're not going to bind to your own laptop that would be kind of risky, right? So what you do is you create a volume Reliable volume. There's different kinds Depending on the cloud vendor you work with and you can have persistent volume claims that you can link it to it And then all of this is exposed via services internally and exposed to the outside world via a concept We call ingress and I know it's fairly complicated And it's not the scope of this presentation to give you all the info about that because it will a bore you and Be will be out of time and out of drinks by the time I finish that So on my local laptop again, you saw me deploy the stack in the same way by using my Docker compose file I use a recent version sort of edge version a beta version of Docker So I already have kubernetes and this is the binary which you manage kubernetes So you do kubectl get deploy and you're already seeing the deployments So if you use the native way of using kubernetes, you see that docker Docker Toolset already created that for me and then you can get PO PO is short for pod. I don't know why they abbreviated that I know you can type keep CTL get pods and it will give you the pods But if you do PO you have to type two characters less and it's very cool And you see pods that only have a single node that are running and you can get the services that were automatically Defined in our docker compose file now mind you and Charlie at the end of this presentation I will show you the native Kubernetes definitions it will blow your mind in a way I have to do that in the next five minutes according to Wendy So here you see all these kind of services and how they're exposed and this one is exposed on our local computer to port 80 So we could just type local host again and have the power of kubernetes be accustomed to kubernetes because that's what we're going to run in production and We're gonna do we're gonna write our own deployment This is what docker compose that the the translation stage from local docker compose to a full blown kubernetes system did For us, but when we want to go to productions. We have to write these files ourselves. So let's start with the MySQL part. Are you ready? Yes, let's do it This is our service definition all of this all these chip snippets of files and code will be hosted in my case in a Single file single deployment file. We're gonna run that and it will do rolling deployments to the cloud So what we're doing here is answering some of setting some metadata But what we're primarily doing is saying we want to expose the port 3 306 for an app that is called WordPress and Then we're doing some persistent volume claims don't look at the details the ideas that we're claiming one gigabyte of storage from our system from our cluster because it's a Cluster system at the minimum of six nodes tree master nodes tree worker nodes or minion nodes as they call it and Then we have our deployment or my SQL deployment contains similar strategies I know it's a lot of yaml and that's my main concern here lots of yaml What we're doing here is we're naming things we're naming it's a MySQL WordPress We're using that 5.7 image and it goes on right the environment variables you see him What we're doing here, and that's what I wanted to point out to you is using Secrets here. We have a secret that is registered in our cluster that is encrypted and where the passwords reside So have separate ways of doing that So I have all these environment variables and we link far lip my SQLs to make sure that it's attached to that persistent volume claim If that container dies and gets booed up again because that's what the container Orchestrator will do if something dies it will reschedule it automatically and you can have replicas so that you have multiple Versions of this and it all will get bound to far lip my SQL in that way you have safety about the storage of your data Because that matters and WordPress again similar service which service port 80 We're gonna do type load balancers so that it's load balanced across the cluster if we have multiple replicas We'll have a 1 gigabyte storage in this case We're gonna have the very similar things. We're gonna host the latest version of wordpress have some made of data here Have all these parameters here so that it's bound Use the storage yada yada yada What I'm doing here again. I'm sorry. I'm gonna put it in my command line history I'm gonna register those secrets. You can read them from a file again. It will be stored nicely and securely within the cluster and then We're gonna do cube see and this is the magic This is what happens keep CTL apply minus F that entire file with that huge Yawl definition and it will automatically orchestrated in the cloud and it will load balance it And you can have replicas and all that you want and you can check the pods and the pods are there They're first at first. They're not ready for creating the containers and they're running You're up and running and you can run all that stuff and you can get the services and the services are there And you're good to go and you can get the deployments then and you can say we're gonna scale We add two replicas so that it's load balanced on the fly Again, it will run it and there will be a desired state of two So I'm not gonna go in all those details But what I would advise you if you want to really really feel the power of Kubernetes locally on your system Is to install mini cube a mini cube as it says is a miniature version of kubernetes That only contains a single instance hosted in its own little virtual machine. I think primarily on your Mac Maybe you can have it on Windows as well. I'm not sure And then you can do these kinds of things the service that is defined on port 80 Well, then you can do mini cube service minus minus you are all WordPress and you'll get the URL You could run you don't have to care about all the networking stuff because that cluster IP kind of thing that is hosted Even in DVM you can't really touch that because again This is all Linux and your MacBook and your Windows that is not Linux So there's a little virtual machine in place to make that happen And when you want to when you're too lazy to copy and paste that URL You can just do mini cube service WordPress your browser will open and you'll see the service That's a way of abstracting it when you go into the cloud it all depends on your vendor and Company you work with how it's gonna get exposed to the outside world via HTTP or what have you and then if you're curious about what runs on kubernetes You can type mini cube dashboard and it will open the kubernetes dashboard. You can see all the bells and whistles And when you're ready for production when you want to go to deployment I have two minutes left. Maybe that's one by now And we're getting there. We're reaching the end. You only have six more slides You can do Qubectl config use context and you can switch to a production context So you'll have multiple contexts. You'll have a development and maybe a staging and a production and an acceptance Or you have something at Google something at Combell something at Amazon you can switch and then just apply that same Configuration file that by now you don't want to look at anymore. We just built it. It's there and It's done And believe me. There's more There's a lot more. It's a lot more, but that's that's a story for another day. I just wanted to dive you like take you and dive right in into the wonderful world of WordPress and Docker I understand and accept that it's quite hardcore quite technical but I do believe that it's a way that is passing by right now and Might as well want to ride it to take your surfboard ride that wave because the future is definitely going to be containers I'm not sure if Docker will be the technology that will be out there in the next 10 or 20 years But containers is definitely something you have to look at that being said you can find these slides will be published on E.U. Later on you'll see a list of my past and upcoming talks if you want to see more that stuff Follow me there, and I'm on Twitter Instagram. You name it I want to thank you because we've reached the end and you haven't fallen asleep most of you I guess and there's drinks outside and But unfortunately word camp and rip is done. So thank you for sticking around see you next time Thank you for hanging out with me