Skip to content

Various Fixes#24

Open
kevinkjt2000 wants to merge 6 commits into
Lemmons:masterfrom
kevinkjt2000:fixes
Open

Various Fixes#24
kevinkjt2000 wants to merge 6 commits into
Lemmons:masterfrom
kevinkjt2000:fixes

Conversation

@kevinkjt2000

Copy link
Copy Markdown

First off, thanks for these terraform modules! Definitely a huge time saver for me! I wanted to contribute back some fixes that I found.

@kevinkjt2000 kevinkjt2000 changed the title Modernize invocation ARNs and ACM cert validations Various Fixes Dec 20, 2020
@kevinkjt2000

Copy link
Copy Markdown
Author

I'm noticing that large curseforge packs suffer from rcon-cli not being able to connect to the rcon port. Several others have voiced this too itzg/docker-minecraft-server#518. Have no fear though! There's an alternative way to getting the number of players online. https://github.com/Dinnerbone/mcstatus

# add a function to instance.py that gets the hostname of a docker (e.g. `minecraft`)
# pass that hostname to mcstatus in players.py instead of doing `rcon-cli list`
server = MinecraftServer.lookup(f"{game_host}:{game_port}")
status = server.status()
players = status.players.online
return players

@Lemmons Any thoughts on this? Have you also experienced trouble with rcon-cli?

environment:
EULA: "TRUE"
MAX_RAM: "7G"
MAX_MEMORY: "7G"

@kevinkjt2000 kevinkjt2000 Dec 20, 2020

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX_MEMORY should probably be a user-defined variable since the size corresponds with instance type. It would also be nice to be able to add additional environment variables to this section. Terraform has some built in yaml functions that could take a dictionary variable in, merge it with another, and the pass the result through yaml:

locals {
  environment_defaults = merge(
    {
      "EULA": "TRUE",
      "MAX_MEMORY": var.max_memory,
      "TYPE": var.modpack_type,
    },
    (var.modpack_type == "FTB" ? {"FTB_SERVER_MOD": var.modpack_version} : {"CF_SERVER_MOD": var.modpack_version}),
  )
}

# later inside the template...
environment: ${yamlencode(merge(local.environment_defaults, var.environment_overrides))}

Thoughts?

https://www.terraform.io/docs/configuration/functions/yamlencode.html
https://www.terraform.io/docs/configuration/functions/merge.html

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am already merging environments in my setup, but I'll wait until this PR is done to include these changes in another. Trying to keep this one strictly on bug fixing for now.

@kevinkjt2000

Copy link
Copy Markdown
Author

More on that rcon issue, it seems that there are multiple server.properties files

image

The one in /srv/minecraft-spot/data has all of the correct properties, but the one in the FeedTheBeast folder is missing anything provided by the environment section in docker-compose (thus rcon disabled by default).

Hmmmm I'll need to investigate further, but I suspect that unpacking the modpack zip to /srv/minecraft-spot/data/FeedTheBeast instead of /srv/minecraft-spot/data is breaking things for the curseforge pack that I'm trying to start. https://www.curseforge.com/minecraft/modpacks/project-ozone-3-a-new-way-forward with a direct download of https://media.forgecdn.net/files/3077/771/PO3+-+3.3.61server.zip

@kevinkjt2000

Copy link
Copy Markdown
Author

Found the spot where itzg is hardcoding data/FeedTheBeast https://github.com/itzg/docker-minecraft-server/blob/f613228619c6a3d2e4a3ad39c595f966cc1e7c31/start-deployCF#L8

Seems there is no environment variable to override this, and it is incompatible with the hard-coded path of data/server.properties https://github.com/itzg/docker-minecraft-server/blob/f613228619c6a3d2e4a3ad39c595f966cc1e7c31/start-configuration#L58. Which leads me to think that multiple server.properties is an issue for itzg and not this repo.

@Lemmons

Lemmons commented Dec 21, 2020

Copy link
Copy Markdown
Owner

Thanks for the contribution and thought you put into this! I'm glad to know this project has been useful to somebody other than myself. I haven't had time to review the changes yet, as I'm actually in the middle of a move, but wanted to at least confirm I've seen this and let you know I'll try to get to it in the next week.

@kevinkjt2000

Copy link
Copy Markdown
Author

I hacked a custom version of itzg's docker where the directory FeedTheBeast/ is not present and modified appropriate input vars for this module. Now, I can use rcon-cli without issue 😄 . I'm sure they'll fix it eventually; the issue is in waiting for feedback stage after I pointed out the root cause.

I'm open to contributing a lot more to this repo. If there's a roadmap that you have in mind or you want to just hear some of my ideas, I'd be happy to meet online at some point. Improvements to the web interface, backing up server log files, removing the previous.zip from S3 (since the bucket has versioned files), allow running in regions other than us-east-1... I don't struggle with coming up with ideas; I do have a hard time prioritizing them on a project that I have barely started using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants