Skip to main content

Introduction

API Developer Portal is an end-user or developer portal where API Consumers can access documentation related to APIs offered by an organization, test them, use them within certain limitations, and ask and answer questions about these topics. API Developer Portal, like other Apinizer products, runs on Kubernetes Platform. No database is used for Portal operations, instead interaction is provided directly with APIs provided by API Manager.

Pre-Installation Steps

Before starting the installation of Apinizer API Portal, the following should be noted:
API Manager must be installed. Also, API Developer Portal must be present in your license key.

Installation Steps

API Portal Installation is done in two ways.
  • If Kubernetes management is done through Apinizer, you can install API Developer Portal through API Manager.
  • If Kubernetes management is not done through Apinizer, manual installation can be done to Kubernetes and then connection can be established with API Manager.

Creating Token for Personal API Access

Token information can be obtained by creating a new token or using an existing token on the My Profile page. Staff tokens usually start with the apnz_ prefix.
To create a token, you can go to the My Profile page in API Manager and create a new token.
Token Creation

Token creation - Creating personal API token from My Profile page

API Developer Portal Installation

If API Developer Portal Installation Will Be Done Through API Manager

For API Developer Portal installation through API Manager, the following section must be active in the General Settings menu.
If Kubernetes management is done through Apinizer, the “Kubernetes Management” option must be active on the General Settings page.
In API Manager, go to Administration → Server Management → Kubernetes Resources page. Enable API Portal from the Deployment & Pods tab. Complete the installation by making the necessary definitions.
Kubernetes Resources Page

Kubernetes Resources page - API Portal enablement

In the opened dialog, define the required fields according to your organization.
API Portal Installation Dialog

API Portal installation dialog - Configuration of required settings

API Portal Settings

API Portal settings - API Manager integration configuration

FieldDescription
Apinizer Portal Management API URLManagement API address run by API Manager required for API Developer Portal to consume Apinizer Management APIs. Example address: http://<API_MANAGER_ACCESS_URL>:<PORT>/
Apinizer Portal Management API Key/TokenToken information required for API Developer Portal to consume Apinizer Management APIs.
Count (Count)Gateway engine count, adjusts the replicaSet setting in Kubernetes Cluster.
Service Port (Service Port)Gateway engine access port, adjusts the NodePort setting of the service object in Kubernetes Cluster.
Node List (Node List)Sets which Kubernetes Worker servers the Pods will run on. Adjusts the NodeAffinity setting in Kubernetes.
CPUInformation about the maximum CPU core count the Pod will use.
Memory (Memory)Maximum memory value the Pod will use.
Memory Unit (Memory Unit)The unit of the value required for memory is selected; MB, GB.
Additional Variables (Additional Variables)Default and optional variables and values to be run in the Pod are defined. Default variables cannot be deleted, only their values can be edited.
Host Aliases (Host Aliases)IP addresses in the network can sometimes be placed behind host names, if these are not defined in nameserver or host file or cannot be resolved by Apinizer in some way, Host Alias definition must be made for worker pods to resolve these names.
Additional VariablesWhen configuring the Java Options setting in the Additional Variables field, the following warning should be considered:
  • When -Xmx and -Xms parameters are used, automatic heap sizing is disabled.
  • Apinizer sets JVM Heap values to use 75.0% of the memory given to the container since it runs inside the container.
  • UseContainerSupport is active by default.
  • Old flags -XX: {Min | Max} RAMFraction are now deprecated. There is a new -XX: MaxRAMPercentage flag that takes a value between 0.0 and 100.0 and defaults to 75.0. Therefore, if there is a 1 GB memory limit, the JVM heap is limited to ~ 750 MB by default.

If API Developer Portal Installation Will Not Be Done Through API Manager

The following steps should be followed for manual installation of API Developer Portal.
Important: Kubernetes Secret containing API Manager API address and API Key/Token information must be created. The following information should be filled according to your organization.
  • apinizerManagementApiBaseUrl: Management API address running on API Manager required for API Developer Portal to consume Apinizer Management APIs. An example address: http://apimanager-ui-ip-address:port
  • apiKey: Token information required for API Developer Portal to consume Apinizer Management APIs.
API_MANAGER_URL='<APINIZER_MANAGEMENT_API_BASE_URL>'
API_MANAGER_APIKEY='<API_KEY>'
echo -n ${API_MANAGER_URL} | base64  # We will put the output of this in place of <ENCODED_URL> variable in the next step
echo -n ${API_MANAGER_APIKEY} | base64  # We will put the output of this in place of <ENCODED_API_KEY> variable in the next step
vi api-portal-secret.yaml
apiVersion: v1
kind: Namespace
metadata:
  name: apinizer-portal
---
apiVersion: v1
kind: Secret
metadata:
  name: apinizer-portal-secret
  namespace: apinizer-portal
type: Opaque
data:
  apinizerManagementApiBaseUrl: <ENCODED_URL>
  apiKey: <ENCODED_API_KEY>
kubectl apply -f api-portal-secret.yaml
vi apinizer-portal-deployment.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: apinizer-portal
  namespace: apinizer-portal
spec:
  replicas: 1
  selector:
    matchLabels:
      app: apinizer-portal
      version: v1
  template:
    metadata:
      labels:
        app: apinizer-portal
        version: v1
    spec:
      containers:
        - name: apinizer-portal-app
          image: apinizercloud/apiportal:<APINIZER_VERSION>
          env:
            - name: SPRING_PROFILES_ACTIVE
              value: prod
            - name: JAVA_OPTS
              value: -XX:MaxRAMPercentage=75.0
            - name: API_PORTAL_MANAGEMENT_API_BASE_URL
              valueFrom:
                secretKeyRef:
                  key: apinizerManagementApiBaseUrl
                  name: apinizer-portal-secret
            - name: API_PORTAL_MANAGEMENT_API_KEY
              valueFrom:
                secretKeyRef:
                  key: apiKey
                  name: apinizer-portal-secret
          livenessProbe:
            failureThreshold: 13
            httpGet:
              path: /apinizer/management/health
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 60
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 30
          ports:
            - containerPort: 8080
              protocol: TCP
          readinessProbe:
            failureThreshold: 13
            httpGet:
              path: /apinizer/management/health
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 30
          resources:
            limits:
              cpu: "1"
              memory: 1Gi
          startupProbe:
            failureThreshold: 13
            httpGet:
              path: /apinizer/management/health
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 60
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: apinizer-portal-service
  namespace: apinizer-portal
  labels:
    app: apinizer-portal
spec:
  selector:
    app: apinizer-portal
  type: NodePort
  ports:
    - name: http
      port: 8080
      nodePort: <API_DEVELOPER_PORTAL_PORT>
kubectl apply -f apinizer-portal-deployment.yaml
ImportantUp to this stage, API Developer Portal interface installation may have been done, but for APIs to be displayed on API Developer Portal, Credentials to be created and other capabilities to be used, integration with API Manager must be done.

API Developer Portal Integration with API Manager

In API Manager, go to Portal → Settings → Portal page and make the definitions according to your organization. Click here for detailed information.

Starting API Developer Portal with SSL

In desired cases, API Developer Portal can be opened for access with SSL. Click here for detailed information. After completing the above steps and ensuring that the Pods belonging to API Portal on Kubernetes are in ready state, you can access the Portal Interface from the following address.
http://<KUBERNETES_WORKER_IP>:<API_PORTAL_PORT>

Next Steps