Enable monitoring for enterprise edition (#32)
* chore(install): flag to install monitoring Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com> * chore(install): change request to min memory and cpu. * chore(install): grafana proxy path Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com> * chore(install): ansible tag for grafana password Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com> * fix(install): grafana password override Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com> * chore(install): Adding grafana nginx path Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com> * feat(nginx): getting resolver ip for nginx ip resolution. Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>
This commit is contained in:
parent
83b3d73460
commit
b958da38dd
16 changed files with 100 additions and 34 deletions
|
|
@ -18,8 +18,8 @@ resources:
|
|||
cpu: 256m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
cpu: 1m
|
||||
memory: 1Mi
|
||||
|
||||
env:
|
||||
ALERT_NOTIFICATION_STRING: http://chalice-openreplay.app.svc.cluster.local:8000/alerts/notifications
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ resources:
|
|||
cpu: 256m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
cpu: 1m
|
||||
memory: 1Mi
|
||||
|
||||
env:
|
||||
ASSETS_ORIGIN: /sessions-assets # TODO: full path (with the minio prefix)
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ resources:
|
|||
cpu: 1000m
|
||||
memory: 1Gi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
cpu: 1m
|
||||
memory: 1Mi
|
||||
env:
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
pg_host: postgresql.db.svc.cluster.local
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ resources:
|
|||
cpu: 256m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
cpu: 1m
|
||||
memory: 1Mi
|
||||
|
||||
env:
|
||||
POSTGRES_STRING: postgres://postgres:asayerPostgres@postgresql.db.svc.cluster.local:5432
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ resources:
|
|||
cpu: 256m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
cpu: 1m
|
||||
memory: 1Mi
|
||||
|
||||
env:
|
||||
REDIS_STRING: redis-master.db.svc.cluster.local:6379
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ resources:
|
|||
cpu: 256m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
cpu: 1m
|
||||
memory: 1Mi
|
||||
|
||||
env:
|
||||
ASSETS_ORIGIN: /sessions-assets # TODO: full path (with the minio prefix)
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ resources:
|
|||
cpu: 512m
|
||||
memory: 1Gi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
cpu: 1m
|
||||
memory: 1Mi
|
||||
|
||||
env:
|
||||
POSTGRES_STRING: postgres://postgres:asayerPostgres@postgresql.db.svc.cluster.local:5432
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ resources:
|
|||
cpu: 512m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
cpu: 1m
|
||||
memory: 1Mi
|
||||
|
||||
pvc:
|
||||
create: true
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ resources:
|
|||
cpu: 512m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
cpu: 1m
|
||||
memory: 1Mi
|
||||
|
||||
pvc:
|
||||
# PVC Created from filesink.yaml
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ uline="\e[4m"
|
|||
reset="\e[0m"
|
||||
|
||||
working_dir=$(pwd)
|
||||
script_name=`basename "$0"`
|
||||
|
||||
echo -e ${reset}
|
||||
|
||||
|
|
@ -86,6 +87,7 @@ cat <<"EOF"
|
|||
EOF
|
||||
echo -e "${green}Usage: openreplay-cli [ -h | --help ]
|
||||
[ -v | --verbose ]
|
||||
[ -m | --monitoring <Only for enterprise edition> ]
|
||||
[ -e | --enterprise <enerprise_key> ]
|
||||
[ -a | --app APP_NAME ] to install/reinstall specific application
|
||||
[ -t | --type small|medium|ideal ]"
|
||||
|
|
@ -105,9 +107,9 @@ apps can specifically be installed/reinstalled:
|
|||
installation_type=1
|
||||
type() {
|
||||
case "$1" in
|
||||
small) installation_type=1 ;;
|
||||
small) installation_type=1 ;;
|
||||
medium) installation_type=1.5 ;;
|
||||
ideal) installation_type=2 ;;
|
||||
ideal) installation_type=2 ;;
|
||||
*)
|
||||
echo -e ${red}${bold}'ERROR!!!\nwrong value for `type`'${reset}
|
||||
usage ;;
|
||||
|
|
@ -136,15 +138,25 @@ function app(){
|
|||
esac
|
||||
}
|
||||
|
||||
enterprise=0
|
||||
function enterprise(){
|
||||
enterprise=1
|
||||
sed -i "s#enterprise_edition_license.*#enterprise_edition_license: \"${1}\"#g" vars.yaml
|
||||
# Updating image version to be ee
|
||||
sed -i "s/\(image_tag.*[0-9]\)\"$/\1-ee\"/" vars.yaml
|
||||
echo "Importing enterprise code..."
|
||||
cp -rf ../../ee/scripts/* ../
|
||||
}
|
||||
monitoring(){
|
||||
if [[ enterprise -eq 0 ]]; then
|
||||
echo -e "${red}Monitoring is supported only for enterprise edition.\n bash ./${script_name} -e <key> --monitoring ${reset}"
|
||||
exit 1
|
||||
fi
|
||||
sed -i "s#enable_monitoring.*#enable_monitoring: \"true\"#g" vars.yaml
|
||||
}
|
||||
|
||||
# Parsing command line args.
|
||||
PARSED_ARGUMENTS=$(color getopt -a -n openreplay-cli -o vht:a:e: --long verbose,help,type:,app:,enterprise: -- "$@")
|
||||
PARSED_ARGUMENTS=$(color getopt -a -n openreplay-cli -o vht:a:e:m --long verbose,help,type:,app:,enterprise:,monitoring -- "$@")
|
||||
VALID_ARGUMENTS=$?
|
||||
if [[ "$VALID_ARGUMENTS" != "0" ]]; then
|
||||
usage
|
||||
|
|
@ -154,11 +166,12 @@ eval set -- "$PARSED_ARGUMENTS"
|
|||
while :
|
||||
do
|
||||
case "$1" in
|
||||
-v | --verbose) VERBOSE=1 ; shift ;;
|
||||
-h | --help) usage ; shift ;;
|
||||
-t | --type) type $2 ; shift 2 ;;
|
||||
-a | --app) app $2 ; shift 2 ;;
|
||||
-e | --enterprise) enterprise $2 ; shift 2 ;;
|
||||
-v | --verbose) VERBOSE=1 ; shift ;;
|
||||
-h | --help) usage ; shift ;;
|
||||
-t | --type) type $2 ; shift 2 ;;
|
||||
-a | --app) app $2 ; shift 2 ;;
|
||||
-e | --enterprise) enterprise $2 ; shift 2 ;;
|
||||
-m | --monitoring) monitoring ; shift ;;
|
||||
# -- means the end of the arguments; drop this, and break out of the while loop
|
||||
--) shift; break ;;
|
||||
# If invalid options were passed, then getopt should have reported an error,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,15 @@ data:
|
|||
proxy_set_header Host $host;
|
||||
proxy_pass http://http-openreplay.app.svc.cluster.local;
|
||||
}
|
||||
location /grafana {
|
||||
set $target http://monitoring-grafana.monitoring.svc.cluster.local;
|
||||
rewrite ^/grafana/(.*) /$1 break;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass $target;
|
||||
}
|
||||
location /streaming/ {
|
||||
set $target http://ios-proxy-openreplay.app.svc.cluster.local; rewrite ^/streaming/(.*) /$1 break;
|
||||
proxy_http_version 1.1;
|
||||
|
|
@ -107,6 +116,7 @@ data:
|
|||
;
|
||||
|
||||
sites.conf: |-
|
||||
resolver {{ .Values.kubeDnsIP }};
|
||||
# Need real ip address for flags in replay.
|
||||
# Some LBs will forward real ips as x-forwarded-for
|
||||
# So making that as priority
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ image:
|
|||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
|
||||
# DNS address of the kubernetes resolver
|
||||
kubeDnsIP: ""
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
|
|
|||
|
|
@ -20,7 +20,17 @@
|
|||
- "app/*.yaml"
|
||||
when: app_name|length == 0
|
||||
tags: apps
|
||||
|
||||
- name: getting kube dns ip
|
||||
shell: kubectl get service --namespace kube-system kube-dns -o jsonpath="{.spec.clusterIP}"
|
||||
register: kube_dns_ip
|
||||
tags: nginx
|
||||
- name: Installing Proxy
|
||||
shell: |
|
||||
helm upgrade --install -n nginx-ingress nginx-ingress "./nginx-ingress/nginx-ingress" --create-namespace
|
||||
helm upgrade --install -n nginx-ingress nginx-ingress "./nginx-ingress/nginx-ingress" --create-namespace --set kubeDnsIP="{{ kube_dns_ip.stdout }}"
|
||||
tags: nginx
|
||||
- name: Installing Monitoring
|
||||
shell: |
|
||||
helm upgrade --install -n monitoring monitoring "./monitoring/kube-prometheus-stack" -f "/tmp/monitoring.yaml" --create-namespace
|
||||
tags: monitoring
|
||||
when: enable_monitoring == "true"
|
||||
|
|
|
|||
|
|
@ -126,3 +126,19 @@
|
|||
when: enterprise_edition_license|length > 0
|
||||
register: enterprise_edition_license_check
|
||||
failed_when: enterprise_edition_license_check.json.data.valid != true
|
||||
- name: Generaing grafana password
|
||||
block:
|
||||
- name: Generating grafana password
|
||||
set_fact:
|
||||
grafana_password_generated: "{{ lookup('password', '/dev/null length=30 chars=ascii_letters') }}"
|
||||
- name: Updating vars.yaml
|
||||
lineinfile:
|
||||
regexp: '^grafana_password'
|
||||
line: 'grafana_password: "{{ grafana_password_generated }}"'
|
||||
path: vars.yaml
|
||||
- name: Generating grafana access key
|
||||
set_fact:
|
||||
grafana_password: "{{ grafana_password_generated }}"
|
||||
when: grafana_password|length == 0
|
||||
tags:
|
||||
- pre-check
|
||||
|
|
|
|||
6
scripts/helm/roles/openreplay/templates/monitoring.yaml
Normal file
6
scripts/helm/roles/openreplay/templates/monitoring.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
fullnameOverride: "openreplay"
|
||||
grafana:
|
||||
adminPassword: "{{ grafana_password }}"
|
||||
env:
|
||||
GF_SERVER_ROOT_URL: http://grafana.local.com/grafana
|
||||
|
||||
|
|
@ -46,13 +46,6 @@ nginx_ssl_key_file_path: ""
|
|||
# By default, a default key will be generated and will update the value here.
|
||||
jwt_secret_key: ""
|
||||
|
||||
# Enable monitoring
|
||||
# If set, monitoring stack will be installed
|
||||
# including, prometheus, grafana and other core components,
|
||||
# to scrape the metrics. But this will cost, additional resources (cpu and memory).
|
||||
# Monitoring won't be installed on base installation.
|
||||
enable_monitoring: "false"
|
||||
|
||||
# Random password for minio,
|
||||
# If not defined, will generate at runtime.
|
||||
# Use following command to generate password
|
||||
|
|
@ -63,3 +56,18 @@ minio_secret_key: ""
|
|||
# If you're using enterprise edition.
|
||||
# Insert the enterprise_edition_License key which you got.
|
||||
enterprise_edition_license: ""
|
||||
|
||||
# Enable monitoring
|
||||
# If set, monitoring stack will be installed
|
||||
# including, prometheus, grafana and other core components,
|
||||
# to scrape the metrics. But this will cost, additional resources (cpu and memory).
|
||||
# Monitoring won't be installed on base installation.
|
||||
enable_monitoring: "false"
|
||||
# Password for grafana.
|
||||
# If password is not given, it'll be generated, and updated here.
|
||||
#
|
||||
# Use following command to generate password
|
||||
# `openssl rand -base64 30`
|
||||
#
|
||||
# Username: admin
|
||||
grafana_password: ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue