-
Notifications
You must be signed in to change notification settings - Fork 5
/
yugabyte_deployment.json
253 lines (252 loc) · 11.6 KB
/
yugabyte_deployment.json
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.2",
"parameters": {
"ClusterName": {
"type": "string"
},
"SshKeypair": {
"type": "string"
},
"SshUser": {
"type": "string",
"defaultValue": "centos"
},
"YBVersion": {
"type": "string",
"defaultValue": "2024.1.3.0-b1"
}
},
"variables": {
"count" : 3,
"vmSize" : "Standard_D2s_v3",
"singleQuote" : "'"
},
"resources": [
{
"apiVersion": "2019-04-01",
"name": "[concat(parameters('ClusterName'),'-Network')]",
"type": "Microsoft.Network/virtualNetworks",
"location": "[resourceGroup().location]",
"dependsOn":["[concat(parameters('ClusterName'),'-networkSecurityGroup')]"],
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
]
},
"copy": [
{
"name": "subnets",
"count": "[variables('count')]",
"input": {
"name": "[concat('PublicSubnet-',add(copyIndex('subnets'),1))]",
"properties": {
"addressPrefix": "[concat('10.0.',add(copyIndex('subnets'),1),'.0/24')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(parameters('ClusterName'),'-networkSecurityGroup'))]"
}
}
}
}
],
"enableDdosProtection": false
}
},
{
"name": "[concat(parameters('ClusterName'),'-networkSecurityGroup')]",
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2019-02-01",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
"name": "SSH",
"properties": {
"protocol": "Tcp",
"sourcePortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1001,
"direction": "Inbound",
"destinationPortRanges": [
"22",
"9100",
"9000",
"5433",
"7100",
"7000",
"9042",
"6379"
],
"destinationAddressPrefixes": []
}
}
]
}
},
{
"name": "[concat(parameters('ClusterName'),'-publicIpAddress',add(copyIndex('publicIP'),1))]",
"type": "Microsoft.Network/publicIpAddresses",
"apiVersion": "2019-02-01",
"location": "[resourceGroup().location]",
"properties": {
"publicIpAllocationMethod": "Static"
},
"sku": {
"name": "Standard",
"tier": "Regional"
},
"copy": {
"name": "publicIP",
"count": "[variables('count')]"
}
},
{
"name": "[concat(parameters('ClusterName'),'networkInterface',add(copyIndex('nic'),1))]",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2018-10-01",
"location": "[resourceGroup().location]",
"copy": {
"name": "nic",
"count": "[variables('count')]"
},
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', concat(parameters('ClusterName'),'-networkSecurityGroup'))]",
"[concat('Microsoft.Network/virtualNetworks/', concat(parameters('ClusterName'),'-Network'))]",
"[concat('Microsoft.Network/publicIpAddresses/', concat(parameters('ClusterName'),'-publicIpAddress',add(copyIndex('nic'),1)))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', concat(parameters('ClusterName'),'-Network'), concat('PublicSubnet-',add(copyIndex('nic'),1)))]"
},
"privateIPAllocationMethod": "Dynamic",
"publicIpAddress": {
"id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', concat(parameters('ClusterName'),'-publicIpAddress',add(copyIndex('nic'),1)))]"
}
}
}
],
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(parameters('ClusterName'),'-networkSecurityGroup'))]"
}
}
},
{
"name": "[concat(parameters('ClusterName'),'-VM',add(copyIndex('vm'),1))]",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2019-03-01",
"location": "[resourceGroup().location]",
"copy": {
"name": "vm",
"count": "[variables('count')]",
"mode": "serial"
},
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', concat(parameters('ClusterName'),'networkInterface',add(copyIndex('vm'),1)))]"
],
"zones":["[add(copyIndex('vm'),1)]"],
"properties": {
"hardwareProfile": {
"vmSize": "[variables('vmSize')]"
},
"storageProfile": {
"osDisk": {
"createOption": "fromImage",
"diskSizeGB": 50,
"managedDisk": {
"storageAccountType": "Premium_LRS"
}
},
"imageReference": {
"publisher": "OpenLogic",
"offer": "CentOS",
"sku": "7.5",
"version": "latest"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(parameters('ClusterName'),'networkInterface',add(copyIndex('vm'),1)))]"
}
]
},
"osProfile": {
"computerName": "[concat(parameters('ClusterName'),'-VM-',add(copyIndex('vm'),1))]",
"adminUsername": "[parameters('SshUser')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', parameters('SshUser'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('SshKeypair')]"
}
]
}
}
}
},
"resources": [
{
"apiVersion": "2015-06-15",
"type": "extensions",
"name": "config-app",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', concat(parameters('ClusterName'),'-VM',add(copyIndex('vm'),1)))]",
"[concat('Microsoft.Network/publicIpAddresses/', concat(parameters('ClusterName'),'-publicIpAddress',add(copyIndex('vm'),1)))]"
],
"tags": {
"displayName": "config-app"
},
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"https://raw.githubusercontent.com/YugaByte/utilities/master/common_scripts/install_software.sh",
"https://raw.githubusercontent.com/YugaByte/utilities/master/scripts/start_master.sh",
"https://raw.githubusercontent.com/YugaByte/utilities/master/scripts/start_tserver.sh",
"https://raw.githubusercontent.com/YugaByte/utilities/master/common_scripts/create_universe.sh"
]
},
"protectedSettings": {
"commandToExecute": "[concat('mv *.sh /home/',parameters('SshUser'),' && chmod 0755 /home/',parameters('SshUser'),'/*.sh && chown ',parameters('SshUser'),':',parameters('SshUser'),' /home/',parameters('SshUser'),'/*.sh && bash -c \"sudo -u ',parameters('SshUser'),' /home/',parameters('SshUser'),'/install_software.sh ',parameters('YBVersion'),'\" && bash -c \"sudo -u ',parameters('SshUser'),' /home/',parameters('SshUser'),'/create_universe.sh Azure ', resourceGroup().location, ' 3 ',variables('singleQuote'),reference(concat(parameters('ClusterName'),'networkInterface1'),'2016-09-01').ipConfigurations[0].properties.privateIPAddress,' ',reference(concat(parameters('ClusterName'),'networkInterface2'),'2016-09-01').ipConfigurations[0].properties.privateIPAddress,' ',reference(concat(parameters('ClusterName'),'networkInterface3'),'2016-09-01').ipConfigurations[0].properties.privateIPAddress,variables('singleQuote'),' ',add(copyIndex('vm'),1),' ',parameters('SshUser'),'\"')]"
}
}
}
]
}
],
"outputs": {
"UI": {
"type": "string",
"value": "[concat('http://',string(reference(concat(parameters('ClusterName'),'-publicIpAddress1')).ipAddress),':7000')]"
},
"JDBC": {
"type": "string",
"value": "[concat('postgresql://yugabyte@', string(reference(concat(parameters('ClusterName'),'-publicIpAddress1')).ipAddress),':5433')]"
},
"YSQL": {
"type": "string",
"value": "[concat('ysqlsh -U yugabyte -h ',string(reference(concat(parameters('ClusterName'),'-publicIpAddress1')).ipAddress),' -p 5433')]"
},
"YCQL": {
"type": "string",
"value": "[concat('ycqlsh ',string(reference(concat(parameters('ClusterName'),'-publicIpAddress1')).ipAddress),' 9042')]"
},
"YEDIS": {
"type": "string",
"value": "[concat('redis-cli -h ',string(reference(concat(parameters('ClusterName'),'-publicIpAddress1')).ipAddress),' -p 6379')]"
}
}
}