Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Running Luanti and Mapserver in different docker-compose files

I finally got around to setting my Luanti mod mapserver to active mode and send player locations to the mapserver web app.

So you might recall that I use 2 separate docker-compose files so I can take them up and down separately. Well, I needed to put them on the same network. That wasn't too hard.

files/2025/listings/game-docker-compose.yml (Source)

 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
# startdate: 2025-02-27 16:46
# author: bgstack15
# this app in the container uses ~/.minetest/main-config/minetest.conf
# Reference:
#    https://github.com/linuxserver/docker-luanti
#    https://github.com/minetest-mapserver/mapserver/blob/master/docker-compose.yml
#    https://github.com/minetest-mapserver/mapserver/blob/master/doc/install.md more useful
---
version: "3.5"
services:
  luanti:
    image: lscr.io/linuxserver/luanti:latest
    container_name: luanti
    networks:
      - luanti
    environment:
      - PUID=1009
      - PGID=1009
      - TZ=Etc/UTC
      - "CLI_ARGS=--gameid mineclonia --worldname world1"
    volumes:
      - /home/luanti/.minetest:/config/.minetest
    ports:
      - 30000:30000/udp
    restart: unless-stopped
networks:
  luanti:
    name: luanti1
...

files/2025/listings/mapserver-docker-compose.yml (Source)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# startdate: 2025-03-07-6 10:20
# author: bgstack15
# Purpose: Run the map server separately from the game world
# Reference:
#    https://github.com/linuxserver/docker-luanti
#    https://github.com/minetest-mapserver/mapserver/blob/master/docker-compose.yml
#    https://github.com/minetest-mapserver/mapserver/blob/master/doc/install.md more useful
---
version: "3.5"
services:
  mapserver:
    image: ghcr.io/minetest-mapserver/mapserver
    restart: always
    networks:
      - luanti
    volumes:
      - /home/luanti/.minetest/worlds/world1:/minetest
    working_dir: "/minetest"
    ports:
      - 8086:8080/tcp
networks:
  luanti:
    name: luanti1
...

So they clearly have the container use network luanti, and it is aliased to the same-name network. I probably didn't even need to do that, but too late now.

And then I added to my file main-config/minetest.conf the url of the docker internal listening port and container name.

secure.http_mods = mapserver
# hostname for mapserver comes from ~/mapserver/docker-compose.yml with correct network config
mapserver.url = http://mapserver:8080
mapserver.key = IUEXAMPLELTdhxnJ

And then a docker-compose restart for each one later, they were able to share information to each other!

Comments