Open bobruub opened 3 years ago
Hi @bobruub ,
I haven't had a lot of time to look into things (been busy with other projects)... There's been changes to grpc where some of the mock here was probably made obsolete. This is applicable to all custom protocols.
For mountebank-grpc it should go somehting like this (i did this on a win10 host, so adjust accordingly):
Directory Structure
C:\mydir\mountebank-grpc
C:\mydir\mountebank-grpc\mountebank-grpc # cloned repo
C:\mydir\mountebank-grpc\Dockerfile # Dockerfile below
C:\mydir\mountebank-grpc\protocols.json # protocols.json below
Dockerfile
FROM debian:buster
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates dirmngr gnupg wget;\
apt-get install -y --no-install-recommends curl; \
curl -fsSL https://deb.nodesource.com/setup_12.x | bash -; \
apt-get install -y nodejs; \
\
# add whatever you want here
rm -rf /var/lib/apt/lists/*; \
apt-get clean;
COPY . /etc/mountebank
WORKDIR /etc/mountebank
RUN set -ex; \
# install mountebank global
npm install -g mountebank; \
# install mountebank-grpc local
npm install ./mountebank-grpc;
ENTRYPOINT ["mb", "start", "--protofile", "protocols.json"]
protocols.json
{
"grpc": {
"createCommand": "node /etc/mountebank/mountebank-grpc/src/index.js"
}
}
Build the image and run
docker build --tag=mb-grpc:latest
docker run -p 2525:2525 -p 4545:4545 --rm -it mb-grpc
After that I was able to use postman/curl to load the imposter from the README.md
PS C:\mydir\mountebank-grpc> docker run -p 2525:2525 --rm -it mb-grpc
info: [mb:2525] Loaded custom protocol grpc
info: [mb:2525] mountebank v2.4.0 now taking orders - point your browser to http://localhost:2525/ for help
info: [mb:2525] POST /imposters
info: [grpc:4545] Open for business...
info: [grpc:4545] [2021-08-21T21:14:08.925Z] server started on port '4545'
I didn't test the overall grpc functionality since i don't have the tools on this machine.
This should at least get you started. Hope it helps!
Hi,
I was hoping someone could help me and provide me a working docker file for mountebank-grpc.
I've been poking at it for a couple of days now and always end up with error creating imposter: [{"code":"bad data","message":"the grpc protocol is not yet supported"}]
Current attempt: