Today we explore the wild world of Python deployment with my friend Calvin Hendricks Parker from 6 Feet Up.
We'll tackle some of the biggest challenges in taking a Python app from "it works on my machine" to production, covering inconsistent environments, conflicting dependencies, and sneaky security pitfalls.
Along the way, Calvin shares how containerization with Docker and Kubernetes can both simplify and complicate deployments, especially for smaller teams.
Finally, we'll introduce Scaf, a powerful project blueprint designed to give developers a rock-solid start on Python web projects of all sizes.
This is Talk Python to Me, episode 496, recorded Tuesday, January 21st, 2025.
Are you ready for your host, please?
You're listening to Michael Kennedy on Talk Python to Me.
Live from Portland, Oregon, and this segment was made with Python.
Welcome to Talk Python to Me, a weekly podcast on Python.
This is your host, Michael Kennedy.
Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython, both accounts over at fosstodon.org, and keep up with the show and listen to over nine years of episodes at talkpython.fm.
If you wanna be part of our live episodes, you can find the live streams over on YouTube.
Subscribe to our YouTube channel over at talkpython.fm/youtube and get notified about upcoming shows.
This episode is sponsored by Posit Connect from the makers of Shiny.
Publish, share, and deploy all of your data projects that you're creating using Python.
Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quarto, Reports, Dashboards, and APIs.
Posit Connect supports all of them.
Try Posit Connect for free by going to talkpython.fm/posit, P-O-S-I-T.
And it's brought to you by my new book, Talk Python in Production.
I've long felt that most guidance and marketing about how we need to run Python apps in production has been overly complex and expensive.
This book is both a look at the history of Talk Python To Me and an antidote to this overly complex cloud world.
Read it online and get the full book at talkpython.fm/devopsbook.
This episode has something unique and special.
I thought it'd be fun if I could come up with a song that was about deploying code, about Kubernetes, about the cloud, all the different things that Calvin's gonna come on and tell us all about.
I turned that into a song and I stuck it at the end of the show.
I wanted to put it at the beginning, but it's three minutes or so long and I think it might take away from getting right into the episode.
So if you're interested in that, you can check out the song, it's called "Deploy the Dream".
It's at the very end, almost the end, that lasts maybe another 45 seconds after that.
And you'll find the link to the standalone song and MP3 file right on the episode page in the link section or in your podcast player show notes.
I hope you love it.
It was a lot of fun to create and I think it'll make a lot of you smile out there.
Quick announcement before we jump into the show.
I recently completely re-imagined and rewrote the effective PyCharm course.
So if you wanna be effective with an IDE and use professional tools to build your Python applications, you should give my new and updated course, Effective PyCharm, a look.
You'll find it at talkpython.fm.
Just click on courses in the menu at the top.
And if you were already in the prior version of the course, it's been automatically updated for you.
So you'll have access to the new course right away.
Head on over and check it out.
And if you have one of our everything bundles that gives you access to all of our courses in the library.
Well, you also have access to this course, assuming the original was in your bundle.
Thanks to everyone who's taking courses over there and checking it out.
This is a really fun course.
I think you'll get a ton out of it if you haven't taken it yet.
And with that, let's jump into the show.
Alvin, welcome to Talk Python to Me.
Great to finally have you on the show.
What have you been doing all this time?
- I don't know, not being on your show, I guess.
I actually was super excited when you asked that I could be on here, This has been like a life goal, at least a goal since ClockPython to me has ever existed.
>> I really appreciate that. That's very kind.
Well, it's great to have you on here and I am all about DevOps and deployment these days.
I think it's another superpower that I think people can really have.
You've got an idea, you want to deploy the dream as the song that we'll play later, we'll say.
If you're not familiar with this stuff, it's a huge roadblock.
I built this thing, but how do I get it up there and how can I keep it running?
- Yeah.
- And so what we're gonna talk about is a framework you all have created to make this much more automated and easy and packaged up, if you will.
- Yeah, I agree.
I mean, part of the developer experience, not just the deployment story, but how do I make a developer be productive from day one?
Like I get super obsessed about the experience.
Like, is it smooth?
Is it easy?
Can developers like join your organization and be productive right away?
Like that's important to me as a owner of a business who produces software.
We'll start there.
Who are you?
What is your business?
What do you do?
Set the stage for everyone.
- All right.
So my name's Calvin Hendricks Parker.
I am CTO and co-founder of Six Feet Up.
We are a Python and AI for good software agency based out of the Midwest here in Indiana, but we have folks all across the country and a few folks across the globe.
We help impactful tech leaders level up their game.
Like if you've got an idea and you can see the future, our part of our goal is to make that happen.
Like we love tackling the super hard software problems.
The harder the better and the more unique and the more impactful the better.
Part of our goal has been to do 100 impactful projects by 2033 and those impactful projects are things that are making the world a better place.
So some of our projects do actually impact climate or energy, done some stuff with NASA on space travel.
So it's cool stuff like that that the people who work at Six Feet Up get super excited about.
And like part of what drives me to do what we do every day for sure.
Yeah.
And to get to work on space travels.
Oh man.
It's like, I'm getting up early today.
I'm going to work on space travels.
It's literally rocket science.
Literally rocket science.
Yeah.
How amazing.
And you've been doing Python for a long time.
You've been involved since the early days, right?
Yeah.
I first adopted or touched Python in literally the year 2000.
I started working on it.
I was in a startup in the Bay Area and the guy sitting next to me was like, check out this Python based application server called Zope.
And at that point in time in my life, I had just graduated college.
I think I understood the three words in between all the other words that he just said.
And so that was a whole new world that got opened up to me.
And so I started out my journey in Python really with Zope as the kind of the first thing that got me in.
But back in that day, like Zope and BitTorrent were kind of the killer apps for Python.
Folks remember there were like Zope tracks at PyCon And my keynotes were like around Zope.
It was the thing.
And I still attribute that community to really bringing me into Python and getting me engaged.
It's some of the smartest people I've ever worked with who are part of that open source community who made that a thing.
And I'm still friends with those people today.
You know, people like Paul Everett and Trey Seaver.
And those folks were really part of my upbringing into the Python community.
And I can't thank them enough.
That's awesome.
You
know, there's a really interesting fact that was shown at least amongst survey respondents in the PSF JetBrains survey, I can't pull out of it, that, that I would say 40% of the people who are doing Python these days are two years or less into it, which is an incredible statistic.
I think 30%, 30% or so is this is their first year.
And then, you know, the rest of the second year.
So we're amongst the, the rare birds, but the reason I bring that up 25
years later, we're still here doing it.
Exactly.
Uh, the reason I bring that up is, you know, I suspect people who've been at this for three or four years, maybe don't know what ZOPE is.
They probably heard the word, but they're like, yeah, is that, is that like a thing that Django does?
Tell people what ZOPE is like.
I mean, the, the, the application framework space back in the, in the 2000s was not a crowded space.
There weren't many options.
And I think the beauty of what the app, the ZOPE was an application framework.
It had some interesting opinions.
One of them being the ZODB, which I still do love to this day, which is an object graph database that enabled you to build applications quickly.
And I think initially one of their goals was through the web even.
Like if you remember Z-classes, you could build and rapid prototype through the web in your browser.
I mean, this is the year 2000.
This is not last year where people were like, "Wow, cool.
This is a low-code thing." This was that 25 years ago.
>> This was ahead of its time.
- He's way ahead of his time.
Now, granted, I don't think that was not the future.
That shouldn't be the future.
I'm actually hoping to give some conference talks this year about low code, no code, in my opinions on that.
Especially, I should frame it in my context of Zope and Z-Classes.
But maybe that's too much of an inside joke.
I don't know if enough people would even understand what I'm talking about there.
Because like you said, so many people are new to the community, which I think is awesome.
I think that shows it's a vibrant, growing community.
If you're in a community and you're wondering where the new next generation is gonna come from, there's a problem.
And I don't think Python has that problem.
Python has an incredible traction with new people.
And I've always loved it because of the simplicity.
I love it because the language is predictable in its patterns.
It's not a cognitive overhead to remember all the various ways to call things in Python 'cause typically they're pretty consistent.
- Yeah,
but Python's slow, we can't use it for stuff.
(laughing)
I do not believe that for a second.
- No.
If you're doing maybe mathematical simulations or certain types of really, really intense low level things maybe, but as a general application framework, it applies, it's fine.
Yeah.
And that's the problem too is that if you go off right now and you ask your ChatGPT or your cloud about like, you know, maybe what are some disadvantages of Python, it's going to mention these kind of broad old opinions about it because it only knows the average of all the knowledge has ever been on the internet.
And it's learned
a bunch of like trash talk as well.
and which is mostly inaccurate.
But if you ask it to dig deeper, and
someday
we'll be able to ask it I think a little more critically, you'll probably dig in and get the truth.
- Yeah, a bit of a side note.
I recently, for a couple things I needed, got the Chat GPT Pro.
Not the paid version, but the insane pro version.
- Oh, the $200?
- Yeah, $200 a month, and I laughed at myself.
Like, this is the stupidest thing I've ever done, but I need it, so I'm gonna do it for a little few days, turn it off.
It's incredible, I'm not turning it off.
It's like my side buddy, I can ask anything.
And it's so good.
The future is here, it's just not evenly distributed.
- It's not evenly distributed because it's hard for most folks to have the right mindset, I think, to approach to get that level of value out of it.
I think you have to know how to talk to it.
And I've said this before, it's the same problem with people who aren't good at using Google, just plain old search.
Like, you know, the people who have to say, let me Google that for you, are the ones who understand how to like, use the search engine, you know, well.
Some people-- - You know,
that can be answered in an exact phrase if you
just say the phrase, just say the
phrase, you know what I mean, you know?
And it's also a mindset, right?
Like, I started thinking like, instead of this is a cost or something, like, this is like another employee that I can just give jobs and five minutes later, I'll come back and it's done pretty thorough research.
You know, it's--
- Yeah, especially with the new scheduling feature, where you can actually schedule tasks to happen.
I'm getting kind of excited about, everyone's talking about agents, and I know this isn't the AI show we're here to talk about, but I think agents are interesting, but we're not there yet.
They're about the level of maybe interns and what you would trust them to do for you.
- Yeah, I totally agree.
I'm a little worried about what all this stuff is gonna do to the industry
in
a broad sense.
My main concern is
I
think it'll sort of carve out that gap between early dev and senior dev, and it's gonna be harder for folks to cross that.
but
it's also an incredible technology and I think it's also silly to pretend it doesn't exist.
So anyway, you're right, it's not the AI show, but boy is it, is it top of mind for a lot of us, right?
- Yeah, for sure.
- Yeah, okay, so let's talk Python deployment.
Talk some pitfalls, maybe a little bit of Docker.
How's this?
- It's a shame.
- Why did you all attack this problem?
And I guess setting the stages, where does this fit in your consulting story, right?
You must need to deliver these applications often in a way that people can continue to let keep them going on their own without you constantly going back. Yeah, there's a there's some pip updates. So we'll take care of that for you.
Well, and that definitely reaches into the longer tale of the whole story. I think if you go back to the beginning of the story of deployment, a lot of us started out or a lot of us older ones, more seasoned veteran developer folks in a world where if you wanted to deploy your web application, you threw some PHP into a web root. And as long as you had modphp installed, the stuff ran.
Like you didn't have to think about configuring ingress and egress routes.
And it was, you know, databases just ran on the same server you were on.
So you just ran it on local host.
Like it's the world has changed when it comes to the deployment story.
But it's because things have gotten more complex and sophisticated because they had to.
Like we had needs for more sophisticated authentication mechanism.
We have needs for caching and delivery.
We have needs for time series data.
Like, because those opportunities opened up, more sophisticated software gets built, which means it's a little trickier to deploy.
- Well, looking back, and with your perspective of all this experience as well, and it's something I've seen, every time the technology gets easier to work with, you know, like that used to be 100 lines of code, now it's three.
You know, we're gonna be out of jobs soon, a lot of people would say, it's like, no, we're just gonna solve bigger, more ambitious problems.
And that's been the case for so long, and it's not that, well, things got easier, so we're not gonna do it.
No, every time it got easier, we were able to just think of bigger, more, instead of, we don't need a team, one person can solve this amazing problem.
But that means, underneath that, there's this mountain, this iceberg of stuff going on, right?
- Well, and that's where deployment has gotten, I think, hard in a lot of people's minds, is because there is a mountain of knowledge, like there's a giant shoulders that you're standing on that makes that happen.
And my VP of engineering was complaining to me yesterday, Like, why can't we just, how can we not easily put websites on the internet anymore?
And it's not that we can't put websites on the internet anymore.
They just do so much for us.
Like the complexity and the sophistication and the covers is what's causing a lot of this issue.
And the person who wrote software is not always the person who deploys software because I think they've just got kind of different mindsets or different ways of thinking about the problems.
And it's rare you find people who are truly a full stack and do front end to the back into the database, the network, all the layers that are in between.
And it's nice that services like, you know, the cloud have come about where it greatly simplifies that deployment.
And that was part of our journey into containers.
I was resistant to containers probably until 2020 when we did, in 2020 there was a change, obviously, some things happened in the world, but we also
built...
- You had more time to be at home and figure out stuff.
- Right.
But we also had time to build some software to help us in our little conference we were doing. We put on the Python web conference during the pandemic.
We actually started the pre-pandemic, but during the pandemic, we took time to write some software to deploy a virtual event platform. And I think containers, at that point in time, I adopted containers and container orchestration because it allowed the developers to think more about developing and less about the deploying part of a sophisticated application like streaming web video, audio mixing, switching, live chats and web sockets. I mean, there's a whole lot of moving parts in something when you're delivering a live video conference experience. And the containers were a nice, like, equalizing layer to allow us to say, I don't care where it goes to, whether it's in Docker Compose or Kubernetes or Docker Swarm, or in our case, we used Amazon's Fargate, because I just didn't want to deal with infrastructure. I just told Fargate, I got some tasks here, some containers, make
them live, like turn them on.
Yeah.
And it sounds like that's for devs as well.
Yeah.
And we do-- Not just the infrastructure you're pointing to, but this is, it sounds like you're smoothing the path for the whole team, right?
Correct.
That's an opinion I hold that containers are for development as well.
Like that developer experience, some organizations I've seen, they may be deploying on the Kubernetes because there were operational opinions about deploying into containers, but the developers themselves haven't adopted that fully on their local workstation because it may feel hard until you've got that muscle built up for doing that level of development. That's originally, that's why Scaf came about, to make that development experience just a breeze.
We focused on how quickly can a developer be productive locally using containers and still have all your tools. It shouldn't feel different than if you were developing with your local Django files on your local file system and you were just running a Postgres instance, you know, out of homebrew, except it's better because now the versions will match what's running in production and you can have five different projects running with five different versions of things because you want to make sure they match your expectations when they go to launch and not be surprised when, you know, the version of Redis doesn't support some new operator because you were one minor version off in your local machine compared to the sandbox and production machines.
>>
Yeah.
I was not against containers, but I was resistant to use them myself because I felt
like, well, here's another thing to understand, another thing that's a layer between me and my code, and it could go wrong and I don't need it.
You know what? I'm a believer.
It is so nice to be able to just say, here's three commands you can run.
>> Exactly.
>> Always going to be exactly.
Another thing that I've done is on my new Macs and stuff, my dev machines, I don't put databases on there.
Nope.
Caching.
I don't even necessarily install Python directly on, you know, as in go to python.org or homebrew or something like that.
It's, if I want a tool and you know, instead of installing say MongoDB, I can just have a Docker command that runs MongoDB.
That listens on the same port.
Yep.
And it's, it's always up to date.
And if I don't like it, I get rid of it.
If I want to change the version of it, I just change the flag somewhere in a file.
And it's, it's incredible.
That and UV.
Yeah.
Think back to the old, old days.
and the old days for us, but probably the current state for a lot of people in certain organizations, is you had a large getting started document that you would have to follow top to bottom.
You know, make sure you get this version of that, make sure you get that version of this, make sure you put these files there, make sure your database is running with these couple extra options because we've enabled some, and maybe we've enabled GIS or some extension to the database.
If you didn't get all those magic incantations just right and follow the document to the letter, you were having, you know, a long time to get started.
like it was a struggle.
Whereas you just tell someone Git pull and then we'll tilt up, in our case for Scaf, we've adopted the tilt management tool, they're running and they can start making, contributing code within an hour.
That's my goal.
My goal has always been fresh laptop out of the box, on my desk and be able to contribute like a pull request in an hour.
- This portion of Talk Python to Me is brought to you by the folks at Posit.
Posit has made a huge investment in the Python community lately.
Known originally for RStudio, they've been building out a suite of tools and services for Team Python.
Over the past few years, we've all learned some pretty scary terms, hyper-squatting, supply chain attack, obfuscated code, and more.
These all orbit around the idea that when you install Python packages, you're effectively running arbitrary code off the internet on your dev machine, and usually even on your servers.
The thought alone makes me shudder, and this doesn't even touch the reproducibility issues surrounding external packages.
But there are tools to help.
Posit Package Manager can solve both problems for you.
Think of Posit Package Manager as your personal package concierge.
Use it to build your own package repositories within your firewall that keep your project safe.
You can upload your own internal packages to share or import packages directly from PyPI.
Your team members can install from these repos in normal ways using tools like pip, poetry, and ub.
Posit Package Manager can help you manage updates ensuring you're using the latest, most secure versions of your packages.
But it also takes point-in-time snapshots of your repos, which you can use to rerun your code reproducibly in the future.
Posit Package Manager reports on packages with known CVEs and other vulnerabilities so you can keep ahead of threats.
And if you need the highest level of security, you can even run Posit Package Manager in air-gapped environments.
If you work on our data science team where security matters, you owe it to you and your to check out Posit Package Manager.
Visit talkpython.fm/ppm today and get a three month free trial to see if it's a good fit.
That's talkpython.fm/ppm.
The link is in your podcast player show notes.
Thank you to Posit for supporting the show.
Do
you, when you guys are doing development, do you actually do development in containers or do you just use them to support all of your stuff?
- No, everything's in containers.
That was, Scaf primarily, And some people will see Scaf as a deployment tool.
I see Scaf as a developer experience tool and a deployment tool.
I covered both ends of that spectrum because everything starts obviously with the developer and an idea and some building some software.
Well, if they can't build the software easily or they can't collaborate with another contributor on that software, it slows things down.
So part of what we, you know, that Scaf tool is, it's gonna be able to give you the scaffolding to build out of an initial project.
Like starting from scratch, you have nothing on the file system, Scaf will build out those initial tools, but then Scaf is a set of opinions, more importantly, because lots of scaffolding tools exist out there.
I mean, current Scaf is built on Cookie Cutter, but we can move that, we can move those opinions as we change our opinions about the development world.
So as we build a new project and let that get started, we now can develop locally on containers.
Like we use Kind for our Kubernetes cluster locally, which is nice.
and you'd think running Kubernetes might be overkill for a local development environment.
But the nice part about that is, is like now the Kubernetes manifests, you know, layer nicely.
You've got a local base layer, a local instance, you've got a sandbox instance or a development instance you may launch into the cloud someplace, or you've got your production layers all right in there using customized, for example.
- Nice.
- Yeah, nice part about that is, if my machine doesn't have enough horsepower or memory or disk space to run a specific project that where I need to jump in and help, I can just run that in the cloud.
I don't, there's nothing saying I have to be running that locally on my own machine.
All the tooling, all the file synchronization will work just as well if it's running in a sidecar.
Like if I had a big white box, Intel machine or machine sitting in my, under my desk, I can run that or I can just launch it into a digital ocean or an AWS cloud, doesn't matter.
- Yeah, absolutely.
So let's dive in, let's dive into Scaf.
But before we do, have you seen, I think it was in the last episode, this new AI computer thing that NVIDIA announced?
- I'm pretty excited about that actually.
- I'm super excited.
NVIDIA unveils a $3,000 desktop AI computer.
And I think it's just, you kind of remote in and run containers on it as well, I'm pretty sure.
- Yeah, I was excited 'cause I felt like CES, this is obviously launched at CES by NVIDIA on stage.
And I was excited to see CES have something It was interesting for developers again.
I feel like CES had kind of gotten boring maybe over the last decade.
And this was exciting.
I think
that...
It's got to be all doorbells and TVs.
Yeah,
right.
Exactly.
I love home automation.
Don't get me wrong.
But there's only so much of that junk I could possibly be interested in.
This is something I'm very interested in.
Exactly.
Well, Jamie out in the audience says, "Totally all in on developing with Guinness.
Very few tools installed on my Mac, but we're here with you."
Awesome.
Yeah, the important tools.
Like you've got your IDE, your VS Code, you've got your, you know, you've got your favorite Git visualization tool.
Like, I mean, those, those are critical to your, your tool chain, your workflow and they should work everywhere.
They should work just as work alike on every project you're on.
Yeah, I agree.
I don't develop containers, but I work with local virtual environments and then like basically try to replicate exactly the same, but all the surrounding stuff, all the daemons and the servers and all that.
It's all like, so we're at a slightly different stage of our container journey, I believe, We're both far down the path, I think.
>>
Much further than we used to be.
>> Certainly.
[LAUGHTER]
>>
All
right. Here we are, six feet up slash Scaf on GitHub.
>> Yep.
>> Scaf provides developers and DevOps engineers with a complete blueprint for a new project using Kubernetes.
We talked a lot about the motivation and so on, but let's start with the beginning.
You said I have an idea for a project that wasn't well-structured.
This is a little cookie cutter-ish in a sense, but what it makes is more than just a Python project, right?
Tell us what we got here.
- So this started out, if you've ever followed the Cookie Cutter project, there was a Cookie Cutter Django template out there made by Pi Danning.
It kind of kicked that off and started it.
I liked a lot of his opinions, but I wanted more to it, or I wanted to change some of them.
So that was the original, like, kind of kernel of where this started.
And then we grew a lot more around the deployment story and some of the developer tools so that we could be on Kubernetes.
We could standardize on Kubernetes as a container platform, so we could launch into any cloud, whether it's a managed Kubernetes or whether you're bare metal and are running like VMs and EC2, or it doesn't matter.
Because the nice part about Kubernetes is it gives you that agnostic interface to launch new containers.
I think a lot of people see Kubernetes as complex and used for like container orchestration and scaling.
But I see Kubernetes as a way, it's an interface, it's an API to allow us to deploy easily.
So we wanted to focus on things like CI/CD, and could you make that simple?
So SCAF includes opinions around Argo CD, for example.
So when you deploy into Sandbox, it deploys the Argo CD operator, and then it sits and watches your repository for changes.
So anytime you merge to Dev branch, for example, it will release to Sandbox, and then the QA team can go test.
You don't have to think about it.
Like you just make a PR, if it gets reviewed and accepted and merged, the release happens.
Like no one forgets to do the release.
No one has to do manual steps to do the release.
Long gone are the days of shelling into a box and doing a Git pull or SPN up in a directory and forgetting to restart some service to pick up those changes.
Because humans, we're humans.
We're terrible about repeatability and maintaining and being able to do maintenance type tasks like that.
We're just not built for it.
We're built for creative type thinking.
We should let the computers do the bits are good at, which I feel like that's what some of these opinions are based around is can we automate those pieces away?
Right.
It's like a deployment checkbox.
Oh yeah.
Checklist
and like tech, tech, tech.
Have we installed this?
Do you set this version exactly?
Yeah.
And some, some humans are good at checklists.
Like there's people who are, that is their thing.
Like, you know, doctors and surgery.
Don't take their checks from them.
Right.
Like they love their checklists and glad they've got them.
I feel like people who have gravitated towards software development are craftsmen, kind of artisans around a craft.
And it's not so much about checking check boxes as it is how do they creatively solve a problem because a lot of the problems they're solving haven't existed.
If they existed already, they would be solved.
And what would be the point of us writing any software?
Yeah.
And that's why we have that.
It works on my machine.
Yeah, totally.
Program because
we
don't check the boxes and we're not amazing at making everything work the same, but yeah.
And
this is my goal is the getting rid of the works on my machine.
Like it should work everywhere the same, exactly the same.
And you should be able to use your own machine for development.
Like a lot of I've seen a lot of teams where they have this big central server that's called dev and that's where they all shell into and work simultaneously on a single spot.
And that just feels fraught with errors and terror to me.
Yeah.
You know what it feels like it screams to me is you might end up It doesn't work on my machine.
It only works on that machine.
Exactly.
Even worse.
It only works.
I once worked on a research project with a pretty big funding organization and there was a bunch of different contractors, one of them out of Seattle, and we all had to build some pretty complex software team.
I was on, we built something that kind of coordinated all of them and it was fine.
Worked great.
We were all happy.
The other people will deliver, but there was this one team that had built something on a big, big Linux server and big fat desktop thing.
Why do I know the size of it?
Because they had worked on it for nine months and then they tried to get it to run on another, they literally could not get it to run on any other computer.
And so they put it into the most fragile, or most careful shipping container they could and they drove it from Seattle to San Diego and they set it up in the corner 'cause they literally couldn't get the software they wrote to run on any other system.
Could you imagine?
Like, what are you going to do in the next time around?
What if it breaks?
- Right.
- Yeah, that, that, I'm working on a big central server.
Maybe there's a way to like restore it and stuff, but you could, you could craft your software into a corner on that big server where it's like, well, we're going to move to the cloud.
Like, no, we're going to keep it on that thing and it better just be enough, you know?
- Right.
And how do you onboard someone new to help you?
Like, you gotta be like, well, be very, very careful.
There's this one, only one server where it only runs.
- Oh my goodness.
Could you, could you not?
- Onboarding is such a challenge there.
- Yeah.
You want to be able to onboard developers like with confidence and they can have the confidence to know that they can make mistakes and they can burn things to the ground and they can try stuff knowing that it's not going to affect like the production machine or even the sandbox machine.
Like they can experiment with a little bit of reckless abandon because that's how you learn.
Like you break things.
In my mind, you break things to learn.
There's a lot of learning that happens when you get to break things.
And if you can break things confidently knowing that no big deal, I can just get full or put a branch and delete that branch and start over.
>> 100 percent. And there's different, there's different layers at which people should embrace that to the maximum.
They should embrace that in refactoring, reorganizing, right?
So if I have, if I have Git and I have frequent check-ins, I should be able to go crazy.
You shouldn't be like, "Oh, don't mess with that." You should be able to go crazy on your code and go, "Oh my gosh, it's better." Or, "That was a horrible idea." Revert.
>> Get rid of that.
>>
And it should not, it should not be terror.
It should be like, "Oh, let's give that a try.
I bet that would be awesome.
And if it's not, we're going to get out.
Also though, on the containers give you that for your infrastructure locally and in the cloud.
What if we ran on the newest version of Postgres?
Yep.
Let's try it.
Is that
amazing or is it a horrible idea?
Like, you've got the one server that everyone's using.
You're definitely, or even the QA server.
You're like, we're not going to break everyone because there's 10 people who are going to lose their productivity if we screw this up, but I can change a number in a Docker file and try it.
And I've seen this in action, again, in production, in action, in we have with our own customer stuff where a junior, you know, admin, sysadmin was doing some standard maintenance activity, you know, maybe they accidentally dropped the database.
But if you have all the things lined up and all the infrastructure, you know, set up in this kind of optimal way, no big deal.
It's like, no problem.
Like you go push, you go run the command that like restores the DB.
Like for example, one of our opinions in here is a cloud native PG.
So you have options.
Like we can use cloud native PG in the cluster and that does things like point time restore, recovery, you can be using RDS.
Those opinions can happen afterwards, but given that the whole thing can be blown away and redeployed in a moment, in literally a moment's notice, gives you a lot of confidence in being able to bring something back from a destructive action.
- Yeah,
absolutely.
I
think
we're both so excited about this, we keep getting on tangents.
I originally would have asked you kind of, how do I get started with this?
Like, talk us through.
(laughing)
Talk us through,
like I'm a-- - Oh, you'd like to try it?
(laughing)
They give people a sense of like, if they, if they don't, obviously most people don't have this already.
Like what are they, they want a new project.
They want it to have this more forward looking.
Yep.
So on that structure, yeah.
On that GitHub page, there's a one-liner you can just copy paste into your terminal.
I think it's toward the, yeah, it is right there.
Yeah.
There's a little, I
applaud you for not having the dollar at the beginning.
Thank you.
I'm
dollar fan, not a fan.
I'm pragmatic about this.
Yeah.
And that one liner will install a lot of the opinions.
Um, I've mentioned this before to some people that Scaf gives you all of those kind of cool opinions, cool tools, like neat techniques that as a developer, like it takes like decades to refine and hone and kind of gain into your toolbox.
Scaf tries to give those to you like right away.
Like, so it's, for example, it's going to install kubectl and kind and tilt and a couple of other tools if they're not found on your system and it'll use, if homebrew installed, it'll just use homebrew out of the box to do that and it puts it into your home directory. It doesn't, it shouldn't require, you know, one of my goals is not to require sudo anywhere in this process, you know, there's no sudo needed here for that curl command to run. And so it should be less impactful on your system than a lot of other tools, but it gives you a lot of power for what you are installing. So you run that one liner, it will now give you in like your dot local bin directory, a scaf CLI command that you'll be able to run.
And you can just run scaf and then the name of the project you want to build.
And it'll ask you some questions.
So this is the kind of cookie cutter part at that point, is that it's going to ask you, "Hey, do you want to build a Django app with Next.js running?
And do you want to use Sentry? Do you want to have Celery?" Just some standard questions.
What mail provider are you going to use?
So it gives you then on your file system a new, in this case, a Django project.
I'll talk about some of the future vision pieces of that, but that's what it gives you today.
It also gives you, in addition to a standard Django project, because you can get a Django project just by running the Django start project, a Django admin start project command, it would blow out a very simple version of a Django project.
This has more to it.
There's some opinions about users and sites and some other things.
But not only that, there's going to be all the Kubernetes manifests for running locally.
There's going to be Terraform in there for deploying into a sandbox cloud, like on Amazon, for example.
So if you chose Amazon as your target cloud, There's going to be all these kind of other opinions in here.
What database we're using, what if we're using Celery, we're going to use Redis, actually we should change that.
We're changing from Redis over to Valky at the moment as well.
>> Valky, what is this?
>> So Valky, V-A-L-K-E-Y.
>> Close.
>> Valky, which is the Redis.
>> Valky,
okay.
>> The Redis for Blake's Code.
>> Yeah.
>> Okay. Why this?
- Just because of licensing changes on the Reddit side of things.
I think that's another whole, we could do a whole other podcast on just open source licensing and interesting history.
You know, the Elastic folks did this with ElasticCache.
I think the Reddit folks kind of were following suit, but then you now-- - I think Mongo did
maybe a little bit as well.
- Well,
now you've seen the Elastic folks kind of go back on that, heading back toward the more open open source licensing.
We'll see.
- I'm sympathetic to, at least some of these, because they built these businesses and the cloud folks are just like, "Awesome, we'll host that for you, thanks." You're like, "Wait a minute, we were hoping to kind of "have some kind of deal." - Yeah, be that.
- Yeah, yeah, yeah. - That'd be great for you.
- I can also totally understand, "No, we just want this stuff unencumbered." - Yeah. - It's not that complicated, probably we could probably make this work, and we got together and teamed up, and okay, this is news to me, this is awesome.
- Yeah, no, it's, again, it's drop-in replacement for the most current version of Redis.
- I was actually
just thinking about doing something with Redis, but I think I might just do a little Norse legend type of stuff.
Try that out.
This portion of the talk Python to me is brought to you by a very special project that I've been working hard on for some time, a new book, the talk Python in production book.
I've long felt that most guidance and marketing about how we need to run Python apps in production has been overly complex and expensive.
I'm sure you've heard me espouse the ideas that you're not Google, you're not and you're not Netflix to emphasize that the legitimately incredible technology powering these companies can be admired but mostly shouldn't be used as a guide for your own applications and APIs. This book, "Talk Python in Production" is me pulling back the curtain and showing the world how this can be easily done.
You'll see how and why various technology choices have led us to truly maintainable web apps that can be managed by a single developer, cost a tiny fraction of most cloud-based solutions
and
result in a blazing fast web app built on modern Python. You might be wondering if you need to be an expert in Docker or Linux to benefit from this book. You don't. While having some exposure to Docker or Linux servers helps, the book walks through setting up and managing a modern Docker-based deployment from scratch. Think of it as a guided tour of these technologies with best practices and pitfalls explained along the way. When deploying to the cloud, you often hear that you should just use serverless or other no-touch services. While they can work well, they often suffer from cold start slowness and more importantly, unpredictable bursts of costs if your app becomes popular. In Python in production, we keep these costs low and nearly flat by avoiding dozens of microservices and serverless functions. You won't be blindsided by unpredictable bills if you adopt this methodology.
Some of the more notable chapters include chapter 4, one big server rather than many small ones.
Chapter 6, running on Rust Python application servers.
Chapter 8, visualizing servers and other tools.
Chapter 14, picking a Python web framework.
Talk Python in production is available to read online or you can buy the full book at talkpython.fm/devopsbook.
If you're interested in running professional web applications and APIs in production with high availability and yet keeping things simple and manageable, then please consider the Talk Python in production book from yours truly.
Read it online or get the full book at talkpython.fm/devopsbook.
Getting the book is a great way to support Talk Python and keep the show going strong.
The link to the book is in your podcast player show notes.
Russ out there asks,
"Wagtail?" Not yet. I don't believe we have a Wagtail template, but I'll talk about that in the roadmap. That's coming.
I guess it's worth pointing out to people that this is sort of at its core Django philosophy, right?
Currently. We have some other
use cases that we want to be able to satisfy with Scaf as well.
For example, instead of deploying into a cloud and like you've got Argo CD, watching for like continuous deployment type stuff. What if you were deploying an appliance like into someone's data center.
And there were different concerns around security and updates and adopting updates and how it got updated.
We want to be able to support that use case.
We want to be able to, I'd love to be able to support a fully serverless, you know, SCAF lite type environment where maybe we're using Lambdas and DynamoDB and API Gateway to deploy the backend in a totally serverless manner.
SCAF should be able to support that too.
It's not there yet.
That's definitely, that's the roadmap piece for sure.
There probably is some, I'm not totally up on it, but it's probably some open source Valky equivalent Docker based Lambda type stuff as well that you might be able to say, we want to have a self-contained serverless as part of this.
- Yeah, for example, the Scaf challenge.
So if you went to DjangoCon last year, 6PF ran a Scaf challenge where it was to see how fast you could basically run and get a running Django project on your machine in Kubernetes, running locally, ready to develop.
The winner did it in 26 seconds from running Scaf to Django, actually ready to respond to HTTP requests.
Wow.
That backend that tracked it was all done in Dynamo, Lambda, and API Gateway using the SAM framework.
And so on Amazon, there's the serverless application framework that they've got called SAM, which is really nice because you can run it all locally.
You just do SAM serve or whatever, SAM start, and it spins up containers locally, you spin up your Dynamo container locally.
So I had the whole thing running on my own machine, much in a way that's why I like about Scaf because it all runs locally, it all is contained and I can play with it, I can destroy it, I can make mistakes, and then when I'm ready, I make a pull request.
>> Yeah. One of the things that I'm always apprehensive about is building apps that have to have lots of Cloud services constantly active, and not just because I want to be able to say, work in a coffee shop with poor internet connectivity or on an airplane or something like that. But also I feel like there's probably some leakage. I mean I just heard an ad on some podcast about it for a company that whose job is to go and look at all the AWS or Azure stuff you're doing that you might have left running and is costing you $10,000 a month. People just forgot about it.
You know they'd be like, "Oh, let's try this." >> I think you should say that. We've had that.
>> Oh really? Tell us a story.
>> Yeah, that's
another reason for parts we're adding into SCAF around compliance and cost controls.
I'm a big fan of an open source tool called Cloud Custodian, which is a event-driven Cloud compliance tool.
If you haven't checked it out, Cloud Custodian is a really great tool for compliance, but also fin ops.
Making sure your Dev instances aren't running 24/7 when they really only need to run probably eight hours a day, they don't need to run on weekends.
Cloud Custodian can shut those things down.
That's something we're adding into SCAF right now, is some minimum set of things.
like make sure any cloud resources you get deployed are properly tagged.
You know, are they tagged with an environment like production or development?
Are they tagged with a cost center or whatever your policies may be, but that will help you avoid those kinds of instances where we had, for example, someone spun up a spot instance.
Well, if you're not familiar with Amazon, you can request spot instances, which are kind of excess EC2 VMs that are hanging out.
And if someone releases one, you can pick it up and use it cheaper.
And they're typically meant to be used temporarily.
but you request them and they come asynchronously to you.
So you could go into your console and request one, and if it doesn't come right away, you're like, "Shoot, that didn't work." And you could take off, you know, go get a coffee and get lunch, and then totally forget you requested the spot instance for a giant GPU, whatever.
- And then it's ready.
- Yeah, and then it'll show up later in the day.
And if you don't go and turn it off, you'll pay for it for the month, which was $10,000 for one of them, once that happened to us.
So putting in place the fact that if someone did spin up an instance like that, Cloud Custodian would be watching for it, and we'd shut it down within a day if it didn't follow whatever your policy is for starting up new kinds of instances.
- That's really cool.
We're learning about a lot of cool open source tools here.
This is great.
- And that's why they're all packaged into SCAP because not everyone knows about all these things.
So we're trying to take our kind of cumulative six feet up journey of 25 years of being on the internet and deploying software and developing software and packaging those opinions into like one spot where it's kind of like someone took our brains, collective brains, and put them into a code repository and now we can deploy and develop like we've been doing
it for 25 years.
- Yeah, it's like, well, that was a really sharp edge.
Let's see if we can come up with that.
- Oh my gosh,
yes.
(both laughing)
- Somebody's like, guys, sorry, but there's a big bill.
- There was a big bill.
Look, I'll give a shout out to Amazon.
I contacted them and they did refund us for that accidental big bill.
They're generally pretty good about it if you make that mistake once.
Now, you gotta make sure you show them, you can demonstrate to them, you've put in place things to not have it happen again.
- Okay, 'cause you might
pay for it again.
- Yeah, I honestly work in the cloud, it's super scary in that regard, you know, when it's overly automated.
So, one of the things, speaking of deployments and all this that I do when I'm working with my Docker stuff is I'll set up a Docker compose file, that's kind of my zen right now.
- Yeah.
- And in there you can set deployment limits, like this container can only use so much CPU, more significantly for me usually is like, this container can only use one gig of RAM, even though the server's got 16, tell it it has one.
And the reason that I think that's super useful is, something goes crazy or starts using too much memory or something like that, you could say, "Oh, there's something going on here without it taking down everything else." And there's other things, especially databases. They're like, "Oh, I've got 16 gigs. I was just going to load everything into memory because that'll be more efficient." Like, no, no, no, you're sharing this with everyone. Could you just load the indexes into your two gigs? That would be good, right? Is there stuff like that here?
Yeah, exactly. And our opinions on that are in the Kubernetes world. You can be able to put in resource limits and priorities.
This actually also literally happened to us.
Again, all of our experience you get to benefit from.
If you aren't careful with Kubernetes.
>>
I think every one of these that have a little double dagger thing, you click on it.
>> That's totally right.
>> Here's the
story why this is here.
Here's the story why this is here, because that's the truth.
If you don't use resource limits on Kubernetes, they will absolutely stomp on each other.
Kubernetes is an amazing orchestrator and it will do exactly what it's told.
And if you've told it that this doesn't have limits, it will give it all the things all the time.
And you can run into a situation, for example, if you're using cloud native PG, your database is in the cluster, which means it's orchestrated by the cluster.
If you don't give it any limits and you're running multiples and you do a backup, the resources when you do a backup go up.
Yes,
100%. Yeah.
If you do, it basically like scans through all of the data.
And all the things.
Why is it using three gigs? It was using just one.
Oh, because I asked for a full backup.
>>
Well, and I tell you what it'll do is it'll consume all the resources on one node and then it'll fail over, orchestrated, it'll fail over to the second node and then use all the resources on the second node and then it'll corrupt your database and crash the whole thing.
Now, if you put in the resource limits and the priorities, because what it should do is it should go off and be like, there's a lot of Django instances running that I don't need to be, I can kill those first.
I can orchestrate smartly for you only if you smartly configure it.
>> Right. Here's my goal is to not let this get out of control.
help me with that. Don't just feed it everything.
- Yeah.
- Yeah, it's interesting. A lot of these servers are like, "We could do better if we could just take it, "we could load up more and pre-cache more." But they don't work well together like
that.
- Right, yeah. I mean, they're greedy.
They're gonna try and take the resources they need to do the job they need to do, but they can be told to be less greedy.
And Kubernetes is how we do that.
- Yeah, more
importantly, they can be forced to be less greedy.
- You
need to stay in line.
(laughing)
- So what you got? You're not getting more.
All right, let's talk through the building blocks here.
You mentioned a couple of them, but there's a big long list of things that I think is gonna be pretty interesting to people.
Started with Django.
- Yeah.
- And then let's go down the building block.
When I make an app like this, it has an opinion, it looks like as well.
It's not just a vanilla Django app.
- Correct.
Yeah, you could be doing asynchronous tasks, so that's why there's a Celery opinion in there.
Like we, you know, if you've got a project, you know you're gonna have jobs in the background.
Sure, let's get Celery installed.
If you're doing something with a fancy front end React, where our opinion is really to use Next.js. And if you install Next.js, you'll get like the strawberry GraphQL stuff out of the box, which is kind of nice and Apollo on the front end, if the Next.js is also chosen. So some GraphQL opinions have been made and the plumbing laid to make it just work, which is kind of hard sometimes. If you're diving into a new technology like React and GraphQL, it's nice to have some opinions and to have them pre-wired up for you. So you can just just kind of follow the pattern that's already been laid for you.
Okay. I'm told that
Next.js is really, really popular.
Yeah.
Tell us about what is Next.js.
Yeah, I mean, Next.js is a set of opinions around React.
Much in the way that, for example, like Zope and Plone were opinions around how to do a Python web framework.
Next.js is kind of a packaging of some opinions about how I would deploy and write React applications and keep them up to date.
For anyone who's done a React application, you can start with the standard React demo application.
But from there, you start adding on it.
Again, I'm definitely not the TypeScript, JavaScript front-end person, but dependency spaghetti mess will happen very quickly in this world, or can happen very quickly in this world, which will lead you into a spot where it's really difficult to upgrade your React application to get all the dependencies upgraded.
and there's security vulnerabilities and issues you need to be aware of and performance things.
So you want to make sure you can stay on top of those versions.
And Next.js is basically a set of guidelines and opinions that should help guide you down a more happy path.
And that's why we chose it.
I think even the React folks tend to suggest using Next.js instead of just React on its own because you get those opinions and should have an easier time keeping things up to date.
Yeah,
I know the JS stuff feels like it's so complicated, but it's again because we're
asking more and more.
People have high expectations of the web applications that they interact with on a daily basis.
It's just a fact of life that people expect, have expectations about how things are going to behave and the experience they're going to get.
Yeah. They're like, Gmail's cool.
Google Maps is cool. Can ours do that?
Like, you realize this is a static website.
You're the developer behind that?
Yeah.
And then if we
keep going down this list, I mean, we've standardized on Postgres.
Um, and that's historic.
We probably 15 years ago used MySQL.
And that was back in the days of MySQL silently dropping data, on you.
Um, but I don't think those You got enough.
I mean, you got enough of your data kept. There's a lot.
That's exactly what it was. So we, we switched to Postgres and haven't looked back. and there's just a lot of exciting things happening there. So if you're not on Postgres, I highly
recommend it. Good, good, good bet there, because if you look at the surveys and stuff, like The majority of people are doing that, especially if they're doing relational databases.
It's Postgres and then you better justify why you're not using Postgres.
>> Then if you're going to run Postgres and you're running Kubernetes, you're going to want to have some kind of an operator to manage it for you.
If you want to have high availability, you want to have data backups, and that's what Cloud Native PG gives you.
You can back up into S3 buckets, or you can back up into, you name it.
There's multiple kinds of targets that are supported, but it manages all that hard complexity for you.
If you've ever set up Postgres replication and high availability on your own and had to deal with all the wall files and moving them around and backing them up, it's a sophisticated beast, a complicated, sophisticated beast and no one wants to deal with that.
And that's what Cloud Native PG does for you.
It gives you UI and a way to configure it and away you go.
- And then after that,
we have Valky.
- Yeah, Valky.
Which is our Redis drop-in replacement.
If you're not using Redis in your Django apps, you should be.
even if nothing more than just the Django template cache, I would turn that on.
We've been using Mailhog for our email locally.
So this is a local developer tool.
Allows you to simulate email being sent off of your development instance without actually sending email anywhere.
- So it's a little
bit like mocking email.
- Yeah, yeah, it's super nice.
It runs an SMTP server, it gives you a web UI.
It looks like real email, it gives you an inbox so you can basically see what your end users are gonna see.
Argo is the CI/CD product, but the open source GitOps.
So it watches your repositories, kind of tracks the status of the deployments.
- Okay, so you basically pick
a prod branch or something like that and you push the prod then magic happens.
- Yeah, Argo does the magic behind that.
And you can see that it also gives you a bit of a insight into your cluster, you know, what's running, what's being deployed, what state they're in, you know, it handles all the like blue green, you know, rollout of new code, new pods and new containers into your clusters.
It's, yeah, I can set up a
QA cluster as well.
Yep. Right. Just pick a different branch and have it watch that. Right.
But that's what we do. So inside the SCAF built skeleton you get on your file system, you're going to have a Kubernetes manifest directory that has a base set of manifests, which are, this is what's needed to define the deployment and the services and all the bits.
And then each environment, for example, like the sandbox environment, has an Argo running that'll be watching for sandbox changes, and the production environment will be watching for production changes. Another thing we standardize on here that's not listed is things like sealed secrets. So you can check in your secrets to your Git repository for sandbox, for example, but the only machine on the planet that can decrypt them is the sandbox instance, because you actually use the sealed secrets operator to do the encryption. And the only The only way it can be decrypted is if those things are sitting in that cluster, in the sandbox cluster or in the production cluster.
So what's nice is the sandbox cluster cannot decrypt the production secrets.
So you can have, obviously you want to have different secrets for production than you do for sandbox.
So you can have least privilege.
You know, developers have access, maybe more unfettered access to sandbox, but they may have more limited access on production.
And tools like sealed secrets and customize and Kubernetes manifests and sealed secrets actually make all that work.
Okay.
Yeah.
And that's, that's news to me as well.
This one, I love it.
I do something similar with my things as well.
Like I know a lot of people have huge environment variable definitions of all their, I'm like, yeah, you just, you just need one value that unlocks the other, you know, highly encrypted stuff.
Now for, for someone actually asked a question I'm getting ready to answer, which is about external secrets and services for those things, local development, we've have an opinion around using one password for all of our secrets management, whether it's like passwords for websites or API keys, or in this case, development environment, database passwords, development environment, you know, secrets, like Django has a secret, Django secret in there, things like that. Those are actually, in our case, environment variables. And we use the one password command line tool to only decrypt them ever in memory. So when you run like the Django start, or like the anytime you run the Kubernetes cluster locally and kind, it will feed those environment variables via the config map into your cluster so that it can access the database in the cluster locally. So even locally, you have a long, random, unknown password to you that is actually stored in one password. So if you want to go use your, I use Postico as a GUI for accessing my local Postgres, I can use that. I can actually feed the data from one password and actually access my services. So locally using one password and environment variables and config maps. But when going to sandbox, we just use sealed secrets on sandbox and production for mostly cross-platform consistency. You could be using, you know, SSM parameter store on Amazon or secrets manager on Amazon, but then that won't work on Google or won't work on Azure. And so we just standardize around the sealed secrets for ease of deployment to any cluster in any platform anywhere.
Yeah, the one password new CLI stuff and SSH.
So nice.
Secret provider, whatever you call that thing.
Yeah, it's super nice.
Yeah, if you've not turned on the SSH keys for your 1Password CLI, I have no secret keys, no SSH keys, no API credentials.
I have no secrets on my file system unencrypted.
They're living in 1Password and 1Password proxies that access when needed.
Yeah, that's pretty neat.
I feel like I should maybe embrace that more.
I embrace 1Password a lot, but there's more.
Especially when
you're working on multiple projects and multiple environments and you want to, again, have that least privileged access.
You don't want to have one key to rule them all.
You want to have keys to get you access to Sandbox, keys that can get you access to production, and you want to be able to give only certain people access to those production keys and only certain people access to Sandbox keys.
And we actually do that with, so we're a Microsoft 365 shop.
We use Microsoft's Entra Directory service, which is their Azure Active Directory product, and we use security groups.
And so based on what security groups or what project you're working on, gives you access to only certain vaults inside of one password, gives you access to only certain accounts inside of Amazon and those kinds of things are all wired up to our, our single sign on platform.
Yeah. Very nice.
Traffic.
Traffic's just an ingress controller. it's like a load balancer
type thing.
Yeah. It's a load balancer kind of cloud.
If you rethought about a web server and it was cloud native and containers and understood clusters like Kubernetes clusters, this is what traffic is.
Um,
I see.
So maybe a better analogy would be like IngenX or yeah.
Yeah.
I mean, I think we all grew up,
we all grew up on IngenX and made it do all the crazy reverse proxy things like traffic is the one born in the cloud native world version of that.
Now IngenX has their own ingress controller as well that they've re rewritten to be more cloud native.
That's just what traffic is for us.
Um, cert manager again, handling things like TLS certificates and renewals and you name it, cert manager, make sure.
How's that different than Let's Encrypt and Certbot and things like that?
I mean, it's really similar in those cases.
I think actually Certmanager, I think, is using Let's Encrypt under the covers.
I could be wrong on that one.
Maybe more
cluster focused because that could be a real challenge.
Well,
because a lot of the, again, another beauty of Kubernetes that I don't think a lot of people talk about is the operators.
These are like, you know, extensions or plugins to the Kubernetes cluster that give you superpowers to do things like make sure the certs are always, you know, renewed, make sure the latest code is always deployed.
Make sure the database is highly available and backed up.
Make sure, you know, that's what these operators do in the Kubernetes world.
Is there like just plugins to your cluster that give you these extended capabilities?
And that's what CertManager is, it's another one of those.
So, and that handles the certificates and grass routes.
That's all like kind of traffic CertManager certificates.
It's all,
yeah, it's all together.
All together.
Won't give you the certificate unless it can prove that certificate, that domain routes back to that thing.
And yeah, it's great, but it does get a little complicated in Docker already.
And then I can imagine auto scaling blusters that gets thrown away.
You want it all just to work.
Yeah, you don't want the certificate expired.
Warning, danger, do not proceed to this website.
Oh, no.
All right, we got Prometheus in the house.
Well, and Prometheus and Grafana are
kind of together here.
It's nice to have a observability, be able to see stats and trending data, to be able to make decisions on how you're scaling or handling load.
It's hard to predict sometimes what a service is going to do when you go deploy it to real users.
Real users have an uncanny knack of pushing buttons and making things happen that produce lots of crazy edge cases.
- Right, this part was slow, so I just kept pushing the button.
Like, you know, it's how
much more load you're putting.
It was really slow, 'cause I couldn't handle it.
- And you'd prefer
that you know about these problems before your users report them to you.
So tools like Prometheus and Grafana and Loki.
So Loki specifically is log aggregation.
Prometheus is going to be a lot of metrics.
And we combine those all into like Grafana dashboards.
The trick here is, you know, you want to be able to get all the data, but then you got to make something meaningful of the data.
And so we try to put in some, you know, default dashboards that give you that.
If I was stuck on an island, what was the one screen of information I might need to make a business decision about what's happening here type view of things and not overload you with too much information.
But you want to be able to dive deeper and see, oh, you know, when the database backup kicks in, the IO all of a sudden goes crazy. And that's why we're seeing a dip in here.
And that's why there was a failover. Like, be able to trace back those things without data is impossible. And you only again, because we're in a clustered world and there's lots of interdependencies and these things can scale out, you could have many, many nodes running these tools, you got to have some way of getting a, I hate to say it, a single pane of glass. I'll put that out there.
I
can see my entire business in a single pane of glass. It is humming smoothly.
Yeah, I'm sure
all the IT folks, they all just cringe to like, "Oh my God, he just said it." Some
people cringe and say, "Yes, they're speaking my language." Out there, my goal in the audience, the Media Cube from EPS is all of the pre-configured dashboards for Yeah, it's out of the box.
Yeah,
yeah, yeah, yeah, definitely.
I mean, there's there's so many good example dashboards under Fanta that it is no reason not to be using this for durability.
And this is like the table stakes, like you better start here and you better just do it.
But a lot of people deploy an app and then they they I mean, how many times have you worked within a developer and you're like, well, if something's wrong, I can't figure out why.
And the first thing you tell them, I guarantee you, Michael, the first thing you tell them to do is did you look in the logs?
And they're like, no, I didn't look in the logs.
I'm like, well, that's the first thing I do is go look at the logs.
Yeah, that's the second thing you tell them.
What's the first?
First thing is, do you have logging?
[laughing]
True, okay.
Yes, I have it.
Okay, did you look at them?
Fair enough.
I was about to ask you though, like, do you have, do you have logging set up in this?
And do you have like Log Guru or do you have Logbook or do you just do Python logging or what's the
story?
Yeah, I mean, we're using containers, so things should be set up to log as we would expect them in Kubernetes.
So it's kind of like the if you've ever looked at the 12 factor app, you know, there's opinions about how logging should happen.
That's what we adhere to is that logging should end up in a natural spot where it's easy for us to aggregate with tools like Prometheus and Grafana and actually then action and do something with them.
So we typically have another SSH
into other machines to see, well, what's this thing doing? What's that doing?
And that's one thing I want to have no SSH into these clusters.
Actually, one of our deployment opinions here is using things like Talos Linux for our Kubernetes deployments.
Talos does not have a SSH shell enabled.
Talos Linux has the ability to launch Kubernetes clusters.
So you can use kubectl to manage your Kubernetes, but then you have the Talos CTL to manage Talos.
There's no reason to shell into a box.
It's just another security surface that you can now get rid of.
>> Yeah. Very interesting. There's a couple of
these single-purpose Linux distributions out there that are really, really cool.
>>
We've evaluated quite a few, And this is the one we picked.
I liked its opinions.
I liked its approach.
I like the community that's behind it.
One thing when you're picking a lot of these software tools is you need to look at the communities.
You need to see how active they are.
You need to understand, is this going to be a viable project, you know, five years from now?
'Cause these are opinions you'll pick now and you'll have to live with potentially a long time.
- That's a great point.
Is this going to be your hobby project that you're going to have to keep it running for
everyone else?
Or is this thing got a life of its own?
'Cause I don't need another hobby.
- Yeah, exactly.
We want this to be for real.
Yeah.
Let's do one more shout out of all the building blocks here.
Sentry, you know, long time sponsor, friend of the show.
Yeah. So again, observability tools like this, especially when it comes to like tools like Sentry or even DataDog and New Relic, we just happen to pick Sentry because I like, again, like the community.
I like the people who are behind that tool.
I can't tell you how much time a tool like Sentry has saved us when trying to diagnose and debug performance issues.
I know it has lots and lots of features it can do, But when you're looking at a stack and you've got a n plus one performance issue going on with your database queries and its integrations with Django, its integrations with Redis and Postgres, just make tracking down that kind of stuff so much easier.
We again, I'll go back to that 2020, 2021, when we launched Loud Swarm as a virtual event platform space.
being able to deliver the schedule to a React application quickly as it's changing throughout the day was actually a big performance challenge.
And Sentry highlighted exactly where the problems were.
And then we just implemented a simple Redis cache that took us from 90 second generation of the schedule down to like milliseconds.
And that was because we were able to pinpoint the issue really, really carefully and really, really close to a Sentry.
It just, it bubbles up your problems and now you just go pick off the low hanging fruit.
Yeah, that's awesome. I've also used it for error monitoring stuff and it's, I'm more than one, I know I say this on the show for some of the ads, but more than once, and this is not an ad, but I've certainly gotten an error and it's got all the variables of not just the stack trace, but actually the variables of what user ran into problems and all sorts of stuff.
And I reached out to multiple people, said, I see you ran into this problem. I'm really sorry. I fixed it. Give it another try. And I'm sure that's a creepy experience in one way, but also you're like, geez, that doesn't happen very often.
But you know, like, well, I fix it and I know who it is.
I might as well tell them like, hey, sorry, you hit this.
Yeah.
One tool we've not mentioned here that is not in this list that I think is super important to our staff stack is Tilt.
That is the local Kubernetes management tool of choice that we have picked.
And if you've not played with Tilt, we've gone through different tools along the way.
There was one called Scaffold and I can't remember the other ones we tried.
There's numerous ones out there who basically sit in this space and try and solve this problem.
But the killer feature for Tilt was two-way sync between your cluster and your local machine.
So again, if you're running locally and using Kine, you probably don't notice anything because Tilt is watching your file system, synchronizing your files into the Kubernetes cluster for you to work, but it also does the reverse.
One of the key bits I wanted was when you do a compilation of your requirements for your project, you're running Django and you've got a whole set of requirements, if you get into some trickier things, like around the data science world, there may be things that compile differently on macOS than on Linux, than on Windows, because they use some slightly different dependencies.
That can be tricky when you're working in a container world.
So you want to make sure you're doing your pip-tools compile, well, via UV, but your pip-tools compile in the container, in the target environment of where this is going to be deployed and built, because you'll get different results if you ran that pip-tools compile on your Mac, as opposed to into the Linux VM or Linux container.
- Yeah,
that's true.
>> A platform specific wheels.
>> Yeah. So tools like Tilt makes sure that I can run my thing in the container, and the result of it synchronizes back to my file system, and then I check that into the repository.
That was a key bit there.
Again, it has a lot of other cool things, nice UI.
If you fire up Scaf, at the very end of it, it'll tell you, "Congratulations, you got a new project on your file system.
CD in your project and just type Tilt up." You type Tilt up and you hit space bar, I think it is, and it launches a web browser with all the status of all the containers that are running locally.
You can see all the logging, you can tilt watches for changes to your local file system for the code, tilt watches for changes to the Docker files.
If you change the Docker file out from underneath tilt, like while you're developing, say you're adding a new layer, a new dependency or something that's needed in Docker and not in your Python, tilt will rebuild the container immediately for you.
Like without you having to do anything, like you just kind of, you just code along and tilt keeps up.
- Wow, that's awesome.
- Yeah.
setting your unit has
to run on every save.
>> Exactly.
It is. It's fast.
Sometimes you barely even notice.
Like if you're working in a very late layer in the build, those builds can happen really, really quickly because most of the stuff is cached.
Just notice of opinions.
We've really tried to finally tune all the caching in the Docker files and all the layers so that these images build fast, they build slim, they use caches.
So if you're running locally, it's going to cache things locally in your file system.
you blow things away and start over again, it doesn't take forever to download all the stuff.
It should be pulling from your local cache.
- Yeah, that's a big shift when you're doing container type stuff.
- Oh, man, 'cause some folks may have a not great experience with containers because of the size of some of these things and because they're not effectively using caching.
This is a game changer.
- Right, it 100% is.
And just maybe potentially just
reordering or splitting up commands could make - Oh, yeah.
- 10x difference in speed.
- Well, and you were the one who convinced me to switch over to UV inside their container builds as well.
And that absolutely sped things up.
Speed is a feature.
I know you had that interview with Charlie, and that was one of the things that came out of that, but it's stuck in my head is speed is a feature, and I take that everywhere with me.
- Yeah, that's awesome.
It's a cheat code for sure.
It's like, oh, we've hit it three, 10 times.
Let's try that, that's awesome.
And then, yeah, you can layer on more caching on top of that and make it even more ridiculous.
All right, I think that's probably it for the time to talk through this.
What a cool project you got here.
Let's close it out with a roadmap.
- So we've got a lot of things coming.
One of the big ones is a big shift from using Cookie Cutter, which I've mentioned already, to using Copier as our underlying templating product.
The big benefit-- - Tell people what Copier
is, yeah.
- Yeah, so Copiers, like Cookie Cutter, actually is a drop-in replacement for Cookie Cutter.
You can use your Cookie Cutter templates you've already built with Copier, but now you can actually modularize them and upgrade them.
So one of the problems with Cookie Cutter, was it was kind of one and done.
Like you blew out your template onto the file system, you've got your code. That's the last time you would touch cookie cutter.
But if new opinions come around, which we're constantly adding new opinions to SCAF about how we do dev and how we do deployment, you would want those to roll back into old projects that had been built with that same tool.
Copier enables this.
Copier now allows us to rerun against an existing project and adopt new opinions that have been made from the source template. And that's another change we're making is we're actually allowing Scaf to have multiple template types.
So right now, the Scaf kind of runs in a full stack Django app mode.
We're going to have the Scaf Lite version, which may be serverless.
We're going to have the appliance mode, which would enable not using Argo CD, for example, but different ways of updating.
We'll have opinions that are not Django necessarily.
They may be more data pipeline versions of your apps.
And so those will be templates that can be updated and and redeployed and kept up to date with Copier.
That's cool. Yeah, I can see a whole idea, a whole concept of this for ML workloads and science
workloads. And we don't actually need a web app. Exactly.
What we need is data ingestion and intel and we want results, either a notebook or just something in a database on the other end of them.
Yeah. Yeah, that's a big, that's a big deal. And that's another thing that is included in Skap Opinions is the CI pipeline, the GitHub actions, Bitbucket Act, you know, workflows or whatever their CI thing is called. Because those Those are important, those need to be there day one, 'cause they're so hard to tack on later, or you just get busy and you don't tack them on when you should have.
- Yeah, it's good to have all this experience and all these rounded off rough edges put together in one box for you, very cool.
All right, well we're certainly out of time, Calvin, so how about, we've got two things to close this out, unlike normal.
So let's close it out with a final call to action.
People are interested in SCAF.
- Yeah, they
should definitely go to-- - Should I go to Starrett?
- Yep, go to Starrett.
log in apparently. Yeah, go hang out, go to the 6github/scaph GitHub repository. It's a one-liner to install. I would love to hear your feedback, you know, any feature requests, you know, any bugs you find. We've worked really hard on ironing out a lot of those issues over the last year as we kind of pushed toward DjangoCon last year. It's amazing and mind-blowing to see how fast you can get a Django project up and running on your own machine with Kubernetes in the mix. Maybe people a little background information, like they're like, I heard of Kubernetes.
What do I do with it?
Like you got good resources for them to Oh, on YouTube, there's
an excellent YouTuber. Her name's Nana. So if you just search Nana and Kubernetes, she does an incredible job of explaining Kubernetes to everybody.
Yeah. I believe it's Nana Codes. Yeah. Technical Nana.
Yeah.
Yeah. She's awesome.
She's really good. Yeah.
She's really good.
a great way of explaining these kind of deeper technology things.
That's literally where I went.
I was like, I need to know more about Kubernetes.
I went and watched her videos.
I met her in person.
She's actually an AWS hero.
And she was at reInvent a couple of years ago.
And just again, superhuman being doing this for the love of technology.
Actually, I can give a shout out also to one of the people in the chat.
Michael Levin is also a prolific YouTuber on Kubernetes.
Oh, no kidding.
Okay, I'll put a link to his channel as well.
Awesome.
All right, well, Calvin, thank you for being here.
It's been awesome.
I can't tell you how excited I was about the opportunity.
Yeah, it's been super
fun and I
was excited as well.
So much so, so much so that I've made a theme song for this episode.
I'm not going to play it on the YouTube live stream version.
It's just the logistics of that are a little bit challenging.
But I'll put a link
in
the YouTube description in a day or two.
And when this show comes out, it's going to be at the end.
And so if you're listening through the MP3 version of your podcast player, be sure to listen to the end.
There's gonna be a-- - Get ready to crank
it up.
- Yeah, so here's the thing.
If you like Linkin Park and that style of music, you're gonna love it.
If you hate Linkin Park, maybe call it a show.
Anyway, it's gonna be super fun.
We'll put, let's deploy, or deploy the dream at the end.
It'll be a great theme song to round things out.
And with that, Calvin, thanks for being on the show.
- Awesome, thanks, Michael.
- Yeah, bye.
(gentle music)
(dramatic music)
Every line in the repo, a key to set us free And now we break through on Talk Python To Me!
Deploy the dream Shake the ground under your feet Surge forward in the stream Python code is moving heat With Talk Python To Me We ignite the synergy Let's tear down walls, let's own the scene Deploy the dream ♪ Deploy the dream Shake the ground under your feet Search forward in the street ♪ Python code is moving heat ♪ With talk Python to me We ignite the synergy ♪ ♪ Let's tear down walls ♪ ♪ Let's own the scene ♪ ♪ Deploy the dream Shards of GML swirling in the night ♪ ♪ Argo CDs overhead guiding by its light ♪ ♪ We watch the pipeline triggers ♪ ♪ Silent countdown clock ♪ ♪ From dev to prod, we're unstoppable stock ♪ ♪ The logs are rolling in, Prometheus can see ♪ ♪ Our metrics rise like signals, a living symphony ♪ ♪ Mailog sends illusions to the test in the sky ♪ ♪ While Sentry's capturing errors with an all-seeing eye ♪ ♪ We commit, we build, we test once more ♪ ♪ Containers racing onward to the cloud's front door ♪ ♪ Resilience in the code, watch the pods come free ♪ ♪ The stage is set now on top, Python to May Deploy the dream Shatter limits that confine A brand new scheme Pushing progress down the line We're unstoppable now Calvin's leading strategy Let's break the mold, let's rewrite souls Deploy the dream Deploy the cap Offtense beat and build dealing intensity ♪ I see the server lights blinking in the distance ♪ ♪ Code commits illusion smashing with persistence ♪ ♪ Dive deep into the backlog we're forging the path ♪ ♪ Docker image at the ready time to feel the wrath ♪ ♪ Python in my veins blueprint on the screen ♪ ♪ Dev to stage to prod no in between ♪ ♪ We scale up, scale out then break the routine ♪ ♪ This is talk Python to me ♪ ♪ A new reality ♪ Toss the girls belt, belt them ♪ ♪ No code left behind ♪ ♪ We share the knowledge so all devs can find ♪ ♪ A way to unify the spark ♪ ♪ A chance to break free ♪ ♪ Join Calvin, Hendrix, Parker ♪ ♪ Let's make history ♪ Deploy the dream ♪ ♪ High voltage in our core Evolve the theme We're unstoppable once more ♪ Untalk Python to me ♪ ♪ Our voices ring in synergy ♪ Now let's ascend ♪ ♪ Let's set this free ♪ I dream
the
dream
This has been another episode of Talk Python to Me.
Thank you to our sponsors.
Be sure to check out what they're offering.
It really helps support the show.
This episode is sponsored by Posit Connect from the makers of Shiny.
Publish, share, and deploy all of your data projects that you're creating using Python.
Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quarto, Reports, Dashboards, and APIs.
Posit Connect supports all of them.
Try Posit Connect for free by going to talkpython.fm/posit, P-O-S-I-T.
This episode is brought to you by my new book, "Talk Python in Production." I've long felt that most guidance and marketing about how we need to run Python apps in production has been overly complex and expensive.
This book is both a look at the history of Talk Python To Me and an antidote to this overly complex cloud world.
Read it online and get the full book at talkpython.fm/devopsbook.
And to level up your Python, we have one of the largest catalogs of Python video courses over at Talk Python. Our content ranges from true beginners to deeply advanced topics like memory and async. And best of all, there's not a subscription in sight. Check it out for yourself at training.talkpython.fm.
Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
We should be right at the top. You can also find the iTunes feed at /itunes, the Google play feed at /play and the direct RSS feed at /rss on talkpython.fm. We're live streaming most of our recordings these days. If you want to be part of the show and have your comments featured on the air, be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
This
is your host Michael Kennedy. Thanks so much for listening. I really appreciate it. Now get out there and write some Python code.