This program is useful to distribute minetest media (textures, models, sounds) to minetest clients for multiplayer server owners that wish to have their media hosted on a `remote media server` URL. Doing this as a separate download removes some of the download bandwidth from the actual game server and offloads it to a different HTTP or HTTPS server. This will work for all clients that have cURL support enabled.
- nginx or apache, with fcgi
- webserver must be able to access file sockets in /run/mtmediasrv
- systemd for controlling the service startup
- (optional) go to build the service(there are binary builds available for Linux)
At startup, the program can optionally scan mods and subgames to find and copy or hardlink (the default) all the assets into the webroot. The hardlink method is better for space, but may fail if the media is not on the same filesystem as the webroot.
When a client connects, the client POSTS their list of known sha1 hashes of files they need.
The program verifies for each needed hash that the server has the hash listed, and returns the needed hashes only, and only hashes that it has the files for.
The actual file content is not served by this program, for this you need to have your web server serve that content as static files.
Last, it needs to be noted that minetest clients older than, and including, 0.4.13 are NOT supported by this service. These will fail to properly POST the needed hash data to the service and will fail to load any remote media. Please tell your users to upgrade to a newer MT version.
not recommended, there are binary releases available!
Run `make` in the folder to create the binary `mtmediasrv`.
Please note the currently hardcoded values in the binary and example configuration files.
Several example config and service units are provided as an example on how to deploy this service.
Once you have configured your web server properly so that it serves up the static content files by hash, point the mtmediasrv to the same folder and it will talk to minetest clients that request media automatically. If the content changes, you need to restart the program.
You should not have a file called `index.mth` in the media folder, although this will not break anything, it will probably be confusing.
opy and edit the `mtmediasrv.yaml` file and point it at the proper webroot, socket path, and mediapath entries. Place it in `/etc/` or `~/.config/`.
The program logs all clients and writes out the following data to the log output (journal/syslog):
- remote address
- user agent
- hashes needed/hashes given
- content-length of sent bytes
Code: Select all
mtmediasrv: 184.108.40.206:34567 'Minetest/0.4.15 (Linux/4.10.1 x86_64)' 64/64 1286
Github Project: https://github.com/sofar/mtmediasrv
Download: (binaries!) https://github.com/minetest-tools/mtmed ... x86_64.zip
Download: (source!) https://github.com/sofar/mtmediasrv/archive/master.zip