A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
$ yarn install
- Add IP address of computer to the list of whitelist IPs on mongoDB Atlas
# development
$ yarn run start
# watch mode
$ yarn run start:dev
or
$ yarn dev
# production mode
$ yarn run start:prod
$ yarn add --dev package_name
or
$ yarn add package_name
- Create a config folder in the root directory of the project
- Add .env file and specify your variables
Enter this in terminal in the root folder:
openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:65537
- Setup a global git ignore by creat the file in your root directory
- copy and paste this
git config --global core.excludesFile {path to .gitignore file}
- Create a feature branch off of develop
- git branch -b "name of branch"
- git add .
- git commit -m "your message"
- git push -u origin feature/"name of branch"
- DATABASE_URI : mongodb uri consisting of your username, password and cluster number
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov
ssh -i "quickmart-secret.pem" ubuntu@ec2-44-211-194-83.compute-1.amazonaws.com
NOTE: the public ip might change
NOTE: make sure docker desktop is running
-
Retrieve an authentication token and authenticate your Docker client to your registry. Use the AWS CLI:
aws ecr get-login-password --region ca-central-1 | docker login --username AWS --password-stdin 376620901748.dkr.ecr.ca-central-1.amazonaws.com
-
Build your Docker image using the following command. For information on building a Docker file from scratch see the instructions here . You can skip this step if your image is already built:
docker build -t monolith-ecr .
-
After the build completes, tag your image so you can push the image to this repository:
docker tag monolith-ecr:latest 376620901748.dkr.ecr.ca-central-1.amazonaws.com/monolith-ecr:latest
Optional:
To run: docker run -p 7080:7080 image_name
- Run the following command to push this image to your newly created AWS repository:
docker push 376620901748.dkr.ecr.ca-central-1.amazonaws.com/monolith-ecr:latest
NOTE: NEVER Login with AWS Credentials, create IAM Role to grant access to the ECS:
sudo chmod 666 /var/run/docker.sock
-
Run the following command to pull this image from the ECR Repository on EC2
docker pull 376620901748.dkr.ecr.ca-central-1.amazonaws.com/monolith-ecr:latest
-
Run
docker images
to see if the image has been added -
Run
docker stop {pid}
to stop previous image -
Run the following command to expose the port in background mode
docker run -p 7080:7080 -d 932400219699.dkr.ecr.ca-central-1.amazonaws.com/quickmart-server:{tag_name}
-
Run this to check if image is running
docker ps
-
Run this to see the logs, add -f (to see the love feed)
docker logs {container id} -f
-
docker system prune -a
-
docker volume prune
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.