Skip to content

Commit

Permalink
:tadam: kibana k8 works
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjourne committed Nov 10, 2023
1 parent 3c0e3b3 commit 8a84c87
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 43 deletions.
38 changes: 18 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,32 @@ export BACKEND_PORT=5000
export BACKEND_HOST = backend

# frontend dir
export FRONTEND_PORT=3000
export FRONTEND = ${APP_PATH}/frontend
export FRONTEND_DEV_HOST = frontend-dev
export FILE_FRONTEND_APP_VERSION = $(APP)-$(APP_VERSION)-frontend.tar.gz
export FILE_FRONTEND_DIST_APP_VERSION = $(APP)-$(APP_VERSION)-frontend-dist.tar.gz
export FILE_FRONTEND_DIST_LATEST_VERSION = $(APP)-latest-frontend-dist.tar.gz
export FRONTEND_STATIC_USER = ${APP_PATH}/frontend/static/user # user folder in static folder of frontend

export VIEWERJS_VERSION=0.5.8

export BUILD_DIR = ${APP_PATH}/${APP}-build
export FRONTEND_PORT =3000
export FRONTEND = ${APP_PATH}/frontend
export FRONTEND_DEV_HOST = frontend-dev
export FILE_FRONTEND_APP_VERSION = $(APP)-$(APP_VERSION)-frontend.tar.gz
export FILE_FRONTEND_DIST_APP_VERSION = $(APP)-$(APP_VERSION)-frontend-dist.tar.gz
export FILE_FRONTEND_DIST_LATEST_VERSION= $(APP)-latest-frontend-dist.tar.gz
export FRONTEND_STATIC_USER = ${APP_PATH}/frontend/static/user # user folder in static folder of frontend
export VIEWERJS_VERSION =0.5.8
export BUILD_DIR = ${APP_PATH}/${APP}-build
# nginx
export PORT = 80
export NGINX = ${APP_PATH}/nginx
export NGINX_TIMEOUT = 30
export API_USER_LIMIT_RATE=1r/s
export API_USER_BURST=20 nodelay
export API_USER_SCOPE=http_x_forwarded_for
export NGINX = ${APP_PATH}/nginx
export NGINX_TIMEOUT = 30
export API_USER_LIMIT_RATE =1r/s
export API_USER_BURST =20 nodelay
export API_USER_SCOPE =http_x_forwarded_for
export API_GLOBAL_LIMIT_RATE=20r/s
export API_GLOBAL_BURST=200 nodelay
export API_GLOBAL_BURST =200 nodelay
# SWIFT
export BUCKET_NAME=${INDEX_NAME}
export BUCKET_NAME =${INDEX_NAME}

# this is usefull with most python apps in dev mode because if stdout is
# buffered logs do not shows in realtime
PYTHONUNBUFFERED=1
PYTHONUNBUFFERED =1

dummy := $(shell touch artifacts)
dummy := $(shell touch artifacts)
include ./artifacts
export

Expand Down
7 changes: 6 additions & 1 deletion backend/tools/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@


# On établit une connection
# test
# curl -k -X GET -u elastic:elastic "http://elasticsearch-master:9200/_cluster/health?pretty" -vv
# es = Elasticsearch(['https://elastic:elastic@elasticsearch-master:9200'],use_ssl=False)
# es.search(index='bld',body={"query":{"match_all":{}}})

es = Elasticsearch([{'host': getenv('ES_HOST', 'elasticsearch'),
'port': getenv('ES_PORT', '9200'), 'timeout': 240,
'max_retries': 10,
'retry_on_timeout': True,
}],
http_auth=(getenv('ES_USER', 'elasticsearch'), getenv('ES_PSWD', 'elasticsearch')))
http_auth=(getenv('ES_USER', 'elastic'), getenv('ES_PSWD', 'elastic')))

indices = elasticsearch.client.IndicesClient(es)

Expand Down
2 changes: 2 additions & 0 deletions delete-kibana-pre-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ kubectl delete configmaps kibana-kibana-helm-scripts -n ridoc
kubectl delete -n ridoc secrets kibana-kibana-es-token
kubectl delete pods --field-selector status.phase=Failed -n ridoc
kubectl delete -n ridoc deployment kibana-kibana
kubectl delete -n ridoc jobs.batch post-delete-kibana-kibana
kubectl delete -n ridoc serviceaccounts post-delete-kibana-kibana

for resource in $resource_types; do
# List resources with the specified name
Expand Down
2 changes: 1 addition & 1 deletion deployments/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
image: logicalspark/docker-tikaserver
ports:
- containerPort: 9998

# Mount secrets elasticsearch-master-certs
volumes:
- name: data
persistentVolumeClaim:
Expand Down
10 changes: 6 additions & 4 deletions deployments/ekl/elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ secret:
password: "elastic"
# generated randomly if not defined

protocol: http
createCert: false
protocol: https
createCert: true

# esConfig:
# elasticsearch.yml: |
# xpack.security.enabled: true
# xpack.security.transport.ssl.enabled: true
# xpack.security.http.ssl.enabled: true
# xpack.security.transport.ssl.enabled: false
# xpack.security.http.ssl.enabled: false

# Config testée
# protocol https,createCert / xpack.ssl false/tru
volumeClaimTemplate:
accessModes: ["ReadWriteOnce"]
resources:
Expand Down
44 changes: 37 additions & 7 deletions deployments/ekl/kibana.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
elasticsearchHosts: "http://elasticsearch-master:9200"
elasticsearchHosts: "https://elasticsearch-master:9200"
elasticsearchCertificateSecret: elasticsearch-master-certs
elasticsearchCertificateAuthoritiesFile: ca.crt
elasticsearchCredentialSecret: elasticsearch-master-credentials

imageTag: "7.17.0"

replicas: 1

resources:
requests:
cpu: "300m"
memory: "0.1Gi"
cpu: "500m"
memory: "1Gi"
limits:
cpu: "300m"
memory: "0.5Gi"
cpu: "500m"
memory: "1Gi"

extraEnvs:
- name: "NODE_OPTIONS"
value: "--max-old-space-size=1800"
- name: SERVER_REWRITEBASEPATH
value: "true"
- name: SERVER_BASEPATH
value: "/kibana"

# - name: "ELASTICSEARCH_USERNAME"
# value: "elastic"
# - name: "ELASTICSEARCH_PASSWORD"
# value: "elastic"
# valueFrom:
# secretKeyRef: elasticsearch-master-credentials
# name:
# key: username
# valueFrom:
# secretKeyRef: elasticsearch-master-credentials
# name:
# key: password
# extraEnvs:
# - name: "NODE_OPTIONS"
# value: "--max-old-space-size=1800"
# healthCheckPath: "/api/status"
# protocol: http
healthCheckPath: "/kibana/app/kibana"
protocol: http

readinessProbe:
failureThreshold: 5
initialDelaySeconds: 60
periodSeconds: 30
successThreshold: 6
timeoutSeconds: 10
2 changes: 1 addition & 1 deletion deployments/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
containerPort: 3000
env:
- name: APP_VERSION
value: ${APP_VERSION}
value: "${APP_VERSION}"
envFrom:
- configMapRef:
name: env-${INDEX_NAME}
Expand Down
18 changes: 9 additions & 9 deletions deployments/traefik/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ spec:
middlewares:
- name: stripprefix
namespace: ridoc
# - match: Host(`kubernetes.ridoc.fr`) && PathPrefix(`/kibana`)
# kind: Rule
# services:
# - name: kibana
# namespace: ridoc
# port: http
# middlewares:
# - name: stripprefix
# namespace: kibana
- match: Host(`kubernetes.ridoc.fr`) && PathPrefix(`/kibana`)
kind: Rule
services:
- name: kibana-kibana
namespace: ridoc
port: http
# middlewares:
# - name: stripprefix
# namespace: ridoc
tls:
certResolver: le

Expand Down

0 comments on commit 8a84c87

Please sign in to comment.