Shows a list of IP addresses viewing the page
Application launched with docker: node server with redis server as a message broker for scaling
and nginx server as a balancer and web server for static client files (index.html
and index.js
)
git clone
this repo- Make sure you use latest
docker
anddocker-compose
- Run
yarn build
fromclient
directory to createdist/index.js
bundle - Run
docker-compose up
. It buildsweb
,redis
andsocket-server
containers for you. Rundocker-compose build
if you want to rebuild containers - Site available on
0.0.0.0:80
on Unix-like systems (checkifconfig
to find correct IP if not)
Client uses Webpack to create bundle dist/index.js
.
If something changed in client/src
directory, yarn build
should be launched to update index.js bundle
- Unit tests launch
yarn test-unit
- Functional tests must be launched in docker env like
docker exec currentlyviewingapp_socket-server_1 yarn test-func
!!!NOTE!!! In purpose of testing on one machine, websocket server doesn't use real IPs, but number which changed every 10 seconds.
When user opens a tab in browser, number N assigned to this tab via socket connection.
When user opens the second tab in browser, application assigns the same number N or the new number M.
IF the second tab assigned with number N and user closes the first tab, it's "IP-number" still in the list, because there is at least one tab. It allows to see how would it work if user opens many tabs from the same and different computers.
Uncomment server/src/index.js:15 if you wish to see real IP addresses (requires to restart docker container)
- add deploy script to launch
yarn build
before docker containers start. Ignore client index.js bundle from get repo