From 5f7ef091ba67d941e9c1d4c0e0f645d33053e3a9 Mon Sep 17 00:00:00 2001 From: David Kotlirevsky Date: Fri, 5 Aug 2022 17:26:53 -0300 Subject: [PATCH 1/2] enhancement/ Add some notes on Readme * Add some notes to README to improve the experience about running locally: * redis local conf * how to run with docker-compose --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 71df8fc7..de4b95f4 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ This project includes the boilerplate for a basic rest-api made in Node.JS with 5. `cp .example.env.test .env.test` 6. Create your DB (i.e. psql for Postgres: `psql -U -h -c "create database ;"`) with same name as your .env file. 7. Run `ENV=[dev, test, prod] yarn db:setup`. -8. Start your server with `ENV=[dev, prod] yarn dev`. +8. Check Redis notes conf for running local. +9. Start your server with `ENV=[dev, prod] yarn dev`. ## Some scripts @@ -58,10 +59,10 @@ Also, for configuring the SonarQube keys you can follow the next [steps](https:/ ## Running with Docker ### Prerequisites -In order to run the app with Docker, you should install or update to the latest version, we recommend to install [Docker-Desktop](https://docs.docker.com/get-docker/) due to composer and some cool CLI-UI tools are included. +* In order to run the app with Docker, you should install or update to the latest version, we recommend to install [Docker-Desktop](https://docs.docker.com/get-docker/) due to composer and some cool CLI-UI tools are included. +* If you're running it local, don't forget to change REDIS_HOST to localhost into the .env.dev file. ### Development with Docker - The following commands will build and run all you need to start working on the base, without any other installation requirements. Important: if you already have postgres running locally, you'll need to kill the service before run `docker-compose up`. ``` @@ -69,7 +70,12 @@ docker-compose --env-file .env.dev build ``` ``` -docker-compose --env-file .env.dev up +docker-compose --env-file .env.dev up -d --no-recreate +``` + +if you only want to run redis and postgres locally: +``` +docker-compose --env-file .env.dev up -d --no-recreate postgres redis ``` ### Deployment with Docker (only for production) @@ -89,7 +95,7 @@ docker run --rm --env-file=.env.prod -p 3000:3000 --name node-api node-ts-api-ba ``` ### Fix issue at build docker image (dependencies to install bcrypt are not providede in alpine version of node) - + Add the following line before the command ` RUN yarn ` in the Dockerfile. ``` @@ -153,7 +159,7 @@ This is the suggested scaffolding for this project. You can take a look at: - [tsconfig-paths](https://github.com/dividab/tsconfig-paths#readme) - Utility to register relative paths set at tsconfig file - [express-rate-limit](https://github.com/nfriedly/express-rate-limit) - Basic rate-limiting middleware used to limit repeated requests to public APIs - [morgan](https://github.com/expressjs/morgan) - HTTP request logger middleware for node.js -- [nodemailer](github.com/nodemailer/nodemailer) - Module for Node.js to allow the easy email sending. +- [nodemailer](github.com/nodemailer/nodemailer) - Module for Node.js to allow the easy email sending. ## Code Quality From 4f24958e39305f39ffac21dd126b641f09bf0e44 Mon Sep 17 00:00:00 2001 From: David Kotlirevsky Date: Fri, 5 Aug 2022 17:45:52 -0300 Subject: [PATCH 2/2] Add REDIS password to allow running test locally --- .example.env.test | 1 + 1 file changed, 1 insertion(+) diff --git a/.example.env.test b/.example.env.test index 32848c04..cf0c2220 100644 --- a/.example.env.test +++ b/.example.env.test @@ -22,6 +22,7 @@ TYPEORM_MIGRATIONS_RUN = true REDIS_HOST = localhost REDIS_PORT = 6379 +REDIS_PASSWORD = redis #TOKEN