Standard Installation#
Note
Prerequisites: Existing RDM or DataParser style database
Setup#
-
Install nodejs v12
npm i pm2 -g
-
Clone the repository
git clone https://github.com/versx/MapJS && cd MapJS
-
Install dependencies
npm run update
-
Create your project config
cp src/configs/config.example.json src/configs/config.json
-
Fill out config. See config#discord for Discord Auth instructions.
vi src/configs/config.json
-
Create/copy a
static/custom/nests.json
file to show nests (GeoJSON format) - Create/copy a
static/custom/areas.json
file to show scan areas (GeoJSON format) - Run
npm run start
(see pm2 section for demonized run) - Access via http://machineip:port/ login using your Discord account
Updating#
- Pull latest changes
git pull
- Run
npm update
in root folder - Run
npm start
orpm2 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:
-
Install pm2 globally
npm i pm2 -g
-
Start pm2 on system reboots. Follow the output from the prompt, it varies depending on the OS!
pm2 startup
-
Create an
ecosystem.config.js
file, make sure to replace yourcwd
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' }] };
-
Start with
pm2 start ecosystem.config.js
- 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>