/chat-app

A Real time chat application (Docker | React | Node.js)

Primary LanguageJavaScriptMIT LicenseMIT

Chat-app

A Real time chat application (Docker | React | Express)

Dependencies

  1. Docker
  2. NPM
  3. NodeJS

Running the project

  1. First set up your own .env. file, Use this command to generate it -> cp config/env.env.docker-compose-example config/.env.docker-compose

  2. Install dependencies npm install From thr root directory.

  3. Run All -> Run npm run docker-run:dev

  4. Stop All -> Run npm run docker-stop

  5. In order to tail a single service logs -> docker-compose logs -f {service_name},

The apps are available (default port if not overridden).


Executing into Dokcer containers

Run the following command -> npm run bash -- {service-unique-name}.

For example to get into the Authentication micro-service, we can see that its unique name on the docker compose file is chat-app-auth-service All you need to pass is the service unique name as an argument,so in our case it is auth. The final command will be npm run bash -- auth. The bash scripts automatically read the COMPOSE_PROJECT_NAME defined variable form the config/.env.docker-compose file and use it as a prefix. IN our case it is chat-app-, and also add a static suffix of -service after the unique service name.

Enviroment variables

Docker compose enviroment variables

The variables are defined in the docker/.env file.

Docker containers enviroment variables
  • server: Defined in the config/server.env file.
  • redis: Defined in the config/redis.env file.
  • client: Defined in the config/client.env file.