Standard Installation#

Note

Prerequisites: Existing RDM or DataParser style database

Setup#

  1. Install nodejs v12

    npm i pm2 -g
    
  2. Clone the repository

    git clone https://github.com/versx/MapJS && cd MapJS
    
  3. Install dependencies

    npm run update
    
  4. Create your project config

    cp src/configs/config.example.json src/configs/config.json
    
  5. Fill out config. See config#discord for Discord Auth instructions.

    vi src/configs/config.json
    
  6. Create/copy a static/custom/nests.json file to show nests (GeoJSON format)

  7. Create/copy a static/custom/areas.json file to show scan areas (GeoJSON format)
  8. Run npm run start (see pm2 section for demonized run)
  9. Access via http://machineip:port/ login using your Discord account

Updating#

  1. Pull latest changes git pull
  2. Run npm update in root folder
  3. Run npm start or pm2 restart MapJS

PM2#

Once everything is setup and running appropriately, you can add this to PM2 ecosystem.config.js file so it is automatically started:

  1. Install pm2 globally

    npm i pm2 -g
    
  2. Start pm2 on system reboots. Follow the output from the prompt, it varies depending on the OS!

    pm2 startup
    
  3. Create an ecosystem.config.js file, make sure to replace your cwd path.

    module.exports = {
      apps : [{
        name: 'MapJS',
        script: 'index.js',
        cwd: '/home/username/MapJS/src/',
        instances: 1,
        autorestart: true,
        watch: false,
        max_memory_restart: '2G',
        out_file: 'NULL'
      }]
    };
    
  4. Start with pm2 start ecosystem.config.js

  5. Save your configuration pm2 save

Nginx example#

Read a nginx guide if you're unfamiliar with this web-service. Use Nginx or Apache but not both.

#sudo vi /etc/nginx/conf.d/mapjs.conf
server {
        listen 80;
        server_name map.example.com;
        location / {
            proxy_set_header   X-Forwarded-For $remote_addr;
            proxy_set_header   Host $http_host;
            proxy_pass         http://127.0.0.1:8080;
        }
}

Apache example#

Read an apache guide if you're unfamiliar with this web-service. Use Nginx or Apache but not both.

#sudo vi /etc/apache2/sites-available/mapjs.conf
<VirtualHost *:80>
 ServerName map.example.com

 ProxyRequests On
 ProxyPass / http://127.0.0.1:8080
 ProxyPassReverse / http://127.0.0.1:8080
</VirtualHost>