You're reading Mocko v1 (legacy) documentation. Mocko v2 is the current version. View the v2 docs.
Deploying
Get Mocko running on the internet so you can access it from anywhere, not just your local machine.
Standalone mode: Docker
To run Mocko with as few resources as possible, build a container image using gabrielctpinheiro/mocko-proxy as a base. Create this structure:
mocko-project
├── Dockerfile
└── mocks
└── main.hclIn your Dockerfile:
FROM 'gabrielctpinheiro/mocko-proxy'
COPY ./mocks ./mocksTo override settings, set environment variables in the Dockerfile:
FROM 'gabrielctpinheiro/mocko-proxy'
COPY ./mocks ./mocks
ENV PROXY_BASE-URI=https://my-real-api.tld/v1All available environment variables and their defaults are listed in mocko-proxy/default.env.
Complete stack on Kubernetes with Helm
Install the complete stack (proxy + control UI + Redis) in your cluster with three commands.
Helm 3:
$ git clone https://github.com/mocko-app/mocko.git
$ cd mocko
$ helm install mocko ./mocko-helm --set \
redis.host=YOUR.REDIS.HOST,\
redis.password=YOUR_REDIS_PASSWORD,\
proxy.uri=http://your-real-api.url/v1Helm 2:
$ git clone https://github.com/mocko-app/mocko.git
$ cd mocko
$ helm install ./mocko-helm -n mocko --set \
redis.host=YOUR.REDIS.HOST,\
redis.password=YOUR_REDIS_PASSWORD,\
proxy.uri=http://your-real-api.url/v1Other chart values you may want to configure:
| Chart value | Description | Default |
|---|---|---|
| proxy.uri | URL of your actual API to proxy; leave blank to disable | blank |
| proxy.timeoutMillis | Milliseconds before replying with 504 Gateway Timeout | 180000 |
| proxy.cors | Override CORS rules (true) or proxy OPTIONS to the API (false) | true |
| proxy.replicas | Number of proxy replicas | 1 |
| redis.host | Redis host | redis-headless.default.svc.cluster.local |
| redis.port | Redis port | 6379 |
| redis.password | Redis password | blank |
| redis.database | Redis database index | 0 |