-
Notifications
You must be signed in to change notification settings - Fork 280
Running dredd itself and hook server in separate docker containers #748
Comments
At the moment the hook server is started by dredd but you can at least in theory pass dredd the custom hook handler command in your case the |
Some info is available in the relevant part of the docuemntation http://dredd.readthedocs.io/en/latest/hooks-new-language/#writing-dredd-hook-handler-for-new-language |
Im afraid, this is not possible, because you can not run docker container inside docker container (it is actually possible but not in our case), anyway - maybe I can try to pass some dummy command, which will output string "Starting"... I will try and lat you know. |
I see, In that case I'd just put some script which would run and stop on SIGTERM, something along these lines should suffice. #!/bin/bash
function term() {
echo 'Caught SIGTERM, exiting.'
exit 0
}
trap 'term' SIGTERM
while true
do
sleep 1
done |
Look at the default values of all the related to hook handlers settings so that you listen on correct port and so on http://dredd.readthedocs.io/en/latest/usage-cli/#-hooks-worker-after-connect-wait |
@honzatrtik What @w-vi wrote you is exactly what we do in tests. We use dummy script (e.g. this) as a value for the So this should work perfectly. Feed Dredd with dummy script and expose the hook handler on correct port. You will just need to start and stop the hook handler yourself. I'll close this as solved, but please come back and comment in case it doesn't work, so we can re-open and find a solution 🙂 And thanks for using Dredd and for bringing this up! 👍 |
Hey, it'd be super sweet if there was a native solution for this. We're running into this as well now. Maybe It seems kind of pointless to have the whole handler host/port configuration if Dredd then wants to set it up itself anyway, right? I was about to create a different issue for this, but this is probably a more appropriate place. |
@TotempaaltJ Actually, I think a new issue linking this one would be nice! I agree it's a good idea to give a standard option to bypass the handler logic. |
Alright I created #755 ^ |
Close apiaryio/docker-base-images#149, close #748, document #755
Close apiaryio/docker-base-images#149, close #748, document #755
Close apiaryio/docker-base-images#149, close #748, document #755
🎉 This issue has been resolved in version 5.4.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Does anyone have an example https://gist.github.com/rayzeller/255fbbf88f9686b3062e84a67dbfa8fa Current error: It seems that |
Would --hooks-worker-handler-host and --hooks-worker-handler-port help you? |
@honzajavorek i have those set in my
|
No, having them in YAML should be enough. Are you able to see anything interesting using |
AH. i see it now. correct me if i'm wrong, but It looks like if Line 56 in 8d517ac
anyway, i was able to get hooks to register by changing my
Meaning. the hooks server doesn't get called at all. |
If the language is If you're about to use the JavaScript hooks, this should be enough to get you going: const hooks = require('hooks');
//example hook just to get things going!
hooks.before('auth > Facebook Auth > Callback (Get) > 200 > application/json', (transaction) => {
transaction.request.headers.Authorization = 'Basic: YWxhZGRpbjpvcGVuc2VzYW1l';
}); Save it as |
Awesome, thanks. It definitely says that in the docs, but I missed it! |
For anyone else needing a quick POC for using hooks with
and then |
OK, it turns out the issue for me was that the hardcoded |
Hi, first of all, thanks for dredd, it is great tool!
Im trying to start my hook tcp server in separate docker container and then run dredd tool itself in another container and link them together. The motivation is that I need to bootstrap our app in hook file, create some fixtures etc. but dont want to bloat our production image with dredd.
My idea was something like:
Is something like this supposed to work? Im not sure, if hook server must be started by dredd itself...
Thanks in advance!
The text was updated successfully, but these errors were encountered: