Skip to content

Docker image and Kubernetes

The standa-alone application can run in Kubernetes using our image gcr.io/api-console-a6952/app. Before using it check for the latest version of the image by visiting the link.

Usage

docker run  \
  -v "$PWD":/app/api \
  -e API_PROJECT="api.raml" \
  -e API_TYPE="RAML 1.0" \
  -e API_MIME="application/raml" \
  gcr.io/api-console-a6952/app:0.1.0

This command assumes that you are running it in your API definition folder.

The -v "$PWD":/app/api option tells the docker to mount current directory ("$PWD") to /app/api of the running instance. The application looks for the API data there.

-e API_PROJECT="api.raml" is a required variable and it points to the API main file in current directory.

Remote sources

The API_PROJECT variable can points to a publicly accessible API specification file on the internet. In this case the -v option is not needed.

-e API_TYPE="RAML 1.0" variable tells the application what is the type of the API. It must be one of the supported API formats.

Automatic type lookup

When API_TYPE or API_MIME variable is not set then the application tries to recognize the correct value. If the automation fails try to define own values.

-e API_MIME="application/raml" variable represents the media type of the API. RAML project has only application/raml mime type. OAS can be application/yaml or application/json.

Application port

By default the application runs on port 8080. You can change this behavior by setting PORT environment variable.

Deploying to Kubernetes

Below is an example deployment configuration for your container.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: apiconsole-frontend
  labels:
    app: apiconsole-www
spec:
  selector:
    matchLabels:
      app: apiconsole
      tier: frontend
  replicas: 3
  template:
    metadata:
      labels:
        app: apiconsole
        tier: frontend
    spec:
      containers:
      - name: apiconsole-www
        image: gcr.io/api-console-a6952/app:0.1.0
        env:
        - name: API_PROJECT
          value: https://domain.com/api.raml
        - name: API_TYPE
          value: "RAML 1.0"
        - name: API_MIME
          value: "application/raml"

This example assumes the API is available publicly over internet. You can use volumes property in the deployment configuration. See Deployment and Volumes documentation for more details.