Skip to main content

Introduction

This document explains how to install a new portal on Apinizer API Developer Portal. The newly created API Developer Portal works as an independent structure from the default API Developer Portal. The new portal is provided in an isolated manner using the following components:
  • Separate Namespace
  • Separate Pod
  • Separate Secret
  • Separate Service
Thanks to this structure, each portal’s configuration and management can be maintained without affecting each other.

Pre-Installation Steps

Before starting the installation of Apinizer API Portal, make sure the following prerequisites are met:
API Developer Portal module must be defined and active in your license key.

Installation Steps

API Portal installation can be done in two different ways depending on the Kubernetes management method:
  1. Automatic Installation: If Kubernetes management is done through Apinizer, installation can be done using the API Manager interface.
  2. Manual Installation: If Kubernetes management is not done through Apinizer, installation is done by applying manual manifest (YAML) files to the Kubernetes cluster and then connecting with API Manager.

3.1. Creating Token for Personal API Access

An authorized token is required to communicate with API Manager during installation. 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.
You can create a new token by going to the My Profile page in API Manager for token creation.
Token Creation Screen

Token creation - Creating personal API token from My Profile page

3.2. API Developer Portal Installation

Apply only one of the following titles according to your management method.

3.2.1. API Developer Portal Installation (Through API Manager)

If Kubernetes management is done through Apinizer, make sure the “Kubernetes Management” option is active in the General Settings menu.
  1. Go to Administration → Server Management → Kubernetes Resources page in API Manager.
  2. Enable the new API Portal from the Deployment & Pods tab.
Kubernetes Resources Menu

Kubernetes Resources page - API Portal activation

  1. Make the necessary definitions for the new portal in the opened dialog window.
API Portal Installation Dialog

API Portal installation dialog - Configuring required settings

Portal ID Information: You can find the Portal ID information that will be requested during installation in Administration > Portal > Settings > Portal menu, on the relevant portal’s card.
Portal ID Location Configuration Parameters:
FieldDescription
Apinizer Portal Management API URLThe address required for the portal to consume Apinizer management APIs.
Example: http://<API_MANAGER_ACCESS_URL>:<PORT>/
Apinizer Portal Management API Key/TokenThe token information required for the portal to access management APIs (created in Section 3.1).
API Portal IDSpecifies the unique identifier (UNIQ ID) of the new portal to be created.
CountSpecifies the number of Gateway engine (Pod) instances to run (ReplicaSet).
Service PortSpecifies the port on which the service will be exposed (NodePort).
Node ListDetermines which Kubernetes Worker servers the Pods will run on (NodeAffinity).
CPU / MemoryMaximum CPU and RAM limits to be allocated per Pod.
Additional VariablesEnvironment variables to be executed inside the Pod (Environment Variables).
Host AliasesIP-Host mappings to be added to the etc/hosts file (HostAlias).
Java Options and Memory SettingFor the Java Options setting in the additional variables field:
  • Dynamic memory management is used instead of -Xmx and -Xms.
  • -XX:MaxRAMPercentage=75.0 is used by default (75% of container memory).
  • For a 1 GB limited pod, JVM Heap will be approximately 750 MB.

3.2.2. API Developer Portal Installation (Manual / Outside API Manager)

If Apinizer does not manage the Kubernetes cluster, you can perform manual installation by following the steps below.
Important: In this installation, a different naming such as apinizer-portal-2 is used to separate from the default portal.
Step 1: Creating Secret First, a Kubernetes Secret containing API Manager access information and Portal ID must be created.
# Edit variables according to your environment
API_MANAGER_URL='<APINIZER_MANAGEMENT_API_BASE_URL>' # Example: http://apimanager-ui-ip:port
API_MANAGER_APIKEY='<API_KEY>' # Token from Section 3.1
API_PORTAL_ID='<API_PORTAL_ID>' # ID from Portal Settings

# Base64 Encode Process
echo -n ${API_MANAGER_URL} | base64
# Write the output instead of <ENCODED_URL>

echo -n ${API_MANAGER_APIKEY} | base64
# Write the output instead of <ENCODED_API_KEY>

echo -n ${API_PORTAL_ID} | base64
# Write the output instead of <ENCODED_API_PORTAL_ID>
Step 2: Creating Secret File Create the api-portal-secret-2.yaml file with the following content.
apiVersion: v1
kind: Namespace
metadata:
  name: apinizer-portal-2
---
apiVersion: v1
kind: Secret
metadata:
  name: apinizer-portal-secret-2
  namespace: apinizer-portal-2
type: Opaque
data:
  apinizerManagementApiBaseUrl: <ENCODED_URL>
  apiKey: <ENCODED_API_KEY>
  apiPortalId: <ENCODED_API_PORTAL_ID>
Apply the created secret file:
kubectl apply -f api-portal-secret-2.yaml
Step 3: Creating Deployment and Service Create the apinizer-portal-deployment-2.yaml file with the following content. This file contains both Deployment and Service definitions.
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: apinizer-portal-2
  namespace: apinizer-portal-2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: apinizer-portal-2
      version: v1
  template:
    metadata:
      labels:
        app: apinizer-portal-2
        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-2
            - name: API_PORTAL_MANAGEMENT_API_KEY
              valueFrom:
                secretKeyRef:
                  key: apiKey
                  name: apinizer-portal-secret-2
            - name: API_PORTAL_ID
              valueFrom:
                secretKeyRef:
                  key: apiPortalId
                  name: apinizer-portal-secret-2
          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-2
  namespace: apinizer-portal-2
  labels:
    app: apinizer-portal-2
spec:
  selector:
    app: apinizer-portal-2
  type: NodePort
  ports:
    - name: http
      port: 8080
      nodePort: <API_DEVELOPER_PORTAL_2_PORT>
Apply the created deployment and service file:
kubectl apply -f apinizer-portal-deployment-2.yaml

3.3. Integration of API Developer Portal with API Manager

Important: Up to this stage, the technical installation of the portal is completed, but integration must be completed for API viewing and authorization operations.
Go to Portal → Settings → Portal page in API Manager and make the definitions appropriate for your organization. You can review the Portal Settings documentation for detailed information.

3.4. Starting API Developer Portal with SSL

If desired, API Developer Portal can be opened for secure access (HTTPS) with SSL certificate. You can review the API Developer Portal SSL Configuration documentation for detailed information.

Access

After the above steps are completed and Pods on Kubernetes reach Running status, you can access the new portal from the following address:
http://<KUBERNETES_WORKER_IP>:<API_DEVELOPER_PORTAL_2_PORT>