text
stringlengths
0
1.8k
\[24:10\] Essentially, that goes directly to AppSync. At the moment we don't \[unintelligible 00:24:13.05\] but that might be an option for the future. So AppSync directly goes to the individual services to get the requested data, and then it does that through Next.js, which sort of caches some pages that don't change ...
**Gerhard Lazu:** That makes sense. So Next.js - I imagine that is a JavaScript framework, right? Based on React. That's my understanding. So how do you serve that to users? So if a user goes, for example, to SkyhookAdventure.com, I imagine they load this Next.js-based response...
**Wycliffe Maina:** yeah.
**Gerhard Lazu:** Where does that get served from?
**Wycliffe Maina:** That's based on Vercel. Vercel.com I think is the website... Which basically is like Netlify. It's built on AWS as well, and uses Lambdas under the hood. Basically, each page we have is a Lambda function, but Next.js sort of abstracts that away from us.
**Gerhard Lazu:** So I still in my head am not understanding this... So the request comes in, the DNS... What does the DNS for SkyhookAdventure.com point to?
**Wycliffe Maina:** It points to Vercel servers.
**Gerhard Lazu:** Vercel, I've never heard of them. We'll need to put it in the show notes, because I've never heard of them. Okay... And they are similar to Netlify, right?
**Wycliffe Maina:** They are much similar to Netlify. In fact, they have a lot of similarities. Netlify is the more mature of the services, but Vercel has a zero config option, which means you give them an application, whether it's Next.js or any other framework, and you can get up and running without having to configu...
**Gerhard Lazu:** Interesting. And how do you give them this application?
**Wycliffe Maina:** They have a GitHub application. You connect your repository to their servers, and they determine which sort of application it is, and determine the configuration required \[unintelligible 00:26:04.21\] on their servers.
**Gerhard Lazu:** Right. That's really interesting.
**Wycliffe Maina:** Of course, we are using a custom deployment environment, because we need to pass in some environment variables from AWS, which means we have our own custom CI/CD environment to deploy that.
**Gerhard Lazu:** Okay. And where does the CI/CD run? What is CI/CD in your case?
**Wycliffe Maina:** In our case we basically use GitHub Actions. The faster step is usually to get the secrets from AWS, that is SSM mostly... And \[unintelligible 00:26:35.02\] the URL of the API, AppSync API, and then passes that over to Vercel, so that it can \[unintelligible 00:26:46.04\] the build.
**Gerhard Lazu:** That sounds really interesting. Okay... Again, I've never heard of this service. I definitely wanna check it out. I think you said why you chose it, because Netlify just requires more configuration, right? That was my understanding.
**Wycliffe Maina:** Yeah. With Netlify you have to do a lot of configuration for different environments. It too has improved over the last few years, but the zero config, and then also you factor in that Vercel is the parent company for Next.js, so it's their own product...
**Gerhard Lazu:** I see...
**Wycliffe Maina:** So it becomes a very good combination.
**Gerhard Lazu:** I see. That makes sense. Okay, that makes sense. And do you have multiple environments? Do you have like staging, or per-feature environments? Or is there just like a single production?
**Wycliffe Maina:** That's the beauty of using Vercel - another advantage is that each PR you have gets its own unique URL. So if multiple people build different \[unintelligible 00:27:42.14\]
**Gerhard Lazu:** That sounds really interesting, and I really like that idea. I know Netlify does something similar. But I've never understood... For a stateful service - great. You have a feature environment. But what about the data? How do you do the data migration for that? How do you solve that problem?
**Alan Cooney:** \[28:06\] We would love to have one complete backend built per PR a well, which is close to being feasible in the serverless world, because it costs pennies to run... And then really per PR you could have your own \[unintelligible 00:28:17.03\] your own environment. But we don't have that; it doesn't s...
**Gerhard Lazu:** I see. Okay, and then I imagine that GitHub Actions does any migrations that it needs to do on the staging environment, so that the PR -- is that right? Or do you have like per-PR -- like, how does GitHub Actions know what to do on the staging environment based on the type of push or whatever action i...
**Alan Cooney:** It's basically configured in a GitHub Action file, a workflow file, per microservice, or there's a separate one for the website, the frontend... And that defines a series of steps that it goes through specifically for that service or the website.
**Gerhard Lazu:** That makes sense. So I'm imagining that you have different repositories per microservice. Is that right?
**Wycliffe Maina:** No, we have a single repository for all our services.
**Gerhard Lazu:** Yes! I've got something right! Yes! \[laughter\] I'm a big fan of single repositories. Why? Because it keeps everything simple. Now, I know that's something we discussed in 2019... How well did it actually work in practice with all these changes? I'm so curious to hear about this.
**Alan Cooney:** This has been a super-pivotal thing in terms of leverage that you yourself have had on the company, Gerhard, in terms of saying "Both let's split it up into microservices, but also, at the same time, let's bring everything into one repo on GitHub." And the beauty of it is -- for example yesterday I pus...
**Gerhard Lazu:** Wow... I'm getting so warm and fuzzy right now, and it's not the weather, I can tell you that... This feels great. I think this is the best feedback I received all week, all month... I don't know, this was like amazing. Okay... Wow, it makes me so happy; you have no idea. Great.
I'm wondering now, Wycliffe, what does a merge into the main branch look like? What happens between merging into main and the code appearing in production? Can you run us through that? You have three minutes, because that's how long it takes, right? \[laughs\]
**Wycliffe Maina:** Yeah, \[unintelligible 00:30:51.14\] so it's going to be a single commit... And the first thing it does is run a few tests, that is unit tests. And once that's done -- so that means also running the linting, and also trying to build it so that we can catch all errors that are \[unintelligible 00:31:...
Then after that \[unintelligible 00:31:33.12\] The reason we do this is because sometimes we run integration tests \[unintelligible 00:31:39.01\] staging, which is the step that comes after deploying to staging. And \[unintelligible 00:31:44.26\] on the staging environment that is the integration tests, then the deploy...
So all in all, depending on the amount of tests and the size of the codebase, that may take anwyhere between one to three minutes. On our new smaller services it's even faster than that.
**Gerhard Lazu:** \[32:07\] Do you find yourself pushing changes at the same time to multiple services? Alan, you mentioned yesterday you made a change... What does that look like, I'm wondering, Alan?
**Alan Cooney:** Yeah. I don't do it that often, to that many services, for sure. That was actually a change for billing tagging in AWS. But basically how it works is - for example, you want to update the website and your backend service. You can push those through at the same time, especially if the website feature is...
There's actually quite another cool feature here, which is that we use GitHub Actions, which means we can have very specific tests for specific services. Saul mentioned our API service, which basically just has a GraphQL schema, and that checks for breaking changes to the schema on every push... Which is obviously supe...
**Gerhard Lazu:** That's interesting... Okay. So you have all these tests, all these services... How do you configure them? How do you set everything up in the first place? Because there's quite a bit of things, like GitHub Actions, on AWS you have all those services... How do you set everything up? What do you use for...
**Saul Cullen:** So before CDK there's Hygen that we use. When we first build a new service, what we'll do is we'll code-gen it using a tool called Hygen, and that sets up the basic template of each service. So the core things that we require in a service will be there, will be ready to use, and will be standardized ac...
**Gerhard Lazu:** Okay. Where do you store all this config?
**Alan Cooney:** Hygen is very interesting in that it actually stores your config in your repo, next to where it's being used. So that makes it super-easy to edit, because obviously -- so it contains things like testing and linting setups, so we can go in there and add something in very easily if we want to change how ...
**Gerhard Lazu:** Okay.
**Alan Cooney:** So it's committed up, essentially.
**Gerhard Lazu:** Okay, that's great. It's version controlled. I love the sound of that. How does it get applied? How do all those changes get rolled out onto AWS?
**Alan Cooney:** When we were working together a couple of years ago, Gerhard, we were using CloudFormation...
**Gerhard Lazu:** Yup, I remember that. Oh my goodness me... \[laughter\]
**Alan Cooney:** And one of the things you said, which is obvious in hindsight, is "I really hate yaml, especially when it's 500 lines long for a service." And of course, our services - they're mostly not actually Lambda code; they're things like Simple Queue Service (SQS) queues, and lots of built-in AWS products to r...
**Gerhard Lazu:** \[35:58\] Okay, that sounds like a very good setup, I have to say... And I also would like to add that my relationship with yaml went through different cycles. It's definitely a love/hate sort of thing, I have to say that... But I think my biggest distaste from abusing yaml came from seeing it being u...
I remember that moment, and I think I will remember it till the end of my days; that was horrible. Why would you do that? If you want to do that, then just use a programming language, like TypeScript. That makes a lot of sense. I remember that moment. So I'm really glad that you went down this path, because if you do h...
**Alan Cooney:** Yeah, that's had a big impact on us. One of the most depressing things is changing a small piece of CloudFormation and then waiting 15 minutes for it to tell you that there's something wrong in the CloudFormation.