-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add Fastly support #451
Add Fastly support #451
Conversation
thanks for picking this one up again. great if we can get this in! while having some demo or something to validate that it works with the actual api, i agree that the automated tests should not talk with actual fastly. could you use the MockClient of httplug to expect requests and return canned responses so we can do a functional test within our application boundary? |
I suggest that we do some functional tests with the httplug mock client
and/or the vcr-plugin. That can at least ensure we know what we send out,
and "documents" what we expect as interaction with fastly.
With php-vcr it would be doable to switch tests to talk to an actual fastly
account with credentials and check if it really works.
|
Any existing FOSHttpCache examples of that? |
no such examples, so far we have only unit tests and full integration tests (we install nginx and varnish in travis-ci). |
I did that in my LiteSpeed PR as well so if it works, why not? 😄 |
sure, if we can't do it in one then that sounds fine. with varnish / symfony you can do a request forcing a backend lookup, but when that is not available, doing 2 requests seems fine to me. needs to be sure there is no race condition though (doing the request before the cache got purged) |
Added. @vvuksan Would you be able to verify if what's added here* successfully will trigger a refresh of a url? Or if you would recommend another way? e.g undocumented API or something ;) * TL;DR;
|
build errors should go away once symfony/symfony#32802 is tagged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! this seems reasonable uncomplicated
oh, and link to fastly docs is of course a good idea! can you please also add an entry in the changelog and add info in the documentation? https://github.com/FriendsOfSymfony/FOSHttpCache/tree/master/doc i'd squash all commits, even though that will mash together the git attribution to just one of you. hope you don't mind? otherwise i squash to 2 commits to keep your things separate. @Toflar do you see anything else or should i merge when we have the documentation? i plan a new minor version once this is released. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Toflar do you see anything else or should i merge when we have the documentation? i plan a new minor version once this is released.
Just a minor CS nitpick, the rest looks very simple and straightforward to me. Great addition because it requires zero proxy setup. I wish we had the same for KeyCDN :)
Should definitely be merged once the docs are added. Well done, @andrerom!
Fixed a few things, notable:
|
doc/proxy-clients.rst
Outdated
|
||
* ``service_identifier``: Identifier for your Fastly service account. | ||
* ``authentication_token``: User token for authentication against Fastly APIs. | ||
* NB: To be able to clear all cache(`->clear()`), you'll need a token for user with Fastly "Engineer permissions". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very cool! this is exactly what such documentation should help people with, remove wtf moments 👍
oh, will try that next time, seems nice.
i never used fastly. maybe @hpatoio wants to try to do that? |
Ciao. Cool you finalized my PR. We are not using this bundle anymore (went for a different solution) but I'm happy to help. What do you exactly need ? Sorry but the conversation in the PR is a bit long and a recap could help |
hey hpatoio, good to see you (even if just virtually) - andré said that there are some tests missing. @andrerom can you explain in more detail what tests you would want? end-to-end tests with an actual fastly seems difficult to achieve to me... |
this is what I had in mind |
Got it. For NGINX/Varnish we create services usign the |
… support (not possible with purge)
can we wrap this up somehow? i'd be ok to merge without functional test and add a warning in the doc that fastly support is experimental. |
To be fair I think there's nothing else we can do other than checking that the API requests are correct. We don't need to functional test the API of Fastly, that's their responsiblity. So imho this doesn't need to be experimental :) |
002ab70
to
cef4220
Compare
Ok with me, rebased and pushed. |
@Toflar well, without an end-to-end test we can't be sure that our assumptions about the fastly api are correct. but yeah, utlimately that is up to everybody building an application with these components, as otherwise we still can't be sure if it works. and really would not want to run something that talks to fastly in the FOSHttpCache travis-ci setup. @andrerom can you please apply the cs fixer thingies? the travis failure is "only" the python sphinx installation to test the doc. that is a known problem and not related to your changes. |
@dbu CS fixes and change to use request body has been pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a minor docs formatting issue but I would love to see this merged as is 👍
Co-Authored-By: Yanick Witschi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hooray!
thanks a lot for your persistence! |
Thanks André - great stuff! |
Closes #403
Changes:
Follow Up topics:
Context of this: