Have you heard about the It Works on My Machine certification program?
This is a really awesome certification for developers.
It was created by Joseph Cooney.
Here's how it works.
Step one, compile your application code.
Getting the latest version of any recent code changes from other developers
is purely optional and not a requirement for certification.
Step two, launch the application or website that's just been compiled.
Step three, cause one code path in the code you're checking in to be executed.
Now, the preferred way to do this is with ad hoc manual testing
of the simplest possible case for the feature in question.
And you may omit this step if the code change was less than five lines
or if in the developer's professional opinion,
the code change could not possibly result in an error.
Now, check in your changes to version control.
Congratulations, you're certified.
On this episode of Talk Python to Me, you'll meet Florian Motlik from CodeChip.
He's here to tell us all about continuous integration and continuous delivery.
Maybe you can help keep you and your team from getting certified as well.
This is episode number 38, recorded December 10th, 2015.
Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem,
and the personalities.
This is your host, Michael Kennedy.
Follow me on Twitter where I'm @mkennedy.
Keep up with the show and listen to past episodes at talkpython.fm and follow the show on Twitter via at Talk Python.
This episode is brought to you by Hired and DigitalOcean.
Thank them for supporting the show via Twitter where they're at Hired underscore HQ and at DigitalOcean.
Hey, everyone.
Thanks again for listening today.
I have a few prize winners to announce before we get to the show.
Two weeks ago, JetBrains and I gave away three PyCharm professional licenses.
The lucky winners were Drew Kerr, Ben Kelly, and Seref Alvinides.
And in episode 37 on computer security, Justin Seitz gave away a copy of Black Hat Python.
The lucky winner there was Arek Fyla Kowalski.
Congratulations to everyone.
And if you want to be able to win these giveaways, all you have to do is be a friend of the show.
Just visit talkpython.fm, click Friends of the Show in the navbar, and sign up.
Now, let me introduce Flo.
Florian Motlik is the co-founder and CTO of CodeShip, a continuous delivery service.
While studying and working in the Technical University in Vienna, he stumbled into running test infrastructure for other teams and hasn't stopped since.
He sometimes blogs on the CodeShip blog at blog.codeship.com or on his personal blog, flomotlik.me.
You can also find him on Twitter, where he's at Flo Mollik.
Flo, welcome to the show.
Thanks. Thanks for having me.
Yeah, I'm really excited to talk about building software, testing software, and automating the whole thing with you.
So it'll be fun.
Yeah, totally.
For sure.
So we're going to talk about continuous integration, continuous delivery, maybe throw in a little Docker, infrastructure, all those kinds of things.
But before we get into those topics, maybe give me your story.
How do you get into software and programming and this whole thing?
Sure.
So I mean, as most people at some point, I started playing games on my dad's old computer.
And so that got me into a little bit of scripting and stuff like that and trying to look a little bit under the hood at like 10, 11 or something.
And then when I was 15.
So the school that I did had a computer science branch, basically, that I went to.
And so there I really started to get into programming and what it actually means to develop software.
So that was in school from like 15 on.
So I'm originally from Vienna and then started software engineering.
then, basically, and then basically, and at some level, really, the whole web development side of things really captured my interest.
And so that's web development and infrastructure is what I've done since, basically.
Oftentimes, I ask people how they got into Python because, you know, a lot of my guests are explicitly doing Python.
But you guys are doing all sorts of languages.
Can you maybe just tell me what areas you work in, what technologies?
Sure.
So in the past, basically, like I started with the typical Java, like school and university stack.
So been doing Java for a long time.
At some point, we switched.
So when we started CodeShip, I looked at various technologies out there.
And since it was a small startup and I was the only developer, like I looked into Ruby and Rails for getting stuff up and running quickly.
So most of our stack, including our back end and like the build infrastructure that we're running for customers, was written in Ruby.
And then in terms of production systems, like we've started moving more and more stuff to Go.
So we've re-implemented a lot of the back end systems.
A lot of that stuff is now in Go.
So that's on the part of like developing our own systems.
But then since we basically rerun software and we run the tests for many, many other people and support a lot of different technologies.
I've dabbled in Python, in Java, of course, a lot of it, in Ruby, in many other languages that we support in our stack.
So been playing with and enjoying the ecosystem of many different languages, but mostly programming in either Ruby, Java in the past or a little bit of Go now.
Although I don't get to code a lot anymore, sadly.
That is unfortunate.
So I've worked for very large companies and very small companies.
And I've been in a situation, like you just described, where I'm the only developer.
And I have to say, it's pretty cool to start something new where you're the only developer.
And you kind of get to look across the entire tech landscape and say, I can pick anything.
Where do we start?
You know, that's a really fun place to be.
You work for CodeShip, obviously, and you guys have been a sponsor of the show for a long time.
So thank you for that.
Why don't you tell everyone what you guys do at CodeShip?
Sure.
So the main idea, I mean, just in terms of the messages, CodeShip is a continuous integration, hosted continuous integration and continuous delivery service.
The main point there is that basically when you build software, you want to test it as fast and as often as possible to really know when something breaks.
Like you want to do tests.
You want to do test-driven development or write tests constantly.
And then you need a separate system that whenever you change any of your code, push anything into the repo, that it runs all of your tests, all of your builds, basically.
And doing that on your own local development machine is kind of a hassle.
And oftentimes it's not done.
Like we're all humans.
Like we only think this small change will not break my whole application.
And then it does.
Yeah.
Of course it does.
And, you know, maybe it doesn't break on your machine.
It breaks on someone else's machine.
Exactly.
Have you seen the It Works on My Machine certification program?
No, I haven't actually.
So everyone out there listening, you should search Google for Works on My Machine certification.
It's a really great certification program that basically marks you as a bad developer.
Nice.
I have to look at that.
No, I haven't heard of that one before.
Yeah.
It's really like that whole thing is a huge problem.
And so people really like the...
And that's where the idea came from.
Like we ran or I ran like CI for a lot of companies or like at university before.
And it's just such a hassle.
It's just so painful to run it yourself and maintain that stuff when you actually want to do...
Like you actually want to get productive stuff done and like work on your customers' projects or like your own product.
And yeah.
So that's where it came from.
Instead of having everybody else like do the boring task of maintaining the test infrastructure,
we take that for them and then do it much better for everybody basically.
Yeah.
That's fantastic.
When did you guys get started?
We started in 2010.
We talked a little bit about continuous integration.
Maybe we could dig into that a little bit more.
Like what is continuous integration?
What are the steps?
And like what's involved in that?
Continuous integration as a term is heavily overloaded.
I think at this point, a lot of people when they talk about continuous integration,
especially in like small to medium sized teams, are talking about automated testing and running your automated tests on a separate system.
So I think that's really the main goal of making sure that whenever anything changes on your code base, whenever you push anything anywhere,
that it's run by a separate system, a separate system that makes sure that everything works and notifies you that the whole build has been working fine and everything has been working correctly.
That's the main goal of the CI system.
Right.
I think a lot of people initially, you know, back when you guys started around 2010, saw that almost as a, here's an automated compile step.
Maybe we'll run a couple of tests, you know, depending on whether you're working for with a group that's actually written the test.
Right.
And people have been adding more and more to it over time.
Right.
Yes, absolutely.
So I think that's, that's something where like, I think continuous integration can be seen as more than just running your unit tests.
I think that's something where in the end, like the way I would define is the important part is that at every point,
the team should know that your application works as expected for your customers.
I think that's the whole goal.
Like, and that can be unit tests.
That can be like functional level tests that can be deploying into a staging environment and like testing against that staging environment just to make sure it works there.
I think it's the, the, the end goal.
I think it's the definition that we really like is less about like the technical aspect of continuous integration.
And I don't really like defining the continuous integration as like a technical process.
It's more of like this thing needs to make sure that whenever I run something, that I never want to change something in my, my system.
I can actually do that and not break anything for my customers.
It should be very customer or like user driven.
Like we want to make sure that we don't break anything because that's, that's actually like, that's why we, we build software.
Like we want users to use the things that we've built.
We don't want to break things for them constantly.
And we want to move fast, like move fast and break things.
But even better if you just move fast and don't break things.
Right.
Maybe you break them, but maybe you don't send the broken pieces to your customers.
Yes, exactly.
Exactly.
Get, get that information very quickly.
And I think especially like break things maybe in terms of like features that you remove or when you want to change your product, but not really like break things as in show a 500 error page.
Like that just shouldn't be something that, that actually should be happening.
And I think it's, I mean, all of us have like experienced that all, all the time.
Like things when, when features break, when things don't work as expected anymore, when like there's a downtime, just a drain on like the product.
You don't like the product as much anymore.
And it just doesn't feel good at that point.
And I think continuous integration and the process of really making sure from a customer's perspective that your application works is usually important and can really put a lot of, a lot of stop basically to unnecessary work that your team does.
And has to do that.
I mean, we've all been in those situations where we broke something.
And so now the whole team has to jump onto fixing that thing.
And like, it takes so much resources from the rest of the team.
If you can capture that early and make sure that it actually works and it, and there's no issue.
It just, it puts a lot less stress on the team.
There's a lot less overwork that we need to do.
So that's, I think the, the really important part of automating all of this and just making sure it works.
It basically lets you focus on the fun part of software development.
Writing cool new stuff.
Yes.
Not fixing things that were not broken previously.
Absolutely.
There's no worse thing than regressions that come in where things that are working or have been working are now broken for no particular reason, just because there wasn't anything in place to catch that.
And so that's, that's, it's really important to make sure that that doesn't happen.
Yeah.
I've noticed a lot of really interesting cultural behavioral shifts that seem to be out of proportion with the effort of setting up continuous integration.
So for example, I've seen teams that they release every three months or every six months, you know, to me, that sounds insane, but that's how they were working.
Right.
Because they wanted to test it.
They wanted to make sure they wanted to sort of put it in a box and say, okay, now we're ready to send out this next thing.
And, you know, maybe the next week somebody created some great feature, but well, that's going to come out in three months because it's just too much effort to go through the release test deploy cycle.
Yes.
To justify going through that just to get this one feature out.
But if, if all of that becomes push a button or push to a branch and it just happens, well, maybe all of a sudden when that feature is tested, it's ready to roll and you just push it out.
Yep.
And so I've, yeah, I've seen teams that have sort of gone from releasing these big, painful, slow things like, hey, we're all going to come in Sunday night when no customers are there, shut everything down, make sure the integration stuff works.
It's to just much more fluid work.
And I think that's great for the software.
It's also great for the people that have to do it.
It's way more fun to see your work that you do come right out.
Yeah.
Absolutely.
I think that the whole team productivity and team happiness is a huge part of like automating your, your whole workflows and everything around it.
Because I mean, in the end, the best people that we have in our team, and if you want to build like a high class engineering team, they don't want to fix broken things.
They want to build interesting, new and cool stuff.
So if you have a process that is continuously like bringing down the happiness in the team and continuously having the team have to shift resources between like building new stuff, but then fixing old stuff, building new stuff, fixing old stuff.
That's just going to drive the best people in your team away.
And I think that's a really good way to drive the whole engineering team into the ground.
So I think making sure that automation and how we release processes all really help to strengthen team happiness and putting those into like the perspective of team happiness is, is really crucial because I mean, and also that that's something that we've seen that we've seen with customers that we've seen in our own team.
Like when the build, like when the tests get unstable or something like that, that's a huge drain on like team productivity, team happiness.
And just, it takes so much mental energy from the team and it just, it just puts people in a bad position.
And I think that it really, like, it's not just about the technology.
It's not just about the customers.
It's a big part of that is that, but it's also about putting it into perspective of how can I make my team happy by not having them to do any like menial, boring tasks that I really don't want them to do on a daily basis.
So that's some of the things that I think are really important when setting up all that automation.
And, and we've seen that ourselves where we have teams basically like their release, even small teams, like their release process was like a week of like going through Excel, like having Excel sheets that had manual test cases in there.
And like that took a whole week, like that, that took, like they took their backend, like backend, main backend engineers and just had them run through that because they didn't have any more people.
Like their way of parallelizing all of that was basically getting more people, more engineering people in and like clicking through the application.
And I mean, that obviously doesn't scale and like, and they've, but, but I think it's, it's so often like that path is just so set in stone for some teams that, that it really has to like, they really have to get the help to like be taken out of it and like see a different path, how it can automate this.
And I'm sure like the developers were aware of how this could be done differently.
But I think if you don't put it in terms of like making the team actually happy and just see it as a, that's just more time spent by the team and like not see it as, Hey, if we do this like two more times, like these three people will just leave.
They just, they just won't keep up with this anymore.
I think it's a much easier sell to actually do this.
Yeah.
That's a really interesting point.
It seems crazy.
Like as soon as you said Excel, like I started to get a little bit of a headache and, you know, it was just like, you don't want to do that.
Right.
Like that is, that is not what people signed on for, but you know, some places they seem to develop this culture where that's how software is built.
And, you know, it comes probably from a good place.
Like we can't break things.
You know, maybe you're a bank or something and, and if you're down, it's, you lose a hundred thousand dollars an hour.
Like you obviously want to avoid that.
But you know, things like continuous integration and continuous delivery and all that sort of stuff can really help there.
Yeah, totally.
And I think it's also like, it doesn't necessarily, as you mentioned, we actually like there's like we, we, we worked with teams where they had exactly that, that problem that they were contractually obliged to not release.
Like at a specific point in day, like they, they cannot release from, I think it was like 10 in the morning to like 6 PM or something like that.
There is just like in the contract, you cannot release at that time.
Just, you're not allowed to.
So there is no continuous delivery for them.
Like that's just not, or at least not directly to production because that's, that's not what their business is doing.
But what they, they've done is just simply released to a staging environment, like continuously have something that is pretty much exactly what is, what production is released there on a continuous basis.
And then run like tests against that staging environment to make sure it actually works then so that they can release like during the night or in the very early morning hours.
And actually know that, that this works and then they're fine with that.
So I think there's different ways how to set that up, how to make that work, that, that teams can do and that the teams can use.
Um, but it's really about like, how can I make my customers happy?
How can I make my team happy?
And how can I get the most like productivity and focus out of my team?
Because I mean, in the end that's, we're in a, we're now in a world with software where like everything is basically software.
Like every company, like an Uber is taking over the tax industry.
Netflix and Amazon are taking over like basically everything or like the TV industry.
So like a lot of these industries were in the past, they had a much stronger, part in like the real world, to call it the real world, are not taking over by companies that are software companies that are just intermediaries between like different people selling stuff.
And so everything is software competition moves a lot faster in all of those fields because it's just so much easier and cheaper like AWS and all those other cloud services make it so much cheaper to get started with things.
And then we have so little talent.
Like there's so few engineers generally out there.
Like everybody's constantly hiring.
Everybody's constantly trying to find their people that it's just crazy to spend time of your engineers on doing something that some workflow or automated system could, could do for you.
Because it's like, you need to get faster.
Like you cannot slow down.
Like you're just not allowed to slow down if you're in the software world anymore.
It's just not, it's just over.
Somebody else will come in and just eat your lunch.
This episode is brought to you by Hired.
Hired is a two-sided curated marketplace that connects the world's knowledge workers to the best opportunities.
Each offer you receive has salary and equity presented right up front and you can view the offers to accept or reject them before you even talk to the company.
Typically, candidates receive five or more offers in just the first week and there are no obligations ever.
Sounds pretty awesome, doesn't it?
Well, did I mention there's a signing bonus?
Everyone who accepts a job from Hired gets a $2,000 signing bonus.
And as Talk Python listeners, it gets way sweeter.
Use the link Hired.com slash Talk Python to me and Hired will double the signing bonus to $4,000.
Opportunity's knocking.
Visit Hired.com slash Talk Python to me and answer the call.
Yeah, that's for sure.
Speed is definitely a foundation of your business itself, right?
You mentioned Netflix.
Those guys have tremendous amounts of software driving and cloud deployments and whatnot driving their whole business.
And they have the policy that as an engineer, you can release whenever you want.
Yep.
You decide, yes, it's done.
Out it goes.
And they have all the processes in place.
So it's that kind of stuff you can sort of make much more doable with continuous integration and delivery, right?
Totally agree.
Yeah, I think having those processes in place where I think for once putting a trust in the engineers,
but also having things in place where maybe you just want to release this to like 1% of your customer base and just to try it.
And like give those tools to your engineers.
And it's obviously like at Netflix scale, that's a lot more doable than it is on like other people's scale,
where like you can divert like 1% of your customer, like your requests to that specific new release.
But I think in general, like I think teams should really think through like how can we support our team in like testing new things,
in experimenting with new things, with moving faster.
And yeah, continuous integration and continuous delivery are definitely an important part there to make sure that you can actually release there.
And on the other hand, that you don't actually break stuff for your customers and you just don't break that buy button.
So customers can actually give you money still.
That's right.
I think the other thing that would really helps people have confidence moving faster and just going with it is the ability to undo something, right?
If the ability to say, oh, that's a bad, something broke, right?
We thought we had the system in place.
Turns out not quite everything was caught.
And just push a button and roll it back as well, rather than, oh, we're going to be down for a day if we break this thing.
Yep, absolutely.
You need to have a way to either.
So what we've seen often with continuous delivery, once people move to a point where like you can release so quickly, is that when you release like small batches at a time, then oftentimes people just don't.
They don't really roll back.
But oftentimes they just push forward with like, because you just released something that is incredibly small.
So if there's a bug out there, you find it immediately.
It's typically pretty quick to fix it.
You fix it and push that new fix out there.
So that's something that we've seen a lot of teams go to in terms of the process where you definitely need a way to roll back.
Like that definitely needs to be in place.
But we've seen a lot of teams that then just push forward and like just deploy a new version very quickly.
Because you only deploy so small things that it's really easy to find like what the actual problem is.
You don't deploy like work of like three weeks where like you have no idea, like something breaks and you have just no idea where it happens.
It's just a combination of like five different things coming together and then breaking your application.
But it's just actually a small thing.
So because you're pushing so often and so fast, you can actually push more often and faster because you can find stuff so quickly and so easily.
Yeah, I think that's a really good point.
You talked about releasing on shorter cycles and sort of catching bugs early.
I think, you know, the way that people run into trouble and the way that deployments become not fun at all is you save all of your work for three months and then you put it out on the real system.
And then you figure out what works and what doesn't.
And you find these problems.
You have to go back and like completely analyze the whole system.
Right.
You know, what did you do the last three months?
Well, let's start here.
And the opposite of if I've been working for an hour, I put something out right then.
Well, you probably know exactly what it is.
Just like you said, it's super easy to fix, right?
Yep.
Yep, totally.
And I think that's even something even for teams that have those three month release cycles, like where like maybe the business for some reason can only ship every three months.
But then you need to find a way where push it to a staging environment, push it to like a QA environment, like push continuously somewhere.
And make sure that that somewhere runs correctly and have some like sanity checks, like write a few test cases that just go through the happy paths and like one sad path of that application.
And yeah, so happy path and sad path is basically like a test that should work and a test that shouldn't work as expected and walking through the application.
And if you just, even though, you know, you're just releasing this in three months, but you know, today, like all the changes that have been happening over the three months have been pushed somewhere.
They've been tested somewhere.
Somebody looked at those somewhere.
On a continuous basis.
So once the release comes, there is no surprise anymore.
There is no, no, nothing new that's coming in.
It just, it's all been running somewhere.
And, and I think that's something that every team can do.
I think that's, that's, that there might be like, maybe somebody has some exotic example where this is absolutely not possible for some reason.
But I think for the vast majority of teams, that's something that should not be too hard to do.
And I think most people should be able to do that in some way or another, just to get that feedback early as possible to like make that feedback loop as small as possible and, and, and get going there.
I find usually when people say that it's not possible, that usually is like some kind of sign that something's not quite put together right in the app.
Right.
So there's no way to test this part because it calls into this thing, which goes into this whole infrastructure, which does that other, you know, maybe, you know, you need some, some way to break your app up.
Some design patterns, dependency injection, things like this, that will actually allow you to break your app into the small pieces that you can test and should be testing.
Agreed.
If it's too complex to test it, then it's probably just too complex for anything.
Yeah, that's, that's a great, great way to put it.
I have my own opinions on this, but I'll ask, I'll get yours.
Is there like a size of a team where you should start doing continuous integration?
Like if there's only two of us, should we do this?
Is it worth it?
And is there an upper bound?
Like, you know, if you have 200 people, it's like just too, too crazy, too complicated.
Yeah, I think I'm, I'm obviously like totally biased in that regard.
But I think, yeah, there is definitely, I think you should do CI on, on every level of, on every team size.
I think it just, the approach to CI becomes different on, on different team sizes.
I think that especially like if you're one or two people, like early product, just a proof of concept or something,
you might just want to do something where you write like a few tests and then it depends on like, do you have customers or not?
But in the end, like you, you don't want to break stuff for your customers, especially not your early customers, because they're the ones, even though they expect it to break.
They're the ones that can be the most committed evangelist for your product.
So if you break it for them, then you just lose basically your whole marketing team in the early days.
Like the evangelist, the people that you, the outside people, the outside users and customers, your early users are your marketing team.
They are the ones who are going to talk to everybody else about your product.
So you don't want to break it for them constantly.
So what you can do there, instead of writing like a million small unit tests, you just make sure that you have like 10, 15, 20, very high level tests that make sure like the most important workflows of your application aren't broken.
Like, so people can sign up, people can like, whatever is the main business function of your product.
People can do that.
Like the main things and, and, and those can be easy to write.
They, they can be on a very high level.
So they don't break constantly, even though you're changing your application and they just make sure that like your customers can do at least the most important stuff on a constant basis or like the, especially early users.
Like if some small feature on the sidelines gets broken at some point, like they'll miss it and they'll tell you, but it's probably not going to break everything.
For them and they're probably not going to like leave the product or like leave the, the, the, like evangelizing for you that quickly.
But you should write something where like at least the most important and main paths of your application are covered so that you can push faster.
I think that's also something like in your early times, like you want to move so fast, like you want to push your product out the door as quickly as possible.
And then again, like if you push something out the door that breaks other features and you don't know it and you like, you only know, like after a couple of days that it happened,
and you don't know exactly what broke, like it takes so much time away from, from actually doing something productive that spending a little time on like writing good tests and writing tests from the right perspective of the user on a very high level actually makes a lot more sense.
So I think the, the larger the team gets, the larger the code base gets, you want to like go lower in, in that stack in terms of like high level tests.
So you go away from like, maybe in the beginning, you just write tests like with Selenium or something where you actually like, you just point a browser at your application and just click through your application automatically.
So you actually know that like these things work on a relatively low level as well and not just on the higher level, but you still want to keep that higher level tested very well.
So you know, because in the end, like that's what customers care about.
Like a customer doesn't care if the unit test for a validation on a model works or doesn't like, that's not important to them.
The important part is, does the workflow work?
Does the product work?
Does the feature work?
So that needs to be tested in my opinion at first.
And once you've tested like those few happy and sad paths on the upper level, then you can go like, okay, I've tested like that a validation in generally fires and, and, and error message gets shown on the web UI.
So now let's, let me write like 10 more tests about like all these different validations that we run on the model before we save it.
Um, and, and before that works, because I don't want to test all of them on a very high level because that would be really slow.
So you want to have that mix of like slow, very high level tests to make sure that from a customer's perspective, it works.
And then lots and lots of like smaller level tests that verify specific things that you, you wouldn't want to verify on the higher level because it would just take too long.
So that's at least the mix that I, that I found and that we found works pretty well.
And that really captures and catches a lot of problems early on that, that might impact your, your customers.
That's a really pragmatic and powerful way to look at things.
I guess the way I would kind of summarize that is don't let the perfect be the enemy of the good.
You know, don't let, don't let the goal for saying we must have a hundred percent test driven development.
We must have 95% code coverage push you into a point where you say, well, but we have to go faster.
We're just going to do zero.
Yeah, no, totally.
I agree.
And I think that's, it's, it's a misconception, misconception that that makes you faster, that not writing test makes you faster.
It just makes you, it only makes you faster.
If you don't count the times where you have to actually fix things.
Like if you do that, then it's just not going to make you any faster.
It's just going to make you slower in, in my opinion or, and in my experience, like that's what we, the experience that we've had from, from the teams that I've worked in and from many, many, many different customers that I've talked to.
And I've worked with that writing, you have to do it the right way.
Like, and I've seen teams that have gone up from like early teams that have written thousands and thousands of low level unit tests, but their application still broke constantly.
Like that's not really the right way to go.
Like the, in my opinion, the right way to go is really see it from a, from a customer perspective and whatever the customer needs to make sure that it validates well and that it works well.
That's what you should focus on.
Yeah, that's a good point.
And my rule of thumb is kind of when I, when I look at the, the part that I'm trying to test or think about whether I should write a test for it, I think is the customer actually paying me for this part of my application?
You know, is, is this my core business?
So like, is this the trading engine?
If I work at like a, a stock based company or is this, you know, the continuous integration execution part, if I work at CodeShip or something like, does the, the, about our team page work or not?
Like, you know, I don't really care and I'm not going to put energy into it, but if people are paying me for that part, right?
My company, then probably that part should have a test.
Yeah, exactly.
And I think it can be simple as like, open up the page and see if it, if the page throws an error, like it doesn't have to be like, that's like for, for a lot of things.
And that's something, for example, like when we deploy something new, like we deploy into a staging environment and just simply open up the application.
And that captured a lot of different problems from, or like not a lot, but like from time to time, it captures something where maybe we've done something wrong in the configuration of the page and just the whole web app doesn't load.
And it really pays off to just load one single website or like one single page of the application just to make sure like, does this thing actually boot when we push it somewhere?
And that definitely captured a couple of times where like, we would have pushed something out that, that wouldn't have, that would have gone bad.
And it didn't.
And it was very easy to catch and very easy to deploy a fix for that.
And, and it never saw, saw the light of a customer.
But I think that putting that, that in place.
And I think especially the about page is, I think a good example, because that's something like you wouldn't put a lot of effort into setting up an infrastructure to test your about page.
So that should just something that should be there because you need it for many other things as well, like to, to just make sure that your about page is actually loaded and can actually be shown is something that shouldn't take more than a few seconds basically to implement in, in a test.
But it's really critical because you are, you also don't want to like, you don't want your about page.
Like if somebody looks up your website and the about page breaks, that's kind of like, that's not really a good sign.
Like, especially for a tech product, like I would at least expect the about page to load.
And I think that's some of the things where like, it should be easy.
It should be fast to, to test that.
Then there should be like a lot of different ways how you can do that.
But yeah, your developers shouldn't have to spend a lot of time on, on doing that.
Yeah, I agree.
And like you said, just making requests to the page and seeing if a 200 rather than a 500 comes back actually can do quite a bit.
Yeah, that catches a lot of stuff.
This episode is brought to you by DigitalOcean.
DigitalOcean offers simple cloud infrastructure built for developers.
Over half a million developers deployed to DigitalOcean because it's easy to get started, flexible for scale, and just plain awesome.
In fact, DigitalOcean provides key infrastructure for delivering Talk Python episodes every day.
When you, or your podcast client, download an episode, it comes straight out of a custom Flask app built on DigitalOcean, and it's been bulletproof.
On release days, the measured bandwidth on my single $10 a month server jumps to over 900 megabit per second for sustained periods, and there's no trouble.
That's because they provide great servers on great hardware at a great price.
Head on over to DigitalOcean.com today and use the promo code TALKPYTHON, all caps, no spaces, to get started with a $10 credit.
In the early days, back in 2008, 2009, 2010, it was all about continuous integration and making sure that we could check in our code,
that if we're using a compiled language, it compiles for writing tests, the tests run in an automated sort of way.
But since then, people have been moving on to actually turning this whole system into actually a deployment mechanism, right?
Like I can check in and magically stuff is in production.
And that's called continuous delivery, right?
The main idea with continuous delivery is that you keep your application in a state which either can be or is deployed somewhere constantly.
And I think the important part that can be through CI, that can be by deploying it to a staging environment,
but that can also be by just pushing it out there on a continuous basis.
How would I go about that?
Like I totally know how I check into Git and I set up a continuous integration server to pull that and run my tests.
But how do I get that, say, into my, like if I wanted to do continuous delivery,
how would I actually make changes to my server in AWS, for example, or DigitalOcean, something like that?
So I think the important part there is that to take one quick step back and something that we find really important for continuous delivery in general is how you start triggering those changes.
Basically, I think continuous delivery and the whole deployment part of continuous delivery really needs to be also fully automated and done by like the CI or continuous delivery system for you.
Because in the end, like what you want, even like on a daily basis, like if you deploy all the time, you don't actually want your developers to think about like, okay, now I actually have to deploy this.
Like what you want them to do is here is code and like I'm merging code into master and just do stuff to it.
Like, but, but you want them to like focus on the code all the time, like on a, on a daily basis.
You, you don't want anybody to have to think about like deployment strategy and how, like which script do I run in which way and where do I get which credentials, all that kind of stuff.
So I think the important part and the way we see it is in terms of triggering it is through the repository.
So we think the repository, is a really great way to capture the intent of releasing something.
Like if you merge something from a feature branch into the master branch, like there is some intent to like test it, but also put it somewhere.
So you can use that and just say, basically whenever you're on a specific branch, like run all the test, commands and then also release them to, to production.
But at that point, like the developer can already be working on something completely different.
Um, and, and just is already jumped into the next task and, and works on the next thing, next thing, or, or gets a coffee or has a chat with somebody else on the team, but they don't have to actually think about this.
I think that's, that's a core part of continuous delivery.
Um, because you really only want your developers to focus on code on a daily basis.
That also helps with a couple of other things because it's easy to move between different parts of the infrastructure then because so for example, it doesn't matter.
If you're working on like, if you want to release changes to your DNS system or your main web application.
If all the things you need to do is merge code from a feature branch into the master branch and then it gets released.
Like that's easy to understand.
Um, for anybody and anybody can go into any part of the, the infrastructure application.
And, and actually do it then.
And from then on, it depends, totally depends on like the specific technologies.
If you want to use something like a platform as a service, like a Roku or an AWS elastic beanstalk or have your own servers, different ways, different tools, different abilities.
But I think the important part is really capturing it in an automated fashion, but in a way where like it just happens kind of automatically for, for developers.
Like they know it happens, but they don't have to consciously think about it.
Like at some point, like that merge button on GitHub in a pull request is just like you're merging code and then you're off to the next thing.
And you don't really actually think about the deployment at all at that point anymore.
Yeah.
That's, that's really cool.
Deploying modern software can involve a lot of infrastructure and a lot of pieces, especially if you're doing like microservices, it can involve a whole bunch of them.
Right.
And so if you can automate that, even if it takes you a week to automate that, and normally it would take you a half hour to do a deploy, the speed that you get on the other side of that, the ability to, like you said, push a button, merge to a branch and just magically new software is out.
That's, that's really cool.
Right.
Totally.
I think that's, it's just more of the, I think it's more of that focus and productivity for your engineering team.
Like that's something that is always important.
It's really, really, really important that the engineering team can focus as much as possible on getting new stuff out there and building new features and product for, for customers and anything else that is in the way.
And that is manual testing that is thinking about the release process in terms of like, how do I actually get this out the door?
That's all wasted time.
Like that just shouldn't be.
And it's not just wasted time on like existing engineers who actually know that, but actually when you onboard a new engineer and you have to walk them through like every single way that you deploy all the different systems.
It, that's just a huge time investment that you need to do.
And, and on the other hand, if you just tell them like, yeah, open up a feature branch and like that, then just merge it into the master branch.
And like, this is just a technology, like technologically, you, you know, like it's just a, I don't know, Django or a rails application.
Like, you know how to work with that.
Like our infrastructure might be a little bit different than what you've seen in the past, but you don't really have to worry about that at all.
Like just do your code and like, just merge it in.
And over time you'll learn more about like how actually the whole system works.
And I think it takes away some of that stress of onboarding new people.
And that, like that, that wish that a lot of companies have where like you, you have somebody new and like they should release something on day number one, which I'm not the biggest fan of.
But at least in the first week, I think that it just puts a lot of pressure, unnecessary pressure on everybody to have them release on day number one.
But I think it removes a lot of that, that, that, the pressure, like the problem with like showing somebody how that stuff actually works.
And instead, like you tell them five minutes how the workflow works and then they couldn't do it anywhere from, as I mentioned, the DNS system to like your main application, to your back end application, to whatever.
Yeah, that makes a lot of sense.
You talked about earlier having different levels of tests and running them possibly at different times.
Obviously, you would want to run your tests before you go through and push it through the continuous delivery path.
Do you see people having a different set of tests for like a regular feature branch check-in versus this final step?
Would people write, like run more tests if maybe their tests are slow or something?
Sometimes.
I think that's mostly due to time constraints, though.
I think that's, and I think that's also something like that.
I mean, that's one of the challenges that we try to solve for them.
It's basically giving them a system that makes it so fast that they can run anything in parallel.
But yeah, we definitely see that where people like they have a lot of like they run their maybe unit tests on every feature branch and run like their full on like integration or like functional testing suite only on like the master branch.
This definitely happens.
But yeah, I think so from what I've seen, I haven't seen a team that says I don't want to run it on like all the tests on my branch.
It's more I can't run it there because it's just too slow.
So I think it's a lot of it is just down to like optimizations in the test suite and like making it faster and making it more parallelized, all that kind of stuff.
Yeah.
If it takes two hours to give you feedback, even on your feature branch, it's maybe better to save it for later.
So you know right away whether it's mostly good, right?
Yeah, exactly.
Exactly.
And I think that's so what we've seen.
I think like a team should get their whole build on like a feature branch.
I'm not including deployments on a master, but just like running their tests.
If you can get it down to like two or three minutes, that's below the level of like where people actually have to think about it.
So when I was thinking about it, like as a developer, like I code something locally, I commit something locally, I push it into the repository.
And if I get an answer, if that works or not in like two or three minutes or in less than that, I actually, I don't think about it actually again.
Like I'm still coding on the next thing.
And at some point, like a notification pops up that tells me, hey, everything worked on that thing that you just pushed or a notification pops up.
It didn't work.
And like you have to like fix something that you broke on that feature branch.
But it's not like while I'm still working on the other thing, I'm not thinking like, hey, did this already finish or is this still running?
I think that's like two or three minute like level.
I think anything beyond that.
Then the problem is that you're sitting there, you're coding on your stuff.
You're thinking, hey, wait, did my build already finish?
Let's just look that up.
So you go to a browser, you open up the build, you open up the build page, and you've just lost a little bit of time.
You lost focus from your development effort.
And like over time, like if you have a large team and like a lot of people that have to do this constantly, that just is a lot of focus lost from actually developing.
So I think we like our goal is really to get any team of any size to a point where you can actually run the builds in like this two or three minute time window where you're not actually actively thinking about the results of your build.
And you just basically keep working and you just constantly keep working and you just get notified, hey, this thing worked and now this thing worked and now this thing worked without having to go back.
And I think that's something that in my opinion, people really should strive for.
Again, it's all down to productivity and focus for your engineers.
Anything that takes even slight productivity and focus away from your engineers is something that actually hurts your bottom line.
And so that just you have to get rid of that.
Yeah, there's a lot of talk in programming about flow and focus and getting into the zone.
And these things just can really kill that if you're like half still thinking, well, the thing that I did, is it actually okay?
Or can I go forward assuming it's okay?
Or, you know, do you know because the build finished that you're fine, right?
Exactly, exactly.
And if it just takes 15 minutes, like you're just going to come back, like you're just going to open up the page.
And like then you open the page, you wait for the build to finish, like you open up Reddit or something.
And like it's just like all that kind of stuff is just it's taking away that focus.
And I think it's really important to keep that flow, to keep that focus going.
Sure.
So what's the longest or the craziest build you've seen running?
Definitely people who were like, so where it's been over, like we ran it through the night.
And at some point, like we just we just stopped because it just took too long, basically.
I mean, there's definitely things where like it takes hours and hours.
And I think a lot of it comes down to, especially with the teams that we work with, they're not like huge enterprise, like 48 hours straight, like running through like 100% CPU usage.
It's often just comes down to optimization.
I think oftentimes teams, they build their test suite and it gets progressively slower.
Like no team starts out with like a two minute build.
And then like three weeks later, it's like at an hour.
Like it just happens over a longer time.
Like it's two minutes, then it's three minutes, then it's five minutes, eight minutes, 15 minutes.
And just it gets slower and slower and slower.
And the team never really does the decision to like make this faster and look into it.
So I've certainly seen teams where the tests have been running and they've been running slow, but they've only been running slow because they didn't really look it.
And I mean, that has been the case with us, like a couple of like or a year ago, like one of our engineers joined and he's really strong on like optimizing test suites.
Like that's, that was, he's been doing like for a while and he got our test suite down from 15 minutes to like three or something.
And that's, and we're pretty good with like test suites.
And I think that's something where like he just invested the time.
He had the experience, knowledge about it.
Obviously he then blogged about it on our blog.
So we always try to keep that up.
But that really helps like spending time on actually making your test suite faster and seeing where it's slow and how to make it faster.
And actually like setting an SLA.
Like I think as a team, you should set an SLA on your test suite.
And if it just takes longer than that SLA, you just put resources on it to make it faster.
Because otherwise, if you're just progressively letting it get slower and slower and slower, again, it'll just stop the process.
Like continuous delivery really relies on your test suite being fast.
Because if it's not, then your developers have to constantly wait for the results of what's happening.
And there's nothing worse than having to wait on like the build result getting in before you can open up a pull request.
And like you can ask other people for like feedback or maybe somebody has already looked into it and like given you feedback and done a code review.
But then the build comes back half an hour later and tells you, wait, this actually failed.
Like you have to recode it in some way.
And then they do have to do another, go over it and do a code review.
And like that just takes so much productivity away from you.
Yeah.
And wait again, right?
Wait that 15 minutes again.
Exactly.
So like once you feel like, and I think having a strict rule of like our build should be that fast.
And then dedicating resources to it.
It's so much cheaper than like just waiting, like putting the resources on features and just waiting.
Like it's not going to magically become faster.
And it's just going to block your team like crazy all the time.
And it's just so frustrating if the test suite is slow that you really should dedicate resources to it.
It's just, it's developer productivity.
Developer productivity is really important.
Developers are really expensive and it's really hard to get new ones.
So you really, really should make sure that your team is productive, your team is happy and can actually work on the most important tasks.
And yeah, making your test suites fast is definitely something that pays off very quickly.
Yeah, totally agree.
When you're talking about continuous delivery, the putting the new version of the source code or the compiled bits on the server and making that run, it's pretty straightforward.
But usually it gets really sort of tricky when you're talking about databases.
Yep.
What do you see people doing there?
Putting a lot of it into services.
I think that's something that's a relatively consistent theme that we've seen is like maintaining databases is really, really hard.
I think continuous delivery is definitely something where you can't, whenever you store state, that's really hard to continuously deliver.
And so I think a lot of teams, and that's certainly us as well.
We just put that off to a service and we just let Heroku in our case or Amazon RDS deal with that because they have the infrastructure and the knowledge to actually do that.
If you run your own data system, it's definitely possible to do that with the follower, like do some level of replication and then switching that over.
But it's generally really, really hard.
And the question is, whenever I look at like how often we deploy our web application and how often we would have to upgrade our database, it's not really that big of a deal to deploy.
Like you don't really have to deploy like some infrastructure parts and parts where you store state that often compared to like the things that you that don't store state and that you can actually push constantly.
So I think a lot of teams don't even have to really spend a lot of cycle on like, how do I actually continuously deploy like my database?
Because oftentimes it's just fine enough to do it like on a Sunday morning and like do a one hour window there where you like just do a follower, switch over and then stop out the other one.
So I think that's something where I think it's again, like don't let perfect be the enemy of good.
And I think really focusing the continuous delivery on the parts that you actually can control very easily, mainly being like everything that you don't have stayed in makes sense.
And then I think putting the other systems into like a service, putting it into like a Roku, into an RDS, at least for us, I think that's like, I'm not, I'm not in the business of maintaining databases.
Like that's not my product.
I just need a database.
So if somebody else can provide a really good product around the database, that's totally worth it for me.
And so that I don't have to do that.
And again, put my developers on a much more productive for our customers, much more productive and for our business, much more productive path.
So I think that's how we typically try to deal with it.
But I think, yeah, for most companies, if you really, really have to do like zero downtime database updates, then you're, you're probably in a position where like you have enough resources to do that.
Because if you, if you're really small, but you have to do like zero downtime database deployments, you're something on the business sounds a little bit off because that sounds really hard to do.
Like if you have little customers and you're a small team, but the customers don't pay you a lot.
But on the other hand, they, they still can require like really hard technical things like continuously updating or like zero downtime deploying new databases.
Like that's not easy.
Like then there's probably, you're not making, like you should, you should totally get more money from them.
But on the other hand, I think that's, yeah, just don't worry too much about it.
If you can just get away with a like Sunday early morning update.
I think it's just, it's just really hard for small teams to do that.
Yeah, it definitely is.
So one of the things I saw you guys talking about is Docker.
And I think Docker is going to become increasingly important in the whole way that we host and maintain and evolve our applications.
What's the story of Docker?
So generally I fully agree.
I think it's, it's definitely a very important part of how we will build Docker and like containers and generally like very low level and easy to do virtualization is a big part of how we're going to build infrastructure in the future.
So for me, a lot of the things that are important there are that when the system can maintain itself, it just, you, you easily push a container out that has everything in there that to actually run your application, which also makes that separation between developers and operations much easier because the developers can actually fully control what's actually running as part of their, their application.
But it's still fast.
So that's really important.
And on the test and continuous integration side, obviously, it's really key for us in the future.
So we've just rebuilt our whole system basically to run on top of Docker.
And, and, and the main idea there is that developers should be able to control their build environment fully.
And each repository is different.
Each repository and each application needs a different setup.
And, and Docker can definitely provide that.
And that's just not limited to like code chip.
I think that's, many people are using it for many different ways in their, their test and, and, and CI setup, but it's really about giving the development team a lot more power about the infrastructure that the code is running in.
Um, and so that the operations team, like there's a clear separation between like how to run the whole container.
Like that's just a clear interface.
And then whatever's inside of it, the development team has full control over that.
And I think that's like that separation of concern that you don't just throw code over the wall basically, and just let the operations team or somebody else deal with it, is really key.
And then you can do a lot of, a lot more automation around it, like a lot more health checks, a lot easier way to like, run several instances of that, get it up and running again.
When something goes down, really use the most of your resources, in your machines.
So I think Docker and, and the way I think it's less about just the technology of Docker and like Docker as a company, although I think they're doing great and, and they're providing great, a great product.
I think the more important part there is that it really enables, developers and the whole team to take full control over their environment and work in a different way where it's not just about like, let's update those three servers that we're running, but just.
Let's push this artifact into like our environment.
And then our environment decides where, when, and in how many items this artifact is running.
So I think that's something that is, is really critical where you have a lot of more separation of concerns there where you don't have to think about everything all the time.
And there's just a system taking care of, of a lot of this, and nice abstractions in place, to make this, this run and work.
Yeah, that's cool.
It seems like Docker and continuous delivery go well together because now you're almost able to deliver the infrastructure.
As part of this, right?
Here's the Docker container for this version plus my code, right?
Yeah, absolutely.
You just have a bunch of servers running and that can be in a cloud that can be as a cloud service that can be on your own infrastructure.
And all that thing provides is just a way to run arbitrary Docker containers.
And I think that's really powerful because again, like the development team can take full charge.
Like no, no operations person has to know which version of Java runs in there and they don't have to be involved in our Python or Ruby or whatever.
They don't have to be involved in like updating that or making sure that like all the different projects that are running as part of the company all need to use the same Java version because otherwise like stuff will break all the time.
Like it totally frees every team, every repository, every developer basically to use whatever is best for that specific problem and not have to deal with like all different complexities of running application, like many different applications on the same kind of infrastructure.
And virtualization in the past has definitely gone a long way there.
But then it's just like, it takes a lot more resources to do that.
And with Docker and containers, it just takes a lot less resources that the underlying technology has been, is proven.
Like Google runs their operating system on it.
Facebook runs, runs their operating, like their data centers on it.
So I think we can say that this actually scales to whatever.
I think we just need the tools to make it scaled down.
Like we just need the tools to make it scaled down to like small teams.
And I think that's what really Docker is providing a great tooling for that we can use containers for like a lot of different stuff, a lot of different workflows, a lot of different processes in our either production systems, but also in, in our whole build environment, in our whole build system.
So I think that's where it's, it's really about control and giving the developers the utmost level of control about everything they're running as part of their application and not have other people either take away control or have to worry about that control at all.
So I think you're absolutely right.
I think Docker just moves a little bit more of that control back to the software team.
And by virtue of that moves it into this continuous integration story, right?
So we can build out these Docker containers and I can say, you know, look, if we're going to switch from, let's say Python 3.4 to 3.5 and use some of the new features there, I don't have to make sure I coordinate with the infrastructure team to make sure that the right versions of Python are on the servers we're going to push to.
When we do continuous delivery, we just say, well, we're just going to push a different version of the container and boom, it works, right?
Yeah, exactly.
And on different branches, maybe like on a different branch, you want to test against the new version of Python.
Because like on the master, you're still running against a different version of Python, but on the feature branch, because you want to update, you're running against new version there.
So you want the whole build environment and the whole deployment environment to run on a different version.
So nothing other than that, than just changing it in a config file and using a different one.
That's a really interesting component to it as well, because, you know, as you move forward, you're sort of moving forward in time on your infrastructure and all the other pieces as well on your, your branch.
And so if you need to go back one month and run code from back then, if maybe solve a bug that somebody reported on a different version of your code or something, you, you know, to really do that.
Genuinely, you have to like somehow roll back your system to that level, right?
But if, if the Docker container specification is part of that, that check-in history, you can literally roll back to what you built it on, right?
Yeah, absolutely.
You can have the exact same.
I think that's, I mean, and as I mentioned before, like that's, that's why we built a new system on top of Docker to be able to exactly support that.
Like that should be easy.
Like you should be able to run, to roll back to like your build workflow, your code, your environment that you built, like everything.
You should be able to roll back everything and like have a complete history of, of everything that happened as part of your, your build and even production system.
Because only then, like, as you mentioned before, like if you want to do a rollback, if you want to fix something, if you want to look into something, debug something, there isn't really any other way to do it than to be able to go back historically and like really look up what exactly happened there.
Yeah.
Very cool.
So yeah, we'll see more Docker in the future.
I'm sure.
I'm very sure.
Yeah, definitely.
Okay.
So we're getting kind of to the end of the show.
Do you have a final call to action or something you'd like to make sure people go out and try and do?
So two things on, on, on, on, on the one side of obviously if, if people are interested in like a Docker based, CI system, give us a call.
Um, we're happy to show you guys, what we're doing there.
But I think on a, on a non coaching basis, I think we really, really, really need to need to make sure that as a community, we focus more on the productivity and focus of our engineering teams.
Like that needs to be number one, like customer success, obviously.
And then, but that is driven and done through productivity and focus of, of our engineering team.
So I think that anything, and we deeply need to analyze on a daily basis, like how is our engineering doing things?
What can we change?
What's in their way?
How can we improve the processes?
What can we automate?
How can we automate operations more?
How can we automate automatic health checks so that there's no downtimes and no issues or problems there?
Like how can we do all of that, so that they can actually focus on building stuff for our customers that actually makes us money and is interested in new technology.
So I think that's something that is, is really key and really important.
And that would be my main takeaway for, for people like really, really focus on those processes to make sure that your team can actually focus as much as possible on to building stuff for your customers.
Yeah, that's great.
I really love the focus on team happiness because I think it often gets lost in the technical bits of this story, right?
Yes, absolutely.
Flo, it's been great talking to you.
Thanks for being on the show.
Yeah, thanks for having me.
It was great.
You bet.
Talk to you later.
This has been another episode of Talk Python to Me.
Today's guest with Florian Motlick.
And this episode has been sponsored by Hired and DigitalOcean.
Thank you both for supporting the show.
Hired wants to help you find your next big thing.
Visit Hired.com slash Talk Python to me to get five or more offers with salary and equity presented right up front and a special listener signing bonus of $4,000.
DigitalOcean is amazing hosting blended with simplicity and crazy affordability.
Create an account and within 60 seconds, you can have a Linux server with a 30 gig SSD at your command.
Seriously, I do this all the time.
Remember the discount code too.
It's Talk Python, all caps, no spaces.
You can find the links from today's show at talkpython.fm/episode slash show slash 38.
Be sure to subscribe to the show.
Open your favorite podcatcher and search for Python.
We should be right at the top.
You can also find the iTunes and direct RSS feeds in the footer of the website.
Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
You can hear the entire song on talkpython.fm.
Just look for music in the nav bar.
This is your host, Michael Kennedy.
Thank you so much for listening.
Smix, take us out of here.
I'll see you next time.
you
I'll put it in.
Thank you.