Simple socketIO server with mocha test, jshint and Redis authentication. Create for learning purposes
🙏*N - Can replace each other
🔥 - Complexity level
- NodeJS server version > 12 🔥
- NPM version > 6 🔥 🙏*2
- YARN 🔥🔥 🙏*2
- PM2 🔥
- Docker 🔥🔥
- Redis image version > 5.0 🙏*1 🔥🔥🔥
- Redis package version > 5.0 🙏*1 🔥
- Redis-tools package 🔥
- Install nodeJS and npm 🔥
- Install Docker 🔥🔥
- Install pm2 package globally(sudo required) 🔥
npm install pm2 -g
- Via docker-compose 🙏*1 🔥🔥
- Via docker run command 🙏*1 🔥🔥🔥
docker run -d --name redis -p 6379:6379 redis
- Via package 🔥
- Install redis-tools package 🔥 DEPENDENCY INSTALL
- Via npm 🙏*2 🔥
npm install
- Via yarn 🙏*2 🔥
yarn install
- All env config can be found in config folder
- Default should not be changed use local file instead
- Port should be unique for all servers
- Var env should be prod for master branch
- Var env should be develop for dev branch
- Var env should be test for feature/* branchs
- Var env should replace %ENV% in file ecosystem.config.js
- Clear redis keys if required
redis-cli KEYS "%env%*" | xargs redis-cli DEL
Where %env% is env var from config
- Via pm2 🙏*1 🔥🔥
pm2 start
- Via npm 🙏*1 🔥
npm run server
- Via nodejs 🙏*1 🔥
node --inspect ./server
- Npm run linter 🙏*1 🔥
npm run linter
- Npm run tests and coverage 🙏*1 🔥
npm run test
For the ease of accessing Redis from other containers via Docker networking, the "Protected mode" is turned off by default. This means that if you expose the port outside of your host (e.g., via -p on docker run), it will be open without a password to anyone.For further information, see the following links about Redis security