|
4 | 4 | "parameters": {
|
5 | 5 | "tenantName": {
|
6 | 6 | "type": "string",
|
7 |
| - "defaultValue": "foo" |
| 7 | + "defaultValue": "barbaz" |
8 | 8 | },
|
9 | 9 | "adminUsername": {
|
10 | 10 | "type": "string",
|
|
16 | 16 | "defaultValue": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAk/ViUPrGp7KoJLuN2PgofgMyw7SN9zfLYFDDR0TRYa8cOvJlE8NdZYt6Oqa4aL/fslKr9bmlMCdawhZRL7sHccIIS0I0zG7iD15rQL3/Y5aZOf3ML+bebpSj+SE5OeHT9iobgsYpK8gq72d8tmZZAfKhx6fRJsgC2j2xXH/GveoZ5GkHnhJUYuYPmNjEb/PK7LT43XuP+E9Rderr3LPUTuBeGVW9do0HS7X8I2uTn0+BqgkZLOO4FCnSXxh1u6fuD++ZgOZVmB6Q1xEdHSA7LLnPkjDZqbWezLIh5cSdNPUW2JG7tMxQTAZzVoNMb6vAVsfslB16rqZQ21EdIq+0pw== chgeuer-dcos-1",
|
17 | 17 | "metadata": { "description": "Admin SSH key for the Virtual Machines." }
|
18 | 18 | },
|
| 19 | + "postgresqlUsername": { |
| 20 | + "type": "string", |
| 21 | + "defaultValue": "admin", |
| 22 | + "metadata": { "description": "PostgreSQL user name" } |
| 23 | + }, |
| 24 | + "postgresqlPassword": { |
| 25 | + "type": "securestring", |
| 26 | + "metadata": { "description": "PostgreSQL password" } |
| 27 | + }, |
19 | 28 | "postgresqlInstanceCount": {
|
20 | 29 | "defaultValue": 2, "minValue": 2, "maxValue": 10, "type": "int",
|
21 | 30 | "metadata": { "description": "Number of postgreSQL servers in the cluster." }
|
|
31 | 40 | ],
|
32 | 41 | "type": "string",
|
33 | 42 | "metadata": { "description": "Size of the postgreSQL server in the cluster." }
|
| 43 | + }, |
| 44 | + "postgresAzureVersion": { |
| 45 | + "defaultValue": "master", |
| 46 | + "type": "string" |
34 | 47 | }
|
35 | 48 | },
|
36 | 49 | "variables": {
|
37 | 50 | "commonSettings": {
|
| 51 | + "baseUrl": "[concat('https://raw.githubusercontent.com/chgeuer/postgres-azure/',parameters('postgresAzureVersion'),'/')]", |
38 | 52 | "tenantName": "[parameters('tenantName')]",
|
39 | 53 | "constants": {
|
40 | 54 | "apiVersions": {
|
41 | 55 | "availabilitySets": "2016-04-30-preview"
|
42 | 56 | }
|
43 | 57 | },
|
44 |
| - "vnet": { |
| 58 | + "vnet": { |
45 | 59 | "name": "[concat(parameters('tenantName'),'-vnet')]",
|
46 | 60 | "address": "10.0.0.0/16",
|
47 | 61 | "subnet": {
|
|
65 | 79 | "patroni": "6eb2e2114453545256ac7cbfec55bda285ffb955",
|
66 | 80 | "postgres": "9.6"
|
67 | 81 | },
|
68 |
| - "instanceCount": { |
| 82 | + "instanceCount": { |
69 | 83 | "postgresql": 2,
|
70 | 84 | "postgresqlDataDiskCount": 3,
|
71 | 85 | "zookeeper": 2
|
|
334 | 348 | "apiVersion": "2016-04-30-preview",
|
335 | 349 | "location": "[resourceGroup().location]",
|
336 | 350 | "dependsOn": [
|
| 351 | + "[concat('Microsoft.Compute/availabilitySets/', concat('availabilitySet-postgresql-', variables('commonSettings').tenantName))]", |
337 | 352 | "[concat('Microsoft.Network/networkInterfaces/', concat('networkInterface-', 'postgresql', '-', copyIndex()))]",
|
338 |
| - "[concat('Microsoft.Compute/availabilitySets/', concat('availabilitySet-postgresql-', variables('commonSettings').tenantName))]" |
| 353 | + "[concat('Microsoft.Compute/disks/', concat('osDisk-', 'postgresql', '-', copyIndex()))]" |
339 | 354 | ],
|
340 | 355 | "properties": {
|
341 | 356 | "hardwareProfile": { "vmSize": "[parameters('postgresqlInstanceSize')]" },
|
|
357 | 372 | }
|
358 | 373 | }
|
359 | 374 | },
|
| 375 | + "storageProfile": { |
| 376 | + "imageReference": |
| 377 | + { |
| 378 | + "publisher": "[variables('commonSettings').vm.postgresql.publisher]", |
| 379 | + "offer": "[variables('commonSettings').vm.postgresql.offer]", |
| 380 | + "sku": "[variables('commonSettings').vm.postgresql.sku]", |
| 381 | + "version": "[variables('commonSettings').vm.postgresql.version]" |
| 382 | + }, |
| 383 | + "osDisk": { |
| 384 | + "name": "[concat('osDisk-', 'postgresql', '-', copyIndex())]", |
| 385 | + "caching": "ReadWrite", |
| 386 | + "createOption": "FromImage" |
| 387 | + } |
| 388 | + }, |
360 | 389 | "networkProfile": {
|
361 | 390 | "networkInterfaces": [
|
362 | 391 | {
|
363 | 392 | "id": "[resourceId('Microsoft.Network/networkInterfaces', concat('networkInterface-', 'postgresql', '-', copyIndex()))]"
|
364 | 393 | }
|
365 | 394 | ]
|
366 |
| - }, |
367 |
| - "storageProfile": { |
368 |
| - "osDisk": { |
369 |
| - "name": "[concat('osDisk-', 'postgresql', '-', copyIndex())]", |
370 |
| - "osType": "Linux", |
371 |
| - "caching": "ReadWrite", |
372 |
| - "createOption": "Attach", |
373 |
| - "managedDisk": { "id": "[resourceId('Microsoft.Compute/disks', concat('osDisk-', 'postgresql', '-', copyIndex()))]" } |
374 |
| - } |
| 395 | + } |
| 396 | + } |
| 397 | + }, |
| 398 | + { |
| 399 | + "type": "Microsoft.Compute/virtualMachines/extensions", |
| 400 | + "name": "[concat('virtualMachine-', 'postgresql', '-', copyIndex(), '/extension')]", |
| 401 | + "apiVersion": "2015-05-01-preview", |
| 402 | + "location": "[resourceGroup().location]", |
| 403 | + "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/', concat('virtualMachine-', 'postgresql', '-', copyIndex()))]" ], |
| 404 | + "copy": { "name": "postgresqlVmExtensionCopy", "count": "[variables('commonSettings').instanceCount.postgresql]" }, |
| 405 | + "properties": { |
| 406 | + "publisher": "Microsoft.OSTCExtensions", |
| 407 | + "type": "CustomScriptForLinux", |
| 408 | + "typeHandlerVersion": "1.2", |
| 409 | + "settings": { |
| 410 | + "fileUris": [ |
| 411 | + "[concat(variables('baseUrl'), 'scripts/setup-raid.sh')]", |
| 412 | + "[concat(variables('baseUrl'), 'scripts/start-zk.sh')]", |
| 413 | + "[concat(variables('baseUrl'), 'scripts/start-pg.sh')]" |
| 414 | + ], |
| 415 | + "commandToExecute": "[concat('./start-pg.sh ', parameters('clusterName'), ' ', concat(variables('commonSettings').vnet.subnet.zookeeper.addressRangePrefix, '.10'), ' ', variables('commonSettings').instanceCount.zookeeper, ' ', concat(variables('commonSettings').vnet.subnet.postgresql.addressRangePrefix, '.10'), ' ', variables('commonSettings').instanceCount.postgresql, ' ', copyIndex(), ' ', parameters('postgresqlUsername'), ' ', concat('\"', parameters('postgresqlPassword'), '\"'), ' ' variables('commonSettings').softwareversions.patroni, ' ',variables('commonSettings').softwareversions.postgres )]" |
375 | 416 | }
|
376 | 417 | }
|
377 | 418 | }
|
|
0 commit comments