 All right. All right. Hi everyone. I'm James Hi, I showed you some cool videos. Thank you. So who am I? I'm a hacker working in config management stuff I read technical blog called the technical blog of James who's seen it. Just raise your hand If you haven't just raised your hand anyway, so I seem really popular. Thank you. I reuse all my jokes I'm actually a physiologist by training So I used to do a lot of stuff on cardiology and sort of what I my goal is really research and things like that Really into DevOps and I used to do a lot of stuff with puppets and everything was a big trash fire and it was pretty terrible and I didn't want to Sort of reinvent new tools and reinvent the wheel if there were existing tools But I didn't like this wheel. It was kind of a shitty wheel. I want to like the new shiny wheel And so I basically came and I was like is there an existing tool or language that is good enough This was the question that I was sort of asking myself. And what did you think anybody? No one wants to answer. That's okay. This guy will answer for me He's my nope guy. I'm gonna be sitting down a little bit so I can do some demos. So don't worry. I'm still here So yeah, there just wasn't really sometimes you really need to build new things and so that's the thing so long story short I sat down I started working on this project called mgmt. We have a nice pretty logo that someone made. It's a dag It's a graph it has two main parts So just a little intro who's seen mgmt stuff before anyone or you're all complete beginners, okay? So we're gonna go some basics. There's basically two parts. There's the engine and the language and we're gonna talk about both of them so Three main parts of the engine There's it can run stuff in parallel So basically have this graph of resources and it can run through the graph and run in parallel Everything's event driven, which I'll show you and it works as a distributed system So this is basically a graph of resources that you would normally see in in these sorts of declarative tools And the blue box basically represent what happens in what order and the black arrows are dependencies So typically you would run through do a topological sort and execute everything But we actually run in parallel and each of these boxes in addition to being able to run when it's time It also can respond to events and wake up and do stuff. So I'm just gonna show you an example of that So here's just a little solo he'll you example so on the left I'm gonna run on your left. I'm gonna run MGMT and on the right We have a folder and gets right here And so I've basically asked MGMT to create one file and you can see that it has like little message Is it big enough? Can everyone see? Yes, cool, and the cool thing is I can actually like remove this file And if I do list you can see it came right back because MGMT is noticing the state in real time of the machine So it removes the file and it comes right back and I show this demo because it's quite fun you can even Sorry, you can even move the file and Cat the file and you can see even before the whole command runs MGMT is waking up and doing this so you keep the state in real time and you can even do this sort of trick which With this little program called watch which will run something over and over again really really quickly And you can see as fast as you're running it always is keeping the state in real time cool That makes sense you like that Okay, so this works for every resource for files packages services for AWS resources in some cloud thing if you're into that kind of thing virtual machines Containers also, maybe that's your jam all sorts of resources, and you can write a new resource too if you want It's very simple ultimately The out of the the output of the program is a dag So it's this graph kind of like the logo that I showed you and that says what we do and Because this is the languages dev room We're gonna actually describe our language that produces this output because it turns out having a language is actually a very interesting way to Describe exactly what we want over time, and that's what we're going through Here's basically the quote that I've been thinking about for many years ever since I heard it Basically want a language that's going to constrain us as much as possible, but also Make it easy to express some very complicated things and the reason is very simple because if you make an off by one error in your Program and your program controls a whole bunch of infrastructure. You don't want to nuke like three data centers, right? So responsible safe DSLs this guy's like oh, I want to nuke my data center If this responsible safe languages that can describe these things are very powerful So one language. It's safe in my case Declarative basically immutable in I think what you guys would call it. It's a functional typed language The implementation is written in a memory safe language, so it's not some see horror show Hopefully, it's very powerful So it's a reactive language I'll show you about and hopefully that the language has some primitives that make us eat make it easy to understand What's going on am I talking way too fast just not yes is everyone with me so far you want to see another demo I think it'll be more helpful. So here's the first demo I just sort of pasted some code onto the slide and the language I Don't have proper syntax highlighting yet. So this is just me fooling around basically you have some stuff in the language So here's a function date time Here's some multiplication of a bunch of stuff. We put some values into a stuck into a struct There's a load function over here, which you might see and then there's some view meter function I don't know what that does and basically we print it all out Into the contents of this file. Okay, so let me just actually run this and we'll see what happens So this is going to basically print run a bunch of code and then put the data in a file But the thing is this is an FRP so it's a functional reactive language, which means the data has streams and Goes through and actually will produce new values as needed So for example date time happens to produce a new value basically changes every second because the date time in real life Changes every second and if we we see this you can actually run that little watch command We did before but just I'm going to show you the output of that file Just so you see what happens and this is basically all the text that this program Ran and put out here and you can see it's printing out in real time The number of seconds and some math to print out the date from now in one year You can see it's printing out the actual system load and all these values can be used to make decisions about what's happening So based on when the load is up or down you could do different things and model your infrastructure over time Does that make sense? Yeah, so I even made and this last thing here that you see changing is a little view meter So just to show you how you can use any data source as input I actually have my microphone listening right now in my laptop and it's listening and sampling the sound and the louder It gets you can see that it changes in real time, right? So if you make some noise, okay, so we'll be really quiet and then you all make a whole bunch of noise And we'll see if it works, okay Cool, so that sort of thing So I mean this is kind of silly but imagine you wanted to model like an absurd way some You know data center where if there was a lot of noise and people were screaming that maybe you like said everything Only for an hour till people cool off you can model these sorts of decisions That's kind of silly, but you can sort of use your imagination and again. This is very efficient running in real-time I'll show you another demo. This is Historic history demo. So what I'm going to do is I'm going to run this code Basically, I'm going to take the date time value and then I'm going to use these curly brackets around each variable 0 1 2 3 and then just put all of that into the file with a big print F So I'm just going to run this over here and again I always use the example of like running some data and putting it out to a file because it's easy to show you what's going on But instead of writing files on disk and text you could be actually creating virtual machines or doing other fancier things So this is just for example purposes. So you can actually see If I'm running this I'm just running this watch to constantly pull the file and see what's in it We actually have the current date time and the previous value and the previous value before that and the previous value Before that because since we have this time-based language We can actually look back in the past and see what was the variable like five seconds ago or five values ago or so on And with that we can make decisions, right? If we see that the values are constantly going up or constantly going down or doing other some sort of other pattern We can make more intelligent decisions. All right. Does anyone know what this property is called just for fun? It's okay, we're gonna get to it. Okay, any quick quick quick questions so far. Is this cool? Yeah, does anyone use like puppet or ansible or these sorts of tools? This is basically the kind of tool in that way, but we're doing all these things in real time and a lot faster and And way cooler obviously. So that's a demo. You want to see some more demos? I think where's Libra office? All right, so this is a picture. I took for my parents house. Does anyone know what it is? It's a thermostat. Yeah, and you can see it's in the correct units of Celsius I have a simpler photo, which is I got from the internet in some sort of arbitrary like fascist units I'm not sure what they are Doesn't matter the interesting thing is thermostats have an interesting property. What is that property called anyone? Historesis you've seen my talk that's great, or maybe you knew that's okay. Historesis. So what is hysteresis sounds complicated? It's not it's basically sort of what I was telling you before so thermostats They want to respond and heat the room or cool or cool the room by turning themselves off for example or cooling Doesn't matter and by looking at the previous values. They know what to do So for example, if you're heating the room up and you hit 20 Celsius You might want to stop but if you're on the way down you want to stay off until you come back to that value So it just basically gives us some history in the value to make a decision about whether we should go on or off And it's quite useful to stop thermostats from flicking on and off because if the moment you got to 20 Celsius You heat it up a tiny bit it would instantly click off and then click back on and it would just basically break your heater So that's why this is very useful. So I'm going to show you a demo of this oops So my demo is first what I'm going to do is I'm going to run this hysteresis demo so I'm going to run this demo on the left and I'm going to basically run this watch command. It's going to cat the output of this text file and I'm going to list the virtual machines running on this laptop Okay, it's a kind of a crappy laptop, but I'm sure what it's doing and so I ran MGMT and what it did it it started up two VMs one and two and These are just here that were already there and the start of the text file basically shows this threshold and this load average So actually I'm just going to show you the code for this All this code by the way, it's all in git in this project. So you can actually just try these examples at home We don't have syntax highlighting. I think if we like I forget how this works like I think it's like you look sort of like I don't remember how this works, but So Here's the text file With just the contents of a bunch of variables We're doing a little simple hysteresis implementation right here And we're basically declaring one VM and a second and the hysteresis variable say if there's a really high load We're going to shut down one of the VMs and maybe move it somewhere else and if the load is less We'll keep it running Okay, so you can imagine the VM is doing a lot of work on your machine You have like a hundred VMs packed in and when the load gets too high overall You might want to move some of them to some other host right make sense Yes All right, don't be shy. So what I'm going to do is so I've set the threshold to 1.5 Load units, so what I'm going to do is I'm actually just going to go over here I'm just going to artificially create some load Just so you can see what happens when we hit 1.5 We're just running some commands when we get to 1.5 MGM T should React and shut down one of those machines okay Hopefully doesn't crash. There's actually a small bug in this but In the Libvert library, but yeah, so we're gonna just create a whole bunch of load. It is going up Come on now even more Once it goes up. Oh My goodness Okay, it's really going up now. So watch what happens when we hit 1.5 Do we get there? So the kernel actually only updates the load. Oh, there we go. So we hit 1.6 Now we're gonna shut everything down. You saw how the VM shut down Right, so shut it down. Now remember we have the hysteresis. I've programmed a 10 second hysteresis So after we go down below 10 1.5 for 10 seconds, it'll start it back up because we don't want to flap So it just went down. So there we go going down. It's about five seconds right now four three two one and boom 10 seconds later. It started back up. You like that You can clap if you want So so that's the idea, right? We don't want like 10 seconds of silly We don't want the VMs flapping like crazy, but for demo. I just made something simple So the whole point is intelligently in a very small safety SL Describing what we want to happen at a data center scale or whatever scale you want And when you build in that logic, you don't have to respond to monitors and words and pages and things like that You build in the logic of what should happen in real time and at every second of the day the system if you program it We'll know what to do and hopefully do it for you. Is that a good idea? It's the future future Okay, I'm gonna shut this down. Does anyone have any really really quick one second questions? That's a good question. We can't really talk about that right now, but I can tell you how it works after if you want That's a really good question. I don't even so embarrassed that I actually know what that means You want to see we have five minutes left. I'm gonna show you you want to see another demo or This is kind of cool. So I wanted to show a distributed scheduling demo So I'm gonna run this one. So for this one So I'm basically gonna run a whole bunch of MGMT's I think this is the one that I wanted to show you So I'm just gonna run a whole bunch of MG MGMT's on the left and I have to do this quite quickly How do I do that they're creating files here? Okay I'm just gonna show you the output Cat So Each MGMT agent will cluster itself together and just to make this easier I'm just gonna run them all on the same machine with a different fake host name And what each one is going to do in the language is actually going to describe. Hey Hi, I'm here. I'm gonna generate some random value or Anything it wants in this case. There's actually a raft based scheduler. So this cool distributed thing And what actually will happen is will actually it will ask the scheduler to pick some number of hosts out of the pool available hosts So is that five and then I have five minutes for questions. So that's ten. All right, cool Gentleman here in the front was scaring me like what it's not time. So I Started up the first house. You can see it's thinks that each one each two should be scheduled. Let's start up a third one Let's see what happens So I've asked it to pick two hosts out of the available pool and you can see they've all been told in a distributed way I'm gonna pick h1 and h2 but watch what happens if I kill h2 You're gonna say oh h2 is dying. So that's old data h1 and h3 are like, okay. We've got to pick someone else There's only h3 available easy scheduling decision Now you can watch if h2 comes back Okay, it realized it's awake again. It sees that h3 was scheduled it didn't flip to the h2 again Didn't flop back and same thing you can kill h3 for example and It will also come right back and die show that so this is actually you can actually express this in basically a few lines Of code looks like this you run the scheduling function And you'll get a stream of who is scheduled so you can make decisions on let's put some containers over here Let's run some VMs and just to show you it's actually kind of fun If I start h3 again, and then I just forcefully kill h2 it just died because I unplugged it it there's actually a time out and Once the time out to 10 seconds I believe it should flip over to h3 when it realizes that it's permanently dead. So I'll just flip Yeah, boom Kind of subtle it's a bit of a demo that I had to do kind of quickly I'd like to spend more time on it But all these scheduling things all these distributed things you can all be done with this language You can express all sorts of fancy stuff So if you're Google you could spend like years working on this fancy like Kubernetes schedule or monolith or you could build a nice FRP express all the logic and give everyone the pieces so they can build things how they want that makes sense We'll just kill this really fast I Have a few more slides that I want to show you some quick interesting properties for the people that are more on the Hardcore side so the engine in the language are actually two separate pieces. They're on the same binary in the same code base There's a bit of a separation so technically if we had a compile time if we had a runtime error in the language Which we actually aim to eliminate entirely Because it's kind of an FRP then technically it shouldn't leave the engine part alone. It shouldn't cause a big problem That's not perfect, but it's it actually works a fun thing about the language is the language itself is actually graph So in some of my early examples, I wrote code out of order now You should not do this that's insane if you do but if you did do it It's actually legal code because the streams of values kind of like an expel spreadsheet doesn't matter which order they're in It just flows through and the compiler will figure that out Variables are immutable. So if you did something like x equals five and then x equals six This is a compile time error. So we stop all sorts of classes of bugs in the compiler before we even run code to hopefully make things safer Historicis I talked to you about there's different kinds of hysteresis and you can model these in the language because we have history about old values the Really cool thing about all these reactive variables is we can model local reactive variables But we can also because mgmt is built on this distributed system using this raft protocol Can actually look at other variables on other machines and even have like distributed state machines and machines Coordinating to make decisions so you can get really fancy and this is really just the beginning In like ten years like everyone's gonna be doing this. We got to have to model things Across things so I didn't talk about the import and the modules, but that's a dag and that's some fun stuff I don't have another time for more demos. So you'll have to wait For another day some future work. There's still lots of stuff to do in the project I think it's just on the borderline of being usable for like small production uses A lot of things need to be improved new functions in the standard library need to be implemented new resources Especially like cloud type things because those are kind of popular You could imagine like having cost of VMs per minute sort of in as data sources and dynamically moving your VMs around different parts of the world depending on the cost In real time right so if the prices go up or down or if the latency is bad You can think about all these things and building them a bunch of other stuff There's a few bugs and there's kind of some legacy code that was kind of crappy that I wrote that I need to rewrite So that's that's bad, but this is about you. How can you help? You can use this You can use this test this patch it share it document it start on github if you're into that Blog it tweet it if you have Twitter discuss it hack on it with your friends. Yeah, you like free software I'm trying really hard. I left my job at this like somewhat cool tech company to work on this stuff And we need funding it's really kind of unfortunate I'm just living off my savings and I want to do a good thing and not have a proprietary like open core model So that's my goal, but we need funding or patches or both So if you want to help out, I have a patreon. It's like I don't know just an idea If finding a hacker, it's very sexy. So if you want to feel sexy do do the good thing. Let's just recap This is Arthur Benderman putting the cap back on his pen. It's a recapping joke. It's not very good If you're on IRC everyone here is on IRC, right? Yes, we have a IRC channel or a whole bunch of people just hanging out We'll have a Twitter account. There's a mailing list that red hat posts for me Oh, my goodness. Is it time to wake up? She's so loud rooster if you cannot hear If you want to learn more so there's the technical blog of James you all know about it by now purple idea comm very cool There's the github project. There's some old videos online as well as on the github page You can find old recordings of different talks a whole bunch of articles. I've written about MGMT are there I am purple ID on IRC and Twitter and at Gmail and other stuff like that later today I Submitted a bunch of talks to everywhere. I thought it's something interesting to share and some crazy people have fostered them like accepted them all So I got a whole bunch of talks Yes Yeah, they once So I'm giving a whole bunch of talks today and tomorrow some of them will I'll share some of the material I'll definitely reuse all of my jokes, but there'll be different resources and different demos and stuff So if you want to come check them out look on the schedule You'll find them also on the fourth in Ghent. There's config management camp So I give some like way harder talks be giving two talks there and on the sixth There's a hackathons completely free. You can just come we actually get hands-on with code if you want to play with this And you want some friendly pushes? Don't be shy. Check it out. If you like this talk make sure you go up to the Faustum organizers They've rejected my main track talks every year for a few years now and say hey This James guy like he was really dope should have him for a main track talk So find them and if you can go to the schedule page where you're on the Faustum website There's actually the secret button submit feedback like under the schedule click on it and say like awesome because that would really help I have free stickers you promise to use the manual laptops I'll give you a sticker come up at the end and happy to give you one. This is just some dumb jokes. Thank you very much So I've got about four minutes for questions And or stickers, so if you have a question just raise your hand and I'll You know unplug this Anybody have a question don't be shy Gentleman over here first. Yeah Go ahead Louder We get one Yeah Yeah Okay, so let me answer your first question. So can we use reisting code can we you reuse the existing code? We actually not me but this gentleman Felix who also be presenting at config management camp You can actually We wrote a compiler that or partially we're using some puppet code that takes existing puppet code and runs it on our engine And he does some really fancy stuff with this personally I think ultimately you got to use new code There's only so much you'll want to reuse but for migration and for a lot of use cases This actually works surprisingly well Your second question about like at the board or how can you guarantee stuff? I think that sounds like a longer conversation, but come up and ask me after I'll be in the hall for a bit gentlemen over here Yeah, so the way you interact with the hosts Question was just about how you actually interact with the host is with the resource API and the resources that we implement are many different things There are files. There are services like a system D service. You can start or stop We can create and start and stop VMs as you saw And spawn containers. We can even ask an AWS server to start up in a container And anything else you can imagine Well, we have a whole bunch of core resources and you can add more very easily So if you think of anything you wanted to manage anything you want to do or poke at declaratively the resource API is really easy to to write and Any other questions got time for I think one more question One minute. Yeah, quickly Yes, we have all sorts of data structures They're all implemented in Golang and all the code is 100% of the source So I have to go I'll be in the hall if you have any more questions and you want a sticker If not, just find me during the conference. Thank you very much