Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module: replace tmux with systemd socket #52

Closed
wants to merge 1 commit into from

Conversation

Misterio77
Copy link
Contributor

@Misterio77 Misterio77 commented Dec 14, 2023

Supersedes #41.


This PR replaces tmux with a systemd stdin socket. With it, you can easily run commands like so:

echo "say Hi" > /run/minecraft/foobar.stdin

We now use this to run "stop" (or any custom command) on ExecStop, for a cleaner shutdown.

To complement extraReload, I've added more extra* options for different parts of the lifecycle: extra{Post,Pre}{Start,Stop} (preStop and postStart can run game commands, awesome!).

The tests are also expanded:

  • In the simple test: I run list and check the output is good.
  • In the file/symlinks test:
    • I de-op Misterio7x to verify ops.json is both mutable and has the correct declaratively-set value
    • I run an unknown command and check the message matches unknown-command. As paper mutates paper.yml (to fill it up with missing entries) on startup, this verifies that values set through nix-minecraft are kept by it.

@Infinidoge
Copy link
Owner

As per my comment in the last PR, a prerequisite for this kind of change is that it must be configurable. It should be possible to select between tmux and socket, and tmux would remain the default for a deprecation period.

@Misterio77
Copy link
Contributor Author

Yep! Will do. Just re-created this PR to get discussion and feedback going

@Silverdev2482
Copy link
Contributor

I am not familiar with systemd sockets, but do they offer an interactive mode like Tmux? Although not a feature I depend on, it is a convenience I enjoy having.

@Silverdev2482
Copy link
Contributor

I think this is ok to put this here instead of a separate issue, could there be a way to configure the socket to be stored in the Minecraft server's directory? That would me a minor convince to me as I have to type shorter directory names.

@Infinidoge
Copy link
Owner

systemd sockets do not have an interactive function, which is a major reason why I am so adamant about there being a toggle for it.

Sockets are by design put in the /run runtime directory, as that is the standard place to put sockets. (Additionally, it being in /run is generally shorter than the /srv equivalent: /run/minecraft/[servername].sock vs /srv/minecraft/[servername]/server.sock (or similar))

@Silverdev2482
Copy link
Contributor

The reason I say I would like to be able to configure them to be there is that I'm so often cd'ed there. Although that rational makes sense.

@frantisekhanzlikbl
Copy link
Contributor

frantisekhanzlikbl commented Apr 1, 2024

Hi, @Misterio77, are you still working on this? I very much like the changes and am interested in using them myself. If you no longer have the time for this, would you mind me picking it up to make the socket configurable? Thanks!

@Misterio77
Copy link
Contributor Author

Hey @frantisekhanzlikbl,

Thanks for the interest, feel free to pick it up!

While I think the socket being configurable is a useful addition, I think the main blocker for this is currently making this a toggle as per @Infinidoge's comment

@frantisekhanzlikbl
Copy link
Contributor

Ohh, sorry, I didn't express myself too well. 😄
By “making the socket configurable” I meant “making the usage of socket vs tmux configurable”. I'm currently awfully short on time, but hopefully, I'll be able to get on this in a few weeks.

@Infinidoge
Copy link
Owner

Superseded by #67

@Infinidoge Infinidoge closed this Sep 22, 2024
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.

4 participants