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

Pause without players #273

Closed
wants to merge 5 commits into from
Closed

Conversation

Luatan
Copy link
Contributor

@Luatan Luatan commented Feb 2, 2024

Context

Choices

  • Added an additional Script that will send a SIGSTOP to the server. After the process is suspended, it will monitor the server port for any connection attempts.
  • If a player connects to the port it will resume the process and the player will be able to spawn without a timeout.

Feedback is appreciated, if you see something that can be improved!

Todo

  • Add Cronjob
  • RCON handling if the server is suspended
  • Test how suspending the process reflects on the Ingame time
  • Check if port is set

Test instructions

Manually

  1. Start the server with the default docker compose file
  2. run docker exec palworld-server pause
  3. check the server log for a message, that the server has been paused
  4. run echo>/dev/udp/127.0.0.1/8211 or start the game and login
  5. check that the server has continued

Cron

  1. todo

Checklist before requesting a review

  • I have performed a self-review of my code
  • I've added documentation about this change to the README.
  • I've not introduced breaking changes.

@Dashboy1998
Copy link
Contributor

As an alternative to using SIGSTOP you could shutdown the server, monitor the port then start the server.

@Luatan
Copy link
Contributor Author

Luatan commented Feb 2, 2024

As an alternative to using SIGSTOP you could shutdown the server, monitor the port then start the server.

I think if I stop the server binary, I also stop the container because start.sh will exit.

@Dashboy1998
Copy link
Contributor

I think if I stop the server binary, I also stop the container because start.sh will exit.

As written yes. With a few modifications to start.sh you could change that behavioral.

@Luatan
Copy link
Contributor Author

Luatan commented Feb 2, 2024

I think if I stop the server binary, I also stop the container because start.sh will exit.

As written yes. With a few modifications to start.sh you could change that behavioral.

Do you think it would make sense to make the pal server into a service so we can start/restart/stop it easier? If that's even possible inside the container.

Aside from that. I am not sure if a restart would be fast enough to connect again without timeout

@Dashboy1998
Copy link
Contributor

Do you think it would make sense to make the pal server into a service so we can start/restart/stop it easier? If that's even possible inside the container.

I'm not sure how running as a service would make a difference.

You're probably right, the time to start the server might be too long. However SIGSTOP would cause issues with autoreboot.sh, backup.sh, and update.sh. Those don't check if the rcon command was successful, they assume it was.

The term handler in init.sh would produce an error for rcon too and it would hang as the server would never stop since the rcon stop would never be recieved by the paused server.

While it would prevent restore.sh from working properly, that wouldn't have an big issues as @seoseonyu did a great job with error handlers.

That isn't to say this isn't doable. It definitely is doable but it would be a big PR.

I would say something making that many changes should be multiple PRs due to the error handling, rcon checking, and status checking we would need to add to autoreboot.sh, backup.sh, and update.sh.

@Luatan
Copy link
Contributor Author

Luatan commented Feb 12, 2024

closing this. I think it is better for an external Script to pause the container instead of trying to stuff this in (at least at the moment). Maybe the game will give us a command in a later version.

@Luatan Luatan closed this Feb 12, 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.

2 participants