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

[drupal] plan overwrites immutable to get custom config under supervision #583

Open
themightychris opened this issue May 28, 2017 · 7 comments

Comments

@themightychris
Copy link
Contributor

This seems dangerous: https://github.com/habitat-sh/core-plans/blob/master/drupal/hooks/init#L28

# Deplay the nginx config and then launch it
cp -r {{pkg.svc_config_path}}/nginx.conf \
      {{pkgPathFor "core/nginx"}}/config/nginx.conf

hab svc load core/nginx --group {{svc.group}} --force

Can a better way be provided to launch nginx as a service with an entirely custom config file? Maybe via an optional config that a custom run hook looks for?

@bdangit
Copy link
Contributor

bdangit commented May 28, 2017

Yes. Normally you would not want to modify the pkg's config file but instead you want to install your custom nginx.conf into the svc path of nginx. Things may have changed due to multi-service supervisor so there may be a better way.

@reset
Copy link
Collaborator

reset commented May 28, 2017

I'm not a fan of the pattern we see here at all so I'm going to mark it as a bug. Theres too much room for failure trying to manage a second service in a run hook of another. I've seen this in a few places now but am not ready to provide a proper solution just yet. Way back in November of 2015 this popped up and the solution was to create a second package which binds to the first. You can see that in the relationship between builder-api and builder-api-proxy. At the time we also tossed around the idea that a package may not be a 1:1 mapping but I'm not confident that we should make such a large change there either as well.

Another way out of this could be to create a third package which includes both the app and the proxy and then simply manages both of those services in it's own hooks like we are seeing in the drupal hook linked above. If we like this pattern, we could document it and make it more of a first class citizen.

@baggerspion
Copy link
Contributor

What about a third way?

My idea was to effectively use the existing core/nginx as a template. I would "fork" it and put the Drupal code and config into this new fork. This fork could then be bound to a PHP-FPM service.

@reset
Copy link
Collaborator

reset commented May 28, 2017

@therealpadams I think that's essentially what we're doing in builder-api-proxy without forking the compilation process. Just by passing a config with the filepaths overridden to the NGINX binary you get the isolation you need. Was there something additional you had in mind?

@baggerspion
Copy link
Contributor

I don't think so... sounds about right. But I would need to check that out first.

@eeyun eeyun added Type:Bug and removed Bug labels Jun 6, 2017
@baggerspion
Copy link
Contributor

In case anyone is interested, my new approach to Drupal (as I described above) can now be found here: https://github.com/therealpadams/habitat-plans

  • New Drupal plan
  • New PHP which runs PHP-FPM as a service that we can bind to

This is a total experiment to see what this solution looks like. I'm not advocating folks use this over the current core/drupal.

@eeyun eeyun added this to the Accepted Minor milestone Nov 9, 2017
@baggerspion
Copy link
Contributor

Wanted to bump this conversation to remind folks that I am still on this:

After that, I will want to look into how to bring MySQL into the mix. But, for now, I simply want to create a simple core/drupal that can be relied on to not be so dumb as the current one.

@rsertelon rsertelon changed the title Drupal plan overwrites immutable to get custom config under supervision [drupal] plan overwrites immutable to get custom config under supervision Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants