Skip to content

01. Standard Setup Instructions

Derick M edited this page Aug 31, 2024 · 9 revisions

Install the PreReqs

NodeJS V20+

Verify the following:

  • Verify that Node is at version >=20 with node -v in the terminal
  • Verify npm is installed with npm -v
  • Verify yarn is installed with yarn -v

Extras

If Node or npm is missing, install them again

If Yarn is missing:

  1. sudo npm install -g yarn

MySQL

Extras

Database Setup

Overview

ReactMap can utilize an unlimited number of databases but it's recommended to have at least 3. Both the ReactMap database and Manual database will need to be created manually before starting ReactMap

  1. Your scanner database; usually Chuck, MAD, or RDM (user needs at least read access)
  2. The ReactMap database; this is where ReactMap will make the tables it needs to run (user needs write access)
  3. The manual database (optional); this is where your 3rd party tool databases will be, such as nests and portals (user needs at least read access)

Creating databases

Creating users and granting access

  • Instructions
  • It's best practice to create a separate user for each database

Standard Setup

  1. Clone the repo git clone https://github.com/WatWowMap/ReactMap.git
  2. Open up the directory (cd ReactMap)
  3. yarn install
  4. Create your config (cp config/local.example.json server/src/configs/local.json)
  5. Fill out the config, only the database details are required but adding a startLat and startLon are recommended
  6. yarn start

Using yarn start is a good way to test that everything is working, but once you deploy your map, you should continue reading below to setup either Docker or PM2.

Updating

  1. ctrl + c
  2. git pull
  3. yarn install
  4. yarn start

PM2 Setup (Recommended)

Quick

This will quickly add ReactMap to your PM2 processes

  1. sudo npm install -g pm2
  2. While in the ReactMap root folder pm2 start ReactMap.js

Advanced

This will give you a little more control over the ReactMap process, if desired

  1. touch ecosystem.config.js
  2. nano ecosystem.config.js
  3. Copy and paste the below:
module.exports = {
  apps: [
    {
      name: 'ReactMap',
      script: 'ReactMap.js',
      cwd: '/home/your_username_here/ReactMap',
      instances: 1,
      cron_restart: '*/60 */24 * * 0',
      exec_mode: "cluster",
      autorestart: true,
      max_memory_restart: '2G',
      env_production: {
        NODE_ENV: "production",
      },
    },
  ],
};
  1. ctrl + x keys to exit, then y to save when prompted
  2. pm2 start ecosystem.config.js

Updating

  1. git pull
  2. yarn install
  3. pm2 restart ReactMap

Docker Setup

Install the PreReqs

Setting up ReactMap Docker Container

  1. Use docker-compose.yml (cp docker-compose.example.yml docker-compose.yml)
  2. Fill out the environment variables
  3. Full list of environment variable mappings can be found here
  4. Run docker-compose up -d reactmap

Updating

  1. docker-compose pull reactmap
  2. docker-compose up -d reactmap