Skip to content

Simple socketIO server with mocha test, jshint and Redis authentication. Create for learning purposes

Notifications You must be signed in to change notification settings

MaksymSemenykhin/devops-course-10

Repository files navigation

SocketIO server developers notes

Simple socketIO server with mocha test, jshint and Redis authentication. Create for learning purposes

INFO FLAGS

🙏*N - Can replace each other

🔥 - Complexity level

INSTALLATION REQUIREMENTS

ENV PREPARATION

  1. Install nodeJS and npm 🔥
  2. Install Docker 🔥🔥
  3. Install pm2 package globally(sudo required) 🔥
npm install pm2 -g

REDIS START

  1. Via docker-compose 🙏*1 🔥🔥
  2. Via docker run command 🙏*1 🔥🔥🔥
docker run -d --name redis -p 6379:6379 redis
  1. Via package 🔥
  2. Install redis-tools package 🔥 DEPENDENCY INSTALL

  1. Via npm 🙏*2 🔥
npm install
  1. Via yarn 🙏*2 🔥
yarn install

CONFIGURATION

  1. All env config can be found in config folder
  2. Default should not be changed use local file instead
  3. Port should be unique for all servers
  4. Var env should be prod for master branch
  5. Var env should be develop for dev branch
  6. Var env should be test for feature/* branchs
  7. Var env should replace %ENV% in file ecosystem.config.js

SERVER START

  1. Clear redis keys if required
redis-cli KEYS "%env%*" | xargs redis-cli DEL

Where %env% is env var from config

  1. Via pm2 🙏*1 🔥🔥
pm2 start
  1. Via npm 🙏*1 🔥
npm run server
  1. Via nodejs 🙏*1 🔥
node --inspect ./server

CODE QUALITY TOOLS

  1. Npm run linter 🙏*1 🔥
npm run linter
  1. Npm run tests and coverage 🙏*1 🔥
npm run test

SECURITY

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

About

Simple socketIO server with mocha test, jshint and Redis authentication. Create for learning purposes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •