Insomnia allows Enterprise users to create self-hosted mock servers.
Find Configuration details and a Docker image on GitHub.
To run it locally, use NodeJS, Docker, or Kubernetes.
Insomnia allows Enterprise users to create self-hosted mock servers.
Find Configuration details and a Docker image on GitHub.
To run it locally, use NodeJS, Docker, or Kubernetes.
Run the following command to create a deployment for your mock server:
echo "
apiVersion: apps/v1
kind: Deployment
metadata:
name: insomnia-mock
namespace: mock
spec:
replicas: 1
selector:
matchLabels:
app: insomnia-mock
template:
metadata:
labels:
app: insomnia-mock
spec:
containers:
- name: insomnia-mock
image: ghcr.io/kong/insomnia-mockbin-self-hosted:latest
ports:
- containerPort: 9080
env:
- name: MOCKBIN_PORT
value: '9080'
" | kubectl apply -f -
To create a service that exposes the Mockbin internally to the cluster, run the following command:
echo "
apiVersion: v1
kind: Service
metadata:
name: insomnia-mock
namespace: mock
spec:
type: ClusterIP
ports:
- name: mock
port: 9080
targetPort: 9080
selector:
app: insomnia-mock
" | kubectl apply -f -
To configure the Ingress to manage external access, first set your domain and TLS secret, and then apply the manifest. Your domain and TLS settings determine the host and secret of the configuration.
To export a domain and a TLS secret name as environment variables, run the following command:
export DOMAIN='your-domain'
export SECRET_NAME='your-tls-secret-name'
To apply the Ingress manifest, run the following command:
echo "
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: insomnia-mock-ingress
namespace: mock
spec:
ingressClassName: nginx
rules:
- host: $DOMAIN
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: insomnia-mock
port:
number: 9080
tls:
- hosts:
- $DOMAIN
secretName: $SECRET_NAME
" | kubectl apply -f -
Use the following commands to check the status of your resources:
kubectl get deployments -n mock
kubectl get services -n mock
kubectl get ingress -n mock
Once you deploy your mock, point your front-end application to the mock URL.