Skip to content

Installation & Configuration

Connor Peet edited this page Aug 22, 2014 · 1 revision

Although there is a semi-official hosted API at gdn.api.xereo.net, you may wish to run the GDN yourself. It is simple and fast to do so.

Installation

Prerequisites

  • Python 3.3 or later
  • A compiler toolchain (gcc works fine)
  • A MongoDB installation
  • Optional: Git
  • Optional: supervisord
  • Optional: crontab

Downloading the GDN

First, you will need to download the GDN. If you have git, the recommended way to download the GDN is to clone the repo using the following command:

$ git clone https://github.com/XereoNet/SpaceGDN.git <folder-name>

In the future, if you want to get the recent updates, you can simply cd into the GDN's folder and run git pull.

Alternately, you can just download the zip itself, but you won't be able to pull in updates very easily:

$ curl https://github.com/XereoNet/SpaceGDN/archive/master.zip | tar -xf- -C <folder-name>

Finally, run the following command (while in the GDN folder) to load required packages. The default python command may not be 3.3+, depending on your installation. Be sure you run this with the appropriate version:

$ sudo python setup.py install

Configuration

First, you want to copy config.example.json to config.json. There are several commented configuration options therein which you can adjust.

Running the GDN

We recommend running uWSGI with nginx to run the GDN, and ensuring that it stays running with Supervisord. Having run the setup.py script, there will be a uwsgi binary available to execute.

Booting the server

The following command will start the server:

uwsgi -s /tmp/spacegdn.sock -w run:app
On nginx's side

It's then simple to set up an nginx host to proxy to the server. Add an upstream directive, outside of the server config block (so that it should properly by at the 0th indentation level)

upstream spacegdncluster {
  server unix:///tmp/spacegdn.sock;
}

Then finally, have a server block like:

server {
    listen       80;
    server_name  mygdn.com;

    location / {
        uwsgi_pass spacegdncluster;
    }
}
Optional: setting up the gdn to run with Supervisord

Supervisord is a great, stable daemon to make sure your services stay running! The following configuration block can be used to keep your services running:

[program:spacegdn]
command = uwsgi -s /tmp/spacegdn.sock -w run:app
directory = /path/to/spacegdn

Loading Packs, and Cron

Modpacks can be loaded with the following command:

$ python run.py load

This may just as easily be set up to run on a cron. Don't worry about burning bandwidth if you have it set to download pack: only pack versions/builds which we don't already have will be loaded.