A tutorial showing the setup of a Node.js backend for AWS Elastic Beanstalk deployment. The developer creates an .npmrc file for dependency management, implements a health check controller in NestJS, and configures a Procfile to execute database migrations and start the production application.
Length 4:51
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #aws #elastic beanstalk #ci/cd #nestjs #prisma #deployment #programming #backend #vscode #javascript
0:00 All right, so we're almost ready to get started with 0:02 setting up a CI/CD 0:04 pipeline for our application running in AWS, 0:07 meaning whenever we push code to our GitHub repository, we're automatically 0:11 gonna build and deploy that latest code to our production 0:15 environment. 0:16 Now, there's gonna be a couple of tweaks we 0:18 need to make to our backend application 0:20 before we do this, so let's go ahead and jump into that now. 0:23 The first of which is to create a file called a 0:26 .npmrc in the root of our project. 0:30 So this is where we can define settings for pnpm. 0:34 In our case, we need to set a setting called nodeLinker 0:39 equal to hoisted. So what this does is essentially 0:43 it creates a flat node modules folder with pnpm where we 0:46 don't have any symlinks. So essentially, this is the same node 0:50 modules created by npm or Yarn. Now, we have to do 0:54 this in a cloud environment like AWS because we don't have a 0:58 consistent build environment where we can actually store our dependencies 1:02 outside of the project like we can do locally with pnpm. 1:06 So make sure we have this setting enabled in our npmrc. 1:11 And then the last thing we wanna do is create a health check controller for 1:15 our 1:15 application. So when our application is running on Elastic 1:18 Beanstalk, Elastic Beanstalk is automatically gonna be launching GET 1:22 requests at the root of our application to check for its health. 1:26 So as it stands right now, we don't have an endpoint to serve this, 1:29 so let's go 1:30 ahead and create one quickly by creating a simple 1:34 health.controller.ts 1:38 in the root of our project, 1:40 and we'll decorate this with @Controller. 1:43 And again, this will have no prefix because it'll be 1:46 at the very 1:47 root of our API. 1:49 And I'll go ahead and export class HealthController.
The rest of the transcript is for members.
Sign in