Closed PierrickLozach closed 6 years ago
Hi @PierrickI3
Configuration using environment variables has been changed in 1.17 that's probably the reason why you may see a mix between the usage of some of them.
Please have a look to the documentation: https://docs.gravitee.io/apim_installguide_management_api_configuration.html#how_to_configure
Also, there is a good example we use for DevFest @ Lille: https://github.com/gravitee-io/devfestlille-2018/blob/master/docker-compose.yml#L70
If you still found references to GRAVITEEIO_MONGODB_HOST, please tell us where you see it and we will take time to update documentation.
Regards,
Thanks @brasseld I still have an issue with the management API trying to connect to localhost when trying to reach elastic search. Here is an extract from the management API container log:
12:03:29.182 [vert.x-eventloop-thread-3] ERROR i.g.e.client.http.HttpClient - Unable to get a connection to Elasticsearch
io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:9200
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:325)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:633)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused
my yaml file (see the endpoint_0 env variable being set following https://github.com/gravitee-io/devfestlille-2018/blob/master/docker-compose.yml#L73:
apiVersion: apps/v1
kind: Deployment
metadata:
name: gravitee-managementapi
labels:
app: gravitee-managementapi
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
app: gravitee-managementapi
template:
metadata:
labels:
app: gravitee-managementapi
spec:
containers:
- name: gravitee-managementapi
env:
- name: GRAVITEE_MANAGEMENT_MONGODB_URI
value: mongodb://gravitee-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
- name: GRAVITEE_RATELIMIT_MONGODB_URI
value: mongodb://gravitee-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
- name: GRAVITEE_REPORTERS_ELASTICSEARCH_ENDPOINTS_0
value: http://gravitee-elasticsearch:9200
image: graviteeio/management-api:latest
imagePullPolicy: Always
ports:
- containerPort: 8083
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: gravitee-managementapi
labels:
app: gravitee-managementapi
namespace: kube-system
spec:
selector:
app: gravitee-managementapi
ports:
- name: 8083-tcp
port: 8083
protocol: TCP
targetPort: 8083
type: ClusterIP
Here is an export showing that ElasticSearch is available:
bash-4.4$ export
declare -x GRAVITEEIO_HOME="/opt/graviteeio-management-api"
declare -x GRAVITEE_ELASTICSEARCH_PORT="tcp://10.109.151.178:9200"
declare -x GRAVITEE_ELASTICSEARCH_PORT_9200_TCP="tcp://10.109.151.178:9200"
declare -x GRAVITEE_ELASTICSEARCH_PORT_9200_TCP_ADDR="10.109.151.178"
declare -x GRAVITEE_ELASTICSEARCH_PORT_9200_TCP_PORT="9200"
declare -x GRAVITEE_ELASTICSEARCH_PORT_9200_TCP_PROTO="tcp"
declare -x GRAVITEE_ELASTICSEARCH_SERVICE_HOST="10.109.151.178"
declare -x GRAVITEE_ELASTICSEARCH_SERVICE_PORT="9200"
declare -x GRAVITEE_ELASTICSEARCH_SERVICE_PORT_9200_TCP="9200"
I can reach gravitee-elasticsearch:9200
from my pod.
bash-4.4$ wget http://gravitee-elasticsearch:9200
--2018-06-26 12:21:23-- http://gravitee-elasticsearch:9200/
Resolving gravitee-elasticsearch... 10.109.151.178
Connecting to gravitee-elasticsearch|10.109.151.178|:9200... connected.
HTTP request sent, awaiting response... 200 OK
What is the correct env variable to set the elasticsearch service name?
hi,
the correct envvar for elasticsearch is not the same for the gateway and the api.
In the gateway, you use the reporter-plugin. The envvar is : GRAVITEE_REPORTERS_ELASTICSEARCH_ENDPOINTS_0
In the api, you use the repository-plugin. The envvar is :
GRAVITEE_ANALYTICS_ELASTICSEARCH_ENDPOINTS_0
That worked. Thanks! I blindly followed line #71 instead of the correct one.
Thanks for your great product! I saw a presentation at BreizhCamp earlier this year in Rennes, France and I don't think I would have known about you without that.
I am a little bit confused with the environment variables that should be used to point to MongoDB and Elastic in each docker image.
For example, for MongoDB, sometimes, the documentation refers to GRAVITEEIO_MONGODB_HOST but in other locations, it refers to GRAVITEE_MANAGEMENT_MONGODB_URI or GRAVITEE_MANAGEMENT_MONGODB_DATABASE.
So, could you clarify which are available? Also, in the Management API docker image, what is the name of the environment variable for the Elastic Search service? I tried GRAVITEE_REPORTERS_ELASTICSEARCH_ENDPOINTS_0 but it does not work as it still tries to connect to localhost:9200
Thanks.