Setup and Configuration
Before starting the installation, make sure your system meets the following requirements:
- One or more machines running a deb/rpm compatible Linux operating system; e.g: Ubuntu 20.04.2.0 LTS or CentOS 7.9
Recommended minimum system requirements are 8 Core CPU, 8GB RAM and 80GB storage. For different installation scenarios → Installation Topologies
- Replicaset MongoDB 4.2+. To see an example of the setup → Installing Replica Set MongoDB
- Elasticsearch 7.9.+. To see an example of the setup → Installing Elasticsearch Cluster
- Kubernetes 1.18.4 . To see an example of the setup → Kubernetes Cluster Installation
Installation Steps
Variables that need to be configured before deployment
Environment Variables
APINIZER_VERSION
- It is the parameter that specifies which Apinizer version to install. To see the versions → Apinizer VersionsSPRING_DATA_MONGODB_DATABASE
- Database name to use for Apinizer configurationsSPRING_DATA_MONGODB_URI
- Database URL information to be used for Apinizer configurations
Example : mongodb://apinizer:***@YOURMONGOIPADDRESS:25080/?authSource=admin&replicaSet=apinizer-replicaset
JAVA_OPTS
- Java Memory information that the Management Console will use in the operating system
name: JAVA_OPTS
value: ' -Xmx2048m -Xms2048m -Dlog4j.formatMsgNoLookups=true'
Installing Apinizer Management Console
As follows, create a yaml file on your Kubernetes Master server and save it by changing the values of the above variables to suit your environment.
vi apinizer-deployment.yaml
apiVersion: v1
kind: Namespace
metadata:
name: apinizer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: manager
namespace: apinizer
spec:
replicas: 1
selector:
matchLabels:
app: manager
version: 'v1'
template:
metadata:
labels:
app: manager
version: 'v1'
spec:
containers:
- name: manager
image: apinizercloud/manager:2022.01.5
imagePullPolicy: IfNotPresent
env:
- name: SPRING_PROFILES_ACTIVE
value: prod
- name: SPRING_DATA_MONGODB_DATABASE
value: apinizerdb
- name: SPRING_DATA_MONGODB_URI
value: 'mongodb://apinizer:***@YOURMONGOIPADDRESS:25080/?authSource=admin&replicaSet=apinizer-replicaset'
- name: JAVA_OPTS
value: ' -Xmx2400m -Xms2400m -Dlog4j.formatMsgNoLookups=true'
resources:
requests:
memory: '3Gi'
cpu: '1'
limits:
memory: '3Gi'
cpu: '1'
ports:
- name: http
containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: manager
namespace: apinizer
labels:
app: manager
spec:
selector:
app: manager
type: NodePort
ports:
- name: http
port: 8080
nodePort: 32080
After the apinizer-deployment.yaml file is prepared, run the following command line on your Kubernetes Master server.
kubectl apply -f apinizer-deployment.yaml
After this process, to follow the created pod and examine its log, run the first code below and use output pod name in the second code.
kubectl get pods -n apinizer
kubectl logs PODNAME -n apinizer
After the Apinizer images are deployed to the Kubernetes environment, you need to add the License Key given to you by Apinizer to the database.
You can update the license information in the database by updating the License Key given to you by Apinizer in a .js file as follows.
vi license.js
db.general_settings.updateOne(
{"_class":"GeneralSettings"},
{ $set: { licenseKey: 'YOURLICENSEKEY'}}
)
Run the created license.js file. It is expected to see a value such as Matched = 1 in the results.
mongo mongodb://YOURMONGOSIPADDRESS:25080/apinizerdb --authenticationDatabase "admin" -u "apinizer" -p "***" < license.js
Installation Test
If the installation process was successful, you can access the Apinizer Management Console from the address below.
http://ipAddressOfAnyWorker:32080
Defining Log Servers
Apinizer keeps API traffic and metrics in the Elasticsearch database. Elasticsearch Cluster definitions must be made in order to continue with the installation process.
In the Apinizer Administration Console application, go to the Elasticsearch Clusters page under Administration → Server Management.
To define an Elasticsearch Cluster, you can refer to the Elasticsearch Clusters document.
Defining Environment
For an API Proxy to be accessible, it must be deployed in at least one environment. Apinizer allows an API Proxy to be installed in multiple environments at the same time.
To define a new Environment, you can refer to the Environment Document.
With the creation of the environment, the Apinizer installation is completed.
If the host alias structure is desired to be used
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: manager
namespace: apinizer
spec:
replicas: 1
selector:
matchLabels:
app: manager
version: 'v1'
template:
metadata:
labels:
app: manager
version: 'v1'
spec:
hostAliases:
- ip: 10.x.x.x
hostnames:
- myhost1
- ip: 10.x.x.x
hostnames:
- myhost2
- myhost3
- ip: 10.x.x.x
hostnames:
- myhost4
containers:
- name: manager
image: apinizercloud/manager:2022.01.5
imagePullPolicy: IfNotPresent
env:
- name: SPRING_PROFILES_ACTIVE
value: prod
- name: SPRING_DATA_MONGODB_DATABASE
value: apinizerdb
- name: SPRING_DATA_MONGODB_URI
value: 'mongodb://apinizer:***@app101:25080,app102:25080,app103:25080/admin?replicaSet=rs0'
- name: JAVA_OPTS
value: ' -Xmx4096m -Xms4096m'
resources:
requests:
memory: '3Gi'
cpu: '1'
limits:
memory: '3Gi'
cpu: '1'
ports:
- name: http
containerPort: 8080