ElasticHQ / elasticsearch-HQ

Monitoring and Management Web Application for ElasticSearch instances and clusters.
http://www.elastichq.org
Other
4.96k stars 532 forks source link

HQ_DEFAULT_URL does not work in deployment #481

Closed lucaskenda closed 5 years ago

lucaskenda commented 5 years ago

General information

Issue Description

I am executing the following deployment in Kubernetes but it does not initialize with HQ_DEFAULT_URL environment variable. It just list 127.0.0.1:9200

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: elasticsearch-hq
  namespace: elasticsearch
  labels:
    component: elasticsearch
    role: hq
spec:
  replicas: 1
  template:
    metadata:
      labels:
        component: elasticsearch
        role: hq
    spec:
      containers:
      - name: elasticsearch-hq
        image: elastichq/elasticsearch-hq:release-v3.5.0
        env:
        - name: HQ_DEFAULT_URL
          valueFrom:
            secretKeyRef:
              name: elasticsearch-sec
              key: elasticsearch_url
        resources:
          limits:
            cpu: 0.5
        ports:
        - containerPort: 5000
          name: http

Source Code / Logs

HQ_DEFAULT_URL is loaded correctly:

Screenshot from 2019-07-25 16-00-38

But I get this default value:

image

Thanks! Lucas

royrusso commented 5 years ago

Please see if the latest docker release fixes this. Someone did a https://github.com/ElasticHQ/elasticsearch-HQ/pull/476 that may address this.

OphyTe commented 5 years ago

I think this doesn't work anymuch better with your add 0a43f042b8202f14bc0c8e13d6d2c9f0a4ccb2c6

I'm running the 3.5.4 version from Docker Swarm and no env var is taken into account ...

royrusso commented 5 years ago

@OphyTe Which ENV? I tested with HQ_DEFAULT_URL and it is working with docker.

OphyTe commented 5 years ago

I've tested HQ_DEFAULT_URL and HQ_DEBUG=False (because it's true by default on my installation) on a swarm environment

  elastic-hq:
    image: elastichq/elasticsearch-hq:release-v3.5.4
    ports:
      - 5000
    environment:
      - HQ_DEFAULT_URL=http://elasticm01:9200
      - HQ_DEBUG=False
royrusso commented 5 years ago

Interesting. I'll try with docker compose, because I tested within Pycharm and it worked. Stay tuned.

OphyTe commented 5 years ago

Hi, does this means that you cannot reproduce my bug or that it will be resolved in the future?

Le lun. 11 nov. 2019 à 22:07, Roy Russo notifications@github.com a écrit :

Closed #481 https://github.com/ElasticHQ/elasticsearch-HQ/issues/481.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ElasticHQ/elasticsearch-HQ/issues/481?email_source=notifications&email_token=AARGQ76GETCQNS4LU7OAQCDQTHCPNA5CNFSM4IG5UC3KYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOUZAZJ5I#event-2789315829, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARGQ7ZX52NUJ2PDZGACXIDQTHCPNANCNFSM4IG5UC3A .

royrusso commented 5 years ago

I couldn't reproduce with the latest release. I tested with a sample docker-compose that I committed here (https://github.com/ElasticHQ/elasticsearch-HQ/blob/develop/example/docker-compose.yml), as some others were having trouble with containerized HQ and ES working together.

That file will start up the latest HQ from dockerhub, and ES 2.x. It will auto-populate HQ_DEFAULT_URL in the address bar. Try running the compose file and let me know if it doesn't work, then we can reopen this perhaps.

OphyTe commented 5 years ago

I've just tested it and it didn't work. The only adjustment I did was on the network driver that I pass to overlay because bridge didn't work with Swarm.

And for the record, in my previous tests, my elastic stack was in 6.5.1-oss.

royrusso commented 5 years ago

Can you post your docker-compose file?

aceeric commented 3 years ago

I realize this issue is old. I just tried with v3.5.12 in Kubernetes (air-gapped) and as described above, the default url on the main page is http://localhost:9200. If I paste in the correct URL in the UI then it connects and works great. The logs have an initial entry:

DEBUG elastichq status.get:63 {"name": "ElasticHQ", installed_version: "3.5.12",
"current_stable_version": "Err: unable to reach elastchq.org", "tagline": "You know, for
ElasticSearch", "clusters": [], "default_url":
https://elastic:hz9p6uTw11kQQQQQFz23423PY23dg@nxelastic-es-http:9200"}

Is it possible that - in an air-gapped environment - the inability to connect to elastichq.org causes it to exit some initialization path?

I'm standing up ElasticHQ with a Deployment manifest, defining the environment variables as I understand the docs to require:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: elastichq
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: elastichq
  template:
    metadata:
      labels:
        app.kubernetes.io/name: elastichq
    spec:
      containers:
      - name: elastichq
        image: elastichq/elasticsearch-hq:release-v3.5.12
        ports:
        - containerPort: 5000
          protocol: TCP
        env:
        - name: HQ_ENABLE_SSL
          value: 'True'
        - name: HQ_CA_CERTS
          value: /usr/share/elasticsearch/config/http-certs/ca.crt
        - name: HQ_VERIFY_CERTS
          value: 'False'
        - name: ELASTICPASS
          valueFrom:
            secretKeyRef:
              name: nxelastic-es-elastic-user
              key: elastic
        - name: HQ_DEFAULT_URL
          value: https://elastic:$(ELASTICPASS)@nxelastic=es=htttp:9200
        volumeMounts:
        - name: nxelastic-es-htttp-certs-internal
          mountPath: /usr/share/elasticsearch/config/http-certs
    volumes:
    - name: nxelastic-es-htttp-certs-internal
       secret:
         secretName: nxelastic-es-htttp-certs-internal

This ElasticSearch cluster is being provisioned by Elastic Cloud on Kubernetes . The ES cluster is functioning fine and - ElasticHQ works fine as well - once I manually enter the URL on the greeting page. But the UI doesn't seem to pick up the default URL from the Pod environment variable...

jacobluo commented 1 year ago

@lucaskenda add para HQ_ENABLE_SSL.

docker run -d -p 5000:5000 -e HQ_VERIFY_CERTS=False -e HQ_ENABLE_SSL=True elastichq/elasticsearch-hq