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

Fixes #29246 - introduce new feature to handle foreman service #321

Merged
merged 9 commits into from
May 13, 2020

Conversation

kgaikwad
Copy link
Member

@kgaikwad kgaikwad commented Mar 3, 2020

  • adding @sthirugn into loop.
    @sthirugn, I have mentioned service priority as 30. Please correct me if any modifications required.
    It would be good to have your review on overall changes.

Reference links for these changes:
theforeman/puppet-foreman#802
https://github.com/theforeman/foreman/blob/develop/extras/systemd/foreman.service

@theforeman-bot
Copy link
Member

Issues: #29246

@@ -0,0 +1,18 @@
module ForemanMaintain
module Features
class Puma < ForemanMaintain::Feature
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to name this something related to foreman-service given thats the systemd service?

Copy link

Choose a reason for hiding this comment

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

I agree here too, we don't need to call out puma.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed feature puma to foreman_service.

@upadhyeammit
Copy link
Contributor

Few thoughts on this one,

  1. The maintain already has foreman_server feature which has httpd as service. Here we consider passenger needs the httpd service and we dont have separate service for passenger.
  2. Can we keep the foreman_server as parent class and have two children, one for httpd and other for puma ? The common things of both features goes in foreman_server and we delegate the methods, variables etc to either puma, httpd(passenger) as per what is available ?

This way we still refer to foreman_server while doing or adding changes and at same time maintain both of these ?

@sthirugn
Copy link

sthirugn commented Mar 3, 2020

Few thoughts on this one,

1. The maintain already has foreman_server feature which has httpd as service. Here we consider passenger needs the httpd service and we dont have separate service for passenger.

The passenger is not a separate service but it is embedded into httpd itself. But the new foreman.service is a separate service outside of httpd. Also note that we will drop passenger in the near future.

2. Can we keep the foreman_server as parent class and have two children, one for httpd and other for puma ? The common things of both features goes in foreman_server and we delegate the methods, variables etc to either puma, httpd(passenger) as per what is available ?

This way we still refer to foreman_server while doing or adding changes and at same time maintain both of these ?

I recommend keeping the new foreman.service separate as it is intended to be separate from httpd.

@ehelms
Copy link
Member

ehelms commented Mar 3, 2020

Starting with Foreman 2.1 (Sat 6.8) the architecture will be a separate foreman service with Apache as a reverse proxy. So httpd will no longer need to be restarted to restart Foreman with the Foreman server.

@kgaikwad
Copy link
Member Author

kgaikwad commented Mar 4, 2020

Starting with Foreman 2.1 (Sat 6.8) the architecture will be a separate foreman service with Apache as a reverse proxy. So httpd will no longer need to be restarted to restart Foreman with the Foreman server.

@ehelms, currently httpd service added in three features i.e foreman, pulp2, pulpcore. Doesn't that mean it will no longer required in all or only applicable for Foreman?

@kgaikwad
Copy link
Member Author

kgaikwad commented Mar 4, 2020

  1. Can we keep the foreman_server as parent class and have two children, one for httpd and other for puma ? The common things of both features goes in foreman_server and we delegate the methods, variables etc to either puma, httpd(passenger) as per what is available ?


This way we still refer to foreman_server while doing or adding changes and at same time maintain both of these ?

I recommend keeping the new foreman.service separate as it is intended to be separate from httpd.

@upadhyeammit, @sthirugn,
I have kept foreman_service as separate feature but modified services list in foreman_server based on foreman_service feature presence.
Will it be okay?

@ehelms
Copy link
Member

ehelms commented Mar 4, 2020 via email

module Features
class ForemanService < ForemanMaintain::Feature
metadata do
label :puma
Copy link

@sthirugn sthirugn Mar 4, 2020

Choose a reason for hiding this comment

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

I think you renamed everything but missed this puma?

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad. Fixed!

Copy link

Choose a reason for hiding this comment

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

no worries, thank you for the quick fix

@sthirugn
Copy link

sthirugn commented Mar 4, 2020

@upadhyeammit, @sthirugn,
I have kept foreman_service as separate feature but modified services list in foreman_server based on foreman_service feature presence.
Will it be okay?

I am not fully aware of foreman_maintain architecture, so the changes here look sane to me in general. I will let @upadhyeammit weigh in with respect to architecture.

@kgaikwad kgaikwad force-pushed the 29246_foreman_service branch 2 times, most recently from 35cafd5 to 686487e Compare March 5, 2020 03:30
@kgaikwad kgaikwad changed the title [WIP]Fixes #29246 - introduce puma feature to handle foreman service [WIP]Fixes #29246 - introduce new feature to handle foreman service Mar 5, 2020
@kgaikwad
Copy link
Member Author

kgaikwad commented Mar 5, 2020

Tests are failing due to current changes. I will update PR.

@ekohl
Copy link
Member

ekohl commented Mar 20, 2020

As part of theforeman/foreman#7536 we'll also add foreman.socket

@kgaikwad
Copy link
Member Author

kgaikwad commented Mar 24, 2020

For Foreman and Pulpcore Apache is a reverse proxy to their services.

@ehelms, @sthirugn,
Does that mean httpd service will be there?
Only difference is foreman/pulpcore will have different services to restart.
I am asking this thing repeatitively because want to understand that along with required changes foreman-maintain should/should not show httpd service in service list as output of command foreman-maintain service list.

@ehelms
Copy link
Member

ehelms commented Mar 24, 2020

Yes, httpd should still be shown.

@kgaikwad kgaikwad force-pushed the 29246_foreman_service branch from 038ce71 to fb3c9d2 Compare March 25, 2020 14:55
@kgaikwad
Copy link
Member Author

@ehelms, @upadhyeammit,
I have removed feature foreman_service and added apache feature just to handle httpd service.

As part of theforeman/foreman#7536 we'll also add foreman.socket

@ekohl, does it mean like services we need to provide way to apply actions (start/stop/status) for socket?

@kgaikwad kgaikwad requested review from ehelms and upadhyeammit March 30, 2020 15:19
system_service('httpd', 30)
]
if foreman_service_installed?
[system_service('foreman', 30)]
Copy link
Member

Choose a reason for hiding this comment

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

We have introduced a foreman.socket that works like a service but does not need to be restarted. However, I think it would be helpful to ensure that the socket is running whenever we perform service operations. @ekohl what do you think regarding handling the socket?

@ekohl
Copy link
Member

ekohl commented Apr 1, 2020

If the socket is started and Apache is as well, it'll automatically start foreman.service. Probably good to ensure it's stopped as well when stopping foreman.service. Note that foreman.service requires foreman.socket so there's no need to start both.

Short summary:

Full stop: systemctl stop foreman.socket foreman.service
Start lazy (when the first request comes in): systemctl start foreman.socket
Start eager: systemctl start foreman.service (foreman.socket can be added but is redundant)
Restart: systemctl restart foreman.service
Reload: systemctl reload foreman.service

@kgaikwad kgaikwad changed the title [WIP]Fixes #29246 - introduce new feature to handle foreman service Fixes #29246 - introduce new feature to handle foreman service Apr 2, 2020
@kgaikwad
Copy link
Member Author

kgaikwad commented Apr 2, 2020

Thank you @ehelms, @ekohl for providing more details on it.
I have removed WIP status as I think current changes will sufficient. It would be good to have your review on this.

@kgaikwad
Copy link
Member Author

@sthirugn,
To test these changes, what kind of setup I will require?

@ekohl
Copy link
Member

ekohl commented Apr 13, 2020

All changes for the service are in nightly.

@sthirugn
Copy link

sthirugn commented Apr 14, 2020

@sthirugn, could you verify updated changes? please let me know if any change required.

My test worked fine, pending @ekohl's new comments.

@ekohl
Copy link
Member

ekohl commented Apr 14, 2020

IIRC, there is change in priorities in case of dynflow-sidekiq services.

Ah, that makes sense.

@kgaikwad kgaikwad requested review from ekohl and ehelms April 16, 2020 15:57
[
system_service('httpd', 30)
]
if foreman_service_installed?
Copy link
Member

Choose a reason for hiding this comment

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

If foreman-service is installed, Apache is usually still used as a reverse proxy. The installer can set it up without Apache, but I personally haven't used that and we don't recommend it unless you know what you're doing.

Copy link
Member Author

Choose a reason for hiding this comment

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

If foreman-service is installed, Apache is usually still used as a reverse proxy.

Yes, Apache will be there. To handle this, I have added Apache feature separately which having httpd in services list.

Copy link
Member Author

Choose a reason for hiding this comment

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

@kgaikwad kgaikwad force-pushed the 29246_foreman_service branch from f5eddbe to 5dc2073 Compare April 23, 2020 10:35
@kgaikwad
Copy link
Member Author

Resolved Rubocop warnings.
Also replaced package checking with systemctl is-enabled foreman check in foreman_server feature.

@kgaikwad kgaikwad requested a review from ekohl April 23, 2020 10:59
Copy link
Contributor

@upadhyeammit upadhyeammit left a comment

Choose a reason for hiding this comment

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

Added one comment, request to check.

definitions/features/service.rb Outdated Show resolved Hide resolved
@kgaikwad kgaikwad force-pushed the 29246_foreman_service branch from 4250319 to 11a104c Compare April 28, 2020 07:09
Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Small nit, but overall 👍

definitions/features/service.rb Outdated Show resolved Hide resolved
@kgaikwad kgaikwad force-pushed the 29246_foreman_service branch from 11a104c to 53faf85 Compare May 5, 2020 14:52
@kgaikwad
Copy link
Member Author

kgaikwad commented May 5, 2020

@upadhyeammit, @ekohl,
Updated PR with suggested changes.

@sthirugn
Copy link

sthirugn commented May 5, 2020

looks great

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Untested, but 👍 from a conceptual perspective. I'll leave it for other reviewers.

@kgaikwad kgaikwad added the 0.6.x changes targeted for 6.8 label May 7, 2020
@kgaikwad kgaikwad requested a review from upadhyeammit May 12, 2020 13:07
@upadhyeammit upadhyeammit merged commit 675680f into theforeman:master May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.6.x changes targeted for 6.8 Needs testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants