A Real time chat application (Docker | React | Express)
-
First set up your own
.env.
file, Use this command to generate it ->cp config/env.env.docker-compose-example config/.env.docker-compose
-
Install dependencies
npm install
From thr root directory. -
Run All -> Run
npm run docker-run:dev
-
Stop All -> Run
npm run docker-stop
-
In order to tail a single service logs ->
docker-compose logs -f {service_name}
,
The apps are available (default port if not overridden).
- server -> http://localhost:5000
- client -> http://localhost:3000
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.
The variables are defined in the docker/.env
file.
- server: Defined in the
config/server.env
file. - redis: Defined in the
config/redis.env
file. - client: Defined in the
config/client.env
file.