guofengji / gpsjam.org

Home Page:gpsjam-org.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GPSJam

Web site for https://gpsjam.org/, the worldwide map of daily GPS/GNSS interference and jamming.

The site uses MapBox to display a map of the world, and each day of data is in one CSV file. The site could be entirely static except for its support of social media preview thumbnails, which are generated dynamically, so it's actually a very simple Express app.

Trying it

npm install
npm run start

Then visit http://localhost:3000/. The mapbox basemap won't load, and there will be errors on the console because it can't find redis, but otherwise it works. :)

Operations

The site runs on an AWS VPS using a bitnami image.

Setting up a new server

Create a gpsjam user:

sudo adduser gpsjam
sudo usermod -aG sudo gpsjam
# Install node:
curl -sL https://deb.nodesource.com/setup_17.x -o /tmp/nodesource_setup.sh
sudo bash /tmp/nodesource_setup.sh
sudo apt install -y nodejs

# Install pm2:
sudo npm install -g pm2

# Download and install gpsjam:
sudo apt install git
git clone git@github.com:wiseman/gpsjam.org.git
cd gpsjam.org
npm install

# Install packages required for chromium:
sudo apt install ca-certificates fonts-liberation libappindicator3-1 libasound2 \
libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 \
libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 \
libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils

# Alternately, run this command to see the libraries it can't find:
ldd ./node_modules/puppeteer/.local-chromium/linux-1022525/chrome-linux/chrome | grep not

# Start the app
pm2 start app

# Configure the app to start at boot time. Run this command and
# **follow its instructions**:
pm2 startup systemd

Install and configure nginx:

sudo apt install nginx
sudo ufw allow 'Nginx Full'

Edit /etc/nginx/sites-available/default and replace the contents with:

upstream gpsjam_upstream {
    server 127.0.0.1:3000;
    keepalive 64;
}

server {
	listen 80 default_server;
	listen [::]:80 default_server;

	# SSL configuration
	#
	# listen 443 ssl default_server;
	# listen [::]:443 ssl default_server;
	#
	# Note: You should disable gzip for SSL traffic.
	# See: https://bugs.debian.org/773332
	#
	# Read up on ssl_ciphers to ensure a secure configuration.
	# See: https://bugs.debian.org/765782
	#
	# Self signed certs generated by the ssl-cert package
	# Don't use them in a production server!
	#
	# include snippets/snakeoil.conf;

	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;

	server_name _;

	location / {
	    	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	        proxy_set_header X-Real-IP $remote_addr;
	    	proxy_set_header Host $http_host;

		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
    		proxy_set_header Connection "upgrade";

		proxy_pass http://gpsjam_upstream/;
    		proxy_redirect off;
    		proxy_read_timeout 240s;
	}
}

Install letsencrypt. See https://certbot.eff.org/instructions

Add netdata monitoring:

Go to https://app.netdata.cloud, select the "Nodes" tab, click on the "+ Add nodes" button and follow the instructions.

About

gpsjam-org.vercel.app


Languages

Language:EJS 35.3%Language:JavaScript 28.7%Language:HTML 23.1%Language:CSS 6.9%Language:Python 5.4%Language:Shell 0.6%