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

EZP-29749: As an Administrator I want to configure Imagine ProxyResolver #2470

Merged
merged 3 commits into from
Dec 20, 2018

Conversation

kmadejski
Copy link
Member

@kmadejski kmadejski commented Oct 26, 2018

Question Answer
JIRA issue EZP-29749
Bug/Improvement yes
New feature yes (?)
Target version 6.7/6.13/2.3/master
BC breaks no
Doc needed yes

As discussed with @bdunogier regarding the issue reported by the customer, this PR contains decorator for imagine cache resolver. It uses ProxyResolver provided by LiipImagine (ref: https://github.com/liip/LiipImagineBundle/blob/master/Resources/doc/cache-resolver/proxy.rst).

Moreover, PR introduces the new siteaccess-aware configuration image_hosts which can be used for defining one host used then for image URLs generation.

Note for QA:

  • Check carefully how it works with Cache\AliasGeneratorDecorator
  • Check carefully how it works with PlaceholderAliasGenerator

@DominikaK I will appreciate your help with documenting this feature 🙂

TODO:

  • Implement feature / fix a bug.
  • Fix new code according to Coding Standards ($ composer fix-cs).
  • Ask for Code Review.

andrerom
andrerom previously approved these changes Oct 26, 2018
alongosz
alongosz previously approved these changes Oct 26, 2018
Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

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

+1 but please see comment below (maybe something for QA to check)

eZ/Bundle/EzPublishCoreBundle/Resources/config/image.yml Outdated Show resolved Hide resolved
@kmadejski
Copy link
Member Author

I checked how it works if I get rid of arrayNode and do it as a simple scalarNode and then everything works as expected, but going this way we can allow the user to use only one host per SiteAccess/SiteAccess Group.

@bdunogier / @andrerom do you think it makes sense to introduce ProxyResolver which can be configured with one host only?

@andrerom
Copy link
Contributor

That would be more clear on our side yes, the randomens feature is not really relevant anymore with http2 anyway so just complicates explaining the feature (and understanding how to configure it).

@kmadejski
Copy link
Member Author

kmadejski commented Nov 14, 2018

@andrerom / @alongosz / @adamwojs / @bdunogier I've changed the approach to allow only one host to be configured. Could you please review?

EE PR will be changed accordingly after approve.


if ($configResolver->hasParameter('image_host') &&
($imageHost = $configResolver->getParameter('image_host')) !== '') {
$this->hosts = [$imageHost];
Copy link
Contributor

Choose a reason for hiding this comment

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

Looked a bit deeper, and from what I can see we are basically hitting this part of the code right?
https://github.com/liip/LiipImagineBundle/blob/master/Imagine/Cache/Resolver/ProxyResolver.php#L90

It has inline comment "BC".
However looking at blame, it does not look to be deprecated so +1 from my side but thought I would mention it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, exactly, we are using that part of the code.

As for me this BC comment is due to the fact, that when they changed Resolver behaviour, it was kind of BC break, please take a look: https://github.com/liip/LiipImagineBundle/pull/687/files#diff-f1e2882ffa991d3494a674108aa8000f

Copy link
Contributor

@andrerom andrerom Nov 14, 2018

Choose a reason for hiding this comment

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

yes, that is the blame I also looked at

ezpublish.image_alias.imagine.cache_resolver_decorator_factory:
class: '%ezpublish.image_alias.imagine.decorated_cache_resolver_factory.class%'
arguments:
- '@ezpublish.config.resolver.chain'
Copy link
Member

Choose a reason for hiding this comment

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

Any specific reason for .chain here? Usually we use @ezpublish.config.resolver.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually not, wasn't sure which one should I use :) Do you want me to change it to @ezpublish.config.resolver?

Co-Authored-By: kmadejski <kamil.madejski@yahoo.com>
Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

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

+1, let's not forget about QA for this one though.

@kmadejski
Copy link
Member Author

kmadejski commented Nov 16, 2018

@micszo I think it's ready for QA!

@micszo
Copy link
Member

micszo commented Dec 18, 2018

So far tested with 1.7.8 and 1.13.4. Didn't find issues.
Working on setting it up on v2...

@kmadejski
Copy link
Member Author

@micszo could you please try do test against v2 using this PR: #2506?

@bdunogier
Copy link
Member

I may have stumbled upon a bug on this: https://jira.ez.no/browse/EZP-30333.

@kmadejski
Copy link
Member Author

Thanks @bdunogier, I'll take a look on that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

6 participants