-
Notifications
You must be signed in to change notification settings - Fork 307
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
Revert many changes that break systemd #308
base: master
Are you sure you want to change the base?
Conversation
I also tested this through and this was working as expected. For me only I was also trying to setup multiprocess Sidekiq services today and and it was not working as expected. Started to read about how systemd works Thankfully I noticed your PR that resolved the multiple process problem. Thank you. Some resources that I was reading to understand how the systemd with |
@legendetm I will be honest I don't know much about the permissions thing but I know this option exists |
@jclusso it would be nice to update the documentation that before changing the And regarding permission issue, I also think that sudo should be only used when |
@legendetm are you referring to the usage of sudo for |
@jclusso I meant we should mention in documentation that you need to run
Other option would be Regarding the sudo part, this is unrelated to this PR. Just in my case the deploy user has no sudo privileges and therefore |
…o users know they need to run the uninstall and install commands.
@seuros where do we stand on getting this merged or are you integrating this into other changes? |
Hey @seuros, just checking in to see if you've had a chance to review this. |
Can you try master branch or the prerelease? |
@seuros I just reviewed the v3.0.0.alpha.1 and it does not appear to be correctly using Systemd's multiprocess support. Did you get a chance to review everything I wrote above? |
@seuros checking in on this again since it's been quite some time. |
@seuros could you please help us to solve this issue impacting more and more people please? 🙏 |
@seuros checking on this again... |
@seuros any chance you've gotten to review this? |
I will fix this gem in this weekend, do you mind if i ping you for testing ? |
No problem - my availability this weekend may be limited, but I'll try and respond! |
@seuros is there any update on this? |
@seuros is there going to be an update on this? |
Inject sidekiq:stop after deploy:reverted
I will look into it. |
I'm the original author of the sidekiq multi process code. I think I have some useful insights into what's happened since my PR was merged.
In #296, an issue was opened about not supporting older versions of systemd that did not support multiple process service naming with the
@
symbol. The solution for this was to make it so that whensidekiq_processes
is set to 1, it uses thesidekiq_service_unit_name
without the@
.However, the changes implemented in #297 changed the
sidekiq_service_file_name
method to never have the@
sign, and they changed thesidekiq_service_unit_name
method to have some conditional logic that doesn't always work.As a result of the changes in #297, #298 was created, which led to #299. #299 modified the
sidekiq:install
task's functionality in an incorrect way, changing it to create multiple sidekiq@[number].service files, which is not how systemd multiple process support is supposed to work. The purpose of the@
sign in systemd service file names is that everything after the@
is passed in as an argument. Therefore, the correct service file name for a multiple process service is"[email protected]". This allows for the full functionality of systemd service arguments. For example, ranges are supported, so you can run a command like
systemctl restart sidekiq@{1..3}
and that single command will execute for all 3 processes. Even though creating multiple files does technically work, I don't believe it is correct, and there is no benefit to having multiple identical service files when you only need one.In order to address the issues created by the changes mentioned above, #300 was created. However, it did not fix everything, which led to #302 and #304, which are further attempts to fix issues created by these changes. Ultimately, you end up with a whole series of changes attempting to patch issues going back to #296. In my opinion, things would be simpler and easier if the code went back to behaving closer to how things were around #296.
The code in this pull request does that. When
sidekiq_processes
is set to one, the systemd unit file will be named "sidekiq.service" and all commands will run on the service named "sidekiq". Whensidekiq_processes
is greater than one, the systemd unit file will be named "[email protected]" and all commands will run either a systemd multi-process command, likesidekiq@{1..3}
, or, in the case of the restart command, it will run on each numbered process in turn (firstsidekiq@1
, thensidekiq@2
, etc.).Finally, in regards to issues around backward compatibility, you can simply run
sidekiq:uninstall
before upgrading andsidekiq:install
after upgrading. This makes more sense than over complicating the code.