Git Product home page Git Product logo

node-events-map's Introduction

Real-time Events Map

This is a simple node.js application which displays a location extracted from an IP address to all connected clients in real time on the world map. This app can be used, for example, to show your users' activity around the world.

The application uses express.js framework and socket.io to push the events to the client. The geolocation of IP addresses is done using a free database from maxmind.

How to run

The app listens to new events at endpoint events/ which is protected by HTTP Basic authorisation with credentials set in config/default.json (by default set to username admin and password admin).

To show sample data on the map you can also run ruby mock_events.rb which generates and posts random IP addresses in random intervals.

With docker

  1. Download a mmdb database file from maxmind and put it in mmdb/GeoLite2-City.mmdb http://dev.maxmind.com/geoip/geoip2/geolite2/
  2. Run command docker-compose up

Manually

  1. Install node and npm
  2. Install npm dependencies npm install
  3. Install MongoDB and start it
  4. Download a mmdb database file from maxmind and put it in mmdb/GeoLite2-City.mmdb http://dev.maxmind.com/geoip/geoip2/geolite2/
  5. Specify environment variables used to connect to MongoDB and start the server, e.g. MONGO_PORT_27017_TCP_ADDR=localhost MONGO_PORT_27017_TCP_PORT=27017 npm start

How to deploy

For easy production deployment you can use docker with the included Dockerfile and docker-compose. To run in production, use the included production file, e.g.

docker-compose -f docker-compose.yml -f production.yml up -d

You can specify the /events endpoint credentials for production in config/production.json.

node-events-map's People

Contributors

jakriz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.