Giter VIP home page Giter VIP logo

mapserver_mod's Introduction

mapserver mod

This is the complementary mod for the mapserver: https://github.com/minetest-tools/mapserver

Documentation

See: https://github.com/minetest-tools/mapserver/blob/master/doc/mod.md

example for active mode configuration

minetest.conf

secure.http_mods = mapserver
mapserver.url = http://127.0.0.1:8080
mapserver.key = myserverkey

Contributors

Thanks to:

  • @Panquesito7 (mod.conf/depends.txt cleanup)
  • @SwissalpS (minor corrections)
  • @Athemis (mineclone support)

License

mapserver_mod's People

Contributors

athemis avatar buckaroobanzay avatar el-naso avatar imgbotapp avatar milesbdyson avatar naturefreshmilk avatar niklp09 avatar nonfreegithub avatar ogelgames avatar panquesito7 avatar peternerlich avatar s-s-x avatar shrimpza avatar swissalps avatar thomasrudin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mapserver_mod's Issues

`http.fetch` issue

root@akheron:/data/pandorabox.io/data/minetest# tail -f debug.txt | grep -i mapserver
2022-07-12 18:55:17: WARNING[Server]: [mapserver-bridge] post took 1818357 us
2022-07-12 18:55:21: WARNING[Server]: [mapserver-bridge] post took 1880952 us
2022-07-12 18:55:28: WARNING[Server]: [mapserver-bridge] post took 1806007 us
2022-07-12 18:55:35: WARNING[Server]: [mapserver-bridge] post took 2084787 us
2022-07-12 18:55:37: WARNING[Server]: [mapserver-bridge] post took 1786854 us
2022-07-12 18:55:46: WARNING[Server]: [mapserver-bridge] post took 1983264 us
2022-07-12 18:55:53: WARNING[Server]: [mapserver-bridge] post took 2209469 us
/lua local x = minetest.get_us_time(); local a = {}; mapserver.bridge.add_players(a); print("xxx:" .. #minetest.write_json(a) .. " us:" .. minetest.get_us_time() - x);
/lua local x = minetest.get_us_time(); local a = {}; mapserver.bridge.add_advtrains(a); print("xxx:" .. #minetest.write_json(a) .. " us:" .. minetest.get_us_time() - x);
minetest_1             | xxx:72071 us:30518
minetest_1             | xxx:72045 us:28952
minetest_1             | xxx:2218 us:936

Relevant code:

local t0 = minetest.get_us_time()
-- data to send to mapserver
local data = {}
mapserver.bridge.add_players(data)
mapserver.bridge.add_defaults(data)
if has_advtrains then
-- send trains if 'advtrains' mod installed
mapserver.bridge.add_advtrains(data)
end
if has_locator then
-- send locator beacons
mapserver.bridge.add_locators(data)
end
local json = minetest.write_json(data)
--print(json)--XXX
local t1 = minetest.get_us_time()
local process_time = t1 - t0
if process_time > 50000 then
minetest.log("warning", "[mapserver-bridge] processing took " .. process_time .. " us")
end
local size = string.len(json)
if size > 256000 then
minetest.log("warning", "[mapserver-bridge] json-size is " .. size .. " bytes")
end
http.fetch({
url = url .. "/api/minetest",
extra_headers = { "Content-Type: application/json", "Authorization: " .. key },
timeout = 5,
post_data = json
}, function(res)
local t2 = minetest.get_us_time()
local post_time = t2 - t1
if post_time > 1000000 then -- warn if over a second
minetest.log("warning", "[mapserver-bridge] post took " .. post_time .. " us")
end
if has_monitoring then
metric_post_size.inc(size)
metric_processing_post_time.inc(process_time)
metric_post_time.inc(post_time)
end
-- TODO: error-handling
minetest.after(mapserver.send_interval, send_stats)
end)

Mapserver cause dev Minetest to crash.

OK. It might be something that I am doing, but if I run the Mapserver (4.5.0) and Minetest 5.6.0-dev-c31b301) together, Minetest crashes after a minute or two. The error is as follows:

ERROR[Server]: /home/cliffp/minetest/src/server.cpp:86: virtual void* ServerThread::run(): A fatal error occurred: Failed to commit SQLite3 transaction: database is locked

I can run either Mapserver or Minetest alone, but not both. I'm compiling Minetest, but I use the binary version of Mapserver. I know that I'm using the dev version and not the official supported version, but I'd appreciate any hints or ideas, if you have the time. Thanks.

[crash] mapserver_mod causes crashloop on EdenLost

I've got the mapserver binary running on EdenLost. However, when I add the mapserver_mod for its features, the server crashloops when loading the mod:

ServerError: AsyncErr: environment_Step: Runtime error from mod 'mapserver' in callback environment_Step(): ...worlds/world/worldmods/mapserver_mod/bridge/defaults.lua:5: bad argument #1 to 'gmatch' (string expected, got nil)
stack traceback:
        [C]: in function 'gmatch'
        ...worlds/world/worldmods/mapserver_mod/bridge/defaults.lua:5: in function 'explode'
        ...worlds/world/worldmods/mapserver_mod/bridge/defaults.lua:14: in function 'get_max_lag'
        ...worlds/world/worldmods/mapserver_mod/bridge/defaults.lua:22: in function 'add_defaults'
        ...hit/worlds/world/worldmods/mapserver_mod/bridge/init.lua:43: in function 'func'
        /home/1hit/multicraft/bin/../builtin/common/after.lua:20: in function </home/1hit/multicraft/bin/../builtin/common/after.lua:5>
        /home/1hit/multicraft/bin/../builtin/game/register.lua:441: in function </home/1hit/multicraft/bin/../builtin/game/register.lua:425>

syntax error

 2020-02-19 06:35:10: ERROR[Main]: ModError: Failed to load and run script from /var/lib/minetest/.minetest/worlds/world/worldmods/mapserver/init.lua:
2020-02-19 06:35:10: ERROR[Main]: /var/lib/minetest/.minetest/worlds/world/worldmods/mapserver/search.lua:160: '}' expected (to close '{' at line 157) near 'func'
2020-02-19 06:35:10: ERROR[Main]: stack traceback:
2020-02-19 06:35:10: ERROR[Main]: 	[C]: in function 'dofile'
2020-02-19 06:35:10: ERROR[Main]: 	.../.minetest/worlds/world/worldmods/mapserver/init.lua:18: in main chunk

Can't restart the server

Jan 24 10:35:22 zeitsprung systemd[1]: Started Lifemap for a running Minetest-Server.
Jan 24 10:35:22 zeitsprung mapserver[145336]: panic: invalid character ']' looking for beginning of value
Jan 24 10:35:22 zeitsprung mapserver[145336]: goroutine 1 [running]:
Jan 24 10:35:22 zeitsprung mapserver[145336]: main.main()
Jan 24 10:35:22 zeitsprung mapserver[145336]: /home/runner/work/mapserver/mapserver/main.go:53 +0x3ca
Jan 24 10:35:22 zeitsprung systemd[1]: minetest_mapserver.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 24 10:35:22 zeitsprung systemd[1]: minetest_mapserver.service: Failed with result 'exit-code'.

Runtime error

I updated to Minetest 5.4.0, advtrains and this mod to latest master. Now I get this error:

mar 08 19:43:42 server minetestserver[6373]: 2021-03-08 19:43:42: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'mapserver' in callback environment_Step(): /usr/share/minetest/mods/mapserver_mod/bridge/advtrains.lua:46: attempt to index field 'main' (a number value)
mar 08 19:43:42 server minetestserver[6373]: 2021-03-08 19:43:42: ERROR[Main]: stack traceback:
mar 08 19:43:42 server minetestserver[6373]: 2021-03-08 19:43:42: ERROR[Main]:         /usr/share/minetest/mods/mapserver_mod/bridge/advtrains.lua:46: in function 'add_advtrains'
mar 08 19:43:42 server minetestserver[6373]: 2021-03-08 19:43:42: ERROR[Main]:         /usr/share/minetest/mods/mapserver_mod/bridge/init.lua:52: in function 'func'
mar 08 19:43:42 server minetestserver[6373]: 2021-03-08 19:43:42: ERROR[Main]:         /usr/share/minetest/builtin/common/after.lua:20: in function </usr/share/minetest/builtin/common/after.lua:5>
mar 08 19:43:42 server minetestserver[6373]: 2021-03-08 19:43:42: ERROR[Main]:         /usr/share/minetest/builtin/game/register.lua:422: in function </usr/share/minetest/builtin/game/register.lua:406>
mar 08 19:43:42 server minetestserver[6373]: 2021-03-08 19:43:42: ERROR[Main]: stack traceback:

The server can start only if I disable either advtrains or mapserver_mod.

Cannot create poi for mapserver

Hi,
I don't know how to setup a POI... and display it in mapserver.

  • do I need a special mods (extra) ?
    (I tried with minetest_poi without success)

Regards,
Dominique

Inconsistent chat message when shops without items found

if data and #data > 0 then
minetest.chat_send_player(playername, "Got " .. #data .. " results")
show_formspec(playername, data)

[13:59.51] <pandorabot> <Yang> why does the /search give more results than it shows? i was searching for a shop and it gave me 5 results but showed 3
[14:01.11] <pandorabot> <SX> sounds like a bug in mod
[14:03.41] <pandorabot> <OgelGames@Discord> doesnt show out of stock shops, but must still count them...
[14:04.08] <pandorabot> <Yang> stock shops?
[14:04.20] <pandorabot> <SolDeNoche> shops that are sold o
[14:04.32] <pandorabot> <Yang> oh
[14:07.16] <pandorabot> <SX> chat message could be moved to show_formspec to easily fix result counts and also possibly show how many out of stock shops
were found
[14:08.50] <pandorabot> <SX> or even add separate filtering function before show_formspec, could be better

What happens here?

From Server Zeitsprung:

Crashreport:

Jan 25 06:30:18 zeitsprung mapserver[161780]: goroutine 52 [running]:
Jan 25 06:30:18 zeitsprung mapserver[161780]: mapserver/tilerendererjob.incrementalRender(0xc0004b2750)
Jan 25 06:30:18 zeitsprung mapserver[161780]:         /home/runner/work/mapserver/mapserver/tilerendererjob/incremental.go:30 +0x54b
Jan 25 06:30:18 zeitsprung mapserver[161780]: mapserver/tilerendererjob.Job(0xc0004b2750)
Jan 25 06:30:18 zeitsprung mapserver[161780]:         /home/runner/work/mapserver/mapserver/tilerendererjob/job.go:27 +0x4f
Jan 25 06:30:18 zeitsprung mapserver[161780]: created by main.main in goroutine 1
Jan 25 06:30:18 zeitsprung mapserver[161780]:         /home/runner/work/mapserver/mapserver/main.go:77 +0x37a
Jan 25 06:30:18 zeitsprung systemd[1]: minetest_mapserver.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 25 06:30:18 zeitsprung systemd[1]: minetest_mapserver.service: Failed with result 'exit-code'.
Jan 25 06:30:18 zeitsprung systemd[1]: minetest_mapserver.service: Consumed 46min 55.603s CPU time.

mapserver.json:

{
	"configversion": 1,
	"port": 8081,
	"enableprometheus": true,
	"enablerendering": true,
	"enablesearch": true,
	"enableinitialrendering": true,
	"enabletransparency": true,
	"enablemediarepository": false,
	"webdev": false,
	"webapi": {
		"enablemapblock": false,
		"secretkey": "xxxxxx"
	},
	"layers": [
		{
			"id": 0,
			"name": "Ground",
			"from": -10,
			"to": 100
		}
	],
	"renderingfetchlimit": 500,
	"renderingjobs": 6,
	"renderingqueue": 10,
	"incrementalrenderingtimer": "5s",
	"mapobjects": {
		"areas": true,
		"bones": true,
		"protector": false,
		"xpprotector": true,
		"privprotector": false,
		"technic_quarry": false,
		"technic_switch": false,
		"technic_anchor": false,
		"technic_reactor": false,
		"luacontroller": false,
		"digiterms": false,
		"digilines": false,
		"travelnet": true,
		"mapserver_player": true,
		"mapserver_poi": true,
		"mapserver_label": true,
		"mapserver_trainline": false,
		"mapserver_border": true,
		"tileserverlegacy": true,
		"mission": false,
		"jumpdrive": false,
		"smartshop": true,
		"fancyvend": false,
		"atm": false,
		"train": false,
		"trainsignal": false,
		"minecart": true,
		"locator": false,
		"signs": true,
		"mapserver_airutils": false
	},
	"mapblockaccessor": {
		"expiretime": "10s",
		"purgetime": "15s",
		"maxitems": 50
	},
	"defaultoverlays": [
		"mapserver_poi",
		"mapserver_label",
		"mapserver_player"
	],
	"skins": {
		"enableskinsdb": true,
		"skinspath": "/usr/share/minetest/games/Smalltech_Game/mods/skinsdb/textures"
	},
	"worldpath": "./",
	"datapath": "./",
	"ColorsTxtPath": "./"

After a restart, it works again.

Search teleport doesn't work

I have the teleport privilege on pandorabox, but I can't get the teleport button to work. The formspec closes, but no message is shown, no sound is played, and I don't get teleported.

Minor issue (interaction with mailbox mod)

As the title says, this is is a fairly minor issue in how this mod plays with the mailbox mod. When putting one of the map server point of interest blocks in a mailbox, anytime you open the mailbox afterwards, you will see this error message:

mapserver-bug

You can take take the map block out no problem and it works fine, but this message will persist and be displayed each time you open the mailbox.

Not sure if this is an issue for this mod or for the mailbox mod, but I thought I'd try here. I can always open an issue in the mailbox repo.

Great mod by the way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.