Skip to content

Commit

Permalink
chore: update to Luanti 5.10.0. (#27)
Browse files Browse the repository at this point in the history
With this update, upstream project renamed the binaries and rebranded
the engine to Luanti.

We still bundle the Minetest Game with our server images.
  • Loading branch information
ronoaldo authored Dec 16, 2024
2 parents 4f923f6 + a6d685d commit 4d456b9
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 74 deletions.
30 changes: 13 additions & 17 deletions .github/workflows/multiarch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/ronoaldo/minetestserver
IMAGE: ghcr.io/ronoaldo/luantiserver

jobs:
multiarch-build:
Expand All @@ -23,22 +23,21 @@ jobs:
include:
- dockerfile: Dockerfile
args: |-
MINETEST_VERSION=master
LUANTI_VERSION=master
MINETEST_GAME_VERSION=master
MINETEST_IRRLICHT_VERSION=none
LUAJIT_VERSION=v2.1
tags: |-
5.10.0-dev
5.11.0-dev
unstable
dev
platforms: |-
linux/amd64
linux/arm64
- dockerfile: Dockerfile
args: |-
MINETEST_VERSION=5.9.0
MINETEST_GAME_VERSION=4e402ec39fb1852b148e62637df0b72ae70ecd7d
LUAJIT_VERSION=f725e44cda8f359869bf8f92ce71787ddca45618
LUANTI_VERSION=5.10.0
MINETEST_GAME_VERSION=f4f365970ac10f2a510a03df392772683177980c
LUAJIT_VERSION=f73e649a954b599fc184726c376476e7a5c439ca
tags: |-
stable
stable-5
Expand All @@ -51,23 +50,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Extract Minetest branch from Dockerfile/args
id: minetest-version
- name: Extract Luanti version/branch for Dockerfile/args
id: luanti-version
run: |
export MINETEST_VERSION="$(echo "${{ matrix.args }}" | grep MINETEST_VERSION | cut -f 2 -d=)"
export LUANTI_VERSION="$(echo "${{ matrix.args }}" | grep LUANTI_VERSION | cut -f 2 -d=)"
export MINETEST_GAME_VERSION="$(echo "${{ matrix.args }}" | grep MINETEST_GAME_VERSION | cut -f 2 -d=)"
export IRRLICHT_VERSION="$(echo "${{ matrix.args }}" | grep IRRLICHT_VERSION | cut -f 2 -d=)"
echo "version=${MINETEST_VERSION}" >> $GITHUB_OUTPUT
echo "version=${LUANTI_VERSION}" >> $GITHUB_OUTPUT
echo "game=${MINETEST_GAME_VERSION}" >> $GITHUB_OUTPUT
echo "irrlicht=${IRRLICHT_VERSION}" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
${{ steps.minetest-version.outputs.version }}
${{ steps.luanti-version.outputs.version }}
${{ matrix.tags }}
- name: Print calculated Docker tags
Expand All @@ -80,9 +77,8 @@ jobs:
id: run-test-build
shell: bash
run: |
MINETEST_VERSION=${{steps.minetest-version.outputs.version}} \
MINETEST_GAME_VERSION=${{steps.minetest-version.outputs.game}} \
MINETEST_IRRLICHT_VERSION=${{steps.minetest-version.outputs.irrlicht}} \
LUANTI_VERSION=${{steps.luanti-version.outputs.version}} \
MINETEST_GAME_VERSION=${{steps.luanti-version.outputs.game}} \
./test/integration-test.sh
- name: Set up QEMU for multiarch builds
Expand Down
44 changes: 23 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
FROM debian:bookworm-slim AS builder

# Build-time arguments - defaults to dev build of more recent version
ARG MINETEST_VERSION=master
ARG LUANTI_VERSION=master
ARG MINETEST_GAME_VERSION=master
ARG MINETEST_IRRLICHT_VERSION=none
# LuaJIT rolling stable branch is v2.1
ARG LUAJIT_VERSION=v2.1

Expand All @@ -23,20 +22,15 @@ RUN apt-get update &&\

# Fetch source
RUN mkdir -p /usr/src &&\
git clone --depth=1 -b ${MINETEST_VERSION} \
https://github.com/minetest/minetest.git \
git clone --depth=1 -b ${LUANTI_VERSION} \
https://github.com/minetest/minetest \
/usr/src/minetest &&\
rm -rf /usr/src/minetest/.git
RUN if [ "${MINETEST_IRRLICHT_VERSION}" != "none" ] ; then \
git clone --depth=1 -b ${MINETEST_IRRLICHT_VERSION} \
https://github.com/minetest/irrlicht \
/usr/src/minetest/lib/irrlichtmt ; \
fi
RUN git clone --depth=1 https://github.com/minetest/minetest_game.git \
RUN git clone --depth=1 https://github.com/minetest/minetest_game \
/usr/src/minetest/games/minetest_game &&\
git -C /usr/src/minetest/games/minetest_game checkout ${MINETEST_GAME_VERSION}
RUN git clone \
https://github.com/LuaJIT/LuaJIT.git \
https://github.com/LuaJIT/LuaJIT \
/usr/src/luajit &&\
git -C /usr/src/luajit checkout ${LUAJIT_VERSION}

Expand Down Expand Up @@ -81,19 +75,27 @@ RUN apt-get update &&\
libspatialindex6 libsqlite3-0 libstdc++6 libtinfo6 zlib1g libzstd1 \
adduser git -yq &&\
apt-get clean
RUN adduser --system --uid 30000 --group --home /var/lib/minetest minetest &&\
chown -R minetest:minetest /var/lib/minetest
# Creates a user to run the server as, with a home dir that can be mounted
# as a volume
RUN adduser --system --uid 30000 --group --home /var/lib/luanti luanti &&\
chown -R luanti:luanti /var/lib/luanti

# Copy files and folders
COPY --from=builder /usr/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf
COPY --from=builder /usr/share/minetest /usr/share/minetest
COPY --from=builder /usr/src/minetest/games /usr/share/minetest/games
COPY --from=builder /usr/bin/minetestserver /usr/bin
COPY --from=builder /usr/share/doc/luanti/minetest.conf.example /etc/luanti/luanti.conf
COPY --from=builder /usr/share/luanti /usr/share/luanti
COPY --from=builder /usr/src/minetest/games /usr/share/luanti/games
COPY --from=builder /usr/bin/luantiserver /usr/bin
COPY --from=builder /usr/bin/contentdb /usr/bin
COPY --from=builder /opt/luajit/usr/ /usr/
ADD minetest-wrapper.sh /usr/bin
ADD luanti-wrapper.sh /usr/bin

WORKDIR /var/lib/minetest
USER minetest
# Add symlinks (minetest -> luanti) to easy the upgrade after upstream rename
RUN ln -s /usr/share/luanti /usr/share/minetest &&\
ln -s /etc/luanti /etc/minetest &&\
ln -s /etc/luanti/luanti.conf /etc/luanti/minetest.conf &&\
ln -s /usr/bin/luanti-wrapper.sh /usr/bin/minetest-wrapper.sh

WORKDIR /var/lib/luanti
USER luanti
EXPOSE 30000/udp 30000/tcp
CMD ["/usr/bin/minetest-wrapper.sh", "--config", "/etc/minetest/minetest.conf", "--gameid", "minetest"]
CMD ["/usr/bin/luanti-wrapper.sh", "--config", "/etc/luanti/luanti.conf", "--gameid", "minetest"]
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
SHELL=bash
IMAGE=ghcr.io/ronoaldo/minetestserver
IMAGE=ghcr.io/ronoaldo/luantiserver
TAG=latest

build:
docker build -t ${IMAGE}:${TAG} .

run: build
docker run --rm --name minetestserver -it -P ${IMAGE}:${TAG}
docker run --rm --name luantiserver -it \
--publish 30000:30000/udp \
--publish 30000:30000/tcp ${IMAGE}:${TAG}

build-workflow-matrix:
@for i in $$(seq 0 1) ; do \
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Minetest Server for Docker Hosting

This is a docker image designed to host [Minetest](https://www.minetest.net)
This is a docker image designed to host [Luanti](https://www.luanti.org)
game servers using Docker.

This is based on Debian Stable (for security patches from upstream), and has
Expand Down Expand Up @@ -37,13 +37,13 @@ how to setup your custom server with Docker using this base image.

You can start building your server easily with the following `Dockerfile`:

FROM ghcr.io/ronoaldo/minetestserver:stable
FROM ghcr.io/ronoaldo/luantiserver:stable

USER root
RUN cd /usr/share/minetest &&\
RUN cd /usr/share/luanti &&\
contentdb install TenPlus1/ethereal

USER minetest
USER luanti

After that, you can build your server image with `docker build`:

Expand Down Expand Up @@ -72,7 +72,7 @@ Then, bind-mount this to the container when launching your server:

docker run -it \
-p 30000:30000/udp -p 30000:30000/tcp \
-v $PWD/data:/var/lib/minetest:rw \
-v $PWD/data:/var/lib/luanti:rw \
myserver:latest

You will see that the folder `./data/.minetest` will be created. You can now
Expand All @@ -88,9 +88,9 @@ provided by the Minetest distribution, and placed at
One easy way to start changing it is to copy the file from the container:

docker run -it \
-v $PWD/data:/var/lib/minetest:rw \
-v $PWD/data:/var/lib/luanti:rw \
myserver:latest \
cp /etc/minetest/minetest.conf /var/lib/minetest/
cp /etc/luanti/luanti.conf /var/lib/luanti/

This will create a new file in your `./data/` folder named `minetest.conf`.

Expand All @@ -101,13 +101,12 @@ to this file or make world backups. To fix that, try this:
sudo chmod -R g+rw ./data

The final step is to launch you server with the new settings. We provide a
convenient [wrapper](./minetest-wrapper.sh) to restart your server automatically
convenient [wrapper](./luanti-wrapper.sh) to restart your server automatically
if it crashes. So, to change the settings, you can then launch the container
like this:

docker run -it \
-p 30000:30000/udp -p 30000:30000/tcp \
-v $PWD/data:/var/lib/minetest:rw \
-v $PWD/data:/var/lib/luanti:rw \
myserver:latest \
minetest-wrapper.sh --config /var/lib/minetest/minetest.conf

luanti-wrapper.sh --config /var/lib/luanti/luanti.conf
4 changes: 2 additions & 2 deletions minetest-wrapper.sh → luanti-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MINETEST_STDERR_FILE=${MINETEST_STDERR_FILE:-/tmp/minetest.stderr}
{
while true ; do
echo -e "\n\n-- Separator --\n\n" >> "${MINETEST_STDERR_FILE}"
minetestserver "$@"
luantiserver "$@"
RET="$?"
echo "${RET}" > /tmp/status
if [ "${NO_LOOP}" == "true" ]; then
Expand All @@ -21,4 +21,4 @@ done
} 2>&1 | tee -a "${MINETEST_STDERR_FILE}"

RET="$(cat /tmp/status || echo 0)"
exit "${RET}"
exit "${RET}"
10 changes: 5 additions & 5 deletions sample/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Use the default stable 5.x version
ARG BASE_IMAGE=ghcr.io/ronoaldo/minetestserver:stable-5
ARG BASE_IMAGE=ghcr.io/ronoaldo/luantiserver:stable-5
FROM ${BASE_IMAGE}

# Install mods from ContentDB
WORKDIR /usr/share/minetest
WORKDIR /usr/share/luanti
USER root
RUN contentdb install TenPlus1/ethereal
RUN contentdb install stu/3d_armor

# Prepare the server to run
COPY minetest.conf /etc/minetest/minetest.conf
WORKDIR /var/lib/minetest
USER minetest
COPY luanti.conf /etc/luanti/luanti.conf
WORKDIR /var/lib/luanti
USER luanti
File renamed without changes.
4 changes: 2 additions & 2 deletions sample/quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ mkdir -p data
docker run -it --rm \
-v "$PWD:/server" \
-u 0:0 \
myserver:latest bash -c 'chown -R minetest /server/data'
myserver:latest bash -c 'chown -R luanti /server/data'

# 3. Run the server
docker run -it --rm --name=myserver \
-v "$PWD/data:/var/lib/minetest" \
-v "$PWD/data:/var/lib/luanti" \
-p 30000:30000/udp -p 30000:30000/tcp \
-e NO_LOOP=true \
myserver:latest
33 changes: 19 additions & 14 deletions test/integration-test.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash
set -e
set -x
[ x"${DEBUG}" = x"true" ] && set -x

export MINETEST_VERSION MINETEST_GAME_VERSION IRRLICHT_VERSION
export LUANTI_VERSION MINETEST_GAME_VERSION LUAJIT_VERSION

BASEDIR="$(readlink -f "$(dirname "$0")/..")"
IMG="ghcr.io/ronoaldo/minetestserver:testing"
IMG="ghcr.io/ronoaldo/luantiserver:testing"
TMPDIR="$(mktemp -d)"
if [ -t 1 ] ; then
export IT=-it
fi

log() {
echo "$(date "+%Y-%m-%d %H%M%S") $*"
echo "[integration-tests] $(date "+%Y-%m-%d %H%M%S") $*"
}

cleanup() {
Expand Down Expand Up @@ -49,16 +49,20 @@ log "Installing required dependencies ..."
install_deps

log "Detecting versions from workflow ..."
MT="$(version_from_workflow MINETEST_VERSION)"
LT="$(version_from_workflow LUANTI_VERSION)"
MTG="$(version_from_workflow MINETEST_GAME_VERSION)"
IRR="$(version_from_workflow MINETEST_IRRLICHT_VERSION)"
LUA="$(version_from_workflow LUAJIT_VERSION)"

log "Building/tagging test image using versions:"
log " Luanti=${LT}"
log " Minetest_Game=${MTG}"
log " LuaJIT=${LUA}"

log "Building/tagging test image using versions: ${MT}, ${MTG}, ${IRR}... "
docker build \
-t "${IMG}" \
--build-arg MINETEST_VERSION="${MT}" \
--build-arg LUANTI_VERSION="${LT}" \
--build-arg MINETEST_GAME_VERSION="${MTG}" \
--build-arg MINETEST_IRRLICHT_VERSION="${IRR}" \
--build-arg LUAJIT_VERSION="${LUA}" \
./

log "Using ${TMPDIR} as a temporary directory"
Expand All @@ -74,7 +78,7 @@ if pushd "${TMPDIR}" ; then
cp -rv "${BASEDIR}"/test/testdata/.minetest "${TMPDIR}/data"

TEST_IMG="gcr.io/ronoaldo/myserver:testsrv"
log "Building and starting test server ..."
log "Building and starting test server ${TEST_IMG}..."
docker build -t ${TEST_IMG} --build-arg BASE_IMAGE=${IMG} ./

# 2. Prepare/fix the data dir
Expand All @@ -83,14 +87,15 @@ if pushd "${TMPDIR}" ; then
docker run ${IT} --rm \
-v "$PWD:/server" \
-u 0:0 \
${TEST_IMG} bash -c 'chown -R minetest /server/data'

docker run --rm ${TEST_IMG} minetestserver --gameid list
${TEST_IMG} bash -c 'chown -R luanti /server/data'
log "Listing installed games:"
docker run --rm ${TEST_IMG} luantiserver --gameid list

# 3. Run the server without the restart loop.
# shellcheck disable=2086
log "Testing a local execution with local mods"
docker run ${IT} --rm \
-v "$PWD/data:/var/lib/minetest" \
-v "$PWD/data:/var/lib/luanti" \
-e NO_LOOP=true \
${TEST_IMG}

Expand Down

0 comments on commit 4d456b9

Please sign in to comment.