Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 80 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,80 @@
# gravitee-openshift
# gravitee-OpenShift

Contributor: C.Prato

## Description

Gravitee is composed by the following three components:
- gateway
- management-api
- management-ui

and the following dependecies:
- mongoDB
- elasticsearch limited to version:
- 2.x
- 5.x

### RampUp
remember to update the url `10.5.18.122.nip.io` to reach from outside the cluster on the following files:
* images/management-ui/html/constants.json
* images/management-ui/Dockerfile


### elastisearch:
* 9200 => REST request
* 9300 => HTTP request

### docker images:

## gateway
Import the images on openshift registry:
- `docker.io/graviteeio/gateway:latest`
- `oc import-image graviteeio/gateway:latest --confirm`

before proceed to create all the openshift objects it sets the properties by ENV section of Deployment Config on Openshift template: ""

```
- name: GRAVITEE_MANAGEMENT_MONGODB_URI
value: "mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000"
- name: GRAVITEE_RATELIMIT_MONGODB_URI
value: "mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000"
- name: GRAVITEE_REPORTERS_ELASTICSEARCH_ENDPOINTS_0
value: "http://elasticsearch:9200"
- name: GRAVITEE_PLUGINS_PATH_0
value: "$${gravitee.home}/plugins"
# - name: GRAVITEE_PLUGINS_PATH_1
# value: "$${gravitee.home}/plugins-ext"
```

## management-api
- `docker.io/graviteeio/gateway:latest`
- `oc import-image graviteeio/gateway:latest --confirm`

```
- name: GRAVITEE_MANAGEMENT_MONGODB_URI
value: "mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000"
- name: GRAVITEE_RATELIMIT_MONGODB_URI
value: "mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000"
- name: GRAVITEE_ANALYTICS_ELASTICSEARCH_ENDPOINTS_0
value: "http://elasticsearch:9200"
- name: GRAVITEE_USER_LOGIN_DEFAULTAPPLICATION
value: "false"
- name: GRAVITEE_PLUGINS_PATH_0
value: "$${gravitee.home}/plugins"
# - name: GRAVITEE_PLUGINS_PATH_1
# value: $${gravitee.home}/plugins-ext
```

## Web Interface for Gravitee
http://managementui-gravitee.10.5.18.122.nip.io/#!/
admin/admin


# Setup on OpenShift

- run the script: `openshift/template-graviteeapim.yaml` as openshift system:admin user
- issue to fix:
- oc tag images...
- java:8
- nginx:latest
2 changes: 2 additions & 0 deletions images/gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ RUN wget https://download.gravitee.io/graviteeio-apim/distributions/graviteeio-f
ENV GRAVITEEIO_HOME /opt/graviteeio-gateway
WORKDIR ${GRAVITEEIO_HOME}

COPY config/gravitee.yml ${GRAVITEEIO_HOME}/config/

ENV GRAVITEEIO_MONGODB_HOST localhost
ENV GRAVITEEIO_MONGODB_PORT 27017
ENV GRAVITEEIO_ELASTIC_HOST localhost
Expand Down
2 changes: 2 additions & 0 deletions images/gateway/Dockerfile-nightly
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ ENV GRAVITEEIO_HOME /opt/graviteeio-gateway-${GRAVITEEIO_VERSION}
RUN ln -s ${GRAVITEEIO_HOME} /opt/graviteeio-gateway
WORKDIR ${GRAVITEEIO_HOME}

COPY config/gravitee.yml ${GRAVITEEIO_HOME}/config/

ENV GRAVITEEIO_MONGODB_HOST localhost
ENV GRAVITEEIO_MONGODB_PORT 27017
ENV GRAVITEEIO_ELASTIC_HOST localhost
Expand Down
249 changes: 249 additions & 0 deletions images/gateway/config/gravitee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
############################################################################################################
#################################### Gravitee.IO Gateway - Configuration ###################################
############################################################################################################

############################################################################################################
# This file is the general configuration of Gravitee.IO Gateway:
# - Properties (and respective default values) in comment are provided for information.
# - You can reference other property by using ${property.name} syntax
# - gravitee.home property is automatically set-up by launcher and refers to the installation path. Do not override it !
#
# Please have a look to http://docs.gravitee.io/ for more options and fine-grained granularity
############################################################################################################

# Gateway HTTP server
#http:
# port: 8082
# host: 0.0.0.0
# idleTimeout: 0
# tcpKeepAlive: true
# compressionSupported: false
# maxHeaderSize: 8192
# maxChunkSize: 8192
# instances: 0
# requestTimeout: 30000
# secured: false
# alpn: false
# ssl:
# clientAuth: false
# keystore:
# path: ${gravitee.home}/security/keystore.jks
# password: secret
# truststore:
# path: ${gravitee.home}/security/truststore.jks
# password: secret

# Plugins repository
#plugins:
# path:
# - ${gravitee.home}/plugins
# - ${gravitee.home}/my-custom-plugins

# If a plugin is already installed (but with a different version), management node does not start anymore
# failOnDuplicate: true

# Management repository is used to store global configuration such as APIs, applications, apikeys, ...
# This is the default configuration using MongoDB (single server)
# For more information about MongoDB configuration, please have a look to:
# - http://api.mongodb.org/java/current/com/mongodb/MongoClientOptions.html
management:
type: mongodb
mongodb:
dbname: ${ds.mongodb.dbname}
host: ${ds.mongodb.host}
port: ${ds.mongodb.port}
# username:
# password:
# connectionsPerHost: 0
# connectTimeout: 500
# maxWaitTime: 120000
# socketTimeout: 500
# socketKeepAlive: false
# maxConnectionLifeTime: 0
# maxConnectionIdleTime: 0
# serverSelectionTimeout: 0
# description: gravitee.io
# heartbeatFrequency: 10000
# minHeartbeatFrequency: 500
# heartbeatConnectTimeout: 1000
# heartbeatSocketTimeout: 20000
# localThreshold: 15
# minConnectionsPerHost: 0
# sslEnabled: false
# threadsAllowedToBlockForConnectionMultiplier: 5
# cursorFinalizerEnabled: true
# possible values are 1,2,3... (the number of node) or 'majority'
# writeConcern: 1
# wtimeout: 0
# journal: true

# Management repository: single MongoDB using URI
# For more information about MongoDB configuration using URI, please have a look to:
# - http://api.mongodb.org/java/current/com/mongodb/MongoClientURI.html
#management:
# type: mongodb
# mongodb:
# uri: mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

# Management repository: clustered MongoDB
#management:
# type: mongodb
# mongodb:
# servers:
# - host: mongo1
# port: 27017
# - host: mongo2
# port: 27017
# dbname: ${ds.mongodb.dbname}
# connectTimeout: 500
# socketTimeout: 250

# When defining rate-limiting policy, the gateway has to store data to share with other gateway instances.
# In this example, we are using MongoDB to store counters.
ratelimit:
type: mongodb
mongodb:
uri: mongodb://${ds.mongodb.host}/${ds.mongodb.dbname}

cache:
type: ehcache

# Reporters configuration (used to store reporting monitoring data, request metrics, healthchecks and others...
# All reporters are enabled by default. To stop one of them, you have to add the property 'enabled: false'
reporters:
# logging configuration
#logging:
# max_size: -1 # max size per API log content respectively : client-request, client-response, proxy-request and proxy-response in MB (-1 means no limit)
# Elasticsearch reporter
elasticsearch:
enabled: true # Is the reporter enabled or not (default to true)
endpoints:
- http://${ds.elastic.host}:${ds.elastic.port}
# index: gravitee
# index_per_type: true
# bulk:
# actions: 1000 # Number of requests action before flush
# flush_interval: 5 # Flush interval in seconds
# settings:
# number_of_shards: 5
# number_of_replicas: 1
# refresh_interval: 5s
# pipeline:
# plugins:
# ingest: geoip, user_agent
# security:
# username: user
# password: secret
# http:
# timeout: 30000 # in milliseconds
# template_mapping:
# path: ${gravitee.home}/config/reporter/elasticsearch/templates
# extended_request_mapping: request.ftl

# Gateway service configurations. Provided values are default values.
# All services are enabled by default. To stop one of them, you have to add the property 'enabled: false' (See the
# 'local' service for an example).
services:
core:
http:
enabled: true
port: 18082
host: localhost
authentication:
# authentication type to be used for the core services
# - none : to disable authentication
# - basic : to use basic authentication
# default is "basic"
type: basic
users:
admin: adminadmin

# Synchronization daemon used to keep the gateway state in sync with the configuration from the management repository
# Be aware that, by disabling it, the gateway will not be sync with the configuration done through management API
# and management UI
sync:
# Synchronization is done each 5 seconds
cron: '*/5 * * * * *'

# Service used to store and cache api-keys from the management repository to avoid direct repository communication
# while serving requests.
apikeyscache:
delay: 10000
unit: MILLISECONDS
threads: 3 # Threads core size used to retrieve api-keys from repository.

# Local registry service.
# This registry is used to load API Definition with json format from the file system. By doing so, you do not need
# to configure your API using the web console or the rest API (but you need to know and understand the json descriptor
# format to make it work....)
local:
enabled: false
path: ${gravitee.home}/apis # The path to API descriptors

# Gateway monitoring service.
# This service retrieves metrics like os / process / jvm metrics and send them to an underlying reporting service.
monitoring:
delay: 5000
unit: MILLISECONDS

# metrics service
metrics:
enabled: false
# default: local, http_method, http_code
# labels:
# - local
# - remote
# - http_method
# - http_code
# - http_path
prometheus:
enabled: true

# heartbeat
# heartbeat:
# enabled: true
# delay: 5000
# unit: MILLISECONDS
# storeSystemProperties: true

handlers:
request:
transaction:
header: X-Gravitee-Transaction-Id

# Referenced properties
ds:
mongodb:
dbname: gravitee
host: ${GRAVITEEIO_MONGODB_HOST:localhost}
port: ${GRAVITEEIO_MONGODB_PORT:27017}
elastic:
host: ${GRAVITEEIO_ELASTIC_HOST:localhost}
port: ${GRAVITEEIO_ELASTIC_PORT:9300}

# Sharding tags configuration
# Allows to define inclusion/exclusion sharding tags to only deploy a part of APIs. To exclude just prefix the tag with '!'.
#tags: products,stocks,!international

# Multi-tenant configuration
# Allow only a single-value
#tenant: europe

#policy:
# Customize the api-key header and / or query parameter
# api-key:
# header: X-Gravitee-Api-Key
# param: api-key

# Gravitee Alert Engine is only available with support
alerts:
enabled: false
default:
enabled: false
# must be reachable by other nodes
cluster:
host: localhost
port: 0
hazelcast:
config:
path: ${gravitee.home}/config/hazelcast.xml
7 changes: 4 additions & 3 deletions images/management-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ ENV GRAVITEEIO_HOME /opt/graviteeio-management-api
WORKDIR ${GRAVITEEIO_HOME}

COPY config/gravitee.yml ${GRAVITEEIO_HOME}/config/
COPY bin/gravitee ${GRAVITEEIO_HOME}/bin/

ENV GRAVITEEIO_MONGODB_HOST localhost
ENV GRAVITEEIO_MONGODB_HOST mongodb
ENV GRAVITEEIO_MONGODB_PORT 27017
ENV GRAVITEEIO_ELASTIC_HOST localhost
ENV GRAVITEEIO_ELASTIC_PORT 9300
ENV GRAVITEEIO_ELASTIC_HOST elasticsearch
ENV GRAVITEEIO_ELASTIC_PORT 9200

ENV GRAVITEEIO_PORTAL_URL http://localhost:80
ENV GIO_MIN_MEM 1g
Expand Down
Loading