forked from AICoE/log-anomaly-detector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (65 loc) · 4.01 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
ui:
pipenv run python app.py ui
run-with-factstore-local-full:
pipenv run python app.py run --config-yaml .test_env_config_fact_store.yaml
run-with-factstore-local-train:
pipenv run python app.py run --config-yaml .test_env_config_fact_store.yaml --job-type train
run-with-factstore-local-inference:
pipenv run python app.py run --config-yaml .test_env_config_fact_store.yaml --job-type inference
run-with-local:
pipenv run python app.py run --config-yaml .test_env_config.yaml --job-type train
test:
pipenv run python setup.py test --addopts -vs
# namespace/project where all the deployments will be made
NAMESPACE=lad
# route for the Factstore deployed
FACTSTORE_ROUTE="http://LAD.FACTSTORE.URL.ENTER.HERE.com/"
# mailing server used by elastalerts to send anomaly alerts
SMTP_SERVER_URL="my.mailing.server.url"
# openshift deployment commands
oc_deploy_elasticsearch:
oc process -f ./openshift/aiops_lad_core.elasticsearch.storage.yaml | oc apply -f - -n ${NAMESPACE}
oc_delete_elasticsearch:
oc process -f ./openshift/aiops_lad_core.elasticsearch.storage.yaml | oc delete -f - -n ${NAMESPACE}
oc_deploy_sql_db:
oc new-app centos/mysql-56-centos7 -e MYSQL_DATABASE=factstore -e MYSQL_PASSWORD=password -e MYSQL_USER=admin -e MYSQL_ROOT_PASSWORD=password -n ${NAMESPACE}
oc_delete_sql_db:
oc delete all -l app=mysql-56-centos7 -n ${NAMESPACE}
oc_deploy_factstore:
oc process -f ./openshift/aiops_factstore.deployment.yaml | oc apply -f - -n ${NAMESPACE}
oc_delete_factstore:
oc process -f ./openshift/aiops_factstore.deployment.yaml | oc delete -f - -n ${NAMESPACE}
oc_deploy_lad:
oc process -f ./openshift/log-anomaly-detector-minishift.yaml -p FACT_STORE_URL=${FACTSTORE_ROUTE} -p ES_ENDPOINT="lad-elasticsearch-service.${NAMESPACE}.svc:9200" | oc apply -f - -n ${NAMESPACE}
oc_delete_lad:
oc process -f ./openshift/log-anomaly-detector-minishift.yaml -p FACT_STORE_URL=${FACTSTORE_ROUTE} -p ES_ENDPOINT="lad-elasticsearch-service.${NAMESPACE}.svc:9200"| oc delete -f - -n ${NAMESPACE}
oc_deploy_demo_app:
oc process -f https://raw.githubusercontent.com/AICoE/anomaly-detection-demo-app/master/openshift/ad_demo.yaml | oc apply -f - -n ${NAMESPACE}
oc_build_elastalert_image:
oc process -f ./openshift/elastalert/lad-elastalert-buildconfig.yaml | oc apply -f - -n ${NAMESPACE}
oc_delete_elastalert_image:
oc process -f ./openshift/elastalert/lad-elastalert-buildconfig.yaml | oc delete -f - -n ${NAMESPACE}
oc_deploy_elastalert:
oc process -f ./openshift/elastalert/lad-elastalert-deployment.yaml -p FACTSTORE_URL=${FACTSTORE_ROUTE} -p SMTP_SERVER=${SMTP_SERVER_URL}| oc apply -f - -n ${NAMESPACE}
oc_delete_elastalert:
oc process -f ./openshift/elastalert/lad-elastalert-deployment.yaml -p FACTSTORE_URL=${FACTSTORE_ROUTE} -p SMTP_SERVER=${SMTP_SERVER_URL}| oc delete -f - -n ${NAMESPACE}
oc_deploy_prometheus:
oc process -f ./openshift/metrics/prometheus.yaml -p TARGET_HOSTS="anomaly-detection-demo.${NAMESPACE}.svc:8088, log-anomaly-detector-demo-svc.${NAMESPACE}.svc:8080" | oc apply -f - -n ${NAMESPACE}
oc_delete_prometheus:
oc process -f ./openshift/metrics/prometheus.yaml -p TARGET_HOSTS="anomaly-detection-demo.${NAMESPACE}.svc:8088, log-anomaly-detector-demo-svc.${NAMESPACE}.svc:8080" | oc delete -f - -n ${NAMESPACE}
oc_deploy_grafana:
oc process -f ./openshift/metrics/grafana.yaml | oc apply -f - -n ${NAMESPACE}
./openshift/metrics/setup_grafana.sh
oc_delete_grafana:
oc process -f ./openshift/metrics/grafana.yaml | oc delete -f - -n ${NAMESPACE}
echo_message:
echo "Please update the vars FACTSTORE_ROUTE and SMTP_SERVER_URL in this Makefile"
# minishift start
minishift_start:
# these commands should run before a vm is created
minishift config set --global memory 8192 # give the cluster about 8 gigs of memory
minishift config set --global cpus 6 # and 6 vcpus
# start the cluster this will take some time
minishift start
oc_deploy_demo_prereqs: oc_deploy_sql_db oc_deploy_elasticsearch oc_deploy_factstore oc_deploy_demo_app oc_build_elastalert_image echo_message
oc_deploy_demo_monitoring: oc_deploy_prometheus oc_deploy_grafana