> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API Developer Multi Portal

> Installation and configuration steps for a new API Developer Portal that works independently and isolated from the default portal on Apinizer on Kubernetes.

## 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:

<CardGroup cols={2}>
  <Card title="Apinizer Installation" icon="server" href="/en/setup/apinizer/apinizer">
    API Manager must be installed and running.
  </Card>
</CardGroup>

<Warning>
  **API Developer Portal** module must be defined and active in your license key.
</Warning>

## 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.

<Info>
  You can create a new token by going to the **My Profile** page in API Manager for token creation.
</Info>

<Frame caption="Token creation - Creating personal API token from My Profile page">
  <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/api-portal/01-token-olusturma.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=c44abc15a0c090f2970ef92462fb82c2" alt="Token Creation Screen" width="1200" height="800" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/api-portal/01-token-olusturma.png" />
</Frame>

### 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.

<Frame caption="Kubernetes Resources page - API Portal activation">
  <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/api-portal/02-kubernetes-resources.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=2acc8694b19b9902c0d60fa4082b6e72" alt="Kubernetes Resources Menu" width="1200" height="600" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/api-portal/02-kubernetes-resources.png" />
</Frame>

3. Make the necessary definitions for the new portal in the opened dialog window.

<Frame caption="API Portal installation dialog - Configuring required settings">
  <img src="https://mintcdn.com/apinizer/74TMnSOZDvjtaICJ/images/setup/apinizer/api-portal/03-api-portal-dialog.png?fit=max&auto=format&n=74TMnSOZDvjtaICJ&q=85&s=3521f7755c5c7e7a26a3f37966f84f50" alt="API Portal Installation Dialog" width="1200" height="800" style={{ borderRadius: '0.5rem' }} data-path="images/setup/apinizer/api-portal/03-api-portal-dialog.png" />
</Frame>

<Info>
  **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.
</Info>

<img
  src="https://mintcdn.com/apinizer/LAWQyEt-1arDa5J_/images/setup/apinizer/api-portal/portal-id.png?fit=max&auto=format&n=LAWQyEt-1arDa5J_&q=85&s=b731d6aee1812fa4514b69eb3604e70b"
  alt="Portal ID Location"
  style={{
width: "100%",
height: "auto",
maxWidth: "100%",
borderRadius: "0.5rem"
}}
  width="1900"
  height="910"
  data-path="images/setup/apinizer/api-portal/portal-id.png"
/>

**Configuration Parameters:**

| Field                                        | Description                                                                                                                      |
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **Apinizer Portal Management API URL**       | The address required for the portal to consume Apinizer management APIs.<br />Example: `http://<API_MANAGER_ACCESS_URL>:<PORT>/` |
| **Apinizer Portal Management API Key/Token** | The token information required for the portal to access management APIs (created in Section 3.1).                                |
| **API Portal ID**                            | Specifies the unique identifier (UNIQ ID) of the new portal to be created.                                                       |
| **Count**                                    | Specifies the number of Gateway engine (Pod) instances to run (ReplicaSet).                                                      |
| **Service Port**                             | Specifies the port on which the service will be exposed (NodePort).                                                              |
| **Node List**                                | Determines which Kubernetes Worker servers the Pods will run on (NodeAffinity).                                                  |
| **CPU / Memory**                             | Maximum CPU and RAM limits to be allocated per Pod.                                                                              |
| **Additional Variables**                     | Environment variables to be executed inside the Pod (Environment Variables).                                                     |
| **Host Aliases**                             | IP-Host mappings to be added to the `etc/hosts` file (HostAlias).                                                                |

<Info>
  **Java Options and Memory Setting**

  For 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.
</Info>

#### 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.

<Warning>
  **Important:** In this installation, a different naming such as `apinizer-portal-2` is used to separate from the default portal.
</Warning>

**Step 1: Creating Secret**

First, a Kubernetes Secret containing API Manager access information and Portal ID must be created.

```bash theme={null}
# 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.

```yaml theme={null}
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:

```bash theme={null}
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.

```yaml theme={null}
---
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:

```bash theme={null}
kubectl apply -f apinizer-portal-deployment-2.yaml
```

### 3.3. Integration of API Developer Portal with API Manager

<Warning>
  **Important:** Up to this stage, the technical installation of the portal is completed, but integration must be completed for API viewing and authorization operations.
</Warning>

Go to **Portal → Settings → Portal** page in API Manager and make the definitions appropriate for your organization.
You can review the [Portal Settings](/en/api-portal/api-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](/en/operations/administrator-guides/api-developer-portal-ssl) 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>
```
