Is there any guide on how to load gRPC extension i...
# help
p
Is there any guide on how to load gRPC extension in a kubernetes container? Is the extension needs to be baked in with the docker image or can be enabled by --extension option?
t
Putting the gRPC extension JAR on the classpath is sufficient provided you’re using the latest versions of everything. It’ll be auto-loaded.
p
so basically I need to download the jar in docker file and set something like this
export CLASSPATH=$CLASSPATH:/path/to/grpc-extension.jar
in the pod manifest file right?
t
You can mount it into the extensions folder inside the container and that’ll have the same effect (assuming you’re using the official WireMock Docker image).
p
yeah, but I am trying to run it as a k8s pod so I guess it has to present either with the docker image itself or downloaded seperately in a node volume and mount that
just to confirm we do not need to provide --extension cli option if we go with this approach right?
t
No, classpath scanning will do the trick, no need to add the parameter
πŸ‘ 1
p
How do I verify grpc extension got installed or not?
when I start wiremock this is the output I see
Copy code
wiremock-dip-7d95fd59f-6cdlk wiremock-dip
wiremock-dip-7d95fd59f-6cdlk wiremock-dip β–ˆβ–ˆ     β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ    β–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ   β–ˆβ–ˆ
wiremock-dip-7d95fd59f-6cdlk wiremock-dip β–ˆβ–ˆ     β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ   β–ˆβ–ˆ β–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ    β–ˆβ–ˆ β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ
wiremock-dip-7d95fd59f-6cdlk wiremock-dip β–ˆβ–ˆ  β–ˆ  β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ    β–ˆβ–ˆ β–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
wiremock-dip-7d95fd59f-6cdlk wiremock-dip β–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ   β–ˆβ–ˆ β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ β–ˆβ–ˆ    β–ˆβ–ˆ β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ
wiremock-dip-7d95fd59f-6cdlk wiremock-dip  β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ β–ˆβ–ˆ   β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ   β–ˆβ–ˆ
wiremock-dip-7d95fd59f-6cdlk wiremock-dip
wiremock-dip-7d95fd59f-6cdlk wiremock-dip ----------------------------------------------------------------
wiremock-dip-7d95fd59f-6cdlk wiremock-dip |               Cloud: <https://wiremock.io/cloud>               |
wiremock-dip-7d95fd59f-6cdlk wiremock-dip |                                                              |
wiremock-dip-7d95fd59f-6cdlk wiremock-dip |               Slack: <https://slack.wiremock.org>              |
wiremock-dip-7d95fd59f-6cdlk wiremock-dip ----------------------------------------------------------------
wiremock-dip-7d95fd59f-6cdlk wiremock-dip
wiremock-dip-7d95fd59f-6cdlk wiremock-dip version:                      3.9.2
wiremock-dip-7d95fd59f-6cdlk wiremock-dip port:                         8080
wiremock-dip-7d95fd59f-6cdlk wiremock-dip https-port:                   8443
wiremock-dip-7d95fd59f-6cdlk wiremock-dip https-keystore:               jar:file:/var/wiremock/lib/wiremock-standalone.jar!/keystore
wiremock-dip-7d95fd59f-6cdlk wiremock-dip enable-browser-proxying:      true
wiremock-dip-7d95fd59f-6cdlk wiremock-dip trust-all-proxy-targets:      false
wiremock-dip-7d95fd59f-6cdlk wiremock-dip ca-keystore:                  /root/.wiremock/ca-keystore.jks
wiremock-dip-7d95fd59f-6cdlk wiremock-dip ca-keystore-type:             jks
wiremock-dip-7d95fd59f-6cdlk wiremock-dip disable-banner:               false
wiremock-dip-7d95fd59f-6cdlk wiremock-dip record-mappings:              true
wiremock-dip-7d95fd59f-6cdlk wiremock-dip match-headers:                []
wiremock-dip-7d95fd59f-6cdlk wiremock-dip no-request-journal:           false
wiremock-dip-7d95fd59f-6cdlk wiremock-dip verbose:                      true
wiremock-dip-7d95fd59f-6cdlk wiremock-dip
wiremock-dip-7d95fd59f-6cdlk wiremock-dip extensions:                   response-template,webhook
I don't see grpc listed here
my docker image
Copy code
FROM wiremock/wiremock:3.9.2-1

RUN mkdir -p /var/wiremock/extensions && \
  wget <https://repo1.maven.org/maven2/org/wiremock/wiremock-grpc-extension-standalone/0.8.1/wiremock-grpc-extension-standalone-0.8.1.jar> \
  -O /var/wiremock/extensions/wiremock-grpc-extension-standalone-0.8.1.jar
I am also setting env
Copy code
"$CLASSPATH:/var/wiremock/extensions/wiremock-grpc-extension-standalone-0.8.1.jar"
ignore it, I had misconfigured it
m
Hi @Tom, do not you think it is better to add this to your docker image as something which one can activate via environment variables? I am right now looking into this and frankly speaking the doc does not say much besides how to do it in Java or Gradle.
BTW @Prakash Nath Jha how did you do it in Docker? I am not using k8s and need to mock some gRPC procedures.
p
you need to download the extension and move it to your extension directory
Copy code
RUN mkdir -p /var/wiremock/extensions && \
  wget <https://repo1.maven.org/maven2/org/wiremock/wiremock-grpc-extension-standalone/0.8.1/wiremock-grpc-extension-standalone-0.8.1.jar> \
  -O /var/wiremock/extensions/wiremock-grpc-extension-standalone-0.8.1.jar
πŸ™Œ 1
plus you also need to set the env
t
πŸ‘€ 1
m
Thanks for the reply, I eventually settled on griomock: https://github.com/kasir-barati/docker/tree/main/docker-compose-files/grpc-mock/baqvix-gripmock Easier to mock and bootstrap if you ask me. Maybe Wiremock can do the same.
t
What aspects did you find were more straightforward?