itzg / docker-minecraft-server

Docker image that provides a Minecraft Server that will automatically download selected version at startup
https://docker-minecraft-server.readthedocs.io/
Apache License 2.0
9.48k stars 1.55k forks source link

Modrinth support for Paper don't work as expected #1973

Closed techsolo12 closed 1 year ago

techsolo12 commented 1 year ago

Describe the problem

Hello,

unfortunately, it seems to be the modrinth auto-download functions is broken. Its also possible that i'm to dumb :) In the logs it seems that the files is downloaded. But unfortunately, its not work. I can't find the plugin and it also be not active.

Another things is that the data crawler only see the older version of the plugin. The older one is 2.2.4 and the newer one 2.2.5.

Sry for bad english skills :/

Container definition

version: "3"

services:
  mc:
    image: itzg/minecraft-server
    container_name: minecraft-server-neu
    ports:
        # Port 25565 should internally be as it is, otherwise container don't get "HEALTHY" status
      - 25565:1195
        # Port for dynmap webserver
      - 8123:8123
    environment:
      EULA: true
      DEBUG: true
      LOG_TIMESTAMP: true
      # Server type, version, build number and memory size 
      TYPE: Paper
      VERSION: 1.19.3
      PAPERBUILD: 404
      MEMORY: 16G
      # Docker spezifierd settings
      UID: 1001
      GID: 1001
      TZ: Europe/Berlin
      # Use AIKARs Flags for better performance with more users
      USE_AIKAR_FLAGS: true
      # Copy config files from ./config to ./data
      COPY_CONFIG_DEST: /data
      # All files get copyed, also if ./data/config is newer as ./data
      SYNC_SKIP_NEWER_IN_DESTINATION: false
      # Skip creation from server.properties settings
      SKIP_SERVER_PROPERTIES: false
      OVERRIDE_SERVER_PROPERTIES: false
      # All files get copyed, also if ./data/plugins is newer as ./plugins
      SYNC_SKIP_NEWER_IN_DESTINATION: false
      # Auto download plugins from spigot.com
      SPIGET_RESOURCES: 2661,64139,81490,59773,74134,74145,82349,76907,77050,4510,28140,19286,67436,44918,49388,74254
      # Remove old .jar mods after download a new version
      REMOVE_OLD_MODS_INCLUDE: "*.jar"
      REMOVE_OLD_MODS_DEPTH: 1
      # Auto download plugins from modrinth.com
      MODRINTH_PROJECTS: nobedexplosions,nobedexplosions:release
    tty: true
    stdin_open: true
    restart: unless-stopped
    volumes:
      - ./data:/data
        # Location for all files which should copyed to ./data folder, like configs
      - ./config:/config
        # Location for all plugins and files which are related to "plugins"
      - ./plugins:/plugins

networks:
  default:
    name: npm_default
    external: true

Container logs

+ modrinthProjects
+ : nobedexplosions,nobedexplosions:release
+ : true
+ : release
+ [[ -n nobedexplosions,nobedexplosions:release ]]
+ isFamily HYBRID FORGE FABRIC SPIGOT
+ for f in "${@}"
+ [[ SPIGOT == \H\Y\B\R\I\D ]]
+ for f in "${@}"
+ [[ SPIGOT == \F\O\R\G\E ]]
+ for f in "${@}"
+ [[ SPIGOT == \F\A\B\R\I\C ]]
+ for f in "${@}"
+ [[ SPIGOT == \S\P\I\G\O\T ]]
+ return 0
+ isFamily HYBRID FORGE
+ for f in "${@}"
+ [[ SPIGOT == \H\Y\B\R\I\D ]]
+ for f in "${@}"
+ [[ SPIGOT == \F\O\R\G\E ]]
+ return 1
+ loader=spigot
+ mc-image-helper modrinth --output-directory=/data --projects=nobedexplosions,nobedexplosions:release --game-version=1.19.3 --loader=spigot --download-optional-dependencies=true --allowed-version-type=release
[mc-image-helper] 14:01:36.734 DEBUG : Starting with projectRef=nobedexplosions
[mc-image-helper] 14:01:37.577 DEBUG : JSON FETCH: uri=https://api.modrinth.com/v2/project/nobedexplosions headers=DefaultHttpHeaders[user-agent: mc-image-helper/1.25.4 (cmd=modrinth), x-fetch-session: 99226081-c811-4fec-9afb-4bfe9f37935d, accept: application/json, host: api.modrinth.com]
[mc-image-helper] 14:01:37.819 DEBUG : JSON FETCH: uri=https://api.modrinth.com/v2/project/7Oj5ApET/version?loaders=%5B%22spigot%22%5D&game_versions=%5B%221.19.3%22%5D headers=DefaultHttpHeaders[user-agent: mc-image-helper/1.25.4 (cmd=modrinth), x-fetch-session: 38ce95df-d812-441a-93e9-c4fb21cd2417, accept: application/json, host: api.modrinth.com]
[mc-image-helper] 14:01:37.970 DEBUG : Starting with projectRef=nobedexplosions:release
[mc-image-helper] 14:01:37.997 DEBUG : JSON FETCH: uri=https://api.modrinth.com/v2/project/nobedexplosions headers=DefaultHttpHeaders[user-agent: mc-image-helper/1.25.4 (cmd=modrinth), x-fetch-session: 7349d2e4-2983-4136-aced-d3144dbc2f86, accept: application/json, host: api.modrinth.com]
+ exec /start-setupModconfig
+ isTrue false
+ case "${1,,}" in
+ return 1
+ isTrue true
+ case "${1,,}" in
+ return 0
itzg commented 1 year ago

Sorry for the delay. It looks like the problem is recreating for me also.

I am curious though, why you listed nobedexplosions twice; however, it seems like shouldn't cause any kind of problem.

techsolo12 commented 1 year ago

No Problem! I thought i need to add it twice in the config. One time for the plugin name and one additional time for the type. I will edit it, thanks for the info :) Have a nice weekend! 👍

techsolo12 commented 1 year ago

Wow this was fast! Im happy to tested the new version on release. Thank you for your damn good work! 💯

techsolo12 commented 1 year ago

I have tested it today, and it works perfectly for me. Thank you!

itzg commented 1 year ago

Just a heads up, that I am going to need to revert for the fix for this. Apparently Modrinth's API is not behaving consistently and nobedexplosions seems to be the exception to the norm. I'll write up an issue with Modrinth to fix it on their end and link here.

itzg commented 1 year ago

and nm that, I found the real issue, which is that that plugin calls out only paper (and purpur) where in other cases I had assumed that spigot compatibility was correct. I'll get a new fix out soon.

techsolo12 commented 1 year ago

Unfortunately, it does not work for all plugins/mods as expected. When I add "vane:release" to modrinth download, i get a crash.

minecraft-server  | [mc-image-helper] 18:16:05.384 INFO  : Downloading NoBedExplosions-2.2.5.jar
minecraft-server  | [mc-image-helper] 18:16:05.746 INFO  : Downloading item-nbt-api-plugin-2.11.1.jar
minecraft-server  | [mc-image-helper] 18:16:06.097 ERROR : 'modrinth' command failed. Version is 1.25.9
minecraft-server  | java.lang.NullPointerException: Cannot invoke "me.itzg.helpers.modrinth.model.VersionFile.getFilename()" because "versionFile" is null
minecraft-server  |     at me.itzg.helpers.modrinth.ModrinthCommand.download(ModrinthCommand.java:174)
minecraft-server  |     at me.itzg.helpers.modrinth.ModrinthCommand.lambda$processProject$5(ModrinthCommand.java:275)
minecraft-server  |     at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
minecraft-server  |     at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
minecraft-server  |     at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
minecraft-server  |     at me.itzg.helpers.modrinth.ModrinthCommand.call(ModrinthCommand.java:87)
minecraft-server  |     at me.itzg.helpers.modrinth.ModrinthCommand.call(ModrinthCommand.java:34)
minecraft-server  |     at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
minecraft-server  |     at picocli.CommandLine.access$1500(CommandLine.java:148)
minecraft-server  |     at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
minecraft-server  |     at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
minecraft-server  |     at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
minecraft-server  |     at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
minecraft-server  |     at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
minecraft-server  |     at picocli.CommandLine.execute(CommandLine.java:2170)
minecraft-server  |     at me.itzg.helpers.McImageHelper.main(McImageHelper.java:123)
minecraft-server exited with code 0

docker-compose.yml

services:
  mc:
    image: itzg/minecraft-server:latest
    container_name: minecraft-server
    ports:
        # Port 25565 should internally be as it is, otherwise container don't get "HEALTHY" status
      - 1195:25565
        # Port for dynmap webserver
      - 8123:8123
    environment:
      EULA: true
      #DEBUG: true
      # Set timestamps in logs
      LOG_TIMESTAMP: true
      # Server type, version, build number and memory size
      TYPE: Paper
      VERSION: 1.19.3
      # Only needed if a specify build number should use
      #PAPERBUILD: 404
      MEMORY: 16G
      # Docker spezifierd settings
      UID: 1001
      GID: 1001
      TZ: Europe/Berlin
      # Use AIKARs Flags for better performance with more users
      USE_AIKAR_FLAGS: true
      # Set config copy from ./config to ./data/
      COPY_CONFIG_DEST: /data
      # Skip creation from server.properties settings and set to manual
      SKIP_SERVER_PROPERTIES: false
      OVERRIDE_SERVER_PROPERTIES: false
      # Auto download plugins from spigot.com
      # Action Bar Health          https://www.spigotmc.org/resources/action-bar-health.2661/
      # AdvancedTeleport           https://www.spigotmc.org/resources/advancedteleport.64139/
      # BestTools                  https://www.spigotmc.org/resources/besttools.81490/
      # ChestSort                  https://www.spigotmc.org/resources/chestsort-api.59773/
      # Chunky                     https://www.spigotmc.org/resources/chunky.81534/
      # CustomRecipeAPI            https://www.spigotmc.org/resources/customrecipeapi-1-13.74134/
      # DeepStoragePlus            https://www.spigotmc.org/resources/deepstorageplus-1-13-1-19.74145/
      # DualWield                  https://www.spigotmc.org/resources/dualwield.82349/
      # FarmingUpgrade             https://www.spigotmc.org/resources/farmingupgrade.76907/
      # InteractionVisualizer      https://www.spigotmc.org/resources/interactionvisualizer-visualize-function-blocks-entities-like-crafting-tables-with-animations.77050/
      # LightAPI                   https://www.spigotmc.org/resources/lightapi.4510/
      # LuckPerms                  https://www.spigotmc.org/resources/luckperms.28140/
      # LumberJack                 https://www.spigotmc.org/resources/lumberjack-tree-gravity-leaf-decay-custom-tree-drops.60306/
      # Minepacks                  https://www.spigotmc.org/resources/minepacks-backpack-plugin-mc-1-7-1-19.19286/
      # TreeAssist                 https://www.spigotmc.org/resources/treeassist.67436/
      # TogglePvp                  https://www.spigotmc.org/resources/togglepvp.44918/
      # UltimateTNT                https://www.spigotmc.org/resources/ultimatetnt-the-ultimate-tnt-plugin.49388/
      # XPStorage                  https://www.spigotmc.org/resources/xpstorage.74254/
      SPIGET_RESOURCES: 2661,64139,81490,59773,81534,74134,74145,82349,76907,77050,4510,28140,60306,19286,67436,44918,49388,74254
      # Remove old .jar mods after download a new version
      REMOVE_OLD_MODS_INCLUDE: "*.jar"
      REMOVE_OLD_MODS_DEPTH: 1
      # Auto download plugins from modrinth.com
      # NoBedExplosions            https://modrinth.com/plugin/nobedexplosions/
      # NBTAPI                     https://modrinth.com/plugin/nbtapi/
      # Vane                       https://modrinth.com/plugin/vane/  
      MODRINTH_PROJECTS: nobedexplosions:release,nbtapi:release,vane:release
      # Auto download other mods which are hosted on not simple supported plattform like dev.bukkit.com or jenkins
      # !!!Important!!!
      # If a new version is released, i must remove the old one in ./plugins/ and ./data/plugins
      # Its important for:
      # Dynmap                     https://dynmap.us/builds/dynmap/Dynmap-3.5-beta-2-spigot.jar
      # Vane-admin                 https://github.com/oddlama/vane/releases/download/v1.10.3/vane-admin-1.10.3.jar
      # Vane-bedtime               https://github.com/oddlama/vane/releases/download/v1.10.3/vane-bedtime-1.10.3.jar
      # Vane-core                  https://github.com/oddlama/vane/releases/download/v1.10.3/vane-core-1.10.3.jar
      # Vane-enchantments          https://github.com/oddlama/vane/releases/download/v1.10.3/vane-enchantments-1.10.3.jar
      # Vane-trifles               https://github.com/oddlama/vane/releases/download/v1.10.3/vane-trifles-1.10.3.jar
      # WildLoaders                https://hub.bg-software.com/job/WildLoaders/lastSuccessfulBuild/artifact/target/WildLoaders-2022.7-b70.jar
      # WildChests                 https://hub.bg-software.com/job/WildChests/lastStableBuild/artifact/target/WildChests-2022.7-b91.jar
      # WorldEdit                  https://dev.bukkit.org/projects/worldedit/files/latest
      # Its NOT important for:
      # ProtocolLib                https://ci.dmulloy2.net/job/ProtocolLib/lastSuccessfulBuild/artifact/target/ProtocolLib.jar
      MODS: >
        https://dynmap.us/builds/dynmap/Dynmap-3.5-beta-2-spigot.jar
        https://ci.dmulloy2.net/job/ProtocolLib/lastSuccessfulBuild/artifact/target/ProtocolLib.jar
        https://github.com/oddlama/vane/releases/download/v1.10.3/vane-admin-1.10.3.jar
        https://github.com/oddlama/vane/releases/download/v1.10.3/vane-bedtime-1.10.3.jar
        https://github.com/oddlama/vane/releases/download/v1.10.3/vane-core-1.10.3.jar
        https://github.com/oddlama/vane/releases/download/v1.10.3/vane-enchantments-1.10.3.jar
        https://github.com/oddlama/vane/releases/download/v1.10.3/vane-trifles-1.10.3.jar
        https://hub.bg-software.com/job/WildLoaders/lastSuccessfulBuild/artifact/target/WildLoaders-2022.7-b70.jar
        https://hub.bg-software.com/job/WildChests/lastStableBuild/artifact/target/WildChests-2022.7-b91.jar
        https://dev.bukkit.org/projects/worldedit/files/latest

    tty: true
    stdin_open: true
    restart: unless-stopped
    volumes:
      - ./data:/data
        # Location for all files which should copyed to ./data folder, like configs
      - ./config:/config
        # Location for all plugins and files which are related to "plugins".
        # Container will copy files to /data/plugins, if a newer one is in /data/plugins
        # it's still remain there
      - ./plugins:/plugins

networks:
  default:
    name: npm_default
    external: true
itzg commented 1 year ago

Thanks for the update. More banging my head on Modrinth I guess...

itzg commented 1 year ago

I'm not sure whether to blame Modrinth or the vane authors

In the API response, none of the files are marked as primary

    "files": [
      {
        "hashes": {
          "sha512": "8040d1bdb4cd9c5a0976ab2b41005b8405ad0e56894e84b5192541c6338c4bce404008808f78085e5020081c7f04876275a6014534dbd5835d63c7851195bac5",
          "sha1": "80e080ca558ab366da36ea87b9baa97a7edb08a7"
        },
        "url": "https://cdn.modrinth.com/data/698NGGtb/versions/AlzUrzCs/all-plugins.zip",
        "filename": "all-plugins.zip",
        "primary": false,
        "size": 3843079,
        "file_type": null
      },
      {
        "hashes": {
          "sha512": "a83a63e83dfc375d23e7ba57e77fdc4a91a9de5d46b545b3b79f708c4107fbdade5291eabb31acd80a4f0716589693320f2f714a446e62273c0dd2929fdc0797",
          "sha1": "76524335d6fa0f911fcd801cc12c9506e58a14a7"
        },
        "url": "https://cdn.modrinth.com/data/698NGGtb/versions/AlzUrzCs/vane-plexmap-1.10.3.jar",
        "filename": "vane-plexmap-1.10.3.jar",
        "primary": false,
        "size": 13395,
        "file_type": null
      },
      {
        "hashes": {
          "sha1": "23b68b8d2984eac046966c138e5393df8bcbf013",
          "sha512": "1336036172d4f4a4d10bc09cfca2bb4bc58922bf86ad03931ac8bc212deee1bd23ec69b2116d71c1c2c2da0b4d2d857696a6e379436b9b1ff3f7337a69940846"
        },
        "url": "https://cdn.modrinth.com/data/698NGGtb/versions/AlzUrzCs/vane-velocity-1.10.3.jar",
        "filename": "vane-velocity-1.10.3.jar",
        "primary": false,
        "size": 171997,
        "file_type": null
      },
      {
        "hashes": {
          "sha1": "bc83207bc87c541b03d45310cc0fb747d0d06b82",
          "sha512": "f91187ae8406a3c1ad41cc21d585c8bb9185942e3d946e4797ebbe0321f3d75d3d113f775827a7080203811c090641a6bd3c1af5db9fee18dc955731c73ea203"
        },
        "url": "https://cdn.modrinth.com/data/698NGGtb/versions/AlzUrzCs/vane-waterfall-1.10.3.jar",
        "filename": "vane-waterfall-1.10.3.jar",
        "primary": false,
        "size": 406122,
        "file_type": null
      }
    ],

Yet the Modrinth page marks the first one primary anyway???

image

I guess I'll assume the same when no files are marked primary.

techsolo12 commented 1 year ago

This was also my intention, but my skill with developing are very limited. I think the problem is modrinth, not the dev. We can test another repo which have a primary marked version.

itzg commented 1 year ago

Thanks! I'm already in the helper code this morning, so I'll go with the assumption of first file wins when none are primary. When I have spot checked others, they always have one marked primary. Logically that's the point of the "primary" indicator 😀

itzg commented 1 year ago

When this build finishes, see if that gets you all the way. Thanks BTW for flushing out some edge cases 😀

https://github.com/itzg/docker-minecraft-server/actions/runs/4337492022

techsolo12 commented 1 year ago

Very nice! You'r welcome! :) Its worked. The helper will download the files now as expected. One thing i don't have expected... I download a .zip and not a .jar, so when the container download vane from modrinth its a bundle which is zipped. :P I think i should open a Feature Request. What are you mean?

itzg commented 1 year ago

Interesting. Yeah, open a feature request for that here or over in the helper repo.

I'll go ahead and close this issue.

itzg commented 1 year ago

I beat you to it 😁. This latest build will unzip downloaded files that are zips

https://github.com/itzg/docker-minecraft-server/actions/runs/4338285978

techsolo12 commented 1 year ago

Lol, this was very fast! 🥇 It's amazing how fast you develop. I have tested the new image and its works very well. Thank you for the fast implementation of this feature 💯