Setting up a server

From AAGRINDER wiki
Revision as of 11:17, 15 September 2022 by Maze (talk | contribs) (Add instructions for https)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Currently, there are only instructions for setting up a server on Linux. Feel free to add instructions for other platforms.

For additional details, see administration tips.

Setting up an AAGRINDER server on Linux

You'll need these things installed:

Acquire the AAGRINDER server software:

$ git clone https://gitlab.com/MRAAGH/aagrinder.git
$ cd aagrinder
$ npm install

You also need the AAGRINDER terrain generator (compiled from source):

$ git clone https://gitlab.com/MRAAGH/aagrinder-terrain.git
$ cd aagrinder-terrain
$ make

The directory aagrinder-terrain should be inside the directory aagrinder.

Move back to the directory aagrinder, then start the server:

$ cd ..
$ npm start


A config.json file will be created. You can change the server configuration, although the defaults should already be functional.

Now, anyone who can access your computer via internet can easily connect to your aagrinder server.

Secure connection over HTTPS

The AAGRINDER server by itself exposes a HTTP website. For better security, HTTPS is preferred. To achieve this, an additional software component needs to be involved as a reverse proxy. In this guide, we use Nginx.

A Nginx configuration for proxying AAGRINDER might look like this:

server {
    server_name aagrinder.xyz;

    location / {
        proxy_pass http://localhost:8926;
    }

    location ~* /.io {
        proxy_pass http://localhost:8926;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-NginX-Proxy false;
        proxy_set_header Host $host;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    listen [::]:443 ssl;
    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/aagrinder.xyz/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/aagrinder.xyz/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

server {
    return 302 https://$host$request_uri;

    server_name aagrinder.xyz;

    listen 80;
    listen [::]:80;
}

Here, AAGRINDER is running on port 8926 and is accessible from the outside on port 443 (https) through Nginx. The HTTPS certificate, located at /etc/letsencrypt/live/aagrinder.xyz was acquired from Let's Encrypt using certbot. For reference, the specific command used to acquire this certificate was:

# certbot certonly --nginx -d aagrinder.xyz