aboutsummaryrefslogtreecommitdiff
path: root/README.docker.md
blob: a47a20ebc968383642201ae0ec2c3b134ded9356 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Building and Running MasterServer in Docker

Running the MasterServer in Docker may be useful on systems which don't have
appropriate build or runtime environments available to run the service 
natively.

## Build

From the project root directory, run:

```sh
docker build -t 333masterserver:latest .
```

This will compile the source and build a Docker image named `333masterserver`,
tagged as `latest`. 

## Setup

To maintain the database and configuration outside the Docker container
runtime, create some directories on the host to hold these files.

1. Create data directory:
   - note: I recommend creating this in a separate location, such as 
     `/var/lib/masterserver`
   1. `/var/lib/masterserver/data`
   2. Assign ownership to UID 1 (this is the non-root UID the process will run
      as): `chown -R 1 /var/lib/masterserver`
2. Create configuration file in 
   `/var/lib/masterserver/data/MasterServer-Settings.ini`
   - Follow configuration instructions in [README.md](README.md) to populate
     the configuration file appropriately.
3. Copy file `SupportedGames.json` to `/var/lib/masterserver/data/`

## Run

After directories and configuration have been created, run the service as a 
non-interactive daemon process:

```sh
docker run --restart always --name masterserver -d \
 -v /var/lib/masterserver/data:/masterserver/data \
 -v masterserver-log:/masterserver/log \
 -p 27900:27900/udp \
 -p 28900:28900/tcp \
 333masterserver:latest
```