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

Phased restart #329

Merged
merged 1 commit into from
Sep 2, 2021
Merged

Phased restart #329

merged 1 commit into from
Sep 2, 2021

Conversation

mksvdmtr
Copy link
Contributor

@mksvdmtr mksvdmtr commented Jun 7, 2021

Added the ability to phased restart puma
Need to define a release directory in config/puma.rb:
directory '/var/www/current'
Otherwise, Puma won't pick up your new changes when running phased restarts

@germanotm
Copy link

Any predictions about when this pull request will be accepted?

@pocke
Copy link

pocke commented Aug 5, 2021

I agree with this PR.
Probably this issue is related to this PR. #303
The current signal, TSTP, does nothing for puma. It looks a bug. So I think replacing TSTP with USR1 is the right way.

@odarriba
Copy link

odarriba commented Sep 1, 2021

We need this PR also!

@seuros
Copy link
Owner

seuros commented Sep 2, 2021

@mksvdmtr Will have this released this week. can you rebase this PR ?

@seuros seuros self-assigned this Sep 2, 2021
@mksvdmtr
Copy link
Contributor Author

mksvdmtr commented Sep 2, 2021

@mksvdmtr Will have this released this week. can you rebase this PR ?

@seuros done

@seuros seuros merged commit 7406c97 into seuros:master Sep 2, 2021
@seuros
Copy link
Owner

seuros commented Sep 2, 2021

I will release a beta version now. Let me know if you find any regression.

@phylor
Copy link
Contributor

phylor commented Sep 9, 2021

@seuros Is there any interest in making this new behavior configurable?

Some arguments against this new behavior:

  • Phased restarts are only useful for zero downtime deployments. At least for Rails these are not the standard case though. I would argue that the defaults should consider the most common case (think of rails new and then deploy).
  • Using phased restarts, the old and new application may run concurrently. This is an issue if you are running database migrations which do not comply with zero downtime deployments. In this scenario, it is possible that either your old or your new application errors out because the database has changed.
  • The puma master process is not restarted using phased restarts. Updating the puma gem will hence require a manual intervention (explicitly restarting puma).
  • At least in my test, Puma didn't catch up on the new application. Possibly, the directory configuration in puma is now mandatory (as mentioned in this PR).

I think it's a good idea to support phased restarts. But I believe that shouldn't be the default as it requires much more work and insight, and introduces more issues if not aware of it.

I would therefore suggest to revert the default back to a puma hot restart. For those who need zero downtime deployments, they could enable a configuration option to activate it.

What are your thoughts about this?

@seuros
Copy link
Owner

seuros commented Sep 9, 2021

@phylor yes. I agree with you .
Do you have time to open a PR ? I might be able to do it this weekend.

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.

6 participants