text
stringlengths
0
1.49k
**Erik St. Martin:** It has its moments... The beginning of the year is usually pretty heavy, and then the month before the conference is really insane, but it's all worth it to see it come together in the end. But we're super excited to have you, and the deep dive into concurrency and into channels is going to be real...
**Kavya Joshi:** Cool, I'm super excited to go to GopherCon this year.
**Erik St. Martin:** Is that another one of your passion things, where you're like "I wonder how that works..." and then kind of dive down?
**Kavya Joshi:** Yes, yes... And especially with channels in Go, they're offered such a language primitive... So diving into how they worked was quite fun. And also the fact that they interact with so many parts of the runtime, as you'd expect. I'm excited about the talk.
**Erik St. Martin:** I'm kind of sad, I'll have to wait a month to see it... \[laughter\] Because usually the conference is so busy, we usually watch everything when the videos come out.
**Kavya Joshi:** Yeah, that makes sense.
**Carlisia Thompson:** I wanted to ask you about the article you just wrote for O'Reilly... I read through it, it's pretty awesome. Samsara, where you work -- is it Samsara?
**Kavya Joshi:** Yeah, that's right.
**Carlisia Thompson:** Do you follow these guidelines...?
**Kavya Joshi:** \[laughs\] Trick question... \[laughter\]
**Erik St. Martin:** Do you practice what you preach?
**Kavya Joshi:** So we follow most of everything in that article. For example, we use the [panic wrap](https://github.com/mitchellh/panicwrap) library that I talk about to report panics. We wrap all the goroutines that we create in a top-level function that does a recover for panic reporting, and we especially find the...
We use an [errors package](https://github.com/pkg/errors), so the package is popular and for good reason, it's a useful package. We ship application metrics, so that's three of five... What was number four...? Structured logging - we use structured loggings. We currently ship our logs to AWS's Elasticsearch service, bu...
Testing - I wish we did a better job at testing, or could... Just in general, we're having good testing practices, but at a system of our scale, unless you start with a good testing story from the beginning, it's hard to come in and get that rolling. We're getting there slowly, but I feel like on the testing side we co...
**Carlisia Thompson:** \[20:07\] Let me just mention that the article is on oreilly.com, and it's called [How To Ship Production-grade Go](https://www.oreilly.com/ideas/how-to-ship-production-grade-go). Definitely a worthwhile read. And I'm sorry, I didn't mean to put your company on the spot, but when I was reading th...
**Kavya Joshi:** Yeah. No, that's a good question. What about y'all? Do you have any good tips for other ways to make Go production-grade?
**Erik St. Martin:** Well, I guess a lot of it would be the same for any program in production - assume everything dies, and that nothing is perfect. You'll get a clock drift you'll get network issues... Those are usually the odd things to track down.
**Kavya Joshi:** Yeah.
**Erik St. Martin:** I think this is a good starting point for everybody, though.
**Johnny Boursiquot:** I think for a lot of us are using a twelve-factor model for configuration of your environment or the application runs, it's something that has been sort of a best-practice for a while now. I think it's still very applicable for Go programs, and it's something that we heavily use in our organizati...
Also, when it comes to designing your own applications, what we've seen that has worked consistently well for us, whether for program design or for making testing easier, we rely heavily on interfaces. We tend to rely on interfaces over concrete types quite a bit, and then we worry about the implementation details late...
Basically, that approach of saying "Hey, I may not have all the answers right away", but running on with some interfaces and help me understand the program a little bit I think has been really great for us in architecting our application the way we want it to be.
**Erik St. Martin:** I love a lot of stuff that's out nowadays too for just configuration management and secrets management too. That gets more and more important as you move applications through environments, and it prevents people from doing things like submitting credentials to GitHub repos and things like that. Tha...
**Kavya Joshi:** [Bolt](https://github.com/boltdb/bolt) is great!
**Carlisia Thompson:** Bolt is amazing. Docker also came out with a secret management system.
**Erik St. Martin:** Oh, interesting.
**Kavya Joshi:** Oh, yeah?
**Carlisia Thompson:** Yeah... Did I get it wrong? Nobody knows this? \[laughs\]
**Erik St. Martin:** I mean, it wouldn't surprise me, because...
**Carlisia Thompson:** I'm pretty sure.
**Erik St. Martin:** ...it falls in line with a lot of the container orchestration; [Kubernetes](https://kubernetes.io/) manages secrets, so with them doing their orchestration, it makes sense for them to also manage secrets being handed to containers. But I don't think I have seen that.
**Kavya Joshi:** I'm not super familiar, I haven't played with Kubernetes myself. We use AWS, so we just run our containers in [ECS](https://aws.amazon.com/ecs/). But how does Kubernetes do secret management?
**Erik St. Martin:** There's a resource type that is secrets, and you can manage things. Basically, there's almost like a manifest file that you use to deploy your containers or pods of containers out, and you can map in those secrets as either a file - so anything running in the container sees it as a file - or as an ...
\[23:58\] So your program can just assume that a file exists on a hard drive, or that an environment variable exists and doesn't need to know or care how it gets there, which is really great because the QA environment can have its own keys, production can have its own keys, the application doesn't change, and then for ...
**Kavya Joshi:** Yeah, that sounds useful.
**Erik St. Martin:** And I just realized we are running late for our first sponsored break. Let's go ahead and take our first sponsored break. Our first sponsor for today is Backtrace.
**Break:** \[24:33\]
**Erik St. Martin:** We are back, talking to Kavya. We were just talking about Kubernetes... We were just running a little late, so we had to cut that one short. Did you have any other questions about Kubernetes? Is that something your team is eyeballing?
**Kavya Joshi:** Eyeballing, but right now it's on the wishlist, because we run all our infrastructure in AWS, and AWS has its own container management and orchestration scheduling service called ECS. We're quite tied in at this point, but the more I read about Kubernetes, the more I wish it was easy to switch over...
**Erik St. Martin:** I haven't looked at Amazon's implementation of the container orchestration... But yeah, we typically try to design as much of the software as possible where it doesn't have to be aware that's it's run within a container... It's kind of like how the secret management works. Really, it could be [Meso...
**Kavya Joshi:** Yeah, so for our secrets, in ECS... Well, you basically run a Docker container. So you can pass in environment variables to your Docker container; other than that, I think you can manage access control on your other resources using Amazon IAM roles, uhmm, but yeah, I don't think they have anything spec...
**Johnny Boursiquot:** In our organization we too rely on AWS ECS for image deployments. Amazon has the KeyMS (Key Measuring Service), which provides you master keys that you can rotate on a regular interval. There's some best practices around that, but that allows us to get those keys, encrypt the secrets, and then we...
That allows us basically not to have to pass keys around, in the nude, so to speak, and basically just keep it encrypted until it's actually retrieved and decrypted in the environment that it's needed. That's worked out for us quite well.
\[28:00\] Going back to what we mentioned about Kubernetes... I read about Kubernetes and I'm like, "Man, they're doing some really cool stuff" and I'm like "Okay, we're still tied into AWS right now...", and trying to bring in Kubernetes and redo everything we've done - it's cool, but it's just too costly for us.
**Erik St. Martin:** I need to look at how that works, because I'm interested whether Amazon has some of the newer concepts of Kubernetes, like deployments or cluster federation. Deployments would be -- so you have these primitives, like a replica set... So you have a pod, which is a group of containers that move toget...
**Johnny Boursiquot:** Yeah, so on our end, basically we have -- Amazon has this concept of test definition, which basically says, "Okay, for this given container, these are the configuration parameters that we want. This is how much memory, CPU, resource allocation... When you have an HA environment, this is where I w...
Let's take a simple example. If I need at a minimum two of this particular container running, I'll say "I want a service with a desired account of two, and with a minimum health of 50%." At that point, what happens is when you have a new container that you wanna roll out, what it will do is because of that 50% requirem...
**Erik St. Martin:** That's awesome.
**Kavya Joshi:** That's what we do as well, but the additional piece that the ECS service doesn't provide is the load balancing. So you would have a load balancer (an ALB - application load balancer) in front of your service, for example, and if you set certain parameters on it, it will continue to route traffic to you...
**Johnny Boursiquot:** Yeah, we ended up having to, in the beginning, roll our own internal load balancer. We had one service whose job was to route traffic to the different services that it was aware of. We kind of had our own service discovery behind the scenes, and internally we had an internal load balancer that ba...