Wiremock Starter
A simple example of how to stand-up one or more Wiremock servers on a development machine, using docker-compose, requiring only configuration files to be specified.
- Run the
init
script to download pre-requisites
chmod u=rwx ./init.sh && ./init.sh
- Start up the servers
docker-compose up -d
- Test the endpoints
(jq
is optionally used to pretty-print the response; omit if you don't like it.)
curl -s http://localhost:8090 | jq
curl -s http://localhost:8091 | jq
curl -s http://localhost:8090/ex1 | jq
- Stop the servers
docker-compose down
# start all servers in the background
docker-compose up -d
# restart all servers to honour any config changes
docker-compose restart
# delete all servers
docker-compose down
# or start all servers in the foreground
docker-compose up
# ctrl-c to stop
# start only one of the servers
docker-compose up server-a
To support response templating, an extension must be downloaded first. This is then bind-mounted into the container, and enabled via the command options.
See the docker-compose
configuration for server-a
for an example.
The ./init.sh script provided will download the required extension.
Verbose logging can be enabled by passing in the --verbose
parameter to the Wiremock server via the command
option to docker.
See the docker-compose
configuration for server-a
for an example.
Any other command line parameters for Wiremock, detailed in the documentaiton can be added in the same way.
-
See the official documentation for more information on configuring endpoints.
-
See the bx-dev-mocks for further configuration examples.