@performance-agent/mcp-server 1.0.1 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +400 -25
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +783 -47
- package/dist/index.js.map +1 -1
- package/dist/prompts/jmx_prompt.txt +262 -0
- package/dist/prompts/prompts/jmx_prompt.txt +262 -0
- package/dist/tools/azure-infra/config-parser.d.ts +14 -0
- package/dist/tools/azure-infra/config-parser.d.ts.map +1 -0
- package/dist/tools/azure-infra/config-parser.js +361 -0
- package/dist/tools/azure-infra/config-parser.js.map +1 -0
- package/dist/tools/azure-infra/index.d.ts +52 -0
- package/dist/tools/azure-infra/index.d.ts.map +1 -0
- package/dist/tools/azure-infra/index.js +448 -0
- package/dist/tools/azure-infra/index.js.map +1 -0
- package/dist/tools/azure-infra/terraform-generator.d.ts +19 -0
- package/dist/tools/azure-infra/terraform-generator.d.ts.map +1 -0
- package/dist/tools/azure-infra/terraform-generator.js +458 -0
- package/dist/tools/azure-infra/terraform-generator.js.map +1 -0
- package/dist/tools/azure-infra/types.d.ts +123 -0
- package/dist/tools/azure-infra/types.d.ts.map +1 -0
- package/dist/tools/azure-infra/types.js +95 -0
- package/dist/tools/azure-infra/types.js.map +1 -0
- package/dist/tools/cloud-executor/index.d.ts +78 -0
- package/dist/tools/cloud-executor/index.d.ts.map +1 -0
- package/dist/tools/cloud-executor/index.js +528 -0
- package/dist/tools/cloud-executor/index.js.map +1 -0
- package/dist/tools/cloud-executor/result-analyzer.d.ts +65 -0
- package/dist/tools/cloud-executor/result-analyzer.d.ts.map +1 -0
- package/dist/tools/cloud-executor/result-analyzer.js +367 -0
- package/dist/tools/cloud-executor/result-analyzer.js.map +1 -0
- package/dist/tools/cloud-executor/vm-metrics.d.ts +87 -0
- package/dist/tools/cloud-executor/vm-metrics.d.ts.map +1 -0
- package/dist/tools/cloud-executor/vm-metrics.js +506 -0
- package/dist/tools/cloud-executor/vm-metrics.js.map +1 -0
- package/dist/tools/jmx-generator/index.d.ts +20 -0
- package/dist/tools/jmx-generator/index.d.ts.map +1 -0
- package/dist/tools/jmx-generator/index.js +115 -0
- package/dist/tools/jmx-generator/index.js.map +1 -0
- package/dist/tools/jmx-generator/sanitizer.d.ts +19 -0
- package/dist/tools/jmx-generator/sanitizer.d.ts.map +1 -0
- package/dist/tools/jmx-generator/sanitizer.js +166 -0
- package/dist/tools/jmx-generator/sanitizer.js.map +1 -0
- package/package.json +5 -2
- package/scripts/copy-prompts.js +46 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terraform Generator for Azure VMs
|
|
3
|
+
* Generates Terraform configuration files for VM provisioning
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
/**
|
|
8
|
+
* Generate complete Terraform configuration for a VM
|
|
9
|
+
*/
|
|
10
|
+
export function generateTerraformConfig(config) {
|
|
11
|
+
const isWindows = config.imageReference.publisher === 'MicrosoftWindowsServer';
|
|
12
|
+
return `# Generated by Performance Agent MCP Server
|
|
13
|
+
# VM: ${config.name}
|
|
14
|
+
# Generated at: ${new Date().toISOString()}
|
|
15
|
+
|
|
16
|
+
terraform {
|
|
17
|
+
required_providers {
|
|
18
|
+
azurerm = {
|
|
19
|
+
source = "hashicorp/azurerm"
|
|
20
|
+
version = "~>3.0"
|
|
21
|
+
}
|
|
22
|
+
tls = {
|
|
23
|
+
source = "hashicorp/tls"
|
|
24
|
+
version = "~>4.0"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
provider "azurerm" {
|
|
30
|
+
features {}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# Variables
|
|
34
|
+
variable "admin_username" {
|
|
35
|
+
description = "Admin username for the VM"
|
|
36
|
+
default = "${config.adminUsername}"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
variable "admin_password" {
|
|
40
|
+
description = "Admin password for the VM (only used for Windows)"
|
|
41
|
+
sensitive = true
|
|
42
|
+
default = null
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
${!isWindows ? `# Generate SSH Key Pair automatically
|
|
46
|
+
resource "tls_private_key" "ssh" {
|
|
47
|
+
algorithm = "RSA"
|
|
48
|
+
rsa_bits = 4096
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# Save private key locally for SSH access
|
|
52
|
+
resource "local_file" "ssh_private_key" {
|
|
53
|
+
content = tls_private_key.ssh.private_key_pem
|
|
54
|
+
filename = "\${path.module}/${config.name}_ssh_key.pem"
|
|
55
|
+
file_permission = "0600"
|
|
56
|
+
}
|
|
57
|
+
` : ''}
|
|
58
|
+
|
|
59
|
+
${config.useExistingResourceGroup ? `# Use existing Resource Group
|
|
60
|
+
data "azurerm_resource_group" "main" {
|
|
61
|
+
name = "${config.resourceGroup}"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
locals {
|
|
65
|
+
resource_group_name = data.azurerm_resource_group.main.name
|
|
66
|
+
location = data.azurerm_resource_group.main.location
|
|
67
|
+
rg_tags = data.azurerm_resource_group.main.tags
|
|
68
|
+
}` : `# Create new Resource Group
|
|
69
|
+
resource "azurerm_resource_group" "main" {
|
|
70
|
+
name = "${config.resourceGroup}"
|
|
71
|
+
location = "${config.region}"
|
|
72
|
+
|
|
73
|
+
tags = ${JSON.stringify(config.tags, null, 4).replace(/"/g, '"')}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
locals {
|
|
77
|
+
resource_group_name = azurerm_resource_group.main.name
|
|
78
|
+
location = azurerm_resource_group.main.location
|
|
79
|
+
rg_tags = azurerm_resource_group.main.tags
|
|
80
|
+
}`}
|
|
81
|
+
|
|
82
|
+
# Virtual Network
|
|
83
|
+
resource "azurerm_virtual_network" "main" {
|
|
84
|
+
name = "${config.networkConfig.vnetName}"
|
|
85
|
+
address_space = ["10.0.0.0/16"]
|
|
86
|
+
location = local.location
|
|
87
|
+
resource_group_name = local.resource_group_name
|
|
88
|
+
|
|
89
|
+
tags = local.rg_tags
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# Subnet
|
|
93
|
+
resource "azurerm_subnet" "main" {
|
|
94
|
+
name = "${config.networkConfig.subnetName}"
|
|
95
|
+
resource_group_name = local.resource_group_name
|
|
96
|
+
virtual_network_name = azurerm_virtual_network.main.name
|
|
97
|
+
address_prefixes = ["10.0.1.0/24"]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# Network Security Group
|
|
101
|
+
resource "azurerm_network_security_group" "main" {
|
|
102
|
+
name = "${config.networkConfig.nsgName}"
|
|
103
|
+
location = local.location
|
|
104
|
+
resource_group_name = local.resource_group_name
|
|
105
|
+
|
|
106
|
+
${generateNSGRules(config.networkConfig.openPorts, isWindows)}
|
|
107
|
+
|
|
108
|
+
tags = local.rg_tags
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
# Associate NSG with Subnet
|
|
112
|
+
resource "azurerm_subnet_network_security_group_association" "main" {
|
|
113
|
+
subnet_id = azurerm_subnet.main.id
|
|
114
|
+
network_security_group_id = azurerm_network_security_group.main.id
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
${config.networkConfig.publicIP ? `# Public IP
|
|
118
|
+
resource "azurerm_public_ip" "main" {
|
|
119
|
+
name = "${config.name}-pip"
|
|
120
|
+
location = local.location
|
|
121
|
+
resource_group_name = local.resource_group_name
|
|
122
|
+
allocation_method = "Static"
|
|
123
|
+
sku = "Standard"
|
|
124
|
+
|
|
125
|
+
tags = local.rg_tags
|
|
126
|
+
}
|
|
127
|
+
` : ''}
|
|
128
|
+
|
|
129
|
+
# Network Interface
|
|
130
|
+
resource "azurerm_network_interface" "main" {
|
|
131
|
+
name = "${config.name}-nic"
|
|
132
|
+
location = local.location
|
|
133
|
+
resource_group_name = local.resource_group_name
|
|
134
|
+
|
|
135
|
+
ip_configuration {
|
|
136
|
+
name = "internal"
|
|
137
|
+
subnet_id = azurerm_subnet.main.id
|
|
138
|
+
private_ip_address_allocation = "Dynamic"
|
|
139
|
+
${config.networkConfig.publicIP ? ' public_ip_address_id = azurerm_public_ip.main.id' : ''}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
tags = local.rg_tags
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
# Virtual Machine
|
|
146
|
+
resource "azurerm_${isWindows ? 'windows' : 'linux'}_virtual_machine" "main" {
|
|
147
|
+
name = "${config.name}"
|
|
148
|
+
resource_group_name = local.resource_group_name
|
|
149
|
+
location = local.location
|
|
150
|
+
size = "${config.vmSize}"
|
|
151
|
+
admin_username = var.admin_username
|
|
152
|
+
${isWindows ? ` admin_password = var.admin_password` : `
|
|
153
|
+
admin_ssh_key {
|
|
154
|
+
username = var.admin_username
|
|
155
|
+
public_key = tls_private_key.ssh.public_key_openssh
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
disable_password_authentication = true`}
|
|
159
|
+
|
|
160
|
+
network_interface_ids = [
|
|
161
|
+
azurerm_network_interface.main.id,
|
|
162
|
+
]
|
|
163
|
+
|
|
164
|
+
${config.priority === 'Spot' ? ` priority = "Spot"
|
|
165
|
+
eviction_policy = "Deallocate"
|
|
166
|
+
max_bid_price = -1
|
|
167
|
+
` : ''}
|
|
168
|
+
|
|
169
|
+
os_disk {
|
|
170
|
+
caching = "ReadWrite"
|
|
171
|
+
storage_account_type = "${config.osDisk.storageAccountType}"
|
|
172
|
+
disk_size_gb = ${config.osDisk.sizeGB}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
source_image_reference {
|
|
176
|
+
publisher = "${config.imageReference.publisher}"
|
|
177
|
+
offer = "${config.imageReference.offer}"
|
|
178
|
+
sku = "${config.imageReference.sku}"
|
|
179
|
+
version = "${config.imageReference.version}"
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
tags = local.rg_tags
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
${config.autoShutdownTime ? generateAutoShutdown(config.name, config.autoShutdownTime) : ''}
|
|
186
|
+
|
|
187
|
+
${config.customScript && !isWindows ? generateCustomScriptExtension(config.name, config.customScript) : ''}
|
|
188
|
+
|
|
189
|
+
# Outputs
|
|
190
|
+
output "resource_group_name" {
|
|
191
|
+
value = local.resource_group_name
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
output "vm_name" {
|
|
195
|
+
value = azurerm_${isWindows ? 'windows' : 'linux'}_virtual_machine.main.name
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
output "vm_id" {
|
|
199
|
+
value = azurerm_${isWindows ? 'windows' : 'linux'}_virtual_machine.main.id
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
${config.networkConfig.publicIP ? `output "public_ip_address" {
|
|
203
|
+
value = azurerm_public_ip.main.ip_address
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
output "ssh_command" {
|
|
207
|
+
value = ${isWindows ? '"Use RDP to connect"' : `"ssh -i \${path.module}/${config.name}_ssh_key.pem \${var.admin_username}@\${azurerm_public_ip.main.ip_address}"`}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
${!isWindows ? `output "ssh_private_key_path" {
|
|
211
|
+
value = local_file.ssh_private_key.filename
|
|
212
|
+
}` : ''}` : `output "private_ip_address" {
|
|
213
|
+
value = azurerm_network_interface.main.private_ip_address
|
|
214
|
+
}`}
|
|
215
|
+
|
|
216
|
+
output "azure_portal_url" {
|
|
217
|
+
value = "https://portal.azure.com/#@/resource\${azurerm_${isWindows ? 'windows' : 'linux'}_virtual_machine.main.id}"
|
|
218
|
+
}
|
|
219
|
+
`;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Generate NSG rules for open ports
|
|
223
|
+
*/
|
|
224
|
+
function generateNSGRules(ports, isWindows) {
|
|
225
|
+
const rules = [];
|
|
226
|
+
let priority = 100;
|
|
227
|
+
for (const port of ports) {
|
|
228
|
+
const ruleName = getPortRuleName(port);
|
|
229
|
+
rules.push(` security_rule {
|
|
230
|
+
name = "Allow-${ruleName}"
|
|
231
|
+
priority = ${priority}
|
|
232
|
+
direction = "Inbound"
|
|
233
|
+
access = "Allow"
|
|
234
|
+
protocol = "Tcp"
|
|
235
|
+
source_port_range = "*"
|
|
236
|
+
destination_port_range = "${port}"
|
|
237
|
+
source_address_prefix = "*"
|
|
238
|
+
destination_address_prefix = "*"
|
|
239
|
+
}`);
|
|
240
|
+
priority += 10;
|
|
241
|
+
}
|
|
242
|
+
return rules.join('\n\n');
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Get human-readable name for common ports
|
|
246
|
+
*/
|
|
247
|
+
function getPortRuleName(port) {
|
|
248
|
+
const portNames = {
|
|
249
|
+
22: 'SSH',
|
|
250
|
+
80: 'HTTP',
|
|
251
|
+
443: 'HTTPS',
|
|
252
|
+
3389: 'RDP',
|
|
253
|
+
3306: 'MySQL',
|
|
254
|
+
5432: 'PostgreSQL',
|
|
255
|
+
27017: 'MongoDB',
|
|
256
|
+
6379: 'Redis',
|
|
257
|
+
8080: 'HTTP-Alt',
|
|
258
|
+
8443: 'HTTPS-Alt',
|
|
259
|
+
};
|
|
260
|
+
return portNames[port] || `Port-${port}`;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Generate auto-shutdown schedule
|
|
264
|
+
*/
|
|
265
|
+
function generateAutoShutdown(vmName, shutdownTime) {
|
|
266
|
+
return `
|
|
267
|
+
# Auto-Shutdown Schedule
|
|
268
|
+
resource "azurerm_dev_test_global_vm_shutdown_schedule" "main" {
|
|
269
|
+
virtual_machine_id = azurerm_linux_virtual_machine.main.id
|
|
270
|
+
location = azurerm_resource_group.main.location
|
|
271
|
+
enabled = true
|
|
272
|
+
|
|
273
|
+
daily_recurrence_time = "${shutdownTime.replace(':', '')}"
|
|
274
|
+
timezone = "UTC"
|
|
275
|
+
|
|
276
|
+
notification_settings {
|
|
277
|
+
enabled = false
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
`;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Generate custom script extension for Linux VMs
|
|
284
|
+
*/
|
|
285
|
+
function generateCustomScriptExtension(vmName, script) {
|
|
286
|
+
const base64Script = Buffer.from(script).toString('base64');
|
|
287
|
+
return `
|
|
288
|
+
# Custom Script Extension
|
|
289
|
+
resource "azurerm_virtual_machine_extension" "custom_script" {
|
|
290
|
+
name = "${vmName}-customscript"
|
|
291
|
+
virtual_machine_id = azurerm_linux_virtual_machine.main.id
|
|
292
|
+
publisher = "Microsoft.Azure.Extensions"
|
|
293
|
+
type = "CustomScript"
|
|
294
|
+
type_handler_version = "2.1"
|
|
295
|
+
|
|
296
|
+
settings = <<SETTINGS
|
|
297
|
+
{
|
|
298
|
+
"script": "${base64Script}"
|
|
299
|
+
}
|
|
300
|
+
SETTINGS
|
|
301
|
+
}
|
|
302
|
+
`;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Generate Azure CLI commands as an alternative
|
|
306
|
+
*/
|
|
307
|
+
export function generateAzureCLICommands(config) {
|
|
308
|
+
const isWindows = config.imageReference.publisher === 'MicrosoftWindowsServer';
|
|
309
|
+
const image = `${config.imageReference.publisher}:${config.imageReference.offer}:${config.imageReference.sku}:${config.imageReference.version}`;
|
|
310
|
+
const commands = [
|
|
311
|
+
`# Azure CLI commands to provision VM: ${config.name}`,
|
|
312
|
+
`# Generated at: ${new Date().toISOString()}`,
|
|
313
|
+
'',
|
|
314
|
+
'# Create Resource Group',
|
|
315
|
+
`az group create --name ${config.resourceGroup} --location ${config.region}`,
|
|
316
|
+
'',
|
|
317
|
+
'# Create Virtual Network',
|
|
318
|
+
`az network vnet create \\`,
|
|
319
|
+
` --resource-group ${config.resourceGroup} \\`,
|
|
320
|
+
` --name ${config.networkConfig.vnetName} \\`,
|
|
321
|
+
` --address-prefix 10.0.0.0/16 \\`,
|
|
322
|
+
` --subnet-name ${config.networkConfig.subnetName} \\`,
|
|
323
|
+
` --subnet-prefix 10.0.1.0/24`,
|
|
324
|
+
'',
|
|
325
|
+
'# Create Network Security Group',
|
|
326
|
+
`az network nsg create \\`,
|
|
327
|
+
` --resource-group ${config.resourceGroup} \\`,
|
|
328
|
+
` --name ${config.networkConfig.nsgName}`,
|
|
329
|
+
'',
|
|
330
|
+
];
|
|
331
|
+
// Add NSG rules for each port
|
|
332
|
+
config.networkConfig.openPorts.forEach((port, index) => {
|
|
333
|
+
commands.push(`# Allow port ${port}`);
|
|
334
|
+
commands.push(`az network nsg rule create \\`);
|
|
335
|
+
commands.push(` --resource-group ${config.resourceGroup} \\`);
|
|
336
|
+
commands.push(` --nsg-name ${config.networkConfig.nsgName} \\`);
|
|
337
|
+
commands.push(` --name Allow-${getPortRuleName(port)} \\`);
|
|
338
|
+
commands.push(` --priority ${100 + index * 10} \\`);
|
|
339
|
+
commands.push(` --destination-port-ranges ${port} \\`);
|
|
340
|
+
commands.push(` --access Allow \\`);
|
|
341
|
+
commands.push(` --protocol Tcp`);
|
|
342
|
+
commands.push('');
|
|
343
|
+
});
|
|
344
|
+
if (config.networkConfig.publicIP) {
|
|
345
|
+
commands.push('# Create Public IP');
|
|
346
|
+
commands.push(`az network public-ip create \\`);
|
|
347
|
+
commands.push(` --resource-group ${config.resourceGroup} \\`);
|
|
348
|
+
commands.push(` --name ${config.name}-pip \\`);
|
|
349
|
+
commands.push(` --sku Standard \\`);
|
|
350
|
+
commands.push(` --allocation-method Static`);
|
|
351
|
+
commands.push('');
|
|
352
|
+
}
|
|
353
|
+
commands.push('# Create VM');
|
|
354
|
+
commands.push(`az vm create \\`);
|
|
355
|
+
commands.push(` --resource-group ${config.resourceGroup} \\`);
|
|
356
|
+
commands.push(` --name ${config.name} \\`);
|
|
357
|
+
commands.push(` --image "${image}" \\`);
|
|
358
|
+
commands.push(` --size ${config.vmSize} \\`);
|
|
359
|
+
commands.push(` --admin-username ${config.adminUsername} \\`);
|
|
360
|
+
if (isWindows) {
|
|
361
|
+
commands.push(` --admin-password '<YOUR_PASSWORD>' \\`);
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
commands.push(` --generate-ssh-keys \\`);
|
|
365
|
+
}
|
|
366
|
+
commands.push(` --vnet-name ${config.networkConfig.vnetName} \\`);
|
|
367
|
+
commands.push(` --subnet ${config.networkConfig.subnetName} \\`);
|
|
368
|
+
commands.push(` --nsg ${config.networkConfig.nsgName} \\`);
|
|
369
|
+
if (config.networkConfig.publicIP) {
|
|
370
|
+
commands.push(` --public-ip-address ${config.name}-pip \\`);
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
commands.push(` --public-ip-address "" \\`);
|
|
374
|
+
}
|
|
375
|
+
commands.push(` --os-disk-size-gb ${config.osDisk.sizeGB} \\`);
|
|
376
|
+
commands.push(` --storage-sku ${config.osDisk.storageAccountType}`);
|
|
377
|
+
if (config.priority === 'Spot') {
|
|
378
|
+
commands.push(` --priority Spot \\`);
|
|
379
|
+
commands.push(` --eviction-policy Deallocate \\`);
|
|
380
|
+
commands.push(` --max-price -1`);
|
|
381
|
+
}
|
|
382
|
+
commands.push('');
|
|
383
|
+
commands.push('# Get VM details');
|
|
384
|
+
commands.push(`az vm show --resource-group ${config.resourceGroup} --name ${config.name} --show-details`);
|
|
385
|
+
return commands.join('\n');
|
|
386
|
+
}
|
|
387
|
+
// Unified output directory name for all performance agent artifacts
|
|
388
|
+
export const PERF_OUTPUT_DIR = '.perf-output';
|
|
389
|
+
/**
|
|
390
|
+
* Save Terraform configuration to a file
|
|
391
|
+
*/
|
|
392
|
+
export async function saveTerraformConfig(config, outputDir) {
|
|
393
|
+
// Use unified .perf-output folder for all outputs
|
|
394
|
+
const terraformDir = path.join(outputDir, PERF_OUTPUT_DIR, 'terraform', config.name);
|
|
395
|
+
// Create directory if it doesn't exist
|
|
396
|
+
if (!fs.existsSync(terraformDir)) {
|
|
397
|
+
fs.mkdirSync(terraformDir, { recursive: true });
|
|
398
|
+
}
|
|
399
|
+
// Generate and save main.tf
|
|
400
|
+
const mainTf = generateTerraformConfig(config);
|
|
401
|
+
const mainTfPath = path.join(terraformDir, 'main.tf');
|
|
402
|
+
fs.writeFileSync(mainTfPath, mainTf);
|
|
403
|
+
// Generate terraform.tfvars template
|
|
404
|
+
const tfvars = `# Terraform Variables
|
|
405
|
+
# Fill in your values and rename to terraform.tfvars
|
|
406
|
+
|
|
407
|
+
admin_username = "${config.adminUsername}"
|
|
408
|
+
# admin_password = "YourSecurePassword123!" # Only for Windows VMs
|
|
409
|
+
# ssh_public_key = "ssh-rsa AAAA..." # Only for Linux VMs
|
|
410
|
+
`;
|
|
411
|
+
fs.writeFileSync(path.join(terraformDir, 'terraform.tfvars.example'), tfvars);
|
|
412
|
+
// Generate README
|
|
413
|
+
const readme = `# ${config.name} - Azure VM
|
|
414
|
+
|
|
415
|
+
Generated by Performance Agent MCP Server
|
|
416
|
+
|
|
417
|
+
## Quick Start
|
|
418
|
+
|
|
419
|
+
1. Install Terraform: https://terraform.io/downloads
|
|
420
|
+
2. Login to Azure: \`az login\`
|
|
421
|
+
3. Initialize Terraform:
|
|
422
|
+
\`\`\`bash
|
|
423
|
+
terraform init
|
|
424
|
+
\`\`\`
|
|
425
|
+
4. Preview changes:
|
|
426
|
+
\`\`\`bash
|
|
427
|
+
terraform plan
|
|
428
|
+
\`\`\`
|
|
429
|
+
5. Apply configuration:
|
|
430
|
+
\`\`\`bash
|
|
431
|
+
terraform apply
|
|
432
|
+
\`\`\`
|
|
433
|
+
|
|
434
|
+
## VM Configuration
|
|
435
|
+
|
|
436
|
+
| Property | Value |
|
|
437
|
+
|----------|-------|
|
|
438
|
+
| Name | ${config.name} |
|
|
439
|
+
| Resource Group | ${config.resourceGroup} |
|
|
440
|
+
| Size | ${config.vmSize} |
|
|
441
|
+
| Region | ${config.region} |
|
|
442
|
+
| OS | ${config.imageReference.offer} ${config.imageReference.sku} |
|
|
443
|
+
| Disk Size | ${config.osDisk.sizeGB} GB |
|
|
444
|
+
| Disk Type | ${config.osDisk.storageAccountType} |
|
|
445
|
+
| Public IP | ${config.networkConfig.publicIP ? 'Yes' : 'No'} |
|
|
446
|
+
| Open Ports | ${config.networkConfig.openPorts.join(', ')} |
|
|
447
|
+
|
|
448
|
+
## Clean Up
|
|
449
|
+
|
|
450
|
+
To destroy all resources:
|
|
451
|
+
\`\`\`bash
|
|
452
|
+
terraform destroy
|
|
453
|
+
\`\`\`
|
|
454
|
+
`;
|
|
455
|
+
fs.writeFileSync(path.join(terraformDir, 'README.md'), readme);
|
|
456
|
+
return terraformDir;
|
|
457
|
+
}
|
|
458
|
+
//# sourceMappingURL=terraform-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terraform-generator.js","sourceRoot":"","sources":["../../../src/tools/azure-infra/terraform-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAgB;IACtD,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,KAAK,wBAAwB,CAAC;IAE/E,OAAO;QACD,MAAM,CAAC,IAAI;kBACD,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;mBAsBvB,MAAM,CAAC,aAAa;;;;;;;;;EASrC,CAAC,SAAS,CAAC,CAAC,CAAC;;;;;;;;;uCASwB,MAAM,CAAC,IAAI;;;CAGjD,CAAC,CAAC,CAAC,EAAE;;EAEJ,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC;;YAExB,MAAM,CAAC,aAAa;;;;;;;EAO9B,CAAC,CAAC,CAAC;;gBAEW,MAAM,CAAC,aAAa;gBACpB,MAAM,CAAC,MAAM;;WAElB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAA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and infrastructure management
|
|
4
|
+
*/
|
|
5
|
+
export interface AzureSubscription {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
state: string;
|
|
9
|
+
isDefault: boolean;
|
|
10
|
+
tenantId: string;
|
|
11
|
+
}
|
|
12
|
+
export interface AzureResourceGroup {
|
|
13
|
+
name: string;
|
|
14
|
+
location: string;
|
|
15
|
+
provisioningState: string;
|
|
16
|
+
tags: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
export type VMSizePreset = 'small' | 'medium' | 'large' | 'xlarge' | 'compute-optimized' | 'memory-optimized' | 'gpu';
|
|
19
|
+
export type OSType = 'ubuntu-22.04' | 'ubuntu-20.04' | 'debian-11' | 'rhel-8' | 'windows-2022' | 'windows-2019';
|
|
20
|
+
export type AzureRegion = 'eastus' | 'eastus2' | 'westus' | 'westus2' | 'westus3' | 'centralus' | 'northcentralus' | 'southcentralus' | 'westeurope' | 'northeurope' | 'uksouth' | 'ukwest' | 'eastasia' | 'southeastasia' | 'japaneast' | 'japanwest' | 'australiaeast' | 'australiasoutheast' | 'brazilsouth' | 'canadacentral' | 'canadaeast' | 'centralindia' | 'southindia' | 'westindia';
|
|
21
|
+
export interface VMConfigInput {
|
|
22
|
+
name: string;
|
|
23
|
+
resourceGroup?: string;
|
|
24
|
+
subscriptionId?: string;
|
|
25
|
+
useExistingResourceGroup?: boolean;
|
|
26
|
+
sizePreset?: VMSizePreset;
|
|
27
|
+
customSize?: string;
|
|
28
|
+
os?: OSType;
|
|
29
|
+
customImage?: string;
|
|
30
|
+
region?: AzureRegion;
|
|
31
|
+
cpuCores?: number;
|
|
32
|
+
memoryGB?: number;
|
|
33
|
+
diskSizeGB?: number;
|
|
34
|
+
diskType?: 'standard' | 'premium' | 'ultra';
|
|
35
|
+
publicIP?: boolean;
|
|
36
|
+
openPorts?: number[];
|
|
37
|
+
vnetName?: string;
|
|
38
|
+
subnetName?: string;
|
|
39
|
+
adminUsername?: string;
|
|
40
|
+
sshKeyPath?: string;
|
|
41
|
+
tags?: Record<string, string>;
|
|
42
|
+
spotInstance?: boolean;
|
|
43
|
+
autoShutdown?: string;
|
|
44
|
+
customScript?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface VMConfig {
|
|
47
|
+
name: string;
|
|
48
|
+
resourceGroup: string;
|
|
49
|
+
subscriptionId?: string;
|
|
50
|
+
useExistingResourceGroup?: boolean;
|
|
51
|
+
vmSize: string;
|
|
52
|
+
imageReference: {
|
|
53
|
+
publisher: string;
|
|
54
|
+
offer: string;
|
|
55
|
+
sku: string;
|
|
56
|
+
version: string;
|
|
57
|
+
};
|
|
58
|
+
region: string;
|
|
59
|
+
osDisk: {
|
|
60
|
+
sizeGB: number;
|
|
61
|
+
storageAccountType: string;
|
|
62
|
+
};
|
|
63
|
+
dataDisks: Array<{
|
|
64
|
+
sizeGB: number;
|
|
65
|
+
lun: number;
|
|
66
|
+
storageAccountType: string;
|
|
67
|
+
}>;
|
|
68
|
+
networkConfig: {
|
|
69
|
+
publicIP: boolean;
|
|
70
|
+
openPorts: number[];
|
|
71
|
+
vnetName: string;
|
|
72
|
+
subnetName: string;
|
|
73
|
+
nsgName: string;
|
|
74
|
+
};
|
|
75
|
+
adminUsername: string;
|
|
76
|
+
sshPublicKey?: string;
|
|
77
|
+
tags: Record<string, string>;
|
|
78
|
+
priority: 'Regular' | 'Spot';
|
|
79
|
+
autoShutdownTime?: string;
|
|
80
|
+
customScript?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface ProvisionResult {
|
|
83
|
+
success: boolean;
|
|
84
|
+
vmName: string;
|
|
85
|
+
resourceGroup: string;
|
|
86
|
+
region: string;
|
|
87
|
+
publicIP?: string;
|
|
88
|
+
privateIP?: string;
|
|
89
|
+
vmSize: string;
|
|
90
|
+
provisioningState: string;
|
|
91
|
+
sshCommand?: string;
|
|
92
|
+
azurePortalUrl?: string;
|
|
93
|
+
terraformGenerated?: boolean;
|
|
94
|
+
terraformPath?: string;
|
|
95
|
+
estimatedCost?: {
|
|
96
|
+
hourly: number;
|
|
97
|
+
monthly: number;
|
|
98
|
+
currency: string;
|
|
99
|
+
};
|
|
100
|
+
message: string;
|
|
101
|
+
steps?: string[];
|
|
102
|
+
}
|
|
103
|
+
export interface ProvisionVMArgs {
|
|
104
|
+
description?: string;
|
|
105
|
+
config?: VMConfigInput;
|
|
106
|
+
method?: 'terraform' | 'azure-cli' | 'dry-run';
|
|
107
|
+
generateTerraform?: boolean;
|
|
108
|
+
outputPath?: string;
|
|
109
|
+
}
|
|
110
|
+
export declare const VM_SIZE_PRESETS: Record<VMSizePreset, {
|
|
111
|
+
size: string;
|
|
112
|
+
cpus: number;
|
|
113
|
+
memoryGB: number;
|
|
114
|
+
description: string;
|
|
115
|
+
}>;
|
|
116
|
+
export declare const OS_IMAGES: Record<OSType, {
|
|
117
|
+
publisher: string;
|
|
118
|
+
offer: string;
|
|
119
|
+
sku: string;
|
|
120
|
+
version: string;
|
|
121
|
+
}>;
|
|
122
|
+
export declare const DISK_TYPES: Record<string, string>;
|
|
123
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/azure-infra/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAGD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,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