Coder Social home page Coder Social logo

Comments (1)

cbrz avatar cbrz commented on June 23, 2024

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!

from mountebank-grpc.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.