<commit_before>{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "Location for all resources."
            }
        },
        "vmSize": {
            "type": "string",
            "metadata": {
                "description": "Size of vm (e.g. Standard_D1_v2)"
            },
            "defaultValue": "Standard_D1_v2"
        },
        "dnsLabelPrefix": {
            "type": "string",
            "defaultValue": "cgamongo",
            "metadata": {
                "description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
            }
        },
        "certificateEmail": {
            "type": "string",
            "metadata": {
                "description": "Email address used for mongoDB letsencrypt certificates"
            }
        },
        "clusterSize": {
            "type": "int",
            "defaultValue": 3,
            "allowedValues": [
                1,
                3,
                5,
                7,
                9,
                11
            ],
            "metadata": {
                "description": "Amount of VMs to deploy for the mongodb replica set"
            }
        },
        "adminUsername": {
            "type": "string",
            "metadata": {
                "description": "The username for all mongoDB VMs (also used for connecting oer SSH)"
            }
        },
        "adminSSHKeyData": {
            "type": "string",
            "metadata": {
                "description": "The mongoDB VM public SSH key"
            }
        },
        "mongoDBUsername": {
            "type": "string",
            "defaultValue": "opencga",
            "metadata": {
                "description": "The username for connecting to mongoDB"
            }
        },
        "mongoDBPassword": {
            "type": "securestring",
            "metadata": {
                "description": "The password for connecting to mongoDB"
            }
        },
        "subnetId": {
            "type": "string",
            "metadata": {
                "description": "Subnet ID"
            }
        },
        "LogAnalyticsWorkspaceID": {
            "type": "string",
            "metadata": {
                "description": "Log Analytics Workspace ID"
            }
        },
        "logAnalyticsWorkSpaceKey": {
            "type": "string",
            "metadata": {
                "description": "Log Analytics Workspace Key"
            }
        },
        "LogAnalyticsWorkspaceResourceID": {
            "type": "string",
            "metadata": {
                "description": "Log Analytics Workspace Resource ID"
            }
        },
        "mongoDbDumpUrl": {
            "type": "string",
            "defaultValue": "",
            "metadata": {
                "description": "The URL pointing to a tar.gz zip of the a mongo dump"
            }
        }
    },
    "variables": {
        "vmName": "mongo-vm",
        "nicName": "mongo-nic",
        "publicIPAddressName": "mongo-publicip",
        "publicIPAddressType": "Static",
        "dnsPrefix": "[concat(parameters('dnsLabelPrefix'), uniquestring(resourceGroup().id))]",
        "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
        "copy": [
            {
                "name": "dnsNames",
                "count": "[parameters('clusterSize')]",
                "input": {
                    "fqdn": "[concat(variables('dnsPrefix'),copyIndex('dnsNames'),'.',parameters('location'),'.cloudapp.azure.com')]"
                }
            }
        ],
        "logAnalyticsAgent": "[concat('docker run --privileged -d -v /var/run/docker.sock:/var/run/docker.sock -v /var/log:/var/log -v /var/lib/docker/containers:/var/lib/docker/containers -e WSID=',parameters('logAnalyticsWorkSpaceID'),' -e KEY=',parameters('logAnalyticsWorkSpaceKey'),' -p 127.0.0.1:25225:25225 -p 127.0.0.1:25224:25224/udp --name=omsagent -h=`hostname` --restart=always microsoft/oms')]",
        "fqdn": "[concat(variables('dnsPrefix'),'#VM_INDEX#','.',parameters('location'),'.cloudapp.azure.com')]",
        "postDeployShEncoded": "H4sI<KEY>
        "renewMongoCertShEncoded": "<KEY>
        "cloudInit": [
            "#cloud-config",
            "",
            "package_upgrade: true",
            "package_reboot_if_required: true",
            "",
            "write_files:",
            "- encoding: gzip",
            "  path: /opt/installmongodb.sh",
            "  permissions: \"0744\"",
            "  content: !!binary |",
            "[concat('    ', variables('postDeployShEncoded'))]",
            "",
            "- encoding: gzip",
            "  content: !!binary |",
            "[concat('    ', variables('renewMongoCertShEncoded'))]",
            "  path: /opt/renew_mongo_cert.sh",
            "  permissions: \"0744\"",
            "",
            "runcmd:",
            "- export DEBIAN_FRONTEND='noninteractive'",
            "- curl -fsSL https://get.docker.com/ | sh",
            "- curl -fsSL https://get.docker.com/gpg | sudo apt-key add -",
            "[concat('- ', variables('logAnalyticsAgent'))]",
            "[concat('- VM_INDEX=#VM_INDEX# CLUSTER_SIZE=', parameters('clusterSize'), ' MONGODB_DUMP_URL=', parameters('mongoDbDumpUrl'), ' CERT_EMAIL=', parameters('certificateEmail'),' MONGODB_USERNAME=', parameters('mongoDBUsername'),' MONGODB_PASSWORD=', parameters('mongoDBPassword'),' APP_DNS_NAME=', variables('fqdn'), ' /bin/bash /opt/installmongodb.sh')]"
        ]
    },
    "resources": [
        {
            "apiVersion": "2017-10-01",
            "type": "Microsoft.Network/networkInterfaces",
            "name": "[concat(variables('nicName'), copyIndex())]",
            "location": "[parameters('location')]",
            "copy": {
                "name": "mongo-ip",
                "count": "[parameters('clusterSize')]"
            },
            "dependsOn": [
                "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'), copyIndex())]"
            ],
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "ipconfig1",
                        "properties": {
                            "privateIPAllocationMethod": "Dynamic",
                            "publicIPAddress": {
                                "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('publicIPAddressName'), copyIndex()))]"
                            },
                            "subnet": {<commit_msg>Fix bug with unescaped url with sas token<commit_after>{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "Location for all resources."
            }
        },
        "vmSize": {
            "type": "string",
            "metadata": {
                "description": "Size of vm (e.g. Standard_D1_v2)"
            },
            "defaultValue": "Standard_D1_v2"
        },
        "dnsLabelPrefix": {
            "type": "string",
            "defaultValue": "cgamongo",
            "metadata": {
                "description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
            }
        },
        "certificateEmail": {
            "type": "string",
            "metadata": {
                "description": "Email address used for mongoDB letsencrypt certificates"
            }
        },
        "clusterSize": {
            "type": "int",
            "defaultValue": 3,
            "allowedValues": [
                1,
                3,
                5,
                7,
                9,
                11
            ],
            "metadata": {
                "description": "Amount of VMs to deploy for the mongodb replica set"
            }
        },
        "adminUsername": {
            "type": "string",
            "metadata": {
                "description": "The username for all mongoDB VMs (also used for connecting oer SSH)"
            }
        },
        "adminSSHKeyData": {
            "type": "string",
            "metadata": {
                "description": "The mongoDB VM public SSH key"
            }
        },
        "mongoDBUsername": {
            "type": "string",
            "defaultValue": "opencga",
            "metadata": {
                "description": "The username for connecting to mongoDB"
            }
        },
        "mongoDBPassword": {
            "type": "securestring",
            "metadata": {
                "description": "The password for connecting to mongoDB"
            }
        },
        "subnetId": {
            "type": "string",
            "metadata": {
                "description": "Subnet ID"
            }
        },
        "LogAnalyticsWorkspaceID": {
            "type": "string",
            "metadata": {
                "description": "Log Analytics Workspace ID"
            }
        },
        "logAnalyticsWorkSpaceKey": {
            "type": "string",
            "metadata": {
                "description": "Log Analytics Workspace Key"
            }
        },
        "LogAnalyticsWorkspaceResourceID": {
            "type": "string",
            "metadata": {
                "description": "Log Analytics Workspace Resource ID"
            }
        },
        "mongoDbDumpUrl": {
            "type": "string",
            "defaultValue": "",
            "metadata": {
                "description": "The URL pointing to a tar.gz zip of the a mongo dump"
            }
        }
    },
    "variables": {
        "vmName": "mongo-vm",
        "nicName": "mongo-nic",
        "publicIPAddressName": "mongo-publicip",
        "publicIPAddressType": "Static",
        "dnsPrefix": "[concat(parameters('dnsLabelPrefix'), uniquestring(resourceGroup().id))]",
        "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
        "copy": [
            {
                "name": "dnsNames",
                "count": "[parameters('clusterSize')]",
                "input": {
                    "fqdn": "[concat(variables('dnsPrefix'),copyIndex('dnsNames'),'.',parameters('location'),'.cloudapp.azure.com')]"
                }
            }
        ],
        "logAnalyticsAgent": "[concat('docker run --privileged -d -v /var/run/docker.sock:/var/run/docker.sock -v /var/log:/var/log -v /var/lib/docker/containers:/var/lib/docker/containers -e WSID=',parameters('logAnalyticsWorkSpaceID'),' -e KEY=',parameters('logAnalyticsWorkSpaceKey'),' -p 127.0.0.1:25225:25225 -p 127.0.0.1:25224:25224/udp --name=omsagent -h=`hostname` --restart=always microsoft/oms')]",
        "fqdn": "[concat(variables('dnsPrefix'),'#VM_INDEX#','.',parameters('location'),'.cloudapp.azure.com')]",
        "postDeployShEncoded": "<KEY>
        "renewMongoCertShEncoded": "<KEY>
        "cloudInit": [
            "#cloud-config",
            "",
            "package_upgrade: true",
            "package_reboot_if_required: true",
            "",
            "write_files:",
            "- encoding: gzip",
            "  path: /opt/installmongodb.sh",
            "  permissions: \"0744\"",
            "  content: !!binary |",
            "[concat('    ', variables('postDeployShEncoded'))]",
            "",
            "- encoding: gzip",
            "  content: !!binary |",
            "[concat('    ', variables('renewMongoCertShEncoded'))]",
            "  path: /opt/renew_mongo_cert.sh",
            "  permissions: \"0744\"",
            "",
            "runcmd:",
            "- export DEBIAN_FRONTEND='noninteractive'",
            "- curl -fsSL https://get.docker.com/ | sh",
            "- curl -fsSL https://get.docker.com/gpg | sudo apt-key add -",
            "[concat('- ', variables('logAnalyticsAgent'))]",
            "[concat('- VM_INDEX=#VM_INDEX# CLUSTER_SIZE=', parameters('clusterSize'), ' MONGODB_DUMP_URL=\"', parameters('mongoDbDumpUrl'), '\" CERT_EMAIL=', parameters('certificateEmail'),' MONGODB_USERNAME=', parameters('mongoDBUsername'),' MONGODB_PASSWORD=', parameters('<PASSWORD>DBPassword'),' APP_DNS_NAME=', variables('fqdn'), ' /bin/bash /opt/installmongodb.sh')]"
        ]
    },
    "resources": [
        {
            "apiVersion": "2017-10-01",
            "type": "Microsoft.Network/networkInterfaces",
            "name": "[concat(variables('nicName'), copyIndex())]",
            "location": "[parameters('location')]",
            "copy": {
                "name": "mongo-ip",
                "count": "[parameters('clusterSize')]"
            },
            "dependsOn": [
                "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'), copyIndex())]"
            ],
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "ipconfig1",
                        "properties": {
                            "privateIPAllocationMethod": "Dynamic",
                            "publicIPAddress": {
                                "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('publicIPAddressName'), copyIndex()))]"
                            },
                            "subnet": {
{'fraction_non_alphanumeric': 0.15712305784521116, 'fraction_numerical': 0.010722882777737253, 'mean_word_length': 1.5809487951807228, 'pattern_counts': {'":': 200, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7056959', 'n_tokens_mistral': 3877, 'n_tokens_neox': 3707, 'n_words': 669}