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

Autostop feature #1212

Merged
merged 4 commits into from
Dec 21, 2021
Merged

Autostop feature #1212

merged 4 commits into from
Dec 21, 2021

Conversation

Oekn5w
Copy link
Contributor

@Oekn5w Oekn5w commented Dec 19, 2021

implements #1211 according to Discord description.

@javabrett
Copy link
Contributor

javabrett commented Dec 19, 2021

Thanks for the PR @Oekn5w .

As my launch-time version of this amounts to a oneline sed of the existing autopause pause.sh script:

sed -i -e "s/pkill -STOP java/rcon-cli stop/" /autopause/pause.sh;/start

... and the functionality (in terms of detect-idle, zero players) is otherwise identical to autopause, I wondered if an approach that shoehorns a custom action into the existing autopause could work, provided it isn't confusing ... as an alternative to duplicating /autopause as /autostop - or are there other differences (I haven't compared them yet)?

So I was debating one of the following:

  • Adding ENABLE_AUTOSTOP, having it set and trigger ENABLE_AUTOPAUSE transparently, but with rcon-cli stop as the action in pause.sh when the new variable is set. Downside is the slightly confusing running of the autopause scripts (including potentially pause.sh but with autostop behaviour, but this seems minor.
  • Adding variable AUTOPAUSE_STOP default false. Makes it clear that autostop is a variant of the autopause behaviour, requires ENABLE_AUTOPAUSE=true. Variant would be AUTOPAUSE_ACTION=pause with option for stop.
  • Variants where just pause.sh is copied to stop.sh.

My current leaning is towards the first of these. WDYT - or are there other advantages in forking autopause to autostop entirely?

@Oekn5w
Copy link
Contributor Author

Oekn5w commented Dec 19, 2021

@javabrett

As there are major differences with how the feature works and requires outside container configuration, I thought this approach is more viable to avoid confusion compared to cobbling this together with a startup sed command.

Autopause does require a lot of validation and configuration for the knockd stuff, which is not needed for Autostop. Additionally we can provide a nice log message with the correct name.

Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

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

I agree with the general observation @javabrett that it looks like more code duplication than expected; however, I do also agree @Oekn5w with the improved usability with the current approach.

files/autostop/autostop-daemon.sh Outdated Show resolved Hide resolved
files/autostop/stop.sh Outdated Show resolved Hide resolved
Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

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

I still need to research how can have GitHub actions do a one off test-image build for PRs, as needed. However, maybe I'll save that for another time and just merge this PR.

@itzg
Copy link
Owner

itzg commented Dec 21, 2021

I found some ideas for PR-driven test image building; however, I'll experiment with that separately.

@itzg itzg merged commit fa4a0e9 into itzg:master Dec 21, 2021
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.

None yet

3 participants