Environment
CentOS 7
4 CPU
8G Memory
172.22.147.111
Hostname : gravitee.io.local

Package resource : https://drive.google.com/drive/folders/1DVlwYm-14C0DP_YJBR7tOMRRhgwcDOOe?usp=sharing


0. Preparation

Download JDK1.8, jdk-8u221-linux-x64.tar.gz from https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, then:

mkdir /usr/local/java/
tar -zxvf jdk-8u221-linux-x64.tar.gz -C /usr/local/java/


Environment variable settings :

vi /etc/profile

export JAVA_HOME=/usr/local/java/jdk1.8.0_221
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

source /etc/profile
ln -s /usr/local/java/jdk1.8.0_221/bin/java /usr/bin/java


check if JDK have already installed successful:

java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)


If yes, modify : /etc/security/limits.conf

vi /etc/security/limits.conf

* soft nofile 65536
* hard nofile 65536


Modify port from 4096 to 32768 in /etc/security/limits.d/20-nproc.conf

# Default limit for number of user's processes to prevent

# accidental fork bombs.

# See rhbz #432903 for reasoning.


*          soft    nproc     32768
root       soft    nproc     unlimited


disable warning message from MongoDB :

echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag

Then, we can start to install Repository、Gateway、Management API、Web UI


1. Elasticsearch

In order to install Repository, we need to install Elasticsearch and MongoDB.

Add yum resource:

vi /etc/yum.repos.d /elasticsearch.repo

[elasticsearch-5.x]
name=Elasticsearch repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md


Elasticsearch installation:

yum install -y elasticsearch

bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.bind_host: 0.0.0.0
network.publish_host: 172.22.147.111 #The IP of your deployment server
http.port: 9200


Start Elasticsearch

service elasticsearch start

Check the elasticsearch to make sure if there is no error message.

tail -f /var/log/elasticsearch/elasticsearch.log


2. MongoDB

Add yum resource:

vi /etc/yum.repos.d/mongodb-org-3.4.repo

[mongodb-org-3.4]
name=MongoDB 3.4 Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=0
enabled=1


MongoDB installation:

yum install -y mongodb-org


Run MongoDB

service mongod start


Check MongoDB to make sure if there is no error message

mongo

MongoDB shell version v3.4.22
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.22

Server has startup warnings:
2019-08-08T16:54:00.591+0800 I CONTROL  [initandlisten]
2019-08-08T16:54:00.591+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-08-08T16:54:00.591+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-08-08T16:54:00.591+0800 I CONTROL  [initandlisten]


3. Gateway

Download gravitee.tar from https://gravitee.io/downloads/apim/index.html

gravitee.tar have already setup all the Config file,graviteeio-full-1.28.0.zip(https://gravitee.io/downloads/apim/index.html) is the original file, the configuration can follow these reference : ~PI Gateway(https://docs.gravitee.io/apim_installguide_gateway.html)`and Management API(https://docs.gravitee.io/apim_installguide_management_api_configuration.html), then setup as follows:

mv gravitee.tar /usr/local
cd /usr/local
tar xvf gravitee.tar
cd gravitee/graviteeio-gateway-1.28.0/
bin/gravitee > run.log &


Check log to make sure if there is no error message

tail -f run.log


Use curl to check if gateway is working.(localhost is your IP Address)

curl -X GET http://localhost:8082/
No context-path matches the request URI.


4. Management API

Run Management API

cd ../graviteeio-management-api-1.28.0/
bin/gravitee > run.log &


Check log to make sure if there is no error message

tail -f run.log


Use curl to check if API is working

curl -X GET http://localhost:8083/management/apis/
[]


5. UI

Install epel-release-latest-7

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install Nginx

yum install nginx

Modify nginx.conf:

Update server_name to your hostname and make sure the location/ root path is the same to the gravitee UI

server {

        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  gravitee.io.local;
        #root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        #include /etc/nginx/default.d/*.conf;

        location / {

            root /usr/local/gravitee/graviteeio-management-ui-1.28.0;

            index index.html;

        }

        #error_page 404 /404.html;
        #    location = /40x.html {
        #}

        error_page 500 502 503 504 /50x.html;

            location = /50x.html {

                root /usr/share/nginx/html;
        }
    }


Replace /etc/nginx/nginx.conf

cp nginx.conf /etc/nginx

Run Nginx

service nginx start

6. Verification

IF you don’t have DNS, you need to modify the /etc/hosts on the Gravitee server
Open browser to http://gravitee.io.local and you will get this:

Click Log In and the default user name/ password is admin/admin.Then,click “My Account”

Click Gateway to make sure the status is Started.


Then the management API link will be: http://gravitee.io.local/PATH

  • No labels