generated from pagopa/pagopa-quarkus-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-local-infra.sh
154 lines (145 loc) · 3.43 KB
/
run-local-infra.sh
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
cd docker-infra
docker compose down --remove-orphans --volumes
docker compose up -d
cd ..
exit 0
sleep 20
echo ""
echo ""
echo "Add policy"
curl -k -X PUT "http://localhost:9200/_ilm/policy/logs-fdr" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"rollover": {
"max_primary_shard_size": "50gb",
"max_age": "2d"
}
}
},
"warm": {
"min_age": "2d",
"actions": {
"set_priority": {
"priority": 50
}
}
},
"cold": {
"min_age": "4d",
"actions": {
"set_priority": {
"priority": 0
}
}
},
"delete": {
"min_age": "7d",
"actions": {
"delete": {}
}
}
},
"_meta": {
"description": "Policy for FDR"
}
}
}
'
echo ""
echo ""
echo "Add _component_template settings"
curl -k -X PUT "http://localhost:9200/_component_template/logs-fdr-settings" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '{
"template":{
"settings": {
"index.lifecycle.name": "logs-fdr"
}
},
"_meta": {
"description": "Settings for FDR"
}
}
'
echo ""
echo ""
echo "Add _component_template mappings"
curl -k -X PUT "http://localhost:9200/_component_template/logs-fdr-mappings" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '{
"template":{
"settings": {
"index.lifecycle.name": "logs-fdr"
}
},
"_meta": {
"description": "Settings for FDR"
}
}
'
echo ""
echo ""
echo "Add _index_template"
curl -k -X PUT "http://localhost:9200/_index_template/logs-fdr" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '{
"index_patterns": [
"logs-fdr-*"
],
"data_stream": {},
"composed_of": [ "logs-fdr-mappings", "logs-fdr-settings" ],
"priority": 500,
"_meta": {
"description": "Index template for FDR"
}
}
'
echo ""
echo ""
echo "Add space"
curl -k -X POST "http://localhost:5601/api/spaces/space" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '{
"id": "fdr",
"name": "Flussi di rendicontazione",
"description" : "This is the FDR Space",
"color": "#4C54E7",
"disabledFeatures": []
}
'
echo ""
echo ""
echo "Add data_views"
data_view=$(curl -k -X POST "http://localhost:5601/s/fdr/api/data_views/data_view" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '{
"data_view": {
"title": "logs-fdr-log-*",
"name": "FDR log Data View",
"timeFieldName": "@timestamp"
}
}
')
echo ""
echo ""
echo "Set default data_views"
data_view_id=$(echo $data_view | jq ".data_view.id")
curl -X POST "http://localhost:5601/s/fdr/api/data_views/default" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d'{
"data_view_id": "${data_view_id}"
}
'