groovenauts / capistrano-systemd-multiservice

Capistrano Plugin to control services with systemd
MIT License
45 stars 17 forks source link

User mode variant of multiservice plugin with shared spec examples #9

Closed satek closed 6 years ago

satek commented 6 years ago

Hi! I needed services to be deployed in the user directory so that they could be managed like so for example: systemctl --user list-unit-files. To that end I created a subclass of MultiService called UserMultiService. The difference is in default directory location and in the way commands are executed - user services don't need sudo permission. I kept changes to the base class as minimal as possible so existing functionality should remain unaffected. The biggest change is actually to the specs - cause I needed to test all the same cases without having duplication, I extracted all the examples into the shared directory and used them for both classes.

Let me know please if you see any problems with this and would you have interest in merging the changes upstream.

minimum2scp commented 6 years ago

@satek Thanks to your contribution!!!

I'm considering to change the class name Capistrano::Systemd::MultiService to Capistrano::Systemd::MultiService::SystemrService. (because this gem name is capistrano-systemd-multiservice, so all modules/classes should be under Capistrano::Systemd::MultiService)

I will rename Capistrano::Systemd::MultiService class in this week.

After that, rebase to upcomming master and add user service feature in this PR.

satek commented 6 years ago

Sounds good to me, @minimum2scp. I'll keep an eye out for the changes you described.

minimum2scp commented 6 years ago

@satek

10 has been merged and released v0.1.0.beta6.

Please take a look at #10, and rebase to (or merge) latest master.

satek commented 6 years ago

Hi @minimum2scp, apologies for the delay on this. Please see the update. Not much has changed in the update since the SystemService class hasn't changed. I added a new optional parameter to the new_service method to pick the service class to use and it defaults to system so it shouldn't affect existing users. If it's not to your liking I can change the way the class selected.

minimum2scp commented 6 years ago

@satek Thanks, nice work!

Please bump version to 0.1.0.beta7, https://github.com/groovenauts/capistrano-systemd-multiservice/blob/0344ff8c93db8c75cf08e2f3c939429659deb164/lib/capistrano/systemd/multiservice/version.rb#L4 and then I will merge this PR and release gem.

satek commented 6 years ago

Thanks, @minimum2scp. Done.

minimum2scp commented 6 years ago

@satek Released as 0.1.0.beta7, thanks!!! https://github.com/groovenauts/capistrano-systemd-multiservice/releases/tag/v0.1.0.beta7 https://rubygems.org/gems/capistrano-systemd-multiservice/versions/0.1.0.beta7