Skip to content

This application mimics Yelp and is based on showing Ethnic Stores around a user.

Notifications You must be signed in to change notification settings

Anjola85/ethnic-store-application-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Installation

$ yarn install

Database connection

  • Add IP address of computer to the list of whitelist IPs on mongoDB Atlas

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev
or
$ yarn dev

# production mode
$ yarn run start:prod

Adding dependencies

$ yarn add --dev package_name

or

$ yarn add package_name

Environment variables

  • Create a config folder in the root directory of the project
  • Add .env file and specify your variables

Generate private_key.pem

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

Setting up gitignore

  • 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}

Commiting your changes

  • 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"

Project variables

  • DATABASE_URI : mongodb uri consisting of your username, password and cluster number

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

Deploy to ECR

To connect to EC2 via console

ssh -i "quickmart-secret.pem" ubuntu@ec2-44-211-194-83.compute-1.amazonaws.com

NOTE: the public ip might change

These are the steps to push the docker image to AWS ECR reposiotry

NOTE: make sure docker desktop is running

  1. 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

  2. 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 .

  3. 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

  1. 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

Steps to make the docker image available on AWS EC2

NOTE: NEVER Login with AWS Credentials, create IAM Role to grant access to the ECS: sudo chmod 666 /var/run/docker.sock

  1. 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

  2. Run docker images to see if the image has been added

  3. Run docker stop {pid} to stop previous image

  4. 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}

  5. Run this to check if image is running docker ps

  6. Run this to see the logs, add -f (to see the love feed) docker logs {container id} -f

Clearing Docker storage

  • docker system prune -a

  • docker volume prune

Support

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.

Stay in touch

License

Nest is MIT licensed.

About

This application mimics Yelp and is based on showing Ethnic Stores around a user.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages