aboutsummaryrefslogtreecommitdiff
path: root/README.docker.md
blob: ae5426b02cea06baa68ecaeec89d16888d0bb23d (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Building and Running MasterServer Web UI in Docker

Running the MasterServer Web UI in Docker may be useful on systems which don't
have appropriate runtime environments available to run the web interface
natively.

## Build

From the project root directory, run:

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

This will build a Docker image containing all the required dependencies and
configuration, named `333masterserver-ui`, tagged as `latest`. 

## Setup

As with the stand-alone configuration described in [README.md](README.md), you
need to also be running the MasterServer itself, since the Web UI shares access
to the database.

Importantly, the database must be readable _and writable_ by UID `1` (`daemon`)
if the IP to Country lookup us used for displaying flags in the UI.

The only other setup required is to customise `settings.pl` as desired.

Specifically, `db_login` must be customised as follows:

```perl
db_login  => ["dbi:SQLite:dbname=/masterserver/data/masterserver.db",'','']
```

## Run

Once the image is build and configuration is in place, you can run the Web UI
as follows.

Note that the service listens on port `8080` internally, any host port can then
be forwarded to this to expose it externally.

```sh
docker run --restart always --name masterserver-ui -d
  -v /path/to/masterserver.db:/masterserver/data/masterserver.db 
  -v /path/to/settings.pl:/masterserver/data/settings.pl:ro
  -p 8900:8080/tcp
  333masterserver-ui:latest
```

NOTE: If to disable the IP to Country lookup, pass set the `NO_IP_TO_COUNTRY`
environment variable, which also allows read-only mounting of the database
file, for example:

```sh
docker run --restart always --name masterserver-ui -d
  -v /path/to/masterserver.db:/masterserver/data/masterserver.db:ro 
  -v /path/to/settings.pl:/masterserver/data/settings.pl:ro
  -p 8900:8080/tcp
  -e NO_IP_TO_COUNTRY=1
  333masterserver-ui:latest
```