ARM templates changes to met MS requirements

This commit is contained in:
danielmkn
2020-05-21 13:14:58 -07:00
parent fac7ef0cc3
commit c7073f72e2
29 changed files with 5235 additions and 664 deletions

View File

@@ -1,6 +1,6 @@
{ {
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
"handler": "Microsoft.Compute.MultiVm", "handler": "Microsoft.Azure.CreateUIDef",
"version": "0.1.2-preview", "version": "0.1.2-preview",
"parameters": { "parameters": {
"basics": [ "basics": [
@@ -38,7 +38,7 @@
"osPlatform": "Linux", "osPlatform": "Linux",
"constraints": { "constraints": {
"required": true, "required": true,
"customPasswordRegex": "^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)[A-Za-z\\d]{12,}$", "customPasswordRegex": "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{12,}$",
"customValidationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number." "customValidationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number."
}, },
"options": { "options": {
@@ -48,30 +48,6 @@
"password": "Provide admin password for the virtual machine" "password": "Provide admin password for the virtual machine"
}, },
"visible": true "visible": true
},
{
"name": "privateRepoUsername",
"type": "Microsoft.Compute.UserNameTextBox",
"label": "Private Repo username",
"osPlatform": "Linux",
"constraints": {
"required": false,
"regex": "^[a-z0-9A-Z]{1,30}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
},
"toolTip": "If you were provided a repo username and apikey by JFrog, enter it here"
},
{
"name": "privateRepoApiKey",
"type": "Microsoft.Compute.UserNameTextBox",
"label": "Private Repo api key",
"osPlatform": "Linux",
"constraints": {
"required": false,
"regex": "^[a-z0-9A-Z]{1,100}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-100 characters long."
},
"toolTip": "If you were provided a repo username and apikey by JFrog, enter it here"
} }
] ]
}, },
@@ -102,15 +78,18 @@
"label": "Virtual machine size", "label": "Virtual machine size",
"toolTip": "The size of the virtual machine for Artifactory", "toolTip": "The size of the virtual machine for Artifactory",
"recommendedSizes": [ "recommendedSizes": [
"Standard_A2_v2" "Standard_D4s_v3"
], ],
"constraints": { "constraints": {
"allowedSizes": [ "allowedSizes": [
"Standard_A2_v2", "Standard_A2_v2",
"Standard_A4_v2", "Standard_A4_v2",
"Standard_A4",
"Standard_D2s_v3", "Standard_D2s_v3",
"Standard_D4s_v3", "Standard_D4s_v3",
"Standard_DS2_v2", "Standard_D8s_v3",
"Standard_D16s_v3",
"Standard_D32s_v3",
"Standard_DS3_v2", "Standard_DS3_v2",
"Standard_D2_v2", "Standard_D2_v2",
"Standard_D3_v2", "Standard_D3_v2",
@@ -121,18 +100,70 @@
"osPlatform": "Linux", "osPlatform": "Linux",
"count": 1 "count": 1
}, },
{
"name": "nodeCount",
"type": "Microsoft.Common.DropDown",
"label": "Number of additional VM instances for member Artifactory nodes. Minimum 1 node.(+1 primary = 2 node cluster)",
"defaultValue": "2",
"toolTip": "Number of Artifactory member nodes in cluster",
"constraints": {
"allowedValues": [
{
"label": "1",
"value": 1
},
{
"label": "2",
"value": 2
},
{
"label": "3",
"value": 3
},
{
"label": "4",
"value": 4
}
],
"required": true
},
"visible": "true"
},
{ {
"name": "artifactoryVersion", "name": "artifactoryVersion",
"type": "Microsoft.Common.DropDown", "type": "Microsoft.Common.DropDown",
"label": "Artifactory-vm image version to deploy.", "label": "Artifactory-vm image version to deploy.",
"defaultValue": "6.15.0", "defaultValue": "7.4.3",
"toolTip": "", "toolTip": "Version of Artifactory to deploy",
"constraints": { "constraints": {
"allowedValues": [ "allowedValues": [
{ {
"label": "6.15.0", "label": "6.8.0",
"value": "6.15.0" "value": "6.8.0"
},
{
"label": "6.16.0",
"value": "0.16.0"
},
{
"label": "6.17.0",
"value": "0.17.0"
},
{
"label": "6.18.0",
"value": "6.18.0"
},
{
"label": "7.2.1",
"value": "7.2.1"
},
{
"label": "7.3.2",
"value": "0.3.2"
},
{
"label": "7.4.3",
"value": "7.4.3"
} }
], ],
"required": true "required": true
@@ -141,38 +172,108 @@
}, },
{ {
"name": "masterKey", "name": "masterKey",
"type": "Microsoft.Common.TextBox", "type": "Microsoft.Common.PasswordBox",
"label": "Artifactory master Key", "label": {
"defaultValue": "1ce2be4490ca2c662cb79636cf9b7b8e", "password": "Artifactory master Key",
"confirmPassword": "Confirm master Key"
},
"toolTip": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'", "toolTip": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'",
"constraints": { "constraints": {
"required": true, "required": true,
"regex": "^[a-z0-9A-Z]{1,32}$", "regex": "^[a-z0-9A-Z]{1,32}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long." "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long."
},
"options": {
"hideConfirmation": true
}
},
{
"name": "artifactoryLicense1",
"type": "Microsoft.Common.TextBox",
"label": "Artifactory Enterprise License.",
"toolTip": "Artifactory Enterprise License. Providing one license is mandatory",
"constraints": {
"required": true,
"regex": "^.{1,10000}",
"validationMessage": "Only Enterprise licenses are allowed."
}
},
{
"name": "artifactoryLicense2",
"type": "Microsoft.Common.TextBox",
"label": "Artifactory Enterprise License.",
"toolTip": "Artifactory Enterprise License. Providing one license is mandatory",
"constraints": {
"required": true,
"regex": "^.{1,10000}",
"validationMessage": "Only Enterprise licenses are allowed."
}
},
{
"name": "artifactoryLicense3",
"type": "Microsoft.Common.TextBox",
"label": "Artifactory Enterprise License.",
"toolTip": "Artifactory Enterprise License. Providing one license is mandatory",
"constraints": {
"required": false,
"regex": "^.{1,10000}",
"validationMessage": "Only Enterprise licenses are allowed."
}
},
{
"name": "artifactoryLicense4",
"type": "Microsoft.Common.TextBox",
"label": "Artifactory Enterprise License.",
"toolTip": "Artifactory Enterprise License. Providing one license is mandatory",
"constraints": {
"required": false,
"regex": "^.{1,10000}",
"validationMessage": "Only Enterprise licenses are allowed."
}
},
{
"name": "artifactoryLicense5",
"type": "Microsoft.Common.TextBox",
"label": "Artifactory Enterprise License.",
"toolTip": "Artifactory Enterprise License. Providing one license is mandatory",
"constraints": {
"required": false,
"regex": "^.{1,10000}",
"validationMessage": "Only Enterprise licenses are allowed."
} }
}, },
{ {
"name": "certificate", "name": "certificate",
"type": "Microsoft.Common.TextBox", "type": "Microsoft.Common.PasswordBox",
"label": "Provide your SSL Certificate.", "label": {
"defaultValue": "-----BEGIN CERTIFICATE----- MIIFhzCCA2+gAwIBAgIJALC4r5BQWZE4MA0GCSqGSIb3DQEBCwUAMFoxCzAJBgNV BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQHDApTYW50YUNsYXJh MQswCQYDVQQKDAJJVDEUMBIGA1UEAwwLKi5sb2NhbGhvc3QwHhcNMTgwMTE3MTk0 NjI4WhcNMTkwMTA4MTk0NjI4WjBaMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs aWZvcm5pYTETMBEGA1UEBwwKU2FudGFDbGFyYTELMAkGA1UECgwCSVQxFDASBgNV BAMMCyoubG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA 7KfOWDQlov8cMa8r/lcJqiWZaH9myQC74Vbe0HXsntQbcvljkjG2P7ebm5dd9Bzc sauNOJpbKf5AhFK1iwJUAkciGc1LR4k8wfWmQM3NPS8hrqrtH20zqNpdFRpNYjja JofwccPNm030GhhZkZ95TpruvmswMDwspl3jfqdcc/eiQsHcKyGnV2a+UAeoqe7J mHhmhRy1MLqAjF5U1GrUYUONA+22iRDJb4c9B91QoWvsnXpdA9NKV/mmA3/rIdx6 Ld2IPRdrIw2K5sAnXsh3bx2oCSvSfussf0x+4XDrnsaHVfjwvfNL8ECOuac2Oi/E WOp9528gOohpFAuwEt63Vl5p8/CC9m0HJDTZBKm2l5eD1kdPIj4PvP9Sn9CxGXKQ E1bxWoFxGX8EyRW0b0NK31N7b8JPZ1SoFNiB5amOMNLvR26a7cQrKumTuJeYK9Ja JaxhMXM7R0DA0Ev8ZG2xmyCygox+1KPSmJOIEpT70BFbj3rKLNqP22ET+zvPuh+2 DdgyrpHFeYkGWjMbWPjK7wJsD2zM8ccoJQfepPz8I4rT0JfrKAQgCGuGOggneaNJ KTVGNOFbj5AXdZ/Q+GvNommyRdq4J7EnqY6L+P25fo5qZ6UZ/iS0tPcvxgn0Fdhs pUPbQyQIDZyxZd3Q1lUIE38ol8P66mS2zbzf8EeOCoUCAwEAAaNQME4wHQYDVR0O BBYEFETAQM/5P7XJ8kevHFj6BPndQOFaMB8GA1UdIwQYMBaAFETAQM/5P7XJ8kev HFj6BPndQOFaMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAJ1TepKv LWYhFmVQcgZwZf/qt1a1cohzJSm6da9RCnnAWC7WC/U117bgSomtrH1v0OysHFhB zBBUeBqI7+OmzAX8dhj+roKkcnFUM/IwlK1eueIIA//CWvEf/o0XExilVS2yCc9d PTpOQBXwk9QinxK36kHdBiGxa7dW0JPnOEEmuMgGORKeLy4J6Ik8iSeFY1SZVcOI +6WWvoKciPlmIeccC+6YVmkeBwhP2o5r5w/UAaO2hSnGvmm4UIj/VJv4VQu7xTUp cIfFz5NtIr80DbqcyPiEMS2ETJ4L/kO4MS5FfeEXyQuXCzmiIDVY6tE3C7+kZmK4 JzPLuWm9ndQoyQySOGfQqvlUR1+YxUdvmu3LrOS5dOA354Q36wHa4wEGUoHU/7GV fYQmmmDSDaNSpXW5PFey6scFyDBS/yYJ0H9EjYb/11HeWYj8Yv5xTWj8nhzJONC8 D6Y5ydlU4PifM2pOf88pTYpmogNwLJWXbql5I9cvMa8APo4yLVqcISU5ynsvFke+ Non+T0mHpJai/hrA9NK+s6EGC1dAX58jy61h6FhOPI1d4s/mov/KMa2t3SfZp5SF 81aR6dHvO56teiK5M1xMkrqG75zh3TMFJJLRFe9XxeB4JeN76URB3mgADOUqkBxd ibSgVqfKwOw4IujEcqMUc5mqSnbLY1Dv+oby -----END CERTIFICATE-----", "password": "Provide your SSL Certificate.",
"confirmPassword": "Confirm SSL Certificate."
},
"toolTip": "To use Artifactory as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate.", "toolTip": "To use Artifactory as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate.",
"constraints": { "constraints": {
"required": true, "required": true,
"regex": "^(-----BEGIN CERTIFICATE-----)(.+)(-----END CERTIFICATE-----)$", "regex": "^(-----BEGIN CERTIFICATE-----)(.+)(-----END CERTIFICATE-----)$",
"validationMessage": "Provide SSL Certificate." "validationMessage": "Provide SSL Certificate."
},
"options": {
"hideConfirmation": true
} }
}, },
{ {
"name": "certificateKey", "name": "certificateKey",
"type": "Microsoft.Common.TextBox", "type": "Microsoft.Common.PasswordBox",
"label": "Provide your SSL Certificate key.", "label": {
"defaultValue": "-----BEGIN PRIVATE KEY----- MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDsp85YNCWi/xwx ryv+VwmqJZlof2bJALvhVt7Qdeye1Bty+WOSMbY/t5ubl130HNyxq404mlsp/kCE UrWLAlQCRyIZzUtHiTzB9aZAzc09LyGuqu0fbTOo2l0VGk1iONomh/Bxw82bTfQa GFmRn3lOmu6+azAwPCymXeN+p1xz96JCwdwrIadXZr5QB6ip7smYeGaFHLUwuoCM XlTUatRhQ40D7baJEMlvhz0H3VCha+ydel0D00pX+aYDf+sh3Hot3Yg9F2sjDYrm wCdeyHdvHagJK9J+6yx/TH7hcOuexodV+PC980vwQI65pzY6L8RY6n3nbyA6iGkU C7AS3rdWXmnz8IL2bQckNNkEqbaXl4PWR08iPg+8/1Kf0LEZcpATVvFagXEZfwTJ FbRvQ0rfU3tvwk9nVKgU2IHlqY4w0u9HbprtxCsq6ZO4l5gr0lolrGExcztHQMDQ S/xkbbGbILKCjH7Uo9KYk4gSlPvQEVuPesos2o/bYRP7O8+6H7YN2DKukcV5iQZa MxtY+MrvAmwPbMzxxyglB96k/PwjitPQl+soBCAIa4Y6CCd5o0kpNUY04VuPkBd1 n9D4a82iabJF2rgnsSepjov4/bl+jmpnpRn+JLS09y/GCfQV2GylQ9tDJAgNnLFl 3dDWVQgTfyiXw/rqZLbNvN/wR44KhQIDAQABAoICAQDm1pAp7UPBCELCG/I3t0KQ GvjWu17RNcwN86SHhl92VcMolSaQ1bjF0h0Q2ccldHm5PHMWAUpnXcAk0mCO5Yh4 aFZVALEraCxBrZGrqJNH2Q9rxwJhIy2+yLD/Apb09iukZfkdnzaRBKrUQWgs6Xd0 OyAh0YBBrJCI/xAG3M0LuUMnBt3xnHQUhv2gJrhYeble5iJqOSRsEZ+OS/1G7aWX 8kI80MS6UguKpEndv/0EV7eHrHHKZ3Ee+z76Lu52Kw9qaaqYnJ0+pdkVV92PUM9f LXhY6cv7TP4sdbtVv8W1LEWakKaTQhySjwYpBXeZrjpB2QlSlEzFi4WjrfrjjSca UZazm/jY5uDI2cXf35NyZUkbYxIKlGtURtDpoPp5R7XguHSoqLrh2Zsc79mZfNST zFwbhNBVB2nAl6ZyIRNFLjVhQScvlImpIVSVZm5/NiiABIEaxRh8w8C5qRMctSTy KF6rS6as2KsPQHpiu/6nDMqqTZ8UMQ3yXEpai5VwAzKFP67usHheKf4RIXNUn7Xc JxWiI8KfOV5n4cSJK1/R+i+ZpWyQiloao4v7GS/fwZTsILeBLBa0utDmNs5aJgVK cEagRjVGAeAEc2W+jXmSqtZRHQowJmEKOARMn4lI+duziSCjIfPH6xIDAUhVlc/K u03432NupfPepW6BYVBgQQKCAQEA/+CD2uiRZgmzuEn/vn/u7jGFjETdUQmfl5kX pMTtueXyQxHBRwBCZqq885doozeQd7mLRcW+klngq1NmnEnjx+NfUzFJLpEmQO1/ AMHUpYpZY4jOyntx9cBy+M+DUfNtdsJUz+VOe3HO5/lJJf+gSgpVp2ku1oOrgEeH a71aGIXOsiOQ/fHL4Q0CuylersD5Dq4Tdf/u6rr4NbwOZQCQ9WH0uTckA9SkjJFu iHXblg8j9RUNbj89WPrEulKA98duFuLvGTeohcAPQ8f60Z7sxDLGLRyRvhUO4EBr hTTmcfI2LsPWSo+X+n6eBqfUfGZub2qN+d2B08qKgnGdgFEf6QKCAQEA7MTtAphl lswq4kPvDkPHMqJhmPBgb5NAUzE2Z8yjJY3IX6zxinSDnuMwEzCinKe7rzv6aYIh klviND/oyLOxVlLESZu62epokgIey05sv9a/030z7q5hradNzcMP1VfGVs6IeOvr 3Kit4T7LI1L2eXwD1Yks6uHHw8lHAlyrrlbwCEmzqElKs0YtkvNa4HFgesFNnObe f8C29LOPZMqje7iAT91823MGI9NML9qGYON/ZLc4uCB9no+o6ZOTQHqX1xxSWv5D 66KGiRnUC/RAq6RbTVn3NxFgvb3k0rejbQbxW5KCri1E4sTw+pZ5bIRUJcXi+J+Z Tg88lVbmqXfwPQKCAQEA94yShDr0UC+au/R7hCXpVnB6r5YAN+KDj/sAsNwE0hDx LIoE31gU5ZbRbylQhne/QNU1NK93C8gAYEAzyYiC4mPLWYUZNAAhbjdW47iirfUH PhChX6vGOOeTU7wPZD2J7ZdczjUelLcqYar/Zc/Fl1wgOfK86bRBO733+fgbLhZm PlnCcKx5fqVDuybu/0qaqeUn1sVgs59nezURCA5gL8YxKO973GjhOU2KDmNXqfnD 49wWPk7YXzldEpW3SACdNW8futnqJFwHaKAUvLBwh/BHYmV9atScq8AnRZxERoD6 govcyg3aDvJomC/OlvvSY+BGszHl5KzTDBg3NGlH4QKCAQA/71lU5xQfqVg3K0MF ZhYHPUP/iYFw/6FSFarsUp0Higa+lzPOQHI+WHjl5a8zgDO1OQwAq6wnGnq1w0A3 2hYcClOI0O2e5KaCLuJj4fSJxRKdqGR6okosG05uLqs63+3mCPVfOc3CEyaI+Wzf SArYeT2LzvP7JSbNXq+3GpEdjcpZYpWJ7uimCmBKGz7B9runykUMBme0tbRx1X72 J6YHxaWYa2XI2IGi8O7UyTyaMzR2XOeLCPMC+yYQlNIhijkwVCyE974dhhCwOvJA nB9Oeh5Rf+a6zw2BjyKYKBCQY1yPbrutDvpYBfhQoot9Wyph3NLScj5yjri8VvAI eSO9AoIBAQDyUx5YUgHgpoJtRZ+8PGQBZHm5L5HJhvfUs96I9Z4lZSXnCmEJyOWn LIob8c0n4hU1EXdbbl+7eRQgG3oGKyF0XXhuaP3vHprIBW6tm9kCGORTliZOaZdW 0Mj9GUv2de1r8anwJMFvIMXsuO08rsGzsIt7DrNYa0YSMkeDwPenRfDHXOYH2fjf RKjlP3fQr/iLL/YuMGaNxzIeyWPZ2WTUUC0bllNxMTZmztuMkPNb7fhhs0hLecXM fE2nbwUaGwMZaails1+5G3HvEAlChJ1GN9XnYxrtfqq93tYELWBiNcv1LaMAFvj8 S+j1+iUKGGhwVmhqh75q5do3+VF3XlAh -----END PRIVATE KEY-----", "password": "Provide your SSL Certificate key.",
"confirmPassword": "Confirm SSL Certificate key."
},
"toolTip": "Provide your SSL Certificate key", "toolTip": "Provide your SSL Certificate key",
"constraints": { "constraints": {
"required": true, "required": true,
"regex": "^(-----BEGIN PRIVATE KEY-----)(.+)(-----END PRIVATE KEY-----)$", "regex": "^(-----BEGIN)(.+)(PRIVATE KEY-----)(.+)(-----END)(.+)(PRIVATE KEY-----)$",
"validationMessage": "Provide SSL Certificate Key." "validationMessage": "Provide SSL Certificate Key."
},
"options": {
"hideConfirmation": true
} }
}, },
{ {
@@ -203,12 +304,12 @@
"name": "extraJavaOptions", "name": "extraJavaOptions",
"type": "Microsoft.Common.TextBox", "type": "Microsoft.Common.TextBox",
"label": "Setting Java Memory Parameters for Artifactory", "label": "Setting Java Memory Parameters for Artifactory",
"defaultValue": "-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\"", "defaultValue": "-server -Xms2g -Xmx8g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\"",
"toolTip": "Setting Java Memory Parameters for Artifactory. Learn about system requirements for Artifactory https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware.", "toolTip": "Setting Java Memory Parameters for Artifactory. Learn about system requirements for Artifactory https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware.",
"constraints": { "constraints": {
"required": true, "required": false,
"regex": "^.{1,10000}", "regex": "[^a-zA-Z0-9]+\\S+\\D",
"validationMessage": "Provide SSL Certificate Key." "validationMessage": "Example: -server -Xms2g -Xmx12g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\""
} }
} }
] ]
@@ -244,7 +345,7 @@
"toolTip": "Admin password for the database", "toolTip": "Admin password for the database",
"constraints": { "constraints": {
"required": true, "required": true,
"regex": "^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)[A-Za-z\\d]{12,}$", "regex": "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{12,}$",
"validationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number." "validationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number."
}, },
"options": { "options": {
@@ -268,7 +369,7 @@
"type": "Microsoft.Common.DropDown", "type": "Microsoft.Common.DropDown",
"label": "Database Edition", "label": "Database Edition",
"defaultValue": "Basic", "defaultValue": "Basic",
"toolTip": "", "toolTip": "Edition of Database to use",
"constraints": { "constraints": {
"allowedValues": [ "allowedValues": [
{ {
@@ -307,17 +408,9 @@
"toolTip": "Storage account type", "toolTip": "Storage account type",
"constraints": { "constraints": {
"allowedValues": [ "allowedValues": [
{
"label": "Premium_LRS",
"value": "Premium_LRS"
},
{ {
"label": "Standard_LRS", "label": "Standard_LRS",
"value": "Standard_LRS" "value": "Standard_LRS"
},
{
"label": "Standard_GRS",
"value": "Standard_GRS"
} }
], ],
"required": true "required": true
@@ -331,8 +424,14 @@
"clusterName": "[steps('clusterConfig').clusterName]", "clusterName": "[steps('clusterConfig').clusterName]",
"vmSku": "[steps('clusterConfig').vmSku]", "vmSku": "[steps('clusterConfig').vmSku]",
"location": "[location()]", "location": "[location()]",
"nodeCount": "[steps('clusterConfig').nodeCount]",
"artifactoryVersion": "[steps('clusterConfig').artifactoryVersion]", "artifactoryVersion": "[steps('clusterConfig').artifactoryVersion]",
"masterKey": "[steps('clusterConfig').masterKey]", "masterKey": "[steps('clusterConfig').masterKey]",
"artifactoryLicense1": "[steps('clusterConfig').artifactoryLicense1]",
"artifactoryLicense2": "[steps('clusterConfig').artifactoryLicense2]",
"artifactoryLicense3": "[steps('clusterConfig').artifactoryLicense3]",
"artifactoryLicense4": "[steps('clusterConfig').artifactoryLicense4]",
"artifactoryLicense5": "[steps('clusterConfig').artifactoryLicense5]",
"certificate": "[steps('clusterConfig').certificate]", "certificate": "[steps('clusterConfig').certificate]",
"certificateKey": "[steps('clusterConfig').certificateKey]", "certificateKey": "[steps('clusterConfig').certificateKey]",
"certificateDomain": "[steps('clusterConfig').certificateDomain]", "certificateDomain": "[steps('clusterConfig').certificateDomain]",
@@ -340,8 +439,6 @@
"extraJavaOptions": "[steps('clusterConfig').extraJavaOptions]", "extraJavaOptions": "[steps('clusterConfig').extraJavaOptions]",
"adminUsername": "[steps('vmCredentials').adminUsername]", "adminUsername": "[steps('vmCredentials').adminUsername]",
"adminPassword": "[steps('vmCredentials').adminPassword.password]", "adminPassword": "[steps('vmCredentials').adminPassword.password]",
"privateRepoUsername": "[steps('vmCredentials').privateRepoUsername]",
"privateRepoApiKey": "[steps('vmCredentials').privateRepoApiKey]",
"DB_Admin_User": "[steps('databaseConfig').dbAdminUsername]", "DB_Admin_User": "[steps('databaseConfig').dbAdminUsername]",
"DB_Admin_Password": "[steps('databaseConfig').dbAdminPassword]", "DB_Admin_Password": "[steps('databaseConfig').dbAdminPassword]",
"DB_Name": "[steps('databaseConfig').dbName]", "DB_Name": "[steps('databaseConfig').dbName]",

View File

@@ -0,0 +1,924 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmSku": {
"type": "string",
"defaultValue": "Standard_D4s_v3",
"metadata": {
"description": "Size of VMs in the VM Scale Set."
}
},
"clusterName": {
"type": "string",
"maxLength": 61,
"metadata": {
"description": "String used as a base for naming resources. Must be 3-61 characters in length and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for the resources."
}
},
"nodeCount": {
"type": "int",
"defaultValue": 2,
"minValue": 1,
"maxValue": 100,
"metadata": {
"description": "Number of VM instances (100 or less) for member artifactory nodes. Minimum 1 node."
}
},
"artifactoryVersion": {
"type": "string",
"defaultValue": "7.4.3",
"allowedValues": [
"6.6.0",
"6.6.1",
"6.7.0",
"6.8.0",
"6.11.3",
"6.15.0",
"0.16.0",
"0.17.0",
"6.18.0",
"7.2.1",
"0.3.2",
"7.4.3"
],
"metadata": {
"description": "Artifactory-vm image version to deploy."
}
},
"masterKey": {
"type": "securestring",
"maxLength": 64,
"metadata": {
"description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'"
}
},
"adminUsername": {
"type": "string",
"metadata": {
"description": "Admin username on all VMs. Follow conventions for azure VM admin user name."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Admin password on all VMs. Follow conventions for azure VM admin password rules."
}
},
"artifactoryLicense1": {
"type": "string",
"metadata": {
"description": "Artifactory Enterprise License. Providing one license is mandatory"
}
},
"artifactoryLicense2": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Artifactory Enterprise License"
}
},
"artifactoryLicense3": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Artifactory Enterprise License"
}
},
"artifactoryLicense4": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Artifactory Enterprise License"
}
},
"artifactoryLicense5": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Artifactory Enterprise License"
}
},
"certificate": {
"type": "securestring",
"metadata": {
"description": "To use Artifactory as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate."
}
},
"certificateKey": {
"type": "securestring",
"metadata": {
"description": "Provide your SSL Certificate key"
}
},
"certificateDomain": {
"type": "string",
"minLength": 1,
"defaultValue": "artifactory",
"metadata": {
"description": "Provide your Certificate Domain Name. For e.g jfrog.team for certificate with *.jfrog.team"
}
},
"artifactoryServerName": {
"type": "string",
"minLength": 1,
"defaultValue": "artifactory",
"metadata": {
"description": "Provide artifactory server name to be used in Nginx. e.g artifactory for artifactory.jfrog.team"
}
},
"extraJavaOptions": {
"type": "string",
"minLength": 1,
"defaultValue": "-server -Xms2g -Xmx8g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\"",
"metadata": {
"description": "Setting Java Memory Parameters for Artifactory. Learn about system requirements for Artifactory https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware."
}
},
"DB_Admin_User": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Database Admin user name"
}
},
"DB_Admin_Password": {
"type": "securestring",
"minLength": 1,
"metadata": {
"description": "Database Admin password"
}
},
"DB_Name": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Database name"
}
},
"DB_Edition": {
"type": "string",
"minLength": 1,
"defaultValue": "Basic",
"allowedValues": [
"Basic",
"Standard",
"Premium"
],
"metadata": {
"description": "Database Edition"
}
},
"storageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS"
],
"metadata": {
"description": "Storage Account type"
}
},
"_artifactsLocation": {
"type": "string",
"metadata": {
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
},
"defaultValue": "[deployment().properties.templateLink.uri]"
},
"_artifactsLocationSasToken": {
"type": "securestring",
"metadata": {
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated."
},
"defaultValue": ""
}
},
"variables": {
"namingInfix": "[toLower(substring(concat(parameters('clusterName'), uniqueString(resourceGroup().id)), 0, 9))]",
"addressPrefix": "10.0.0.0/16",
"subnetPrimaryPrefix": "10.0.1.0/24",
"subnetMemberPrefix": "10.0.2.0/24",
"virtualNetworkName": "[concat(variables('namingInfix'), 'vnet')]",
"subnetPrimaryName": "[concat(variables('namingInfix'), 'primarySubnet')]",
"subnetMemberName": "[concat(variables('namingInfix'), 'memberSubnet')]",
"scaleSetPrimaryName": "[concat(variables('namingInfix'), 'primaryScaleset')]",
"scaleSetMemberName": "[concat(variables('namingInfix'), 'memberScaleset')]",
"lbName": "[concat(variables('namingInfix'), 'lb')]",
"bepoolPrimaryName": "[concat(variables('lbName'), 'primaryBepool')]",
"bepoolMemberName": "[concat(variables('lbName'), 'memberBepool')]",
"fepoolPrimaryName": "[concat(variables('lbName'), 'primaryFepool')]",
"fepoolMemberName": "[concat(variables('lbName'), 'memberFepool')]",
"bepoolPrimaryID": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bepoolPrimaryName'))]",
"bepoolMemberID": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bepoolMemberName'))]",
"feIpConfigPrimaryName": "[concat(variables('fepoolPrimaryName'), 'primaryIpConfig')]",
"feIpConfigMemberName": "[concat(variables('fepoolMemberName'), 'memberIpConfig')]",
"feIpConfigPrimaryId": "[resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', variables('lbName'), variables('feIpConfigPrimaryName'))]",
"feIpConfigMemberId": "[resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', variables('lbName'), variables('feIpConfigMemberName'))]",
"pipPrimaryName": "[concat(variables('namingInfix'), 'primaryPip')]",
"pipMemberName": "[concat(variables('namingInfix'), 'memberPip')]",
"nicPrimaryName": "[concat(variables('namingInfix'), 'primaryNic')]",
"nicMemberName": "[concat(variables('namingInfix'), 'memberNic')]",
"natPoolPrimaryName": "[concat(variables('lbName'), 'primaryNatpool')]",
"natPoolMemberName": "[concat(variables('lbName'), 'memberNatpool')]",
"ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]",
"httpProbePrimaryName": "primaryHttpProbe",
"httpsProbePrimaryName": "primaryHttpsProbe",
"httpProbeMemberName": "memberHttpProbe",
"httpsProbeMemberName": "memberHttpsProbe",
"storageAccountName": "[concat(variables('namingInfix'), 'storage')]",
"vmStorageAccountContainerName": "filestore",
"azureSqlServerName": "[concat(variables('namingInfix'), 'sqlsrv')]",
"DB_Name": "[parameters('DB_Name')]",
"DB_Admin_User": "[parameters('DB_Admin_User')]",
"DB_Admin_Password": "[parameters('DB_Admin_Password')]",
"DB_Edition": "[parameters('DB_Edition')]",
"DB_Location": "[parameters('location')]",
"masterKey": "[parameters('masterKey')]",
"certificate": "[parameters('certificate')]",
"certificateKey": "[parameters('certificateKey')]",
"certificateDomain": "[parameters('certificateDomain')]",
"artifactoryServerName": "[parameters('artifactoryServerName')]",
"extraJavaOptions": "[parameters('extraJavaOptions')]",
"artifactoryLicense1": "[parameters('artifactoryLicense1')]",
"artifactoryLicense2": "[parameters('artifactoryLicense2')]",
"artifactoryLicense3": "[parameters('artifactoryLicense3')]",
"artifactoryLicense4": "[parameters('artifactoryLicense4')]",
"artifactoryLicense5": "[parameters('artifactoryLicense5')]",
"osType": {
"publisher": "jfrog",
"offer": "artifactory-vm",
"sku": "artifactory-vm",
"version": "[parameters('artifactoryVersion')]"
},
"imageReference": "[variables('osType')]",
"dbTemplate": "azureDBDeploy.json",
"dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]",
"nsgName": "[concat(variables('namingInfix'), 'nsg')]"
},
"resources": [
{
"apiVersion": "2019-05-01",
"name": "pid-04c1c376-5d4b-4771-9a7f-054f5910dcef",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": []
}
}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"location": "[parameters('location')]",
"name": "[variables('nsgName')]",
"apiVersion": "2018-07-01",
"properties": {
"securityRules": [
{
"name": "ssh-rule",
"properties": {
"description": "Allow SSH",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
}
},
{
"name": "http-artifactory-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "8081",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 101,
"direction": "Inbound"
}
},
{
"name": "http-nginx-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "80",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 102,
"direction": "Inbound"
}
},
{
"name": "https-nginx-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "443",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 103,
"direction": "Inbound"
}
},
{
"name": "membership-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "10001",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 105,
"direction": "Inbound"
}
}
]
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-07-01",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetPrimaryName')]",
"properties": {
"addressPrefix": "[variables('subnetPrimaryPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
},
{
"name": "[variables('subnetMemberName')]",
"properties": {
"addressPrefix": "[variables('subnetMemberPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
}
]
}
},
{
"apiVersion": "2018-07-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicPrimaryName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetPrimaryName'))]"
}
}
}
],
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
},
{
"apiVersion": "2018-07-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicMemberName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetMemberName'))]"
}
}
}
],
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('pipPrimaryName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"apiVersion": "2018-07-01",
"properties": {
"publicIPAllocationMethod": "Static",
"dnsSettings": {
"domainNameLabel": "[variables('namingInfix')]"
}
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('pipMemberName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"apiVersion": "2018-07-01",
"properties": {
"publicIPAllocationMethod": "Static",
"dnsSettings": {
"domainNameLabel": "[concat(variables('namingInfix'),'2')]"
}
}
},
{
"type": "Microsoft.Network/loadBalancers",
"name": "[variables('lbName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-07-01",
"sku": {
"name": "Standard"
},
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]",
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]"
],
"tags":{
"displayName": "Load Balancer"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "[variables('feIpConfigPrimaryName')]",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipPrimaryName'))]"
}
}
},
{
"name": "[variables('feIpConfigMemberName')]",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipMemberName'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "[variables('bepoolPrimaryName')]"
},
{
"name": "[variables('bepoolMemberName')]"
}
],
"inboundNatPools": [
{
"name": "[variables('natPoolPrimaryName')]",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('feIpConfigPrimaryId')]"
},
"protocol": "tcp",
"frontendPortRangeStart": 10022,
"frontendPortRangeEnd": 11022,
"backendPort": 22
}
},
{
"name": "[variables('natPoolMemberName')]",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('feIpConfigMemberId')]"
},
"protocol": "tcp",
"frontendPortRangeStart": 20022,
"frontendPortRangeEnd": 21022,
"backendPort": 22
}
}
],
"loadBalancingRules": [
{
"name": "HTTPRulePrimary",
"properties": {
"loadDistribution": "Default",
"frontendIPConfiguration": {
"id": "[variables('feIpConfigPrimaryId')]"
},
"backendAddressPool": {
"id": "[variables('bepoolPrimaryID')]"
},
"protocol": "Tcp",
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpProbePrimaryName'))]"
}
}
},
{
"name": "HTTPSRulePrimary",
"properties": {
"loadDistribution": "Default",
"frontendIPConfiguration": {
"id": "[variables('feIpConfigPrimaryId')]"
},
"backendAddressPool": {
"id": "[variables('bepoolPrimaryID')]"
},
"protocol": "Tcp",
"frontendPort": 443,
"backendPort": 443,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpsProbePrimaryName'))]"
}
}
},
{
"name": "HTTPRuleMember",
"properties": {
"loadDistribution": "Default",
"frontendIPConfiguration": {
"id": "[variables('feIpConfigMemberId')]"
},
"backendAddressPool": {
"id": "[variables('bepoolMemberID')]"
},
"protocol": "Tcp",
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpProbeMemberName'))]"
}
}
},
{
"name": "HTTPSRuleMember",
"properties": {
"loadDistribution": "Default",
"frontendIPConfiguration": {
"id": "[variables('feIpConfigMemberId')]"
},
"backendAddressPool": {
"id": "[variables('bepoolMemberID')]"
},
"protocol": "Tcp",
"frontendPort": 443,
"backendPort": 443,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpsProbeMemberName'))]"
}
}
}
],
"probes": [
{
"name": "[variables('httpProbePrimaryName')]",
"properties": {
"protocol": "Http",
"requestPath": "/artifactory/api/system/ping",
"port": 80,
"intervalInSeconds": 60,
"numberOfProbes": 5
}
},
{
"name": "[variables('httpsProbePrimaryName')]",
"properties": {
"protocol": "Tcp",
"port": 443,
"intervalInSeconds": 60,
"numberOfProbes": 5
}
},
{
"name": "[variables('httpProbeMemberName')]",
"properties": {
"protocol": "Http",
"requestPath": "/artifactory/api/system/ping",
"port": 80,
"intervalInSeconds": 60,
"numberOfProbes": 5
}
},
{
"name": "[variables('httpsProbeMemberName')]",
"properties": {
"protocol": "Tcp",
"port": 443,
"intervalInSeconds": 60,
"numberOfProbes": 5
}
}
]
}
},
{
"apiVersion": "2018-07-01",
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[parameters('storageAccountType')]"
},
"tags":{
"displayName": "Artifactory Storage Account"
},
"kind": "Storage",
"properties": {}
},
{
"type": "Microsoft.Resources/deployments",
"name": "deploySQLDB",
"apiVersion": "2018-07-01",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('dbTemplateLocation')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"db_user": {
"value": "[parameters('DB_Admin_User')]"
},
"db_password": {
"value": "[parameters('DB_Admin_Password')]"
},
"db_server": {
"value": "[variables('azureSqlServerName')]"
},
"db_name": {
"value": "[parameters('DB_Name')]"
},
"db_edition": {
"value": "[variables('DB_Edition')]"
},
"db_location": {
"value": "[variables('DB_Location')]"
}
}
}
},
{
"type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[variables('scaleSetPrimaryName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-10-01",
"dependsOn": [
"[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]",
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
],
"plan": {
"name": "artifactory-vm",
"publisher": "jfrog",
"product": "artifactory-vm"
},
"sku": {
"name": "[parameters('vmSku')]",
"tier": "Standard",
"capacity": "1"
},
"properties": {
"singlePlacementGroup": true,
"overprovision": "false",
"upgradePolicy": {
"mode": "Manual"
},
"virtualMachineProfile": {
"storageProfile": {
"osDisk": {
"caching": "ReadWrite",
"diskSizeGB": "250",
"createOption": "FromImage"
},
"imageReference": "[variables('imageReference')]"
},
"osProfile": {
"computerNamePrefix": "[variables('namingInfix')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nIS_PRIMARY=','true','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]"
},
"networkProfile": {
"networkInterfaceConfigurations": [
{
"name": "[variables('nicPrimaryName')]",
"properties": {
"primary": true,
"ipConfigurations": [
{
"name": "[concat(variables('ipConfigName'),'1')]",
"properties": {
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetPrimaryName'))]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bePoolPrimaryName'))]"
}
],
"loadBalancerInboundNatPools": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatPools', variables('lbName'), variables('natPoolPrimaryName'))]"
}
]
}
}
]
}
}
]
},
"extensionProfile": {
"extensions": [
{
"name": "extension1",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": false,
"settings": {
"fileUris": [
"[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory.sh', parameters('_artifactsLocationSasToken')))]",
"[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory7.sh', parameters('_artifactsLocationSasToken')))]",
"[uri(parameters('_artifactsLocation'), concat('scripts/version_selector.sh', parameters('_artifactsLocationSasToken')))]"
]
},
"protectedSettings": {
"commandToExecute": "bash version_selector.sh && ls -al && pwd >> /var/lib/cloud/instance/user-data.txt"
}
}
}
]
}
}
}
},
{
"type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[variables('scaleSetMemberName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-10-01",
"dependsOn": [
"[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[concat('Microsoft.Compute/virtualMachineScaleSets/', variables('scaleSetPrimaryName'))]",
"[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]",
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
],
"plan": {
"name": "artifactory-vm",
"publisher": "jfrog",
"product": "artifactory-vm"
},
"sku": {
"name": "[parameters('vmSku')]",
"tier": "Standard",
"capacity": "[parameters('nodeCount')]"
},
"properties": {
"singlePlacementGroup": true,
"overprovision": "false",
"upgradePolicy": {
"mode": "Manual"
},
"virtualMachineProfile": {
"storageProfile": {
"osDisk": {
"caching": "ReadWrite",
"diskSizeGB": "250",
"createOption": "FromImage"
},
"imageReference": "[variables('imageReference')]"
},
"osProfile": {
"computerNamePrefix": "[variables('namingInfix')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',parameters('certificateKey'),'\nCERTIFICATE=', parameters('certificate'),'\nCERTIFICATE_DOMAIN=',parameters('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',parameters('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',parameters('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nIS_PRIMARY=','false','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]"
},
"networkProfile": {
"networkInterfaceConfigurations": [
{
"name": "[variables('nicMemberName')]",
"properties": {
"primary": true,
"ipConfigurations": [
{
"name": "[concat(variables('ipConfigName'),'1')]",
"properties": {
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetMemberName'))]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bePoolMemberName'))]"
}
],
"loadBalancerInboundNatPools": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatPools', variables('lbName'), variables('natPoolMemberName'))]"
}
]
}
}
]
}
}
]
},
"extensionProfile": {
"extensions": [
{
"name": "extension1",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": false,
"settings": {
"fileUris": [
"[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory.sh', parameters('_artifactsLocationSasToken')))]",
"[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory7.sh', parameters('_artifactsLocationSasToken')))]",
"[uri(parameters('_artifactsLocation'), concat('scripts/version_selector.sh', parameters('_artifactsLocationSasToken')))]"
]
},
"protectedSettings": {
"commandToExecute": "bash version_selector.sh && ls -al && pwd >> /var/lib/cloud/instance/user-data.txt"
}
}
}
]
}
}
}
}
],
"outputs": {
"fqdn": {
"value": "[reference(resourceId('Microsoft.Network/publicIPAddresses',variables('pipMemberName')),'2018-07-01').dnsSettings.fqdn]",
"type": "string"
}
}
}

View File

@@ -0,0 +1,96 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"db_user": {
"type": "string",
"defaultValue": "artifactory",
"minLength": 1
},
"db_password": {
"type": "securestring"
},
"db_server": {
"type": "string",
"defaultValue": "artmssqlsrv",
"minLength": 1
},
"db_name": {
"type": "string",
"defaultValue": "artdb",
"minLength": 1
},
"db_location": {
"type": "string",
"defaultValue": ""
},
"db_edition": {
"type": "string",
"allowedValues": [
"Basic",
"Standard",
"Premium"
]
}
},
"variables": {
"rtdbCollation": "Latin1_General_100_CS_AS",
"db_location": "[parameters('db_location')]"
},
"resources": [
{
"name": "[parameters('db_server')]",
"type": "Microsoft.Sql/servers",
"kind": "v12.0",
"location": "[variables('db_location')]",
"apiVersion": "2019-06-01-preview",
"tags": {
"displayName": "artifactoryDB"
},
"properties": {
"administratorLogin": "[parameters('db_user')]",
"administratorLoginPassword": "[parameters('db_password')]",
"version": "12.0"
},
"resources": [
{
"name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]",
"type": "firewallrules",
"location": "[variables('db_location')]",
"apiVersion": "2019-06-01-preview",
"dependsOn": [
"[concat('Microsoft.Sql/servers/', parameters('db_server'))]"
],
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "0.0.0.0"
}
},
{
"name": "[parameters('db_name')]",
"type": "databases",
"kind": "v12.0,user",
"location": "[variables('db_location')]",
"apiVersion": "2019-06-01-preview",
"dependsOn": [
"[parameters('db_server')]"
],
"tags": {
"displayName": "artifactoryDB"
},
"properties": {
"edition": "[parameters('db_edition')]",
"maxSizeBytes": "1073741824",
"collation": "[variables('rtdbCollation')]"
}
}
]
}
],
"outputs": {
"jdbcConnString": {
"type": "string",
"value": "[concat('jdbc:sqlserver://', reference(concat('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]"
}
}
}

View File

@@ -0,0 +1,214 @@
#!/bin/bash
DB_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JDBC_STR" | sed "s/JDBC_STR=//")
DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//")
DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//")
DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//")
STORAGE_ACCT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_NAME=" | sed "s/STO_ACT_NAME=//")
STORAGE_CONTAINER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_CTR_NAME=" | sed "s/STO_CTR_NAME=//")
STORAGE_ACCT_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_KEY=" | sed "s/STO_ACT_KEY=//")
ARTIFACTORY_VERSION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_VERSION=" | sed "s/ARTIFACTORY_VERSION=//")
MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//")
IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//")
ARTIFACTORY_LICENSE_1=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE1=" | sed "s/LICENSE1=//")
ARTIFACTORY_LICENSE_2=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE2=" | sed "s/LICENSE2=//")
ARTIFACTORY_LICENSE_3=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE3=" | sed "s/LICENSE3=//")
ARTIFACTORY_LICENSE_4=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE4=" | sed "s/LICENSE4=//")
ARTIFACTORY_LICENSE_5=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE5=" | sed "s/LICENSE5=//")
UBUNTU_CODENAME=$(cat /etc/lsb-release | grep "^DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//")
export DEBIAN_FRONTEND=noninteractive
#Generate Self-Signed Cert
mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/
openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost"
CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//")
[ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory
ARTIFACTORY_SERVER_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_SERVER_NAME=" | sed "s/ARTIFACTORY_SERVER_NAME=//")
[ -z "$ARTIFACTORY_SERVER_NAME" ] && ARTIFACTORY_SERVER_NAME=artifactory
#Configuring nginx
rm /etc/nginx/sites-enabled/default
cat <<EOF >/etc/nginx/nginx.conf
#user nobody;
worker_processes 1;
error_log /var/log/nginx/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
variables_hash_max_size 1024;
variables_hash_bucket_size 64;
server_names_hash_max_size 4096;
server_names_hash_bucket_size 128;
types_hash_max_size 2048;
types_hash_bucket_size 64;
proxy_read_timeout 2400s;
client_header_timeout 2400s;
client_body_timeout 2400s;
proxy_connect_timeout 75s;
proxy_send_timeout 2400s;
proxy_buffer_size 32k;
proxy_buffers 40 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 250m;
proxy_http_version 1.1;
client_body_buffer_size 128k;
include /etc/nginx/conf.d/*.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
}
EOF
cat <<EOF >/etc/nginx/conf.d/artifactory.conf
ssl_certificate /etc/pki/tls/certs/cert.pem;
ssl_certificate_key /etc/pki/tls/private/cert.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers on;
## server configuration
server {
listen 443 ssl;
listen 80 ;
server_name ~(?<repo>.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN};
if (\$http_x_forwarded_proto = '') {
set \$http_x_forwarded_proto \$scheme;
}
## Application specific logs
## access_log /var/log/nginx/artifactory-access.log timing;
## error_log /var/log/nginx/artifactory-error.log;
rewrite ^/$ /artifactory/webapp/ redirect;
rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/\$repo/\$1/\$2;
chunked_transfer_encoding on;
client_max_body_size 0;
location /artifactory/ {
proxy_read_timeout 2400;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:8081/artifactory/;
proxy_set_header X-Artifactory-Override-Base-Url
\$http_x_forwarded_proto://\$host:\$server_port/artifactory;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
}
EOF
cat <<EOF >/var/opt/jfrog/artifactory/etc/artifactory.cluster.license
${ARTIFACTORY_LICENSE_1}
${ARTIFACTORY_LICENSE_2}
${ARTIFACTORY_LICENSE_3}
${ARTIFACTORY_LICENSE_4}
${ARTIFACTORY_LICENSE_5}
EOF
cat <<EOF >/var/opt/jfrog/artifactory/etc/ha-node.properties
node.id=art1
artifactory.ha.data.dir=/var/opt/jfrog/artifactory/data
context.url=http://127.0.0.1:8081/artifactory
membership.port=10001
hazelcast.interface=172.25.0.3
primary=${IS_PRIMARY}
EOF
cat <<EOF >/var/opt/jfrog/artifactory/etc/db.properties
type=mssql
driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
url=${DB_URL};databaseName=${DB_NAME};sendStringParametersAsUnicode=false;applicationName=Artifactory Binary Repository
username=${DB_USER}
password=${DB_PASSWORD}
EOF
mkdir -p /var/opt/jfrog/artifactory/etc/security
cat <<EOF >/var/opt/jfrog/artifactory/etc/security/master.key
${MASTER_KEY}
EOF
cat <<EOF >/var/opt/jfrog/artifactory/etc/binarystore.xml
<config version="2">
<chain>
<provider id="cache-fs-eventual-azure-blob-storage" type="cache-fs">
<provider id="sharding-cluster-eventual-azure-blob-storage" type="sharding-cluster">
<sub-provider id="eventual-cluster-azure-blob-storage" type="eventual-cluster">
<provider id="retry-azure-blob-storage" type="retry">
<provider id="azure-blob-storage" type="azure-blob-storage"/>
</provider>
</sub-provider>
<dynamic-provider id="remote-azure-blob-storage" type="remote"/>
</provider>
</provider>
</chain>
<!-- cluster eventual Azure Blob Storage Service default chain -->
<provider id="sharding-cluster-eventual-azure-blob-storage" type="sharding-cluster">
<readBehavior>crossNetworkStrategy</readBehavior>
<writeBehavior>crossNetworkStrategy</writeBehavior>
<redundancy>2</redundancy>
<lenientLimit>1</lenientLimit>
<property name="zones" value="local,remote"/>
</provider>
<provider id="remote-azure-blob-storage" type="remote">
<zone>remote</zone>
</provider>
<provider id="eventual-cluster-azure-blob-storage" type="eventual-cluster">
<zone>local</zone>
</provider>
<!--cluster eventual template-->
<provider id="azure-blob-storage" type="azure-blob-storage">
<accountName>${STORAGE_ACCT}</accountName>
<accountKey>${STORAGE_ACCT_KEY}</accountKey>
<endpoint>https://${STORAGE_ACCT}.blob.core.windows.net/</endpoint>
<containerName>${STORAGE_CONTAINER}</containerName>
</provider>
</config>
EOF
HOSTNAME=$(hostname -i)
sed -i -e "s/art1/art-$(date +%s$RANDOM)/" /var/opt/jfrog/artifactory/etc/ha-node.properties
sed -i -e "s/127.0.0.1/$HOSTNAME/" /var/opt/jfrog/artifactory/etc/ha-node.properties
sed -i -e "s/172.25.0.3/$HOSTNAME/" /var/opt/jfrog/artifactory/etc/ha-node.properties
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//" > /tmp/temp.pem
cat /tmp/temp.pem | sed 's/CERTIFICATE----- /&\n/g' | sed 's/ -----END/\n-----END/g' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/certs/cert.pem
rm /tmp/temp.pem
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_KEY=//" > /tmp/temp.key
cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key
rm /tmp/temp.key
EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//")
[ -z "$EXTRA_JAVA_OPTS" ] && EXTRA_JAVA_OPTS='-server -Xms2g -Xmx6g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError="kill -9 %p"'
echo "export JAVA_OPTIONS=\"${EXTRA_JAVA_OPTS}\"" >> /var/opt/jfrog/artifactory/etc/default
chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/*
# start Artifactory
sleep $((RANDOM % 120))
service artifactory start
service nginx start
nginx -s reload
echo "INFO: Artifactory installation completed."

View File

@@ -0,0 +1,202 @@
#!/bin/bash
DB_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JDBC_STR" | sed "s/JDBC_STR=//")
DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//")
DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//")
DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//")
STORAGE_ACCT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_NAME=" | sed "s/STO_ACT_NAME=//")
STORAGE_CONTAINER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_CTR_NAME=" | sed "s/STO_CTR_NAME=//")
STORAGE_ACCT_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_KEY=" | sed "s/STO_ACT_KEY=//")
ARTIFACTORY_VERSION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_VERSION=" | sed "s/ARTIFACTORY_VERSION=//")
MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//")
JOIN_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JOIN_KEY=" | sed "s/JOIN_KEY=//")
IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//")
ARTIFACTORY_LICENSE_1=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE1=" | sed "s/LICENSE1=//")
ARTIFACTORY_LICENSE_2=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE2=" | sed "s/LICENSE2=//")
ARTIFACTORY_LICENSE_3=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE3=" | sed "s/LICENSE3=//")
ARTIFACTORY_LICENSE_4=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE4=" | sed "s/LICENSE4=//")
ARTIFACTORY_LICENSE_5=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE5=" | sed "s/LICENSE5=//")
#JOIN_KEY_GENERATED=$(openssl rand -hex 16)
export DEBIAN_FRONTEND=noninteractive
#Generate Self-Signed Cert
mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/
openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost"
CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//")
[ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory
ARTIFACTORY_SERVER_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_SERVER_NAME=" | sed "s/ARTIFACTORY_SERVER_NAME=//")
[ -z "$ARTIFACTORY_SERVER_NAME" ] && ARTIFACTORY_SERVER_NAME=artifactory
#Configuring nginx
rm /etc/nginx/sites-enabled/default
cat <<EOF >/etc/nginx/nginx.conf
#user nobody;
worker_processes 1;
error_log /var/log/nginx/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
variables_hash_max_size 1024;
variables_hash_bucket_size 64;
server_names_hash_max_size 4096;
server_names_hash_bucket_size 128;
types_hash_max_size 2048;
types_hash_bucket_size 64;
proxy_read_timeout 2400s;
client_header_timeout 2400s;
client_body_timeout 2400s;
proxy_connect_timeout 75s;
proxy_send_timeout 2400s;
proxy_buffer_size 32k;
proxy_buffers 40 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 250m;
proxy_http_version 1.1;
client_body_buffer_size 128k;
include /etc/nginx/conf.d/*.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
}
EOF
cat <<EOF >/etc/nginx/conf.d/artifactory.conf
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/pki/tls/certs/cert.pem;
ssl_certificate_key /etc/pki/tls/private/cert.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers on;
## server configuration
server {
listen 443 ssl;
listen 80 ;
server_name ~(?<repo>.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN};
if (\$http_x_forwarded_proto = '') {
set \$http_x_forwarded_proto \$scheme;
}
## Application specific logs
## access_log /var/log/nginx/artifactory-access.log timing;
## error_log /var/log/nginx/artifactory-error.log;
rewrite ^/$ /ui/ redirect;
rewrite ^/ui$ /ui/ redirect;
chunked_transfer_encoding on;
client_max_body_size 0;
location / {
proxy_read_timeout 2400;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:8082;
proxy_next_upstream error timeout non_idempotent;
proxy_next_upstream_tries 1;
proxy_set_header X-JFrog-Override-Base-Url \$http_x_forwarded_proto://\$host:\$server_port;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
location ~ ^/artifactory/ {
proxy_pass http://127.0.0.1:8081;
}
}
}
EOF
mkdir -p /opt/jfrog/artifactory/var/etc/artifactory/
cat <<EOF >/opt/jfrog/artifactory/var/etc/artifactory/artifactory.cluster.license
${ARTIFACTORY_LICENSE_1}
${ARTIFACTORY_LICENSE_2}
${ARTIFACTORY_LICENSE_3}
${ARTIFACTORY_LICENSE_4}
${ARTIFACTORY_LICENSE_5}
EOF
HOSTNAME=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
if [ "${IS_PRIMARY}" = "true" ]; then
NODE_NAME=art-primary
else
NODE_NAME=art-$(date +%s$RANDOM)
fi
# Java options
EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//")
sed -i -e "s/#extraJavaOpts: \"-Xms512m -Xmx2g\"/extraJavaOpts: ${EXTRA_JAVA_OPTS}/" /var/opt/jfrog/artifactory/etc/system.yaml
# Node settings
HOSTNAME=$(hostname -i)
sed -i -e "s/#id: \"art1\"/id: \"${NODE_NAME}\"/" /var/opt/jfrog/artifactory/etc/system.yaml
sed -i -e "s/#ip:/ip: ${HOSTNAME}/" /var/opt/jfrog/artifactory/etc/system.yaml
sed -i -e "s/#primary: true/primary: ${IS_PRIMARY}/" /var/opt/jfrog/artifactory/etc/system.yaml
sed -i -e "s/#haEnabled:/haEnabled:/" /var/opt/jfrog/artifactory/etc/system.yaml
# Set MS SQL configuration
cat <<EOF >>/var/opt/jfrog/artifactory/etc/system.yaml
## One of: mysql, oracle, mssql, postgresql, mariadb
## Default: Embedded derby
## Example for mysql
type: mssql
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: ${DB_URL};databaseName=${DB_NAME};sendStringParametersAsUnicode=false;applicationName=Artifactory Binary Repository
username: ${DB_USER}
password: ${DB_PASSWORD}
EOF
# Create master.key on each node
mkdir -p /opt/jfrog/artifactory/var/etc/security/
cat <<EOF >/opt/jfrog/artifactory/var/etc/security/master.key
${MASTER_KEY}
EOF
# Azure Blob Storage configuration
# https://www.jfrog.com/confluence/display/JFROG/Configuring+the+Filestore#ConfiguringtheFilestore-AzureBlobStorageClusterBinaryProvider
mkdir -p /var/opt/jfrog/artifactory/etc/artifactory/
cat <<EOF >/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml
<config version="2">
<chain template="cluster-azure-blob-storage"/>
<provider id="azure-blob-storage" type="azure-blob-storage">
<accountName>${STORAGE_ACCT}</accountName>
<accountKey>${STORAGE_ACCT_KEY}</accountKey>
<endpoint>https://${STORAGE_ACCT}.blob.core.windows.net/</endpoint>
<containerName>${STORAGE_CONTAINER}</containerName>
</provider>
</config>
EOF
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//" > /tmp/temp.pem
cat /tmp/temp.pem | sed 's/CERTIFICATE----- /&\n/g' | sed 's/ -----END/\n-----END/g' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/certs/cert.pem
rm /tmp/temp.pem
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_KEY=//" > /tmp/temp.key
cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key
rm /tmp/temp.key
chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/*
# start Artifactory
sleep $((RANDOM % 120))
service artifactory start
service nginx start
nginx -s reload
echo "INFO: Artifactory HA installation completed."
echo ""

View File

@@ -0,0 +1,13 @@
#!/bin/bash
ARTIFACTORY_VERSION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_VERSION=" | sed "s/ARTIFACTORY_VERSION=//")
IFS=$'\t'
SUPPORTED_VERSIONS=("6.8.0\t6.11.3\t6.15.0\t0.16.0\t0.17.0\t6.18.0")
unset IFS
if [[ "\t${SUPPORTED_VERSIONS[@]}\t" =~ "\t${ARTIFACTORY_VERSION}\t" ]]; then
sh install_artifactory.sh
echo "\ninstall_artifactory.sh was selected" >> user-data.txt
else
sh install_artifactory7.sh
echo "\ninstall_artifactory7.sh was selected" >> user-data.txt
fi

View File

@@ -1,7 +1,5 @@
# Setup Artifactory Enterprise # Setup Artifactory Enterprise
*Note: This ARM template is no longer maintained. Feel free to review this code for your own POC concepts, but we are not continuing to update it or add features. We recommend using the official [Marketplace offerrings](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/jfrog.jfrog-artifactory-ha-arm-template)*.
<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FJFrogDev%2FJFrog-Cloud-Installers%2Fmaster%2FAzureResourceManager%2Fazuredeploy.json" target="_blank"> <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FJFrogDev%2FJFrog-Cloud-Installers%2Fmaster%2FAzureResourceManager%2Fazuredeploy.json" target="_blank">
<img src="http://azuredeploy.net/deploybutton.png"/> <img src="http://azuredeploy.net/deploybutton.png"/>
</a> </a>

View File

@@ -4,41 +4,71 @@
"parameters": { "parameters": {
"vmSku": { "vmSku": {
"type": "string", "type": "string",
"defaultValue": "Standard_A4", "defaultValue": "Standard_D4s_v3",
"metadata": { "metadata": {
"description": "Size of VMs in the VM Scale Set." "description": "Size of VMs in the VM Scale Set."
} }
}, },
"clusterName": { "clusterName": {
"type": "string", "type": "string",
"maxLength": 61,
"metadata": { "metadata": {
"description": "String used as a base for naming resources. Must be 3-61 characters in length and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended." "description": "String used as a base for naming resources. Must be 3-61 characters in length and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended."
}
}, },
"maxLength": 61 "location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for the resources."
}
}, },
"nodeCount": { "nodeCount": {
"type": "int", "type": "int",
"defaultValue": 2, "defaultValue": 2,
"minValue": 1, "minValue": 1,
"maxValue": 100,
"metadata": { "metadata": {
"description": "Number of VM instances (100 or less) for member artifactory nodes. Minimum 1 node." "description": "Number of VM instances (100 or less) for member artifactory nodes. Minimum 1 node."
}, }
"maxValue": 100
}, },
"artifactoryVersion": { "artifactoryVersion": {
"type": "string", "type": "string",
"defaultValue": "6.2.0", "defaultValue": "7.4.30",
"allowedValues": [
"6.6.0",
"6.6.1",
"6.7.0",
"6.8.0",
"6.11.3",
"6.15.0",
"0.16.0",
"0.17.0",
"6.18.0",
"7.0.0717",
"7.0.4001",
"7.2.1",
"7.4.3",
"7.4.30",
"7.4.31"
],
"metadata": { "metadata": {
"description": "Artifactory version to deploy. Supported from 5.8.0 and above." "description": "Artifactory-vm image version to deploy."
} }
}, },
"masterKey": { "masterKey": {
"type": "string", "type": "string",
"defaultValue": "1ce2be4490ca2c662cb79636cf9b7b8e", "maxLength": 64,
"metadata": { "metadata": {
"description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'" "description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'"
}
}, },
"maxLength": 64 "joinKey": {
"type": "string",
"maxLength": 64,
"metadata": {
"description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'"
}
}, },
"adminUsername": { "adminUsername": {
"type": "string", "type": "string",
@@ -52,18 +82,6 @@
"description": "Admin password on all VMs. Follow conventions for azure VM admin password rules." "description": "Admin password on all VMs. Follow conventions for azure VM admin password rules."
} }
}, },
"ubuntuOSVersion": {
"type": "string",
"defaultValue": "16.04.0-LTS",
"allowedValues": [
"12.04.5-LTS",
"14.04.2-LTS",
"16.04.0-LTS"
],
"metadata": {
"description": "The Ubuntu version for the VM."
}
},
"artifactoryLicense1": { "artifactoryLicense1": {
"type": "string", "type": "string",
"metadata": { "metadata": {
@@ -131,7 +149,7 @@
"extraJavaOptions": { "extraJavaOptions": {
"type": "string", "type": "string",
"minLength": 1, "minLength": 1,
"defaultValue": "-server -Xms2g -Xmx12g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\"", "defaultValue": "-server -Xms2g -Xmx8g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\"",
"metadata": { "metadata": {
"description": "Setting Java Memory Parameters for Artifactory. Learn about system requirements for Artifactory https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware." "description": "Setting Java Memory Parameters for Artifactory. Learn about system requirements for Artifactory https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware."
} }
@@ -139,7 +157,6 @@
"DB_Admin_User": { "DB_Admin_User": {
"type": "string", "type": "string",
"minLength": 1, "minLength": 1,
"defaultValue": "artifactory",
"metadata": { "metadata": {
"description": "Database Admin user name" "description": "Database Admin user name"
} }
@@ -147,7 +164,6 @@
"DB_Admin_Password": { "DB_Admin_Password": {
"type": "securestring", "type": "securestring",
"minLength": 1, "minLength": 1,
"defaultValue": "jFrog123",
"metadata": { "metadata": {
"description": "Database Admin password" "description": "Database Admin password"
} }
@@ -155,7 +171,6 @@
"DB_Name": { "DB_Name": {
"type": "string", "type": "string",
"minLength": 1, "minLength": 1,
"defaultValue": "artdb",
"metadata": { "metadata": {
"description": "Database name" "description": "Database name"
} }
@@ -173,11 +188,16 @@
"description": "Database Edition" "description": "Database Edition"
} }
}, },
"DB_Location": { "storageAccountType": {
"type": "string", "type": "string",
"defaultValue": "", "defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS"
],
"metadata": { "metadata": {
"description": "Database location. Default to resource group location if blank." "description": "Storage Account type"
} }
}, },
"_artifactsLocation": { "_artifactsLocation": {
@@ -185,7 +205,7 @@
"metadata": { "metadata": {
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated." "description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
}, },
"defaultValue": "https://raw.githubusercontent.com/JFrogDev/JFrog-Cloud-Installers/master/AzureResourceManager/" "defaultValue": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/refactoring-rt6-rt7/AzureResourceManager/"
}, },
"_artifactsLocationSasToken": { "_artifactsLocationSasToken": {
"type": "securestring", "type": "securestring",
@@ -198,34 +218,45 @@
"variables": { "variables": {
"namingInfix": "[toLower(substring(concat(parameters('clusterName'), uniqueString(resourceGroup().id)), 0, 9))]", "namingInfix": "[toLower(substring(concat(parameters('clusterName'), uniqueString(resourceGroup().id)), 0, 9))]",
"addressPrefix": "10.0.0.0/16", "addressPrefix": "10.0.0.0/16",
"subnetPrefix": "10.0.1.0/24", "subnetPrimaryPrefix": "10.0.1.0/24",
"subnetMemberPrefix": "10.0.2.0/24",
"virtualNetworkName": "[concat(variables('namingInfix'), 'vnet')]", "virtualNetworkName": "[concat(variables('namingInfix'), 'vnet')]",
"subnetName": "[concat(variables('namingInfix'), 'subnet')]", "subnetPrimaryName": "[concat(variables('namingInfix'), 'primarySubnet')]",
"scaleSetName": "[concat(variables('namingInfix'), 'scaleset')]", "subnetMemberName": "[concat(variables('namingInfix'), 'memberSubnet')]",
"scaleSetPrimaryName": "[concat(variables('namingInfix'), 'primaryScaleset')]",
"scaleSetMemberName": "[concat(variables('namingInfix'), 'memberScaleset')]",
"lbName": "[concat(variables('namingInfix'), 'lb')]", "lbName": "[concat(variables('namingInfix'), 'lb')]",
"bepoolName": "[concat(variables('lbName'), 'bepool')]", "bepoolPrimaryName": "[concat(variables('lbName'), 'primaryBepool')]",
"fepoolName": "[concat(variables('lbName'), 'fepool')]", "bepoolMemberName": "[concat(variables('lbName'), 'memberBepool')]",
"lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbName'))]", "fepoolPrimaryName": "[concat(variables('lbName'), 'primaryFepool')]",
"bepoolID": "[concat(variables('lbID'),'/backendAddressPools/', variables('bepoolName'))]", "fepoolMemberName": "[concat(variables('lbName'), 'memberFepool')]",
"feIpConfigName": "[concat(variables('fepoolName'), 'IpConfig')]", "bepoolPrimaryID": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bepoolPrimaryName'))]",
"feIpConfigId": "[concat(variables('lbID'),'/frontendIPConfigurations/', variables('feIpConfigName'))]", "bepoolMemberID": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bepoolMemberName'))]",
"pipName": "[concat(variables('namingInfix'), 'pip')]", "feIpConfigPrimaryName": "[concat(variables('fepoolPrimaryName'), 'primaryIpConfig')]",
"nicName": "[concat(variables('namingInfix'), 'nic')]", "feIpConfigMemberName": "[concat(variables('fepoolMemberName'), 'memberIpConfig')]",
"natPoolName": "[concat(variables('lbName'), 'natpool')]", "feIpConfigPrimaryId": "[resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', variables('lbName'), variables('feIpConfigPrimaryName'))]",
"feIpConfigMemberId": "[resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', variables('lbName'), variables('feIpConfigMemberName'))]",
"pipPrimaryName": "[concat(variables('namingInfix'), 'primaryPip')]",
"pipMemberName": "[concat(variables('namingInfix'), 'memberPip')]",
"nicPrimaryName": "[concat(variables('namingInfix'), 'primaryNic')]",
"nicMemberName": "[concat(variables('namingInfix'), 'memberNic')]",
"natPoolPrimaryName": "[concat(variables('lbName'), 'primaryNatpool')]",
"natPoolMemberName": "[concat(variables('lbName'), 'memberNatpool')]",
"ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]", "ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]",
"httpProbeName": "httpProbe", "httpProbePrimaryName": "primaryHttpProbe",
"httpsProbeName": "httpsProbe", "httpsProbePrimaryName": "primaryHttpsProbe",
"httpProbeMemberName": "memberHttpProbe",
"httpsProbeMemberName": "memberHttpsProbe",
"storageAccountName": "[concat(variables('namingInfix'), 'storage')]", "storageAccountName": "[concat(variables('namingInfix'), 'storage')]",
"storageAccountType": "Standard_LRS",
"vmStorageAccountContainerName": "filestore", "vmStorageAccountContainerName": "filestore",
"azureSqlServerName": "[concat(variables('namingInfix'), 'sqlsrv')]", "azureSqlServerName": "[concat(variables('namingInfix'), 'sqlsrv')]",
"DB_Name": "[parameters('DB_Name')]", "DB_Name": "[parameters('DB_Name')]",
"DB_Admin_User": "[parameters('DB_Admin_User')]", "DB_Admin_User": "[parameters('DB_Admin_User')]",
"DB_Admin_Password": "[parameters('DB_Admin_Password')]", "DB_Admin_Password": "[parameters('DB_Admin_Password')]",
"DB_Edition": "[parameters('DB_Edition')]", "DB_Edition": "[parameters('DB_Edition')]",
"DB_Location": "[parameters('DB_Location')]", "DB_Location": "[parameters('location')]",
"artifactoryVersion": "[parameters('artifactoryVersion')]",
"masterKey": "[parameters('masterKey')]", "masterKey": "[parameters('masterKey')]",
"joinKey": "[parameters('joinKey')]",
"certificate": "[parameters('certificate')]", "certificate": "[parameters('certificate')]",
"certificateKey": "[parameters('certificateKey')]", "certificateKey": "[parameters('certificateKey')]",
"certificateDomain": "[parameters('certificateDomain')]", "certificateDomain": "[parameters('certificateDomain')]",
@@ -237,21 +268,35 @@
"artifactoryLicense4": "[parameters('artifactoryLicense4')]", "artifactoryLicense4": "[parameters('artifactoryLicense4')]",
"artifactoryLicense5": "[parameters('artifactoryLicense5')]", "artifactoryLicense5": "[parameters('artifactoryLicense5')]",
"osType": { "osType": {
"publisher": "Canonical", "publisher": "jfrog",
"offer": "UbuntuServer", "offer": "artifactory-vm",
"sku": "[parameters('ubuntuOSVersion')]", "sku": "artifactory-vm-private",
"version": "latest" "version": "[parameters('artifactoryVersion')]"
}, },
"apiVersion": "2015-06-15",
"imageReference": "[variables('osType')]", "imageReference": "[variables('osType')]",
"dbTemplate": "azureDBDeploy.json", "dbTemplate": "azureDBDeploy.json",
"dbTemplateLocation": "[concat(parameters('_artifactsLocation'), 'nested', '/', variables('dbTemplate'))]", "dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]",
"nsgName": "[concat(variables('namingInfix'), 'nsg')]" "nsgName": "[concat(variables('namingInfix'), 'nsg')]"
}, },
"resources": [ "resources": [
{
"apiVersion": "2019-05-01",
"name": "pid-04c1c376-5d4b-4771-9a7f-054f5910dcef",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": []
}
}
},
{ {
"type": "Microsoft.Network/networkSecurityGroups", "type": "Microsoft.Network/networkSecurityGroups",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"name": "[variables('nsgName')]",
"apiVersion": "2018-07-01",
"properties": { "properties": {
"securityRules": [ "securityRules": [
{ {
@@ -269,7 +314,7 @@
} }
}, },
{ {
"name": "http-rule", "name": "http-artifactory-rule",
"properties": { "properties": {
"description": "Allow HTTP", "description": "Allow HTTP",
"protocol": "Tcp", "protocol": "Tcp",
@@ -283,7 +328,7 @@
} }
}, },
{ {
"name": "http-rule-1", "name": "http-nginx-rule",
"properties": { "properties": {
"description": "Allow HTTP", "description": "Allow HTTP",
"protocol": "Tcp", "protocol": "Tcp",
@@ -297,7 +342,7 @@
} }
}, },
{ {
"name": "https-rule", "name": "https-nginx-rule",
"properties": { "properties": {
"description": "Allow HTTP", "description": "Allow HTTP",
"protocol": "Tcp", "protocol": "Tcp",
@@ -325,15 +370,13 @@
} }
} }
] ]
}, }
"name": "[variables('nsgName')]",
"apiVersion": "2016-03-30"
}, },
{ {
"type": "Microsoft.Network/virtualNetworks", "type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]", "name": "[variables('virtualNetworkName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"apiVersion": "2016-03-30", "apiVersion": "2018-07-01",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" "[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]"
], ],
@@ -345,9 +388,18 @@
}, },
"subnets": [ "subnets": [
{ {
"name": "[variables('subnetName')]", "name": "[variables('subnetPrimaryName')]",
"properties": { "properties": {
"addressPrefix": "[variables('subnetPrefix')]", "addressPrefix": "[variables('subnetPrimaryPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
},
{
"name": "[variables('subnetMemberName')]",
"properties": {
"addressPrefix": "[variables('subnetMemberPrefix')]",
"networkSecurityGroup": { "networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
} }
@@ -357,12 +409,12 @@
} }
}, },
{ {
"apiVersion": "[variables('apiVersion')]", "apiVersion": "2018-07-01",
"type": "Microsoft.Network/networkInterfaces", "type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]", "name": "[variables('nicPrimaryName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipName'))]", "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
], ],
@@ -373,7 +425,7 @@
"properties": { "properties": {
"privateIPAllocationMethod": "Dynamic", "privateIPAllocationMethod": "Dynamic",
"subnet": { "subnet": {
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName')), '/subnets/', variables('subnetName'))]" "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetPrimaryName'))]"
} }
} }
} }
@@ -384,12 +436,12 @@
} }
}, },
{ {
"apiVersion": "[variables('apiVersion')]", "apiVersion": "2018-07-01",
"type": "Microsoft.Network/networkInterfaces", "type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('nicName'),'2')]", "name": "[variables('nicMemberName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipName'),'2')]", "[concat('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
], ],
@@ -400,7 +452,7 @@
"properties": { "properties": {
"privateIPAllocationMethod": "Dynamic", "privateIPAllocationMethod": "Dynamic",
"subnet": { "subnet": {
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName')), '/subnets/', variables('subnetName'))]" "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetMemberName'))]"
} }
} }
} }
@@ -412,12 +464,12 @@
}, },
{ {
"type": "Microsoft.Network/publicIPAddresses", "type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('pipName')]", "name": "[variables('pipPrimaryName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"sku": { "sku": {
"name": "Standard" "name": "Standard"
}, },
"apiVersion": "2017-08-01", "apiVersion": "2018-07-01",
"properties": { "properties": {
"publicIPAllocationMethod": "Static", "publicIPAllocationMethod": "Static",
"dnsSettings": { "dnsSettings": {
@@ -427,12 +479,12 @@
}, },
{ {
"type": "Microsoft.Network/publicIPAddresses", "type": "Microsoft.Network/publicIPAddresses",
"name": "[concat(variables('pipName'),'2')]", "name": "[variables('pipMemberName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"sku": { "sku": {
"name": "Standard" "name": "Standard"
}, },
"apiVersion": "2017-08-01", "apiVersion": "2018-07-01",
"properties": { "properties": {
"publicIPAllocationMethod": "Static", "publicIPAllocationMethod": "Static",
"dnsSettings": { "dnsSettings": {
@@ -443,51 +495,51 @@
{ {
"type": "Microsoft.Network/loadBalancers", "type": "Microsoft.Network/loadBalancers",
"name": "[variables('lbName')]", "name": "[variables('lbName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"apiVersion": "2017-08-01", "apiVersion": "2018-07-01",
"sku": { "sku": {
"name": "Standard" "name": "Standard"
}, },
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipName'))]", "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]",
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipName'), '2')]" "[concat('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]"
], ],
"tags": { "tags":{
"displayName": "Load Balancer" "displayName": "Load Balancer"
}, },
"properties": { "properties": {
"frontendIPConfigurations": [ "frontendIPConfigurations": [
{ {
"name": "[variables('feIpConfigName')]", "name": "[variables('feIpConfigPrimaryName')]",
"properties": { "properties": {
"publicIPAddress": { "publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipName'))]" "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipPrimaryName'))]"
} }
} }
}, },
{ {
"name": "[concat(variables('feIpConfigName'),'2')]", "name": "[variables('feIpConfigMemberName')]",
"properties": { "properties": {
"publicIPAddress": { "publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('pipName'),'2'))]" "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipMemberName'))]"
} }
} }
} }
], ],
"backendAddressPools": [ "backendAddressPools": [
{ {
"name": "[variables('bepoolName')]" "name": "[variables('bepoolPrimaryName')]"
}, },
{ {
"name": "[concat(variables('bepoolName'),'2')]" "name": "[variables('bepoolMemberName')]"
} }
], ],
"inboundNatPools": [ "inboundNatPools": [
{ {
"name": "[variables('natPoolName')]", "name": "[variables('natPoolPrimaryName')]",
"properties": { "properties": {
"frontendIPConfiguration": { "frontendIPConfiguration": {
"id": "[variables('feIpConfigId')]" "id": "[variables('feIpConfigPrimaryId')]"
}, },
"protocol": "tcp", "protocol": "tcp",
"frontendPortRangeStart": 10022, "frontendPortRangeStart": 10022,
@@ -496,10 +548,10 @@
} }
}, },
{ {
"name": "[concat(variables('natPoolName'),'2')]", "name": "[variables('natPoolMemberName')]",
"properties": { "properties": {
"frontendIPConfiguration": { "frontendIPConfiguration": {
"id": "[concat(variables('feIpConfigId'),'2')]" "id": "[variables('feIpConfigMemberId')]"
}, },
"protocol": "tcp", "protocol": "tcp",
"frontendPortRangeStart": 20022, "frontendPortRangeStart": 20022,
@@ -510,14 +562,14 @@
], ],
"loadBalancingRules": [ "loadBalancingRules": [
{ {
"name": "HTTPRule", "name": "HTTPRulePrimary",
"properties": { "properties": {
"loadDistribution": "Default", "loadDistribution": "Default",
"frontendIPConfiguration": { "frontendIPConfiguration": {
"id": "[variables('feIpConfigId')]" "id": "[variables('feIpConfigPrimaryId')]"
}, },
"backendAddressPool": { "backendAddressPool": {
"id": "[variables('bepoolID')]" "id": "[variables('bepoolPrimaryID')]"
}, },
"protocol": "Tcp", "protocol": "Tcp",
"frontendPort": 80, "frontendPort": 80,
@@ -525,19 +577,19 @@
"enableFloatingIP": false, "enableFloatingIP": false,
"idleTimeoutInMinutes": 5, "idleTimeoutInMinutes": 5,
"probe": { "probe": {
"id": "[concat(variables('lbId'), '/probes/', variables('httpProbeName'))]" "id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpProbePrimaryName'))]"
} }
} }
}, },
{ {
"name": "HTTPSRule", "name": "HTTPSRulePrimary",
"properties": { "properties": {
"loadDistribution": "Default", "loadDistribution": "Default",
"frontendIPConfiguration": { "frontendIPConfiguration": {
"id": "[variables('feIpConfigId')]" "id": "[variables('feIpConfigPrimaryId')]"
}, },
"backendAddressPool": { "backendAddressPool": {
"id": "[variables('bepoolID')]" "id": "[variables('bepoolPrimaryID')]"
}, },
"protocol": "Tcp", "protocol": "Tcp",
"frontendPort": 443, "frontendPort": 443,
@@ -545,19 +597,19 @@
"enableFloatingIP": false, "enableFloatingIP": false,
"idleTimeoutInMinutes": 5, "idleTimeoutInMinutes": 5,
"probe": { "probe": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('lbName')), '/probes/', variables('httpsProbeName'))]" "id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpsProbePrimaryName'))]"
} }
} }
}, },
{ {
"name": "HTTPRule2", "name": "HTTPRuleMember",
"properties": { "properties": {
"loadDistribution": "Default", "loadDistribution": "Default",
"frontendIPConfiguration": { "frontendIPConfiguration": {
"id": "[concat(variables('feIpConfigId'),'2')]" "id": "[variables('feIpConfigMemberId')]"
}, },
"backendAddressPool": { "backendAddressPool": {
"id": "[concat(variables('bepoolID'),'2')]" "id": "[variables('bepoolMemberID')]"
}, },
"protocol": "Tcp", "protocol": "Tcp",
"frontendPort": 80, "frontendPort": 80,
@@ -565,19 +617,19 @@
"enableFloatingIP": false, "enableFloatingIP": false,
"idleTimeoutInMinutes": 5, "idleTimeoutInMinutes": 5,
"probe": { "probe": {
"id": "[concat(variables('lbId'), '/probes/', variables('httpProbeName'),'2')]" "id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpProbeMemberName'))]"
} }
} }
}, },
{ {
"name": "HTTPSRule2", "name": "HTTPSRuleMember",
"properties": { "properties": {
"loadDistribution": "Default", "loadDistribution": "Default",
"frontendIPConfiguration": { "frontendIPConfiguration": {
"id": "[concat(variables('feIpConfigId'),'2')]" "id": "[variables('feIpConfigMemberId')]"
}, },
"backendAddressPool": { "backendAddressPool": {
"id": "[concat(variables('bepoolID'),'2')]" "id": "[variables('bepoolMemberID')]"
}, },
"protocol": "Tcp", "protocol": "Tcp",
"frontendPort": 443, "frontendPort": 443,
@@ -585,14 +637,14 @@
"enableFloatingIP": false, "enableFloatingIP": false,
"idleTimeoutInMinutes": 5, "idleTimeoutInMinutes": 5,
"probe": { "probe": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('lbName')), '/probes/', variables('httpsProbeName'),'2')]" "id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpsProbeMemberName'))]"
} }
} }
} }
], ],
"probes": [ "probes": [
{ {
"name": "[variables('httpProbeName')]", "name": "[variables('httpProbePrimaryName')]",
"properties": { "properties": {
"protocol": "Http", "protocol": "Http",
"requestPath": "/artifactory/api/system/ping", "requestPath": "/artifactory/api/system/ping",
@@ -602,7 +654,7 @@
} }
}, },
{ {
"name": "[variables('httpsProbeName')]", "name": "[variables('httpsProbePrimaryName')]",
"properties": { "properties": {
"protocol": "Tcp", "protocol": "Tcp",
"port": 443, "port": 443,
@@ -611,7 +663,7 @@
} }
}, },
{ {
"name": "[concat(variables('httpProbeName'),'2')]", "name": "[variables('httpProbeMemberName')]",
"properties": { "properties": {
"protocol": "Http", "protocol": "Http",
"requestPath": "/artifactory/api/system/ping", "requestPath": "/artifactory/api/system/ping",
@@ -621,7 +673,7 @@
} }
}, },
{ {
"name": "[concat(variables('httpsProbeName'),'2')]", "name": "[variables('httpsProbeMemberName')]",
"properties": { "properties": {
"protocol": "Tcp", "protocol": "Tcp",
"port": 443, "port": 443,
@@ -633,18 +685,23 @@
} }
}, },
{ {
"apiVersion": "[variables('apiVersion')]", "apiVersion": "2018-07-01",
"type": "Microsoft.Storage/storageAccounts", "type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]", "name": "[variables('storageAccountName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"properties": { "sku": {
"accountType": "[variables('storageAccountType')]" "name": "[parameters('storageAccountType')]"
} },
"tags":{
"displayName": "Artifactory Storage Account"
},
"kind": "Storage",
"properties": {}
}, },
{ {
"type": "Microsoft.Resources/deployments", "type": "Microsoft.Resources/deployments",
"name": "deploySQLDB", "name": "deploySQLDB",
"apiVersion": "2014-04-01", "apiVersion": "2018-07-01",
"properties": { "properties": {
"mode": "Incremental", "mode": "Incremental",
"templateLink": { "templateLink": {
@@ -668,29 +725,35 @@
"value": "[parameters('DB_Edition')]" "value": "[parameters('DB_Edition')]"
}, },
"db_location": { "db_location": {
"value": "[parameters('DB_Location')]" "value": "[variables('DB_Location')]"
} }
} }
} }
}, },
{ {
"type": "Microsoft.Compute/virtualMachineScaleSets", "type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[variables('scaleSetName')]", "name": "[variables('scaleSetPrimaryName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"apiVersion": "2017-03-30", "apiVersion": "2018-10-01",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]", "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]", "[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]",
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
], ],
"plan": {
"name": "artifactory-vm-private",
"publisher": "jfrog",
"product": "artifactory-vm"
},
"sku": { "sku": {
"name": "[parameters('vmSku')]", "name": "[parameters('vmSku')]",
"tier": "Standard", "tier": "Standard",
"capacity": "[1]" "capacity": "1"
}, },
"properties": { "properties": {
"singlePlacementGroup": true, "singlePlacementGroup": true,
"overprovision": "false",
"upgradePolicy": { "upgradePolicy": {
"mode": "Manual" "mode": "Manual"
}, },
@@ -707,12 +770,12 @@
"computerNamePrefix": "[variables('namingInfix')]", "computerNamePrefix": "[variables('namingInfix')]",
"adminUsername": "[parameters('adminUsername')]", "adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]", "adminPassword": "[parameters('adminPassword')]",
"customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nCERTIFICATE_KEY=',parameters('certificateKey'),'\nCERTIFICATE=', parameters('certificate'),'\nCERTIFICATE_DOMAIN=',parameters('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',parameters('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',parameters('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), variables('apiVersion')).key1,'\nARTIFACTORY_VERSION=',variables('artifactoryVersion'),'\nMASTER_KEY=',variables('masterKey'),'\nIS_PRIMARY=','true','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]" "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',parameters('certificateKey'),'\nCERTIFICATE=', parameters('certificate'),'\nCERTIFICATE_DOMAIN=',parameters('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',parameters('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',parameters('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\nIS_PRIMARY=','true','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]"
}, },
"networkProfile": { "networkProfile": {
"networkInterfaceConfigurations": [ "networkInterfaceConfigurations": [
{ {
"name": "[variables('nicName')]", "name": "[variables('nicPrimaryName')]",
"properties": { "properties": {
"primary": true, "primary": true,
"ipConfigurations": [ "ipConfigurations": [
@@ -720,16 +783,16 @@
"name": "[concat(variables('ipConfigName'),'1')]", "name": "[concat(variables('ipConfigName'),'1')]",
"properties": { "properties": {
"subnet": { "subnet": {
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName')), '/subnets/', variables('subnetName'))]" "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetPrimaryName'))]"
}, },
"loadBalancerBackendAddressPools": [ "loadBalancerBackendAddressPools": [
{ {
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('lbName'), '/backendAddressPools/', variables('bePoolName'))]" "id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bePoolPrimaryName'))]"
} }
], ],
"loadBalancerInboundNatPools": [ "loadBalancerInboundNatPools": [
{ {
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('lbName'), '/inboundNatPools/', variables('natPoolName'))]" "id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatPools', variables('lbName'), variables('natPoolPrimaryName'))]"
} }
] ]
} }
@@ -750,11 +813,13 @@
"autoUpgradeMinorVersion": false, "autoUpgradeMinorVersion": false,
"settings": { "settings": {
"fileUris": [ "fileUris": [
"[concat(parameters('_artifactsLocation'), 'scripts/','install_artifactory.sh')]" "[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory.sh', parameters('_artifactsLocationSasToken')))]",
"[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory7.sh', parameters('_artifactsLocationSasToken')))]",
"[uri(parameters('_artifactsLocation'), concat('scripts/version_selector.sh', parameters('_artifactsLocationSasToken')))]"
] ]
}, },
"protectedSettings": { "protectedSettings": {
"commandToExecute": "sh install_artifactory.sh" "commandToExecute": "bash version_selector.sh && ls -al && pwd >> /var/lib/cloud/instance/user-data.txt"
} }
} }
} }
@@ -765,16 +830,21 @@
}, },
{ {
"type": "Microsoft.Compute/virtualMachineScaleSets", "type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[concat(variables('scaleSetName'),'2')]", "name": "[variables('scaleSetMemberName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"apiVersion": "2017-03-30", "apiVersion": "2018-10-01",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]", "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[concat('Microsoft.Compute/virtualMachineScaleSets/', variables('scaleSetName'))]", "[concat('Microsoft.Compute/virtualMachineScaleSets/', variables('scaleSetPrimaryName'))]",
"[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]", "[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]",
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
], ],
"plan": {
"name": "artifactory-vm-private",
"publisher": "jfrog",
"product": "artifactory-vm"
},
"sku": { "sku": {
"name": "[parameters('vmSku')]", "name": "[parameters('vmSku')]",
"tier": "Standard", "tier": "Standard",
@@ -782,6 +852,7 @@
}, },
"properties": { "properties": {
"singlePlacementGroup": true, "singlePlacementGroup": true,
"overprovision": "false",
"upgradePolicy": { "upgradePolicy": {
"mode": "Manual" "mode": "Manual"
}, },
@@ -798,12 +869,12 @@
"computerNamePrefix": "[variables('namingInfix')]", "computerNamePrefix": "[variables('namingInfix')]",
"adminUsername": "[parameters('adminUsername')]", "adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]", "adminPassword": "[parameters('adminPassword')]",
"customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nCERTIFICATE_KEY=',parameters('certificateKey'),'\nCERTIFICATE=', parameters('certificate'),'\nCERTIFICATE_DOMAIN=',parameters('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',parameters('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',parameters('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), variables('apiVersion')).key1,'\nARTIFACTORY_VERSION=',variables('artifactoryVersion'),'\nMASTER_KEY=',variables('masterKey'),'\nIS_PRIMARY=','false','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]" "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',parameters('certificateKey'),'\nCERTIFICATE=', parameters('certificate'),'\nCERTIFICATE_DOMAIN=',parameters('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',parameters('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',parameters('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\nIS_PRIMARY=','false','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]"
}, },
"networkProfile": { "networkProfile": {
"networkInterfaceConfigurations": [ "networkInterfaceConfigurations": [
{ {
"name": "[concat(variables('nicName'),'2')]", "name": "[variables('nicMemberName')]",
"properties": { "properties": {
"primary": true, "primary": true,
"ipConfigurations": [ "ipConfigurations": [
@@ -811,16 +882,16 @@
"name": "[concat(variables('ipConfigName'),'1')]", "name": "[concat(variables('ipConfigName'),'1')]",
"properties": { "properties": {
"subnet": { "subnet": {
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName')), '/subnets/', variables('subnetName'))]" "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetMemberName'))]"
}, },
"loadBalancerBackendAddressPools": [ "loadBalancerBackendAddressPools": [
{ {
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('lbName'), '/backendAddressPools/', variables('bePoolName'),'2')]" "id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bePoolMemberName'))]"
} }
], ],
"loadBalancerInboundNatPools": [ "loadBalancerInboundNatPools": [
{ {
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('lbName'), '/inboundNatPools/', variables('natPoolName'),'2')]" "id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatPools', variables('lbName'), variables('natPoolMemberName'))]"
} }
] ]
} }
@@ -841,11 +912,13 @@
"autoUpgradeMinorVersion": false, "autoUpgradeMinorVersion": false,
"settings": { "settings": {
"fileUris": [ "fileUris": [
"[concat(parameters('_artifactsLocation'), 'scripts/','install_artifactory.sh')]" "[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory.sh', parameters('_artifactsLocationSasToken')))]",
"[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory7.sh', parameters('_artifactsLocationSasToken')))]",
"[uri(parameters('_artifactsLocation'), concat('scripts/version_selector.sh', parameters('_artifactsLocationSasToken')))]"
] ]
}, },
"protectedSettings": { "protectedSettings": {
"commandToExecute": "sh install_artifactory.sh" "commandToExecute": "bash version_selector.sh && ls -al && pwd >> /var/lib/cloud/instance/user-data.txt"
} }
} }
} }
@@ -857,7 +930,7 @@
], ],
"outputs": { "outputs": {
"fqdn": { "fqdn": {
"value": "[reference(resourceId('Microsoft.Network/publicIPAddresses',concat(variables('pipName'),'2')),'2016-03-30').dnsSettings.fqdn]", "value": "[reference(resourceId('Microsoft.Network/publicIPAddresses',variables('pipMemberName')),'2018-07-01').dnsSettings.fqdn]",
"type": "string" "type": "string"
} }
} }

View File

@@ -2,29 +2,38 @@
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0", "contentVersion": "1.0.0.0",
"parameters": { "parameters": {
"vmSku": {
"value": "Standard_A4"
},
"clusterName": { "clusterName": {
"value": "GEN-UNIQUE" "value": "GEN-UNIQUE"
}, },
"nodeCount": {
"value": 1
},
"adminUsername": { "adminUsername": {
"value": "ubuntu" "value": "GEN-UNIQUE"
}, },
"adminPassword": { "adminPassword": {
"value": "GEN-PASSWORD" "value": "GEN-PASSWORD"
}, },
"artifactoryVersion": { "DB_Admin_User": {
"value": "6.2.0" "value": "GEN-UNIQUE"
},
"DB_Admin_Password": {
"value": "GEN-PASSWORD"
},
"DB_Name": {
"value": "GEN-UNIQUE"
}, },
"masterKey": { "masterKey": {
"value": "35767fa0164bac66b6cccb8880babefb" "value": "35767fa0164bac66b6cccb8880babefb"
}, },
"joinKey": {
"value": "3143bf2aa4db9c00077e0443c84d252e"
},
"artifactoryLicense1": { "artifactoryLicense1": {
"value": "GEN-UNIQUE" "value": "GEN-UNIQUE"
},
"artifactoryLicense2": {
"value": "GEN-UNIQUE"
},
"artifactoryLicense3": {
"value": "GEN-UNIQUE"
} }
} }
} }

View File

@@ -1,7 +0,0 @@
{
"itemDisplayName": "Artifactory Enterprise Setup",
"description": "This template helps you setup a Artifactory Enterprise environment.",
"summary": "This template has setup Artifactory Enterprise cluster, MSSQL server to store metadata and Azure Blob storage container for storage.",
"githubUsername": "jainishshah17",
"dateUpdated": "2017-10-02"
}

View File

@@ -19,32 +19,10 @@ UBUNTU_CODENAME=$(cat /etc/lsb-release | grep "^DISTRIB_CODENAME=" | sed "s/DIST
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
# install the wget and curl
apt-get update
apt-get -y install wget curl>> /tmp/install-curl.log 2>&1
# install Java 8
add-apt-repository -y ppa:webupd8team/java
apt-get update
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
apt-get install -y oracle-java8-installer>> /tmp/install-java8.log 2>&1
#Generate Self-Signed Cert #Generate Self-Signed Cert
mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/ mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/
openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost" openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost"
# install the MySQL stack
echo "deb https://jfrog.bintray.com/artifactory-pro-debs ${UBUNTU_CODENAME} main" | tee -a /etc/apt/sources.list
curl https://bintray.com/user/downloadSubjectPublicKey?username=jfrog | apt-key add -
apt-get update
apt-get -y install nginx>> /tmp/install-nginx.log 2>&1
apt-get -y install jfrog-artifactory-pro=${ARTIFACTORY_VERSION} >> /tmp/install-artifactory.log 2>&1
#Install database drivers
curl -L -o /opt/jfrog/artifactory/tomcat/lib/mysql-connector-java-5.1.38.jar https://bintray.com/artifact/download/bintray/jcenter/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar
curl -L -o /opt/jfrog/artifactory/tomcat/lib/mssql-jdbc-6.2.1.jre8.jar https://bintray.com/artifact/download/bintray/jcenter/com/microsoft/sqlserver/mssql-jdbc/6.2.1.jre8/mssql-jdbc-6.2.1.jre8.jar
curl -L -o /opt/jfrog/artifactory/tomcat/lib/postgresql-9.4.1212.jar https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar
CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//") CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//")
[ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory [ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory
@@ -209,19 +187,6 @@ cat <<EOF >/var/opt/jfrog/artifactory/etc/binarystore.xml
</config> </config>
EOF EOF
# callhome metadata
mkdir -p /var/opt/jfrog/artifactory/etc/info
cat <<EOF >/var/opt/jfrog/artifactory/etc/info/installer-info.json
{
"productId": "JFrogInstaller_ARM/1.0.0",
"features": [
{
"featureId": "SQLServer"
}
]
}
EOF
HOSTNAME=$(hostname -i) HOSTNAME=$(hostname -i)
sed -i -e "s/art1/art-$(date +%s$RANDOM)/" /var/opt/jfrog/artifactory/etc/ha-node.properties sed -i -e "s/art1/art-$(date +%s$RANDOM)/" /var/opt/jfrog/artifactory/etc/ha-node.properties
@@ -236,7 +201,6 @@ cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CE
cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key
rm /tmp/temp.key rm /tmp/temp.key
echo "artifactory.ping.allowUnauthenticated=true" >> /var/opt/jfrog/artifactory/etc/artifactory.system.properties
EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//") EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//")
[ -z "$EXTRA_JAVA_OPTS" ] && EXTRA_JAVA_OPTS='-server -Xms2g -Xmx6g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError="kill -9 %p"' [ -z "$EXTRA_JAVA_OPTS" ] && EXTRA_JAVA_OPTS='-server -Xms2g -Xmx6g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError="kill -9 %p"'
echo "export JAVA_OPTIONS=\"${EXTRA_JAVA_OPTS}\"" >> /var/opt/jfrog/artifactory/etc/default echo "export JAVA_OPTIONS=\"${EXTRA_JAVA_OPTS}\"" >> /var/opt/jfrog/artifactory/etc/default

View File

@@ -0,0 +1,199 @@
#!/bin/bash
DB_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JDBC_STR" | sed "s/JDBC_STR=//")
DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//")
DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//")
DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//")
STORAGE_ACCT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_NAME=" | sed "s/STO_ACT_NAME=//")
STORAGE_CONTAINER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_CTR_NAME=" | sed "s/STO_CTR_NAME=//")
STORAGE_ACCT_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_KEY=" | sed "s/STO_ACT_KEY=//")
ARTIFACTORY_VERSION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_VERSION=" | sed "s/ARTIFACTORY_VERSION=//")
MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//")
IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//")
ARTIFACTORY_LICENSE_1=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE1=" | sed "s/LICENSE1=//")
ARTIFACTORY_LICENSE_2=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE2=" | sed "s/LICENSE2=//")
ARTIFACTORY_LICENSE_3=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE3=" | sed "s/LICENSE3=//")
ARTIFACTORY_LICENSE_4=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE4=" | sed "s/LICENSE4=//")
ARTIFACTORY_LICENSE_5=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE5=" | sed "s/LICENSE5=//")
export DEBIAN_FRONTEND=noninteractive
#Generate Self-Signed Cert
mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/
openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost"
CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//")
[ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory
ARTIFACTORY_SERVER_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_SERVER_NAME=" | sed "s/ARTIFACTORY_SERVER_NAME=//")
[ -z "$ARTIFACTORY_SERVER_NAME" ] && ARTIFACTORY_SERVER_NAME=artifactory
#Configuring nginx
rm /etc/nginx/sites-enabled/default
cat <<EOF >/etc/nginx/nginx.conf
#user nobody;
worker_processes 1;
error_log /var/log/nginx/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
variables_hash_max_size 1024;
variables_hash_bucket_size 64;
server_names_hash_max_size 4096;
server_names_hash_bucket_size 128;
types_hash_max_size 2048;
types_hash_bucket_size 64;
proxy_read_timeout 2400s;
client_header_timeout 2400s;
client_body_timeout 2400s;
proxy_connect_timeout 75s;
proxy_send_timeout 2400s;
proxy_buffer_size 32k;
proxy_buffers 40 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 250m;
proxy_http_version 1.1;
client_body_buffer_size 128k;
include /etc/nginx/conf.d/*.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
}
EOF
cat <<EOF >/etc/nginx/conf.d/artifactory.conf
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/pki/tls/certs/cert.pem;
ssl_certificate_key /etc/pki/tls/private/cert.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers on;
## server configuration
server {
listen 443 ssl;
listen 80 ;
server_name ~(?<repo>.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN};
if (\$http_x_forwarded_proto = '') {
set \$http_x_forwarded_proto \$scheme;
}
## Application specific logs
## access_log /var/log/nginx/artifactory-access.log timing;
## error_log /var/log/nginx/artifactory-error.log;
rewrite ^/$ /ui/ redirect;
rewrite ^/ui$ /ui/ redirect;
chunked_transfer_encoding on;
client_max_body_size 0;
location / {
proxy_read_timeout 2400;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:8082;
proxy_next_upstream error timeout non_idempotent;
proxy_next_upstream_tries 1;
proxy_set_header X-JFrog-Override-Base-Url \$http_x_forwarded_proto://\$host:\$server_port;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
location ~ ^/artifactory/ {
proxy_pass http://127.0.0.1:8081;
}
}
}
EOF
mkdir -p /opt/jfrog/artifactory/var/etc/artifactory/
cat <<EOF >/opt/jfrog/artifactory/var/etc/artifactory/artifactory.cluster.license
${ARTIFACTORY_LICENSE_1}
${ARTIFACTORY_LICENSE_2}
${ARTIFACTORY_LICENSE_3}
${ARTIFACTORY_LICENSE_4}
${ARTIFACTORY_LICENSE_5}
EOF
HOSTNAME=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
if [ "${IS_PRIMARY}" = "true" ]; then
NODE_NAME=art-primary
else
NODE_NAME=art-$(date +%s$RANDOM)
fi
# Java options
EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//")
sed -i -e "s/#extraJavaOpts: \"-Xms512m -Xmx2g\"/extraJavaOpts: ${EXTRA_JAVA_OPTS}/" /var/opt/jfrog/artifactory/etc/system.yaml
# Node settings
HOSTNAME=$(hostname -i)
sed -i -e "s/#id: \"art1\"/id: \"${NODE_NAME}\"/" /var/opt/jfrog/artifactory/etc/system.yaml
sed -i -e "s/#ip:/ip: ${HOSTNAME}/" /var/opt/jfrog/artifactory/etc/system.yaml
sed -i -e "s/#primary: true/primary: ${IS_PRIMARY}/" /var/opt/jfrog/artifactory/etc/system.yaml
sed -i -e "s/#haEnabled:/haEnabled:/" /var/opt/jfrog/artifactory/etc/system.yaml
# Set MS SQL configuration
cat <<EOF >>/var/opt/jfrog/artifactory/etc/system.yaml
## One of: mysql, oracle, mssql, postgresql, mariadb
## Default: Embedded derby
## Example for mysql
type: mssql
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: ${DB_URL};databaseName=${DB_NAME};sendStringParametersAsUnicode=false;applicationName=Artifactory Binary Repository
username: ${DB_USER}
password: ${DB_PASSWORD}
EOF
# Create master.key on each node
mkdir -p /opt/jfrog/artifactory/var/etc/security/
cat <<EOF >/opt/jfrog/artifactory/var/etc/security/master.key
${MASTER_KEY}
EOF
# Azure Blob Storage configuration
# https://www.jfrog.com/confluence/display/JFROG/Configuring+the+Filestore#ConfiguringtheFilestore-AzureBlobStorageClusterBinaryProvider
mkdir -p /var/opt/jfrog/artifactory/etc/artifactory/
cat <<EOF >/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml
<config version="2">
<chain template="cluster-azure-blob-storage"/>
<provider id="azure-blob-storage" type="azure-blob-storage">
<accountName>${STORAGE_ACCT}</accountName>
<accountKey>${STORAGE_ACCT_KEY}</accountKey>
<endpoint>https://${STORAGE_ACCT}.blob.core.windows.net/</endpoint>
<containerName>${STORAGE_CONTAINER}</containerName>
</provider>
</config>
EOF
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//" > /tmp/temp.pem
cat /tmp/temp.pem | sed 's/CERTIFICATE----- /&\n/g' | sed 's/ -----END/\n-----END/g' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/certs/cert.pem
rm /tmp/temp.pem
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_KEY=//" > /tmp/temp.key
cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key
rm /tmp/temp.key
chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/*
# start Artifactory
sleep 120
systemctl start artifactory
systemctl start nginx
nginx -s reload
echo "INFO: Artifactory HA installation completed."
echo ""

View File

@@ -0,0 +1,13 @@
#!/bin/bash
ARTIFACTORY_VERSION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_VERSION=" | sed "s/ARTIFACTORY_VERSION=//")
IFS=$'\t'
SUPPORTED_VERSIONS=("6.8.0\t6.11.3\t6.15.0\t0.16.0\t0.17.0\t6.18.0")
unset IFS
if [[ "\t${SUPPORTED_VERSIONS[@]}\t" =~ "\t${ARTIFACTORY_VERSION}\t" ]]; then
sh install_artifactory.sh
echo "\ninstall_artifactory.sh was selected" >> user-data.txt
else
sh install_artifactory7.sh
echo "\ninstall_artifactory7.sh was selected" >> user-data.txt
fi

View File

@@ -0,0 +1,332 @@
{
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
"handler": "Microsoft.Azure.CreateUIDef",
"version": "0.1.2-preview",
"parameters": {
"basics": [
{}
],
"steps": [
{
"name": "vmCredentials",
"label": "VM Credential",
"bladeTitle": "VM Credential",
"subLabel": {
"preValidation": "Provide VM credentials",
"postValidation": "Great - let's move on!"
},
"elements": [
{
"name": "adminUsername",
"type": "Microsoft.Compute.UserNameTextBox",
"label": "Admin username",
"osPlatform": "Linux",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,30}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
},
"toolTip": "Provide admin username for the virtual machine"
},
{
"name": "adminPassword",
"type": "Microsoft.Compute.CredentialsCombo",
"label": {
"password": "Password",
"confirmPassword": "Confirm password"
},
"osPlatform": "Linux",
"constraints": {
"required": true,
"customPasswordRegex": "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{12,}$",
"customValidationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number."
},
"options": {
"hideConfirmation": false
},
"toolTip": {
"password": "Provide admin password for the virtual machine"
},
"visible": true
}
]
},
{
"name": "clusterConfig",
"label": "JFrog Container Registry Cluster settings",
"subLabel": {
"preValidation": "Configure JFrog Container Registry Cluster settings",
"postValidation": "Done!"
},
"bladeTitle": "JFrog Container Registry Cluster Settings",
"elements": [
{
"name": "clusterName",
"type": "Microsoft.Common.TextBox",
"label": "Cluster name",
"toolTip": "Cluster name",
"defaultValue": "",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,30}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
}
},
{
"name": "vmSku",
"type": "Microsoft.Compute.SizeSelector",
"label": "Virtual machine size",
"toolTip": "The size of the virtual machine for JFrog Container Registry",
"recommendedSizes": [
"Standard_A2_v2"
],
"constraints": {
"allowedSizes": [
"Standard_A2_v2",
"Standard_A4_v2",
"Standard_A4",
"Standard_D2s_v3",
"Standard_D4s_v3",
"Standard_DS2_v2",
"Standard_DS3_v2",
"Standard_D2_v2",
"Standard_D3_v2",
"Standard_DC2s",
"Standard_DC4s"
]
},
"osPlatform": "Linux",
"count": 1
},
{
"name": "artifactoryVersion",
"type": "Microsoft.Common.DropDown",
"label": "JFrog Container Registry-vm image version to deploy.",
"defaultValue": "0.16.0",
"toolTip": "Version of JFrog Container Registry to dpeloy",
"constraints": {
"allowedValues": [
{
"label": "6.16.0",
"value": "0.16.0"
}
],
"required": true
},
"visible": true
},
{
"name": "masterKey",
"type": "Microsoft.Common.PasswordBox",
"label": {
"password": "JFrog Container Registry master Key",
"confirmPassword": "Confirm master Key"
},
"defaultValue": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"toolTip": "Master key for JFrog Container Registry cluster. Generate master.key using command '$openssl rand -hex 16'",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,32}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long."
},
"options": {
"hideConfirmation": true
}
},
{
"name": "certificate",
"type": "Microsoft.Common.PasswordBox",
"label": {
"password": "Provide your SSL Certificate.",
"confirmPassword": "Confirm SSL Certificate."
},
"toolTip": "To use JFrog Container Registry as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate.",
"constraints": {
"required": true,
"regex": "^(-----BEGIN CERTIFICATE-----)(.+)(-----END CERTIFICATE-----)$",
"validationMessage": "Provide SSL Certificate."
},
"options": {
"hideConfirmation": true
}
},
{
"name": "certificateKey",
"type": "Microsoft.Common.PasswordBox",
"label": {
"password": "Provide your SSL Certificate key.",
"confirmPassword": "Confirm SSL Certificate key."
},
"toolTip": "Provide your SSL Certificate key",
"constraints": {
"required": true,
"regex": "^(-----BEGIN PRIVATE KEY-----)(.+)(-----END PRIVATE KEY-----)$",
"validationMessage": "Provide SSL Certificate Key."
},
"options": {
"hideConfirmation": true
}
},
{
"name": "certificateDomain",
"type": "Microsoft.Common.TextBox",
"label": "Provide your Certificate Domain Name.",
"defaultValue": "artifactory",
"toolTip": "Provide your Certificate Domain Name. For e.g jfrog.team for certificate with *.jfrog.team",
"constraints": {
"required": true,
"regex": "^(\\*)*([\\w-\\.])+$",
"validationMessage": "Must be a valid fully-qualified domain name."
}
},
{
"name": "artifactoryServerName",
"type": "Microsoft.Common.TextBox",
"label": "Provide JFrog Container Registry server name to be used in Nginx.",
"defaultValue": "artifactory",
"toolTip": "Provide JFrog Container Registry server name to be used in Nginx. e.g artifactory for artifactory.jfrog.team",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,20}$",
"validationMessage": "Only letters and numbers are allowed, and the value must be 1-20 characters long."
}
},
{
"name": "extraJavaOptions",
"type": "Microsoft.Common.TextBox",
"label": "Setting Java Memory Parameters for JFrog Container Registry",
"defaultValue": "-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\"",
"toolTip": "Setting Java Memory Parameters for JFrog Container Registry. Learn about system requirements for JFrog Container Registry https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware",
"constraints": {
"required": false
}
}
]
},
{
"name": "databaseConfig",
"label": "Database Configuration",
"subLabel": {
"preValidation": "Configure the Database",
"postValidation": "Done"
},
"bladeTitle": "Database Credential",
"elements": [
{
"name": "dbAdminUsername",
"type": "Microsoft.Compute.UserNameTextBox",
"label": "User name",
"toolTip": "Admin username for the database",
"osPlatform": "Linux",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,30}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
}
},
{
"name": "dbAdminPassword",
"type": "Microsoft.Common.PasswordBox",
"label": {
"password": "Password",
"confirmPassword": "Confirm password"
},
"toolTip": "Admin password for the database",
"constraints": {
"required": true,
"regex": "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{12,}$",
"validationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number."
},
"options": {
"hideConfirmation": false
},
"visible": true
},
{
"name": "dbName",
"type": "Microsoft.Common.TextBox",
"label": "Database name",
"toolTip": "Database name",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,15}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-15 characters long."
}
},
{
"name": "dbEdition",
"type": "Microsoft.Common.DropDown",
"label": "Database Edition",
"defaultValue": "Basic",
"toolTip": "Edition of Database to use",
"constraints": {
"allowedValues": [
{
"label": "Basic",
"value": "Basic"
},
{
"label": "Standard",
"value": "Standard"
},
{
"label": "Premium",
"value": "Premium"
}
],
"required": true
},
"visible": true
}
]
},
{
"name": "storageConfig",
"label": "Storage settings",
"subLabel": {
"preValidation": "Configure the infrastructure settings",
"postValidation": "Done"
},
"bladeTitle": "Storage settings",
"elements": [
{
"name": "storageAccountsType",
"type": "Microsoft.Common.DropDown",
"label": "Storage account type",
"defaultValue": "Standard_LRS",
"toolTip": "Storage account type",
"constraints": {
"allowedValues": [
{
"label": "Standard_LRS",
"value": "Standard_LRS"
}
],
"required": true
},
"visible": true
}
]
}
],
"outputs": {
"clusterName": "[steps('clusterConfig').clusterName]",
"vmSku": "[steps('clusterConfig').vmSku]",
"location": "[location()]",
"artifactoryVersion": "[steps('clusterConfig').artifactoryVersion]",
"masterKey": "[steps('clusterConfig').masterKey]",
"certificate": "[steps('clusterConfig').certificate]",
"certificateKey": "[steps('clusterConfig').certificateKey]",
"certificateDomain": "[steps('clusterConfig').certificateDomain]",
"artifactoryServerName": "[steps('clusterConfig').artifactoryServerName]",
"extraJavaOptions": "[steps('clusterConfig').extraJavaOptions]",
"adminUsername": "[steps('vmCredentials').adminUsername]",
"adminPassword": "[steps('vmCredentials').adminPassword.password]",
"DB_Admin_User": "[steps('databaseConfig').dbAdminUsername]",
"DB_Admin_Password": "[steps('databaseConfig').dbAdminPassword]",
"DB_Name": "[steps('databaseConfig').dbName]",
"DB_Edition": "[steps('databaseConfig').dbEdition]",
"storageAccountType": "[steps('storageConfig').storageAccountsType]"
}
}
}

View File

@@ -0,0 +1,766 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmSku": {
"type": "string",
"defaultValue": "Standard_A4",
"metadata": {
"description": "Size of VMs in the VM Scale Set."
}
},
"clusterName": {
"type": "string",
"maxLength": 61,
"metadata": {
"description": "String used as a base for naming resources. Must be 3-61 characters in length and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for the resources."
}
},
"artifactoryVersion": {
"type": "string",
"defaultValue": "0.16.0",
"allowedValues": [
"6.6.0",
"6.6.1",
"6.7.0",
"6.8.0",
"0.16.0"
],
"metadata": {
"description": "JFrog Container Registry-vm image version to deploy."
}
},
"masterKey": {
"type": "securestring",
"maxLength": 64,
"metadata": {
"description": "Master key for JFrog Container Registry cluster. Generate master.key using command '$openssl rand -hex 16'"
}
},
"adminUsername": {
"type": "string",
"metadata": {
"description": "Admin username on all VMs. Follow conventions for azure VM admin user name."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Admin password on all VMs. Follow conventions for azure VM admin password rules."
}
},
"certificate": {
"type": "securestring",
"metadata": {
"description": "To use Artifactory as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate."
}
},
"certificateKey": {
"type": "securestring",
"metadata": {
"description": "Provide your SSL Certificate key"
}
},
"certificateDomain": {
"type": "string",
"minLength": 1,
"defaultValue": "artifactory",
"metadata": {
"description": "Provide your Certificate Domain Name. For e.g jfrog.team for certificate with *.jfrog.team"
}
},
"artifactoryServerName": {
"type": "string",
"minLength": 1,
"defaultValue": "artifactory",
"metadata": {
"description": "Provide artifactory server name to be used in Nginx. e.g artifactory for artifactory.jfrog.team"
}
},
"extraJavaOptions": {
"type": "string",
"minLength": 1,
"defaultValue": "-server -Xms2g -Xmx12g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\"",
"metadata": {
"description": "Setting Java Memory Parameters for Artifactory. Learn about system requirements for Artifactory https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware."
}
},
"DB_Admin_User": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Database Admin user name"
}
},
"DB_Admin_Password": {
"type": "securestring",
"minLength": 1,
"metadata": {
"description": "Database Admin password"
}
},
"DB_Name": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Database name"
}
},
"DB_Edition": {
"type": "string",
"minLength": 1,
"defaultValue": "Basic",
"allowedValues": [
"Basic",
"Standard",
"Premium"
],
"metadata": {
"description": "Database Edition"
}
},
"storageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS"
],
"metadata": {
"description": "Storage Account type"
}
},
"_artifactsLocation": {
"type": "string",
"metadata": {
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
},
"defaultValue": "[deployment().properties.templateLink.uri]"
},
"_artifactsLocationSasToken": {
"type": "securestring",
"metadata": {
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated."
},
"defaultValue": ""
}
},
"variables": {
"namingInfix": "[toLower(substring(concat(parameters('clusterName'), uniqueString(resourceGroup().id)), 0, 9))]",
"addressPrefix": "10.0.0.0/16",
"subnetPrimaryPrefix": "10.0.1.0/24",
"subnetMemberPrefix": "10.0.2.0/24",
"virtualNetworkName": "[concat(variables('namingInfix'), 'vnet')]",
"subnetPrimaryName": "[concat(variables('namingInfix'), 'primarySubnet')]",
"subnetMemberName": "[concat(variables('namingInfix'), 'memberSubnet')]",
"scaleSetPrimaryName": "[concat(variables('namingInfix'), 'primaryScaleset')]",
"lbName": "[concat(variables('namingInfix'), 'lb')]",
"bepoolPrimaryName": "[concat(variables('lbName'), 'primaryBepool')]",
"bepoolMemberName": "[concat(variables('lbName'), 'memberBepool')]",
"fepoolPrimaryName": "[concat(variables('lbName'), 'primaryFepool')]",
"fepoolMemberName": "[concat(variables('lbName'), 'memberFepool')]",
"bepoolPrimaryID": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bepoolPrimaryName'))]",
"bepoolMemberID": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bepoolMemberName'))]",
"feIpConfigPrimaryName": "[concat(variables('fepoolPrimaryName'), 'primaryIpConfig')]",
"feIpConfigMemberName": "[concat(variables('fepoolMemberName'), 'memberIpConfig')]",
"feIpConfigPrimaryId": "[resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', variables('lbName'), variables('feIpConfigPrimaryName'))]",
"feIpConfigMemberId": "[resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', variables('lbName'), variables('feIpConfigMemberName'))]",
"pipPrimaryName": "[concat(variables('namingInfix'), 'primaryPip')]",
"pipMemberName": "[concat(variables('namingInfix'), 'memberPip')]",
"nicPrimaryName": "[concat(variables('namingInfix'), 'primaryNic')]",
"nicMemberName": "[concat(variables('namingInfix'), 'memberNic')]",
"natPoolPrimaryName": "[concat(variables('lbName'), 'primaryNatpool')]",
"natPoolMemberName": "[concat(variables('lbName'), 'memberNatpool')]",
"ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]",
"httpProbePrimaryName": "primaryHttpProbe",
"httpsProbePrimaryName": "primaryHttpsProbe",
"httpProbeMemberName": "memberHttpProbe",
"httpsProbeMemberName": "memberHttpsProbe",
"storageAccountName": "[concat(variables('namingInfix'), 'storage')]",
"vmStorageAccountContainerName": "filestore",
"azureSqlServerName": "[concat(variables('namingInfix'), 'sqlsrv')]",
"DB_Name": "[parameters('DB_Name')]",
"DB_Admin_User": "[parameters('DB_Admin_User')]",
"DB_Admin_Password": "[parameters('DB_Admin_Password')]",
"DB_Edition": "[parameters('DB_Edition')]",
"DB_Location": "[parameters('location')]",
"masterKey": "[parameters('masterKey')]",
"certificate": "[parameters('certificate')]",
"certificateKey": "[parameters('certificateKey')]",
"certificateDomain": "[parameters('certificateDomain')]",
"artifactoryServerName": "[parameters('artifactoryServerName')]",
"extraJavaOptions": "[parameters('extraJavaOptions')]",
"osType": {
"publisher": "jfrog",
"offer": "jfrogcontainerregistry-vm",
"sku": "artifactory-jcr",
"version": "[parameters('artifactoryVersion')]"
},
"imageReference": "[variables('osType')]",
"dbTemplate": "azureDBDeploy.json",
"dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]",
"nsgName": "[concat(variables('namingInfix'), 'nsg')]"
},
"resources": [
{
"apiVersion": "2019-05-01",
"name": "pid-04c1c376-5d4b-4771-9a7f-054f5910dcef",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": []
}
}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"location": "[parameters('location')]",
"name": "[variables('nsgName')]",
"apiVersion": "2018-07-01",
"properties": {
"securityRules": [
{
"name": "ssh-rule",
"properties": {
"description": "Allow SSH",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
}
},
{
"name": "http-artifactory-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "8081",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 101,
"direction": "Inbound"
}
},
{
"name": "http-nginx-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "80",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 102,
"direction": "Inbound"
}
},
{
"name": "https-nginx-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "443",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 103,
"direction": "Inbound"
}
},
{
"name": "membership-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "10001",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 105,
"direction": "Inbound"
}
}
]
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-07-01",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetPrimaryName')]",
"properties": {
"addressPrefix": "[variables('subnetPrimaryPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
},
{
"name": "[variables('subnetMemberName')]",
"properties": {
"addressPrefix": "[variables('subnetMemberPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
}
]
}
},
{
"apiVersion": "2018-07-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicPrimaryName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetPrimaryName'))]"
}
}
}
],
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
},
{
"apiVersion": "2018-07-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicMemberName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetMemberName'))]"
}
}
}
],
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('pipPrimaryName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"apiVersion": "2018-07-01",
"properties": {
"publicIPAllocationMethod": "Static",
"dnsSettings": {
"domainNameLabel": "[variables('namingInfix')]"
}
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('pipMemberName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"apiVersion": "2018-07-01",
"properties": {
"publicIPAllocationMethod": "Static",
"dnsSettings": {
"domainNameLabel": "[concat(variables('namingInfix'),'2')]"
}
}
},
{
"type": "Microsoft.Network/loadBalancers",
"name": "[variables('lbName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-07-01",
"sku": {
"name": "Standard"
},
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]"
],
"tags":{
"displayName": "Load Balancer"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "[variables('feIpConfigPrimaryName')]",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipPrimaryName'))]"
}
}
},
{
"name": "[variables('feIpConfigMemberName')]",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipMemberName'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "[variables('bepoolPrimaryName')]"
},
{
"name": "[variables('bepoolMemberName')]"
}
],
"inboundNatPools": [
{
"name": "[variables('natPoolPrimaryName')]",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('feIpConfigPrimaryId')]"
},
"protocol": "tcp",
"frontendPortRangeStart": 10022,
"frontendPortRangeEnd": 11022,
"backendPort": 22
}
},
{
"name": "[variables('natPoolMemberName')]",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('feIpConfigMemberId')]"
},
"protocol": "tcp",
"frontendPortRangeStart": 20022,
"frontendPortRangeEnd": 21022,
"backendPort": 22
}
}
],
"loadBalancingRules": [
{
"name": "HTTPRulePrimary",
"properties": {
"loadDistribution": "Default",
"frontendIPConfiguration": {
"id": "[variables('feIpConfigPrimaryId')]"
},
"backendAddressPool": {
"id": "[variables('bepoolPrimaryID')]"
},
"protocol": "Tcp",
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpProbePrimaryName'))]"
}
}
},
{
"name": "HTTPSRulePrimary",
"properties": {
"loadDistribution": "Default",
"frontendIPConfiguration": {
"id": "[variables('feIpConfigPrimaryId')]"
},
"backendAddressPool": {
"id": "[variables('bepoolPrimaryID')]"
},
"protocol": "Tcp",
"frontendPort": 443,
"backendPort": 443,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpsProbePrimaryName'))]"
}
}
},
{
"name": "HTTPRuleMember",
"properties": {
"loadDistribution": "Default",
"frontendIPConfiguration": {
"id": "[variables('feIpConfigMemberId')]"
},
"backendAddressPool": {
"id": "[variables('bepoolMemberID')]"
},
"protocol": "Tcp",
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpProbeMemberName'))]"
}
}
},
{
"name": "HTTPSRuleMember",
"properties": {
"loadDistribution": "Default",
"frontendIPConfiguration": {
"id": "[variables('feIpConfigMemberId')]"
},
"backendAddressPool": {
"id": "[variables('bepoolMemberID')]"
},
"protocol": "Tcp",
"frontendPort": 443,
"backendPort": 443,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpsProbeMemberName'))]"
}
}
}
],
"probes": [
{
"name": "[variables('httpProbePrimaryName')]",
"properties": {
"protocol": "Http",
"requestPath": "/artifactory/api/system/ping",
"port": 80,
"intervalInSeconds": 60,
"numberOfProbes": 5
}
},
{
"name": "[variables('httpsProbePrimaryName')]",
"properties": {
"protocol": "Tcp",
"port": 443,
"intervalInSeconds": 60,
"numberOfProbes": 5
}
},
{
"name": "[variables('httpProbeMemberName')]",
"properties": {
"protocol": "Http",
"requestPath": "/artifactory/api/system/ping",
"port": 80,
"intervalInSeconds": 60,
"numberOfProbes": 5
}
},
{
"name": "[variables('httpsProbeMemberName')]",
"properties": {
"protocol": "Tcp",
"port": 443,
"intervalInSeconds": 60,
"numberOfProbes": 5
}
}
]
}
},
{
"apiVersion": "2018-07-01",
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[parameters('storageAccountType')]"
},
"tags":{
"displayName": "Artifactory Storage Account"
},
"kind": "Storage",
"properties": {}
},
{
"type": "Microsoft.Resources/deployments",
"name": "deploySQLDB",
"apiVersion": "2018-07-01",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('dbTemplateLocation')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"db_user": {
"value": "[parameters('DB_Admin_User')]"
},
"db_password": {
"value": "[parameters('DB_Admin_Password')]"
},
"db_server": {
"value": "[variables('azureSqlServerName')]"
},
"db_name": {
"value": "[parameters('DB_Name')]"
},
"db_edition": {
"value": "[variables('DB_Edition')]"
},
"db_location": {
"value": "[variables('DB_Location')]"
}
}
}
},
{
"type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[variables('scaleSetPrimaryName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-10-01",
"dependsOn": [
"[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]",
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
],
"plan": {
"name": "artifactory-jcr",
"publisher": "jfrog",
"product": "jfrogcontainerregistry-vm"
},
"sku": {
"name": "[parameters('vmSku')]",
"tier": "Standard",
"capacity": "1"
},
"properties": {
"singlePlacementGroup": true,
"overprovision": "false",
"upgradePolicy": {
"mode": "Manual"
},
"virtualMachineProfile": {
"storageProfile": {
"osDisk": {
"caching": "ReadWrite",
"diskSizeGB": "250",
"createOption": "FromImage"
},
"imageReference": "[variables('imageReference')]"
},
"osProfile": {
"computerNamePrefix": "[variables('namingInfix')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nCERTIFICATE_KEY=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nIS_PRIMARY=','true','\n'))]"
},
"networkProfile": {
"networkInterfaceConfigurations": [
{
"name": "[variables('nicPrimaryName')]",
"properties": {
"primary": true,
"ipConfigurations": [
{
"name": "[concat(variables('ipConfigName'),'1')]",
"properties": {
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetPrimaryName'))]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bePoolPrimaryName'))]"
}
],
"loadBalancerInboundNatPools": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatPools', variables('lbName'), variables('natPoolPrimaryName'))]"
}
]
}
}
]
}
}
]
},
"extensionProfile": {
"extensions": [
{
"name": "extension1",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": false,
"settings": {
"fileUris": [
"[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory.sh', parameters('_artifactsLocationSasToken')))]"
]
},
"protectedSettings": {
"commandToExecute": "sh install_artifactory.sh"
}
}
}
]
}
}
}
}
],
"outputs": {
"fqdn": {
"value": "[reference(resourceId('Microsoft.Network/publicIPAddresses',variables('pipPrimaryName')),'2018-07-01').dnsSettings.fqdn]",
"type": "string"
}
}
}

View File

@@ -0,0 +1,96 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"db_user": {
"type": "string",
"defaultValue": "artifactory",
"minLength": 1
},
"db_password": {
"type": "securestring"
},
"db_server": {
"type": "string",
"defaultValue": "artmssqlsrv",
"minLength": 1
},
"db_name": {
"type": "string",
"defaultValue": "artdb",
"minLength": 1
},
"db_location": {
"type": "string",
"defaultValue": ""
},
"db_edition": {
"type": "string",
"allowedValues": [
"Basic",
"Standard",
"Premium"
]
}
},
"variables": {
"rtdbCollation": "Latin1_General_100_CS_AS",
"db_location": "[parameters('db_location')]"
},
"resources": [
{
"name": "[parameters('db_server')]",
"type": "Microsoft.Sql/servers",
"kind": "v12.0",
"location": "[variables('db_location')]",
"apiVersion": "2019-06-01-preview",
"tags": {
"displayName": "artifactoryDB"
},
"properties": {
"administratorLogin": "[parameters('db_user')]",
"administratorLoginPassword": "[parameters('db_password')]",
"version": "12.0"
},
"resources": [
{
"name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]",
"type": "firewallrules",
"location": "[variables('db_location')]",
"apiVersion": "2019-06-01-preview",
"dependsOn": [
"[concat('Microsoft.Sql/servers/', parameters('db_server'))]"
],
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "0.0.0.0"
}
},
{
"name": "[parameters('db_name')]",
"type": "databases",
"kind": "v12.0,user",
"location": "[variables('db_location')]",
"apiVersion": "2019-06-01-preview",
"dependsOn": [
"[parameters('db_server')]"
],
"tags": {
"displayName": "artifactoryDB"
},
"properties": {
"edition": "[parameters('db_edition')]",
"maxSizeBytes": "1073741824",
"collation": "[variables('rtdbCollation')]"
}
}
]
}
],
"outputs": {
"jdbcConnString": {
"type": "string",
"value": "[concat('jdbc:sqlserver://', reference(concat('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]"
}
}
}

View File

@@ -0,0 +1,206 @@
#!/bin/bash
DB_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JDBC_STR" | sed "s/JDBC_STR=//")
DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//")
DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//")
DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//")
STORAGE_ACCT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_NAME=" | sed "s/STO_ACT_NAME=//")
STORAGE_ACT_ENDPOINT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_ENDPOINT=" | sed "s/STO_ACT_ENDPOINT=//")
STORAGE_CONTAINER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_CTR_NAME=" | sed "s/STO_CTR_NAME=//")
STORAGE_ACCT_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_KEY=" | sed "s/STO_ACT_KEY=//")
MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//")
IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//")
UBUNTU_CODENAME=$(cat /etc/lsb-release | grep "^DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//")
export DEBIAN_FRONTEND=noninteractive
#Generate Self-Signed Cert
mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/
openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost"
CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//")
[ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory
ARTIFACTORY_SERVER_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_SERVER_NAME=" | sed "s/ARTIFACTORY_SERVER_NAME=//")
[ -z "$ARTIFACTORY_SERVER_NAME" ] && ARTIFACTORY_SERVER_NAME=artifactory
#Configuring nginx
rm /etc/nginx/sites-enabled/default
cat <<EOF >/etc/nginx/nginx.conf
#user nobody;
worker_processes 1;
error_log /var/log/nginx/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
variables_hash_max_size 1024;
variables_hash_bucket_size 64;
server_names_hash_max_size 4096;
server_names_hash_bucket_size 128;
types_hash_max_size 2048;
types_hash_bucket_size 64;
proxy_read_timeout 2400s;
client_header_timeout 2400s;
client_body_timeout 2400s;
proxy_connect_timeout 75s;
proxy_send_timeout 2400s;
proxy_buffer_size 32k;
proxy_buffers 40 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 250m;
proxy_http_version 1.1;
client_body_buffer_size 128k;
include /etc/nginx/conf.d/*.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
}
EOF
cat <<EOF >/etc/nginx/conf.d/artifactory.conf
ssl_certificate /etc/pki/tls/certs/cert.pem;
ssl_certificate_key /etc/pki/tls/private/cert.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers on;
## server configuration
server {
listen 443 ssl;
listen 80 ;
server_name ~(?<repo>.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN};
if (\$http_x_forwarded_proto = '') {
set \$http_x_forwarded_proto \$scheme;
}
## Application specific logs
## access_log /var/log/nginx/artifactory-access.log timing;
## error_log /var/log/nginx/artifactory-error.log;
rewrite ^/$ /artifactory/webapp/ redirect;
rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/\$repo/\$1/\$2;
chunked_transfer_encoding on;
client_max_body_size 0;
location /artifactory/ {
proxy_read_timeout 2400;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:8081/artifactory/;
proxy_set_header X-Artifactory-Override-Base-Url
\$http_x_forwarded_proto://\$host:\$server_port/artifactory;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
}
EOF
HOSTNAME=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
if [ "${IS_PRIMARY}" = "true" ]; then
NODE_NAME=art-primary
else
NODE_NAME=art-$(date +%s$RANDOM)
fi
cat <<EOF >/var/opt/jfrog/artifactory/etc/ha-node.properties
node.id=${NODE_NAME}
artifactory.ha.data.dir=/var/opt/jfrog/artifactory/data
context.url=http://${HOSTNAME}:8081/artifactory
access.context.url=http://${HOSTNAME}:8081/access
membership.port=10001
hazelcast.interface=${HOSTNAME}
primary=${IS_PRIMARY}
EOF
cat <<EOF >/var/opt/jfrog/artifactory/etc/db.properties
type=mssql
driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
url=${DB_URL};databaseName=${DB_NAME};sendStringParametersAsUnicode=false;applicationName=Artifactory Binary Repository
username=${DB_USER}
password=${DB_PASSWORD}
EOF
mkdir -p /var/opt/jfrog/artifactory/etc/security
cat <<EOF >/var/opt/jfrog/artifactory/etc/security/master.key
${MASTER_KEY}
EOF
cat <<EOF >/var/opt/jfrog/artifactory/etc/binarystore.xml
<config version="2">
<chain>
<provider id="cache-fs-eventual-azure-blob-storage" type="cache-fs">
<provider id="sharding-cluster-eventual-azure-blob-storage" type="sharding-cluster">
<sub-provider id="eventual-cluster-azure-blob-storage" type="eventual-cluster">
<provider id="retry-azure-blob-storage" type="retry">
<provider id="azure-blob-storage" type="azure-blob-storage"/>
</provider>
</sub-provider>
<dynamic-provider id="remote-azure-blob-storage" type="remote"/>
</provider>
</provider>
</chain>
<!-- cluster eventual Azure Blob Storage Service default chain -->
<provider id="sharding-cluster-eventual-azure-blob-storage" type="sharding-cluster">
<readBehavior>crossNetworkStrategy</readBehavior>
<writeBehavior>crossNetworkStrategy</writeBehavior>
<redundancy>2</redundancy>
<lenientLimit>1</lenientLimit>
<property name="zones" value="local,remote"/>
</provider>
<provider id="remote-azure-blob-storage" type="remote">
<zone>remote</zone>
</provider>
<provider id="eventual-cluster-azure-blob-storage" type="eventual-cluster">
<zone>local</zone>
</provider>
<!--cluster eventual template-->
<provider id="azure-blob-storage" type="azure-blob-storage">
<accountName>${STORAGE_ACCT}</accountName>
<accountKey>${STORAGE_ACCT_KEY}</accountKey>
<endpoint>${STORAGE_ACT_ENDPOINT}</endpoint>
<containerName>${STORAGE_CONTAINER}</containerName>
</provider>
</config>
EOF
HOSTNAME=$(hostname -i)
sed -i -e "s/art1/art-$(date +%s$RANDOM)/" /var/opt/jfrog/artifactory/etc/ha-node.properties
sed -i -e "s/127.0.0.1/$HOSTNAME/" /var/opt/jfrog/artifactory/etc/ha-node.properties
sed -i -e "s/172.25.0.3/$HOSTNAME/" /var/opt/jfrog/artifactory/etc/ha-node.properties
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//" > /tmp/temp.pem
cat /tmp/temp.pem | sed 's/CERTIFICATE----- /&\n/g' | sed 's/ -----END/\n-----END/g' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/certs/cert.pem
rm /tmp/temp.pem
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_KEY=//" > /tmp/temp.key
cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key
rm /tmp/temp.key
EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//")
[ -z "$EXTRA_JAVA_OPTS" ] && EXTRA_JAVA_OPTS='-server -Xms2g -Xmx6g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError="kill -9 %p"'
echo "export JAVA_OPTIONS=\"${EXTRA_JAVA_OPTS}\"" >> /var/opt/jfrog/artifactory/etc/default
chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/*
# start Artifactory
sleep $((RANDOM % 240))
service artifactory start
service nginx start
nginx -s reload
echo "INFO: Artifactory installation completed." > /tmp/artifactory-install.log

View File

@@ -0,0 +1,341 @@
{
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
"handler": "Microsoft.Azure.CreateUIDef",
"version": "0.1.2-preview",
"parameters": {
"basics": [
{}
],
"steps": [
{
"name": "vmCredentials",
"label": "VM Credential",
"bladeTitle": "VM Credential",
"subLabel": {
"preValidation": "Provide VM credentials",
"postValidation": "Great - let's move on!"
},
"elements": [
{
"name": "adminUsername",
"type": "Microsoft.Compute.UserNameTextBox",
"label": "Admin username",
"osPlatform": "Linux",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,30}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
},
"toolTip": "Provide admin username for the virtual machine"
},
{
"name": "adminPassword",
"type": "Microsoft.Compute.CredentialsCombo",
"label": {
"password": "Password",
"confirmPassword": "Confirm password"
},
"osPlatform": "Linux",
"constraints": {
"required": true,
"customPasswordRegex": "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{12,}$",
"customValidationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number."
},
"options": {
"hideConfirmation": false
},
"toolTip": {
"password": "Provide admin password for the virtual machine"
},
"visible": true
}
]
},
{
"name": "clusterConfig",
"label": "JFrog Container Registry Cluster settings",
"subLabel": {
"preValidation": "Configure JFrog Container Registry Cluster settings",
"postValidation": "Done!"
},
"bladeTitle": "JFrog Container Registry Cluster Settings",
"elements": [
{
"name": "clusterName",
"type": "Microsoft.Common.TextBox",
"label": "Cluster name",
"toolTip": "Cluster name",
"defaultValue": "",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,30}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
}
},
{
"name": "vmSku",
"type": "Microsoft.Compute.SizeSelector",
"label": "Virtual machine size",
"toolTip": "The size of the virtual machine for JFrog Container Registry",
"recommendedSizes": [
"Standard_A2_v2"
],
"constraints": {
"allowedSizes": [
"Standard_A2_v2",
"Standard_A4_v2",
"Standard_A4",
"Standard_D2s_v3",
"Standard_D4s_v3",
"Standard_DS2_v2",
"Standard_DS3_v2",
"Standard_D2_v2",
"Standard_D3_v2",
"Standard_DC2s",
"Standard_DC4s"
]
},
"osPlatform": "Linux",
"count": 1
},
{
"name": "artifactoryVersion",
"type": "Microsoft.Common.DropDown",
"label": "JFrog Container Registry-vm image version to deploy.",
"defaultValue": "7.4.3",
"toolTip": "Version of JFrog Container Registry to deploy",
"constraints": {
"allowedValues": [
{
"label": "7.2.1",
"value": "7.2.1"
},
{
"label": "7.3.2",
"value": "7.3.2"
},
{
"label": "7.4.3",
"value": "7.4.3"
}
],
"required": true
},
"visible": true
},
{
"name": "masterKey",
"type": "Microsoft.Common.PasswordBox",
"label": {
"password": "JFrog Container Registry master Key",
"confirmPassword": "Confirm master Key"
},
"toolTip": "Master key for JFrog Container Registry cluster. Generate master.key using command '$openssl rand -hex 16'",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,32}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long."
},
"options": {
"hideConfirmation": true
}
},
{
"name": "certificate",
"type": "Microsoft.Common.PasswordBox",
"label": {
"password": "Provide your SSL Certificate.",
"confirmPassword": "Confirm SSL Certificate."
},
"toolTip": "To use JFrog Container Registry as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate.",
"constraints": {
"required": true,
"regex": "^(-----BEGIN CERTIFICATE-----)(.+)(-----END CERTIFICATE-----)$",
"validationMessage": "Provide SSL Certificate."
},
"options": {
"hideConfirmation": true
}
},
{
"name": "certificateKey",
"type": "Microsoft.Common.PasswordBox",
"label": {
"password": "Provide your SSL Certificate key.",
"confirmPassword": "Confirm SSL Certificate key."
},
"toolTip": "Provide your SSL Certificate key",
"constraints": {
"required": true,
"regex": "^(-----BEGIN)(.+)(PRIVATE KEY-----)(.+)(-----END)(.+)(PRIVATE KEY-----)$",
"validationMessage": "Provide SSL Certificate Key."
},
"options": {
"hideConfirmation": true
}
},
{
"name": "certificateDomain",
"type": "Microsoft.Common.TextBox",
"label": "Provide your Certificate Domain Name.",
"defaultValue": "artifactory",
"toolTip": "Provide your Certificate Domain Name. For e.g jfrog.team for certificate with *.jfrog.team",
"constraints": {
"required": true,
"regex": "^(\\*)*([\\w-\\.])+$",
"validationMessage": "Must be a valid fully-qualified domain name."
}
},
{
"name": "artifactoryServerName",
"type": "Microsoft.Common.TextBox",
"label": "Provide JFrog Container Registry server name to be used in Nginx.",
"defaultValue": "artifactory",
"toolTip": "Provide JFrog Container Registry server name to be used in Nginx. e.g artifactory for artifactory.jfrog.team",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,20}$",
"validationMessage": "Only letters and numbers are allowed, and the value must be 1-20 characters long."
}
},
{
"name": "extraJavaOptions",
"type": "Microsoft.Common.TextBox",
"label": "Setting Java Memory Parameters for JFrog Container Registry",
"defaultValue": "-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\"",
"toolTip": "Setting Java Memory Parameters for JFrog Container Registry. Learn about system requirements for JFrog Container Registry https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware",
"constraints": {
"required": false,
"regex": "[^a-zA-Z0-9]+\\S+\\D",
"validationMessage": "Example: -server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\""
}
}
]
},
{
"name": "databaseConfig",
"label": "Database Configuration",
"subLabel": {
"preValidation": "Configure the Database",
"postValidation": "Done"
},
"bladeTitle": "Database Credential",
"elements": [
{
"name": "dbAdminUsername",
"type": "Microsoft.Compute.UserNameTextBox",
"label": "User name",
"toolTip": "Admin username for the database",
"osPlatform": "Linux",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,30}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
}
},
{
"name": "dbAdminPassword",
"type": "Microsoft.Common.PasswordBox",
"label": {
"password": "Password",
"confirmPassword": "Confirm password"
},
"toolTip": "Admin password for the database",
"constraints": {
"required": true,
"regex": "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{12,}$",
"validationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number."
},
"options": {
"hideConfirmation": false
},
"visible": true
},
{
"name": "dbName",
"type": "Microsoft.Common.TextBox",
"label": "Database name",
"toolTip": "Database name",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,15}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-15 characters long."
}
},
{
"name": "dbEdition",
"type": "Microsoft.Common.DropDown",
"label": "Database Edition",
"defaultValue": "Basic",
"toolTip": "Edition of Database to use",
"constraints": {
"allowedValues": [
{
"label": "Basic",
"value": "Basic"
},
{
"label": "Standard",
"value": "Standard"
},
{
"label": "Premium",
"value": "Premium"
}
],
"required": true
},
"visible": true
}
]
},
{
"name": "storageConfig",
"label": "Storage settings",
"subLabel": {
"preValidation": "Configure the infrastructure settings",
"postValidation": "Done"
},
"bladeTitle": "Storage settings",
"elements": [
{
"name": "storageAccountsType",
"type": "Microsoft.Common.DropDown",
"label": "Storage account type",
"defaultValue": "Standard_LRS",
"toolTip": "Storage account type",
"constraints": {
"allowedValues": [
{
"label": "Standard_LRS",
"value": "Standard_LRS"
}
],
"required": true
},
"visible": true
}
]
}
],
"outputs": {
"clusterName": "[steps('clusterConfig').clusterName]",
"vmSku": "[steps('clusterConfig').vmSku]",
"location": "[location()]",
"artifactoryVersion": "[steps('clusterConfig').artifactoryVersion]",
"masterKey": "[steps('clusterConfig').masterKey]",
"certificate": "[steps('clusterConfig').certificate]",
"certificateKey": "[steps('clusterConfig').certificateKey]",
"certificateDomain": "[steps('clusterConfig').certificateDomain]",
"artifactoryServerName": "[steps('clusterConfig').artifactoryServerName]",
"extraJavaOptions": "[steps('clusterConfig').extraJavaOptions]",
"adminUsername": "[steps('vmCredentials').adminUsername]",
"adminPassword": "[steps('vmCredentials').adminPassword.password]",
"DB_Admin_User": "[steps('databaseConfig').dbAdminUsername]",
"DB_Admin_Password": "[steps('databaseConfig').dbAdminPassword]",
"DB_Name": "[steps('databaseConfig').dbName]",
"DB_Edition": "[steps('databaseConfig').dbEdition]",
"storageAccountType": "[steps('storageConfig').storageAccountsType]"
}
}
}

View File

@@ -0,0 +1,619 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmSku": {
"type": "string",
"defaultValue": "Standard_A2_v2",
"metadata": {
"description": "Size of VMs in the VM Scale Set."
}
},
"clusterName": {
"type": "string",
"maxLength": 61,
"metadata": {
"description": "String used as a base for naming resources. Must be 3-61 characters in length and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for the resources."
}
},
"artifactoryVersion": {
"type": "string",
"defaultValue": "7.4.3",
"allowedValues": [
"7.2.1",
"7.3.2",
"7.4.3"
],
"metadata": {
"description": "JFrog Container Registry-vm image version to deploy."
}
},
"masterKey": {
"type": "securestring",
"maxLength": 64,
"metadata": {
"description": "Master key for JFrog Container Registry cluster. Generate master.key using command '$openssl rand -hex 16'"
}
},
"adminUsername": {
"type": "string",
"metadata": {
"description": "Admin username on all VMs. Follow conventions for azure VM admin user name."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Admin password on all VMs. Follow conventions for azure VM admin password rules."
}
},
"certificate": {
"type": "securestring",
"metadata": {
"description": "To use Artifactory as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate."
}
},
"certificateKey": {
"type": "securestring",
"metadata": {
"description": "Provide your SSL Certificate key"
}
},
"certificateDomain": {
"type": "string",
"minLength": 1,
"defaultValue": "artifactory",
"metadata": {
"description": "Provide your Certificate Domain Name. For e.g jfrog.team for certificate with *.jfrog.team"
}
},
"artifactoryServerName": {
"type": "string",
"minLength": 1,
"defaultValue": "artifactory",
"metadata": {
"description": "Provide artifactory server name to be used in Nginx. e.g artifactory for artifactory.jfrog.team"
}
},
"extraJavaOptions": {
"type": "string",
"minLength": 1,
"defaultValue": "-server -Xms2g -Xmx12g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\"",
"metadata": {
"description": "Setting Java Memory Parameters for Artifactory. Learn about system requirements for Artifactory https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware."
}
},
"DB_Admin_User": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Database Admin user name"
}
},
"DB_Admin_Password": {
"type": "securestring",
"minLength": 1,
"metadata": {
"description": "Database Admin password"
}
},
"DB_Name": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Database name"
}
},
"DB_Edition": {
"type": "string",
"minLength": 1,
"defaultValue": "Basic",
"allowedValues": [
"Basic",
"Standard",
"Premium"
],
"metadata": {
"description": "Database Edition"
}
},
"storageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS"
],
"metadata": {
"description": "Storage Account type"
}
},
"_artifactsLocation": {
"type": "string",
"metadata": {
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
},
"defaultValue": "[deployment().properties.templateLink.uri]"
},
"_artifactsLocationSasToken": {
"type": "securestring",
"metadata": {
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated."
},
"defaultValue": ""
}
},
"variables": {
"namingInfix": "[toLower(substring(concat(parameters('clusterName'), uniqueString(resourceGroup().id)), 0, 9))]",
"addressPrefix": "10.0.0.0/16",
"subnetPrimaryPrefix": "10.0.1.0/24",
"virtualNetworkName": "[concat(variables('namingInfix'), 'vnet')]",
"subnetPrimaryName": "[concat(variables('namingInfix'), 'primarySubnet')]",
"scaleSetPrimaryName": "[concat(variables('namingInfix'), 'primaryScaleset')]",
"lbName": "[concat(variables('namingInfix'), 'lb')]",
"bepoolPrimaryName": "[concat(variables('lbName'), 'primaryBepool')]",
"fepoolPrimaryName": "[concat(variables('lbName'), 'primaryFepool')]",
"bepoolPrimaryID": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bepoolPrimaryName'))]",
"feIpConfigPrimaryName": "[concat(variables('fepoolPrimaryName'), 'primaryIpConfig')]",
"feIpConfigPrimaryId": "[resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', variables('lbName'), variables('feIpConfigPrimaryName'))]",
"pipPrimaryName": "[concat(variables('namingInfix'), 'primaryPip')]",
"nicPrimaryName": "[concat(variables('namingInfix'), 'primaryNic')]",
"natPoolPrimaryName": "[concat(variables('lbName'), 'primaryNatpool')]",
"ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]",
"httpProbePrimaryName": "primaryHttpProbe",
"httpsProbePrimaryName": "primaryHttpsProbe",
"storageAccountName": "[concat(variables('namingInfix'), 'storage')]",
"vmStorageAccountContainerName": "filestore",
"azureSqlServerName": "[concat(variables('namingInfix'), 'sqlsrv')]",
"DB_Name": "[parameters('DB_Name')]",
"DB_Admin_User": "[parameters('DB_Admin_User')]",
"DB_Admin_Password": "[parameters('DB_Admin_Password')]",
"DB_Edition": "[parameters('DB_Edition')]",
"DB_Location": "[parameters('location')]",
"masterKey": "[parameters('masterKey')]",
"certificate": "[parameters('certificate')]",
"certificateKey": "[parameters('certificateKey')]",
"certificateDomain": "[parameters('certificateDomain')]",
"artifactoryServerName": "[parameters('artifactoryServerName')]",
"extraJavaOptions": "[parameters('extraJavaOptions')]",
"osType": {
"publisher": "jfrog",
"offer": "jfrogcontainerregistry-vm",
"sku": "artifactory-jcr",
"version": "[parameters('artifactoryVersion')]"
},
"imageReference": "[variables('osType')]",
"dbTemplate": "azureDBDeploy.json",
"dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]",
"nsgName": "[concat(variables('namingInfix'), 'nsg')]"
},
"resources": [
{
"apiVersion": "2019-05-01",
"name": "pid-04c1c376-5d4b-4771-9a7f-054f5910dcef",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": []
}
}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"location": "[parameters('location')]",
"name": "[variables('nsgName')]",
"apiVersion": "2018-07-01",
"properties": {
"securityRules": [
{
"name": "ssh-rule",
"properties": {
"description": "Allow SSH",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
}
},
{
"name": "http-artifactory-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "8081",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 101,
"direction": "Inbound"
}
},
{
"name": "http-nginx-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "80",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 102,
"direction": "Inbound"
}
},
{
"name": "https-nginx-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "443",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 103,
"direction": "Inbound"
}
},
{
"name": "membership-rule",
"properties": {
"description": "Allow HTTP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "10001",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 105,
"direction": "Inbound"
}
}
]
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-07-01",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetPrimaryName')]",
"properties": {
"addressPrefix": "[variables('subnetPrimaryPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
}
]
}
},
{
"apiVersion": "2018-07-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicPrimaryName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetPrimaryName'))]"
}
}
}
],
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
}
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('pipPrimaryName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"apiVersion": "2018-07-01",
"properties": {
"publicIPAllocationMethod": "Static",
"dnsSettings": {
"domainNameLabel": "[variables('namingInfix')]"
}
}
},
{
"type": "Microsoft.Network/loadBalancers",
"name": "[variables('lbName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-07-01",
"sku": {
"name": "Standard"
},
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]"
],
"tags":{
"displayName": "Load Balancer"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "[variables('feIpConfigPrimaryName')]",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipPrimaryName'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "[variables('bepoolPrimaryName')]"
}
],
"inboundNatPools": [
{
"name": "[variables('natPoolPrimaryName')]",
"properties": {
"frontendIPConfiguration": {
"id": "[variables('feIpConfigPrimaryId')]"
},
"protocol": "tcp",
"frontendPortRangeStart": 10022,
"frontendPortRangeEnd": 11022,
"backendPort": 22
}
}
],
"loadBalancingRules": [
{
"name": "HTTPRulePrimary",
"properties": {
"loadDistribution": "Default",
"frontendIPConfiguration": {
"id": "[variables('feIpConfigPrimaryId')]"
},
"backendAddressPool": {
"id": "[variables('bepoolPrimaryID')]"
},
"protocol": "Tcp",
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpProbePrimaryName'))]"
}
}
},
{
"name": "HTTPSRulePrimary",
"properties": {
"loadDistribution": "Default",
"frontendIPConfiguration": {
"id": "[variables('feIpConfigPrimaryId')]"
},
"backendAddressPool": {
"id": "[variables('bepoolPrimaryID')]"
},
"protocol": "Tcp",
"frontendPort": 443,
"backendPort": 443,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpsProbePrimaryName'))]"
}
}
}
],
"probes": [
{
"name": "[variables('httpProbePrimaryName')]",
"properties": {
"protocol": "Http",
"requestPath": "/artifactory/api/system/ping",
"port": 80,
"intervalInSeconds": 60,
"numberOfProbes": 5
}
},
{
"name": "[variables('httpsProbePrimaryName')]",
"properties": {
"protocol": "Tcp",
"port": 443,
"intervalInSeconds": 60,
"numberOfProbes": 5
}
}
]
}
},
{
"apiVersion": "2018-07-01",
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[parameters('storageAccountType')]"
},
"tags":{
"displayName": "Artifactory Storage Account"
},
"kind": "Storage",
"properties": {}
},
{
"type": "Microsoft.Resources/deployments",
"name": "deploySQLDB",
"apiVersion": "2018-07-01",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('dbTemplateLocation')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"db_user": {
"value": "[parameters('DB_Admin_User')]"
},
"db_password": {
"value": "[parameters('DB_Admin_Password')]"
},
"db_server": {
"value": "[variables('azureSqlServerName')]"
},
"db_name": {
"value": "[parameters('DB_Name')]"
},
"db_edition": {
"value": "[variables('DB_Edition')]"
},
"db_location": {
"value": "[variables('DB_Location')]"
}
}
}
},
{
"type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[variables('scaleSetPrimaryName')]",
"location": "[parameters('location')]",
"apiVersion": "2018-10-01",
"dependsOn": [
"[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]",
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
],
"plan": {
"name": "artifactory-jcr",
"publisher": "jfrog",
"product": "jfrogcontainerregistry-vm"
},
"sku": {
"name": "[parameters('vmSku')]",
"tier": "Standard",
"capacity": "1"
},
"properties": {
"singlePlacementGroup": true,
"overprovision": "false",
"upgradePolicy": {
"mode": "Manual"
},
"virtualMachineProfile": {
"storageProfile": {
"osDisk": {
"caching": "ReadWrite",
"diskSizeGB": "250",
"createOption": "FromImage"
},
"imageReference": "[variables('imageReference')]"
},
"osProfile": {
"computerNamePrefix": "[variables('namingInfix')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nCERTIFICATE_KEY=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nIS_PRIMARY=','true','\n'))]"
},
"networkProfile": {
"networkInterfaceConfigurations": [
{
"name": "[variables('nicPrimaryName')]",
"properties": {
"primary": true,
"ipConfigurations": [
{
"name": "[concat(variables('ipConfigName'),'1')]",
"properties": {
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetPrimaryName'))]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bePoolPrimaryName'))]"
}
],
"loadBalancerInboundNatPools": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatPools', variables('lbName'), variables('natPoolPrimaryName'))]"
}
]
}
}
]
}
}
]
},
"extensionProfile": {
"extensions": [
{
"name": "extension1",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": false,
"settings": {
"fileUris": [
"[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory7.sh', parameters('_artifactsLocationSasToken')))]"
]
},
"protectedSettings": {
"commandToExecute": "sh install_artifactory7.sh"
}
}
}
]
}
}
}
}
],
"outputs": {
"fqdn": {
"value": "[reference(resourceId('Microsoft.Network/publicIPAddresses',variables('pipPrimaryName')),'2018-07-01').dnsSettings.fqdn]",
"type": "string"
}
}
}

View File

@@ -0,0 +1,96 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"db_user": {
"type": "string",
"defaultValue": "artifactory",
"minLength": 1
},
"db_password": {
"type": "securestring"
},
"db_server": {
"type": "string",
"defaultValue": "artmssqlsrv",
"minLength": 1
},
"db_name": {
"type": "string",
"defaultValue": "artdb",
"minLength": 1
},
"db_location": {
"type": "string",
"defaultValue": ""
},
"db_edition": {
"type": "string",
"allowedValues": [
"Basic",
"Standard",
"Premium"
]
}
},
"variables": {
"rtdbCollation": "Latin1_General_100_CS_AS",
"db_location": "[parameters('db_location')]"
},
"resources": [
{
"name": "[parameters('db_server')]",
"type": "Microsoft.Sql/servers",
"kind": "v12.0",
"location": "[variables('db_location')]",
"apiVersion": "2019-06-01-preview",
"tags": {
"displayName": "artifactoryDB"
},
"properties": {
"administratorLogin": "[parameters('db_user')]",
"administratorLoginPassword": "[parameters('db_password')]",
"version": "12.0"
},
"resources": [
{
"name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]",
"type": "firewallrules",
"location": "[variables('db_location')]",
"apiVersion": "2019-06-01-preview",
"dependsOn": [
"[concat('Microsoft.Sql/servers/', parameters('db_server'))]"
],
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "0.0.0.0"
}
},
{
"name": "[parameters('db_name')]",
"type": "databases",
"kind": "v12.0,user",
"location": "[variables('db_location')]",
"apiVersion": "2019-06-01-preview",
"dependsOn": [
"[parameters('db_server')]"
],
"tags": {
"displayName": "artifactoryDB"
},
"properties": {
"edition": "[parameters('db_edition')]",
"maxSizeBytes": "1073741824",
"collation": "[variables('rtdbCollation')]"
}
}
]
}
],
"outputs": {
"jdbcConnString": {
"type": "string",
"value": "[concat('jdbc:sqlserver://', reference(concat('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]"
}
}
}

View File

@@ -0,0 +1,178 @@
#!/bin/bash
DB_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JDBC_STR" | sed "s/JDBC_STR=//")
DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//")
DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//")
DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//")
STORAGE_ACCT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_NAME=" | sed "s/STO_ACT_NAME=//")
STORAGE_ACT_ENDPOINT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_ENDPOINT=" | sed "s/STO_ACT_ENDPOINT=//")
STORAGE_CONTAINER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_CTR_NAME=" | sed "s/STO_CTR_NAME=//")
STORAGE_ACCT_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_KEY=" | sed "s/STO_ACT_KEY=//")
MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//")
IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//")
export DEBIAN_FRONTEND=noninteractive
#Generate Self-Signed Cert
mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/
openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost"
CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//")
[ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory
ARTIFACTORY_SERVER_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_SERVER_NAME=" | sed "s/ARTIFACTORY_SERVER_NAME=//")
[ -z "$ARTIFACTORY_SERVER_NAME" ] && ARTIFACTORY_SERVER_NAME=artifactory
#Configuring nginx
rm /etc/nginx/sites-enabled/default
cat <<EOF >/etc/nginx/nginx.conf
#user nobody;
worker_processes 1;
error_log /var/log/nginx/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
variables_hash_max_size 1024;
variables_hash_bucket_size 64;
server_names_hash_max_size 4096;
server_names_hash_bucket_size 128;
types_hash_max_size 2048;
types_hash_bucket_size 64;
proxy_read_timeout 2400s;
client_header_timeout 2400s;
client_body_timeout 2400s;
proxy_connect_timeout 75s;
proxy_send_timeout 2400s;
proxy_buffer_size 32k;
proxy_buffers 40 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 250m;
proxy_http_version 1.1;
client_body_buffer_size 128k;
include /etc/nginx/conf.d/*.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
}
EOF
cat <<EOF >/etc/nginx/conf.d/artifactory.conf
ssl_certificate /etc/pki/tls/certs/cert.pem;
ssl_certificate_key /etc/pki/tls/private/cert.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers on;
## server configuration
server {
listen 443 ssl;
listen 80 ;
server_name ~(?<repo>.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN};
if (\$http_x_forwarded_proto = '') {
set \$http_x_forwarded_proto \$scheme;
}
## Application specific logs
## access_log /var/log/nginx/artifactory-access.log timing;
## error_log /var/log/nginx/artifactory-error.log;
rewrite ^/$ /artifactory/webapp/ redirect;
rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
chunked_transfer_encoding on;
client_max_body_size 0;
location /artifactory/ {
proxy_read_timeout 2400;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:8081/artifactory/;
proxy_set_header X-Artifactory-Override-Base-Url
\$http_x_forwarded_proto://\$host:\$server_port/artifactory;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
location / {
proxy_read_timeout 2400;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:8082;
proxy_set_header X-Artifactory-Override-Base-Url \$http_x_forwarded_proto://\$host:\$server_port/artifactory;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
}
EOF
HOSTNAME=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
if [ "${IS_PRIMARY}" = "true" ]; then
NODE_NAME=art-primary
else
NODE_NAME=art-$(date +%s$RANDOM)
fi
# Java options
EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//")
sed -i -e "s/#extraJavaOpts: \"-Xms512m -Xmx2g\"/extraJavaOpts: ${EXTRA_JAVA_OPTS}/" /var/opt/jfrog/artifactory/etc/system.yaml
# Set MS SQL configuration
cat <<EOF >>/var/opt/jfrog/artifactory/etc/system.yaml
## One of: mysql, oracle, mssql, postgresql, mariadb
## Default: Embedded derby
## Example for mysql
type: mssql
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: ${DB_URL};databaseName=${DB_NAME};sendStringParametersAsUnicode=false;applicationName=Artifactory Binary Repository
username: ${DB_USER}
password: ${DB_PASSWORD}
EOF
mkdir -p /var/opt/jfrog/artifactory/etc/security
cat <<EOF >/opt/jfrog/artifactory/var/etc/security/master.key
${MASTER_KEY}
EOF
# NOTE: Path is changed in Artifactory 7. Non-HA configuration
mkdir -p /var/opt/jfrog/artifactory/etc/artifactory
cat <<EOF >/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml
<config version="1">
<chain template="azure-blob-storage"/>
<provider id="azure-blob-storage" type="azure-blob-storage">
<accountName>${STORAGE_ACCT}</accountName>
<accountKey>${STORAGE_ACCT_KEY}</accountKey>
<endpoint>https://${STORAGE_ACCT}.blob.core.windows.net/</endpoint>
<containerName>${STORAGE_CONTAINER}</containerName>
</provider>
</config>
EOF
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//" > /tmp/temp.pem
cat /tmp/temp.pem | sed 's/CERTIFICATE----- /&\n/g' | sed 's/ -----END/\n-----END/g' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/certs/cert.pem
rm /tmp/temp.pem
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_KEY=//" > /tmp/temp.key
cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key
rm /tmp/temp.key
chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/*
# start Artifactory
sleep $((RANDOM % 240))
service artifactory start
service nginx start
nginx -s reload
echo "INFO: Artifactory installation completed." >> /tmp/artifactory-install.log

0
JFrogContainerRegistry/AzureResourceManager/README.md Executable file → Normal file
View File

View File

@@ -11,40 +11,37 @@
}, },
"clusterName": { "clusterName": {
"type": "string", "type": "string",
"maxLength": 61,
"metadata": { "metadata": {
"description": "String used as a base for naming resources. Must be 3-16 characters in length, use numbers and lower-case letters only and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended." "description": "String used as a base for naming resources. Must be 3-61 characters in length and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended."
}
}, },
"maxLength": 61 "location": {
},
"artifactoryEdition": {
"type": "string", "type": "string",
"defaultValue": "jfrog-artifactory-jcr", "defaultValue": "[resourceGroup().location]",
"metadata": { "metadata": {
"description": "Artifactory edition to deploy. Supported edition is jfrog-artifactory-jcr." "description": "Location for the resources."
} }
}, },
"artifactoryVersion": { "artifactoryVersion": {
"type": "string", "type": "string",
"defaultValue": "6.15.0", "defaultValue": "7.4.3",
"allowedValues": [
"7.2.1",
"7.3.2",
"7.4.3"
],
"metadata": { "metadata": {
"description": "Artifactory -vm image version to deploy. Supported from 6.15.0 and above." "description": "JFrog Container Registry-vm image version to deploy."
} }
}, },
"masterKey": { "masterKey": {
"type": "string", "type": "string",
"defaultValue": "1ce2be4490ca2c662cb79636cf9b7b8e", "defaultValue": "1ce2be4490ca2c662cb79636cf9b7b8e",
"maxLength": 64,
"metadata": { "metadata": {
"description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'" "description": "Master key for JFrog Container Registry cluster. Generate master.key using command '$openssl rand -hex 16'"
}, }
"maxLength": 64
},
"joinKey": {
"type": "string",
"defaultValue": "abcdef1234567890abcdef1234567890",
"metadata": {
"description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'"
},
"maxLength": 64
}, },
"adminUsername": { "adminUsername": {
"type": "string", "type": "string",
@@ -58,20 +55,6 @@
"description": "Admin password on all VMs. Follow conventions for azure VM admin password rules." "description": "Admin password on all VMs. Follow conventions for azure VM admin password rules."
} }
}, },
"rhelOSVersion": {
"type": "string",
"defaultValue": "7.6.2019072418",
"metadata": {
"description": "The RHEL version for the VM."
}
},
"rhelOSsku": {
"type": "string",
"defaultValue": "7-RAW-CI",
"metadata": {
"description": "The RHEL sku for the VM."
}
},
"certificate": { "certificate": {
"type": "string", "type": "string",
"defaultValue": "-----BEGIN CERTIFICATE----- MIIFhzCCA2+gAwIBAgIJALC4r5BQWZE4MA0GCSqGSIb3DQEBCwUAMFoxCzAJBgNV BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQHDApTYW50YUNsYXJh MQswCQYDVQQKDAJJVDEUMBIGA1UEAwwLKi5sb2NhbGhvc3QwHhcNMTgwMTE3MTk0 NjI4WhcNMTkwMTA4MTk0NjI4WjBaMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs aWZvcm5pYTETMBEGA1UEBwwKU2FudGFDbGFyYTELMAkGA1UECgwCSVQxFDASBgNV BAMMCyoubG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA 7KfOWDQlov8cMa8r/lcJqiWZaH9myQC74Vbe0HXsntQbcvljkjG2P7ebm5dd9Bzc sauNOJpbKf5AhFK1iwJUAkciGc1LR4k8wfWmQM3NPS8hrqrtH20zqNpdFRpNYjja JofwccPNm030GhhZkZ95TpruvmswMDwspl3jfqdcc/eiQsHcKyGnV2a+UAeoqe7J mHhmhRy1MLqAjF5U1GrUYUONA+22iRDJb4c9B91QoWvsnXpdA9NKV/mmA3/rIdx6 Ld2IPRdrIw2K5sAnXsh3bx2oCSvSfussf0x+4XDrnsaHVfjwvfNL8ECOuac2Oi/E WOp9528gOohpFAuwEt63Vl5p8/CC9m0HJDTZBKm2l5eD1kdPIj4PvP9Sn9CxGXKQ E1bxWoFxGX8EyRW0b0NK31N7b8JPZ1SoFNiB5amOMNLvR26a7cQrKumTuJeYK9Ja JaxhMXM7R0DA0Ev8ZG2xmyCygox+1KPSmJOIEpT70BFbj3rKLNqP22ET+zvPuh+2 DdgyrpHFeYkGWjMbWPjK7wJsD2zM8ccoJQfepPz8I4rT0JfrKAQgCGuGOggneaNJ KTVGNOFbj5AXdZ/Q+GvNommyRdq4J7EnqY6L+P25fo5qZ6UZ/iS0tPcvxgn0Fdhs pUPbQyQIDZyxZd3Q1lUIE38ol8P66mS2zbzf8EeOCoUCAwEAAaNQME4wHQYDVR0O BBYEFETAQM/5P7XJ8kevHFj6BPndQOFaMB8GA1UdIwQYMBaAFETAQM/5P7XJ8kev HFj6BPndQOFaMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAJ1TepKv LWYhFmVQcgZwZf/qt1a1cohzJSm6da9RCnnAWC7WC/U117bgSomtrH1v0OysHFhB zBBUeBqI7+OmzAX8dhj+roKkcnFUM/IwlK1eueIIA//CWvEf/o0XExilVS2yCc9d PTpOQBXwk9QinxK36kHdBiGxa7dW0JPnOEEmuMgGORKeLy4J6Ik8iSeFY1SZVcOI +6WWvoKciPlmIeccC+6YVmkeBwhP2o5r5w/UAaO2hSnGvmm4UIj/VJv4VQu7xTUp cIfFz5NtIr80DbqcyPiEMS2ETJ4L/kO4MS5FfeEXyQuXCzmiIDVY6tE3C7+kZmK4 JzPLuWm9ndQoyQySOGfQqvlUR1+YxUdvmu3LrOS5dOA354Q36wHa4wEGUoHU/7GV fYQmmmDSDaNSpXW5PFey6scFyDBS/yYJ0H9EjYb/11HeWYj8Yv5xTWj8nhzJONC8 D6Y5ydlU4PifM2pOf88pTYpmogNwLJWXbql5I9cvMa8APo4yLVqcISU5ynsvFke+ Non+T0mHpJai/hrA9NK+s6EGC1dAX58jy61h6FhOPI1d4s/mov/KMa2t3SfZp5SF 81aR6dHvO56teiK5M1xMkrqG75zh3TMFJJLRFe9XxeB4JeN76URB3mgADOUqkBxd ibSgVqfKwOw4IujEcqMUc5mqSnbLY1Dv+oby -----END CERTIFICATE-----", "defaultValue": "-----BEGIN CERTIFICATE----- MIIFhzCCA2+gAwIBAgIJALC4r5BQWZE4MA0GCSqGSIb3DQEBCwUAMFoxCzAJBgNV BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQHDApTYW50YUNsYXJh MQswCQYDVQQKDAJJVDEUMBIGA1UEAwwLKi5sb2NhbGhvc3QwHhcNMTgwMTE3MTk0 NjI4WhcNMTkwMTA4MTk0NjI4WjBaMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs aWZvcm5pYTETMBEGA1UEBwwKU2FudGFDbGFyYTELMAkGA1UECgwCSVQxFDASBgNV BAMMCyoubG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA 7KfOWDQlov8cMa8r/lcJqiWZaH9myQC74Vbe0HXsntQbcvljkjG2P7ebm5dd9Bzc sauNOJpbKf5AhFK1iwJUAkciGc1LR4k8wfWmQM3NPS8hrqrtH20zqNpdFRpNYjja JofwccPNm030GhhZkZ95TpruvmswMDwspl3jfqdcc/eiQsHcKyGnV2a+UAeoqe7J mHhmhRy1MLqAjF5U1GrUYUONA+22iRDJb4c9B91QoWvsnXpdA9NKV/mmA3/rIdx6 Ld2IPRdrIw2K5sAnXsh3bx2oCSvSfussf0x+4XDrnsaHVfjwvfNL8ECOuac2Oi/E WOp9528gOohpFAuwEt63Vl5p8/CC9m0HJDTZBKm2l5eD1kdPIj4PvP9Sn9CxGXKQ E1bxWoFxGX8EyRW0b0NK31N7b8JPZ1SoFNiB5amOMNLvR26a7cQrKumTuJeYK9Ja JaxhMXM7R0DA0Ev8ZG2xmyCygox+1KPSmJOIEpT70BFbj3rKLNqP22ET+zvPuh+2 DdgyrpHFeYkGWjMbWPjK7wJsD2zM8ccoJQfepPz8I4rT0JfrKAQgCGuGOggneaNJ KTVGNOFbj5AXdZ/Q+GvNommyRdq4J7EnqY6L+P25fo5qZ6UZ/iS0tPcvxgn0Fdhs pUPbQyQIDZyxZd3Q1lUIE38ol8P66mS2zbzf8EeOCoUCAwEAAaNQME4wHQYDVR0O BBYEFETAQM/5P7XJ8kevHFj6BPndQOFaMB8GA1UdIwQYMBaAFETAQM/5P7XJ8kev HFj6BPndQOFaMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAJ1TepKv LWYhFmVQcgZwZf/qt1a1cohzJSm6da9RCnnAWC7WC/U117bgSomtrH1v0OysHFhB zBBUeBqI7+OmzAX8dhj+roKkcnFUM/IwlK1eueIIA//CWvEf/o0XExilVS2yCc9d PTpOQBXwk9QinxK36kHdBiGxa7dW0JPnOEEmuMgGORKeLy4J6Ik8iSeFY1SZVcOI +6WWvoKciPlmIeccC+6YVmkeBwhP2o5r5w/UAaO2hSnGvmm4UIj/VJv4VQu7xTUp cIfFz5NtIr80DbqcyPiEMS2ETJ4L/kO4MS5FfeEXyQuXCzmiIDVY6tE3C7+kZmK4 JzPLuWm9ndQoyQySOGfQqvlUR1+YxUdvmu3LrOS5dOA354Q36wHa4wEGUoHU/7GV fYQmmmDSDaNSpXW5PFey6scFyDBS/yYJ0H9EjYb/11HeWYj8Yv5xTWj8nhzJONC8 D6Y5ydlU4PifM2pOf88pTYpmogNwLJWXbql5I9cvMa8APo4yLVqcISU5ynsvFke+ Non+T0mHpJai/hrA9NK+s6EGC1dAX58jy61h6FhOPI1d4s/mov/KMa2t3SfZp5SF 81aR6dHvO56teiK5M1xMkrqG75zh3TMFJJLRFe9XxeB4JeN76URB3mgADOUqkBxd ibSgVqfKwOw4IujEcqMUc5mqSnbLY1Dv+oby -----END CERTIFICATE-----",
@@ -113,7 +96,6 @@
"DB_Admin_User": { "DB_Admin_User": {
"type": "string", "type": "string",
"minLength": 1, "minLength": 1,
"defaultValue": "artifactory",
"metadata": { "metadata": {
"description": "Database Admin user name" "description": "Database Admin user name"
} }
@@ -121,7 +103,6 @@
"DB_Admin_Password": { "DB_Admin_Password": {
"type": "securestring", "type": "securestring",
"minLength": 1, "minLength": 1,
"defaultValue": "jFrog123",
"metadata": { "metadata": {
"description": "Database Admin password" "description": "Database Admin password"
} }
@@ -129,7 +110,6 @@
"DB_Name": { "DB_Name": {
"type": "string", "type": "string",
"minLength": 1, "minLength": 1,
"defaultValue": "artdb",
"metadata": { "metadata": {
"description": "Database name" "description": "Database name"
} }
@@ -147,11 +127,16 @@
"description": "Database Edition" "description": "Database Edition"
} }
}, },
"DB_Location": { "storageAccountType": {
"type": "string", "type": "string",
"defaultValue": "", "defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS"
],
"metadata": { "metadata": {
"description": "Database location. Default to resource group location if blank." "description": "Storage Account type"
} }
}, },
"_artifactsLocation": { "_artifactsLocation": {
@@ -159,7 +144,7 @@
"metadata": { "metadata": {
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated." "description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
}, },
"defaultValue": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/master/JFrogContainerRegistry/AzureResourceManager/" "defaultValue": "https://raw.githubusercontent.com/JFrogDev/JFrog-Cloud-Installers/refactoring-rt7/JFrogContainerRegistry/AzureResourceManager/"
}, },
"_artifactsLocationSasToken": { "_artifactsLocationSasToken": {
"type": "securestring", "type": "securestring",
@@ -172,57 +157,66 @@
"variables": { "variables": {
"namingInfix": "[toLower(substring(concat(parameters('clusterName'), uniqueString(resourceGroup().id)), 0, 9))]", "namingInfix": "[toLower(substring(concat(parameters('clusterName'), uniqueString(resourceGroup().id)), 0, 9))]",
"addressPrefix": "10.0.0.0/16", "addressPrefix": "10.0.0.0/16",
"subnetPrefix": "10.0.1.0/24", "subnetPrimaryPrefix": "10.0.1.0/24",
"virtualNetworkName": "[concat(variables('namingInfix'), 'vnet')]", "virtualNetworkName": "[concat(variables('namingInfix'), 'vnet')]",
"subnetName": "[concat(variables('namingInfix'), 'subnet')]", "subnetPrimaryName": "[concat(variables('namingInfix'), 'primarySubnet')]",
"scaleSetName": "[concat(variables('namingInfix'), 'scaleset')]", "scaleSetPrimaryName": "[concat(variables('namingInfix'), 'primaryScaleset')]",
"lbName": "[concat(variables('namingInfix'), 'lb')]", "lbName": "[concat(variables('namingInfix'), 'lb')]",
"bepoolName": "[concat(variables('lbName'), 'bepool')]", "bepoolPrimaryName": "[concat(variables('lbName'), 'primaryBepool')]",
"fepoolName": "[concat(variables('lbName'), 'fepool')]", "fepoolPrimaryName": "[concat(variables('lbName'), 'primaryFepool')]",
"lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbName'))]", "bepoolPrimaryID": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bepoolPrimaryName'))]",
"bepoolID": "[concat(variables('lbID'),'/backendAddressPools/', variables('bepoolName'))]", "feIpConfigPrimaryName": "[concat(variables('fepoolPrimaryName'), 'primaryIpConfig')]",
"feIpConfigName": "[concat(variables('fepoolName'), 'IpConfig')]", "feIpConfigPrimaryId": "[resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', variables('lbName'), variables('feIpConfigPrimaryName'))]",
"feIpConfigId": "[concat(variables('lbID'),'/frontendIPConfigurations/', variables('feIpConfigName'))]", "pipPrimaryName": "[concat(variables('namingInfix'), 'primaryPip')]",
"pipName": "[concat(variables('namingInfix'), 'pip')]", "nicPrimaryName": "[concat(variables('namingInfix'), 'primaryNic')]",
"nicName": "[concat(variables('namingInfix'), 'nic')]", "natPoolPrimaryName": "[concat(variables('lbName'), 'primaryNatpool')]",
"natPoolName": "[concat(variables('lbName'), 'natpool')]",
"ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]", "ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]",
"httpProbeName": "httpProbe", "httpProbePrimaryName": "primaryHttpProbe",
"httpsProbeName": "httpsProbe", "httpsProbePrimaryName": "primaryHttpsProbe",
"storageAccountName": "[concat(variables('namingInfix'), 'storage')]", "storageAccountName": "[concat(variables('namingInfix'), 'storage')]",
"storageAccountType": "Standard_LRS",
"vmStorageAccountContainerName": "filestore", "vmStorageAccountContainerName": "filestore",
"azureSqlServerName": "[concat(variables('namingInfix'), 'sqlsrv')]", "azureSqlServerName": "[concat(variables('namingInfix'), 'sqlsrv')]",
"DB_Name": "[parameters('DB_Name')]", "DB_Name": "[parameters('DB_Name')]",
"DB_Admin_User": "[parameters('DB_Admin_User')]", "DB_Admin_User": "[parameters('DB_Admin_User')]",
"DB_Admin_Password": "[parameters('DB_Admin_Password')]", "DB_Admin_Password": "[parameters('DB_Admin_Password')]",
"DB_Edition": "[parameters('DB_Edition')]", "DB_Edition": "[parameters('DB_Edition')]",
"DB_Location": "[parameters('DB_Location')]", "DB_Location": "[parameters('location')]",
"artifactoryEdition": "[parameters('artifactoryEdition')]",
"artifactoryVersion": "[parameters('artifactoryVersion')]",
"masterKey": "[parameters('masterKey')]", "masterKey": "[parameters('masterKey')]",
"joinKey": "[parameters('joinKey')]",
"certificate": "[parameters('certificate')]", "certificate": "[parameters('certificate')]",
"certificateKey": "[parameters('certificateKey')]", "certificateKey": "[parameters('certificateKey')]",
"certificateDomain": "[parameters('certificateDomain')]", "certificateDomain": "[parameters('certificateDomain')]",
"artifactoryServerName": "[parameters('artifactoryServerName')]", "artifactoryServerName": "[parameters('artifactoryServerName')]",
"extraJavaOptions": "[parameters('extraJavaOptions')]", "extraJavaOptions": "[parameters('extraJavaOptions')]",
"osType": { "osType": {
"publisher": "RedHat", "publisher": "jfrog",
"offer": "RHEL", "offer": "jfrogcontainerregistry-vm",
"sku": "[parameters('rhelOSsku')]", "sku": "artifactory-jcr-private",
"version": "[parameters('rhelOSVersion')]" "version": "[parameters('artifactoryVersion')]"
}, },
"apiVersion": "2015-06-15",
"imageReference": "[variables('osType')]", "imageReference": "[variables('osType')]",
"dbTemplate": "azureDBDeploy.json", "dbTemplate": "azureDBDeploy.json",
"dbTemplateLocation": "[concat(parameters('_artifactsLocation'), 'nested', '/', variables('dbTemplate'))]", "dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]",
"nsgName": "[concat(variables('namingInfix'), 'nsg')]" "nsgName": "[concat(variables('namingInfix'), 'nsg')]"
}, },
"resources": [ "resources": [
{
"apiVersion": "2019-05-01",
"name": "pid-04c1c376-5d4b-4771-9a7f-054f5910dcef",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": []
}
}
},
{ {
"type": "Microsoft.Network/networkSecurityGroups", "type": "Microsoft.Network/networkSecurityGroups",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"name": "[variables('nsgName')]",
"apiVersion": "2018-07-01",
"properties": { "properties": {
"securityRules": [ "securityRules": [
{ {
@@ -240,7 +234,7 @@
} }
}, },
{ {
"name": "http-rule", "name": "http-artifactory-rule",
"properties": { "properties": {
"description": "Allow HTTP", "description": "Allow HTTP",
"protocol": "Tcp", "protocol": "Tcp",
@@ -254,7 +248,7 @@
} }
}, },
{ {
"name": "http-rule-1", "name": "http-nginx-rule",
"properties": { "properties": {
"description": "Allow HTTP", "description": "Allow HTTP",
"protocol": "Tcp", "protocol": "Tcp",
@@ -268,7 +262,7 @@
} }
}, },
{ {
"name": "https-rule", "name": "https-nginx-rule",
"properties": { "properties": {
"description": "Allow HTTP", "description": "Allow HTTP",
"protocol": "Tcp", "protocol": "Tcp",
@@ -296,15 +290,13 @@
} }
} }
] ]
}, }
"name": "[variables('nsgName')]",
"apiVersion": "2016-03-30"
}, },
{ {
"type": "Microsoft.Network/virtualNetworks", "type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]", "name": "[variables('virtualNetworkName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"apiVersion": "2016-03-30", "apiVersion": "2018-07-01",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" "[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]"
], ],
@@ -316,9 +308,9 @@
}, },
"subnets": [ "subnets": [
{ {
"name": "[variables('subnetName')]", "name": "[variables('subnetPrimaryName')]",
"properties": { "properties": {
"addressPrefix": "[variables('subnetPrefix')]", "addressPrefix": "[variables('subnetPrimaryPrefix')]",
"networkSecurityGroup": { "networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
} }
@@ -328,12 +320,12 @@
} }
}, },
{ {
"apiVersion": "[variables('apiVersion')]", "apiVersion": "2018-07-01",
"type": "Microsoft.Network/networkInterfaces", "type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]", "name": "[variables('nicPrimaryName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipName'))]", "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
], ],
@@ -344,7 +336,7 @@
"properties": { "properties": {
"privateIPAllocationMethod": "Dynamic", "privateIPAllocationMethod": "Dynamic",
"subnet": { "subnet": {
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName')), '/subnets/', variables('subnetName'))]" "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetPrimaryName'))]"
} }
} }
} }
@@ -356,12 +348,12 @@
}, },
{ {
"type": "Microsoft.Network/publicIPAddresses", "type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('pipName')]", "name": "[variables('pipPrimaryName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"sku": { "sku": {
"name": "Standard" "name": "Standard"
}, },
"apiVersion": "2017-08-01", "apiVersion": "2018-07-01",
"properties": { "properties": {
"publicIPAllocationMethod": "Static", "publicIPAllocationMethod": "Static",
"dnsSettings": { "dnsSettings": {
@@ -372,39 +364,39 @@
{ {
"type": "Microsoft.Network/loadBalancers", "type": "Microsoft.Network/loadBalancers",
"name": "[variables('lbName')]", "name": "[variables('lbName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"apiVersion": "2017-08-01", "apiVersion": "2018-07-01",
"sku": { "sku": {
"name": "Standard" "name": "Standard"
}, },
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('pipName'))]" "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]"
], ],
"tags": { "tags":{
"displayName": "Load Balancer" "displayName": "Load Balancer"
}, },
"properties": { "properties": {
"frontendIPConfigurations": [ "frontendIPConfigurations": [
{ {
"name": "[variables('feIpConfigName')]", "name": "[variables('feIpConfigPrimaryName')]",
"properties": { "properties": {
"publicIPAddress": { "publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipName'))]" "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipPrimaryName'))]"
} }
} }
} }
], ],
"backendAddressPools": [ "backendAddressPools": [
{ {
"name": "[variables('bepoolName')]" "name": "[variables('bepoolPrimaryName')]"
} }
], ],
"inboundNatPools": [ "inboundNatPools": [
{ {
"name": "[variables('natPoolName')]", "name": "[variables('natPoolPrimaryName')]",
"properties": { "properties": {
"frontendIPConfiguration": { "frontendIPConfiguration": {
"id": "[variables('feIpConfigId')]" "id": "[variables('feIpConfigPrimaryId')]"
}, },
"protocol": "tcp", "protocol": "tcp",
"frontendPortRangeStart": 10022, "frontendPortRangeStart": 10022,
@@ -415,14 +407,14 @@
], ],
"loadBalancingRules": [ "loadBalancingRules": [
{ {
"name": "HTTPRule", "name": "HTTPRulePrimary",
"properties": { "properties": {
"loadDistribution": "Default", "loadDistribution": "Default",
"frontendIPConfiguration": { "frontendIPConfiguration": {
"id": "[variables('feIpConfigId')]" "id": "[variables('feIpConfigPrimaryId')]"
}, },
"backendAddressPool": { "backendAddressPool": {
"id": "[variables('bepoolID')]" "id": "[variables('bepoolPrimaryID')]"
}, },
"protocol": "Tcp", "protocol": "Tcp",
"frontendPort": 80, "frontendPort": 80,
@@ -430,19 +422,19 @@
"enableFloatingIP": false, "enableFloatingIP": false,
"idleTimeoutInMinutes": 5, "idleTimeoutInMinutes": 5,
"probe": { "probe": {
"id": "[concat(variables('lbId'), '/probes/', variables('httpProbeName'))]" "id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpProbePrimaryName'))]"
} }
} }
}, },
{ {
"name": "HTTPSRule", "name": "HTTPSRulePrimary",
"properties": { "properties": {
"loadDistribution": "Default", "loadDistribution": "Default",
"frontendIPConfiguration": { "frontendIPConfiguration": {
"id": "[variables('feIpConfigId')]" "id": "[variables('feIpConfigPrimaryId')]"
}, },
"backendAddressPool": { "backendAddressPool": {
"id": "[variables('bepoolID')]" "id": "[variables('bepoolPrimaryID')]"
}, },
"protocol": "Tcp", "protocol": "Tcp",
"frontendPort": 443, "frontendPort": 443,
@@ -450,24 +442,24 @@
"enableFloatingIP": false, "enableFloatingIP": false,
"idleTimeoutInMinutes": 5, "idleTimeoutInMinutes": 5,
"probe": { "probe": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('lbName')), '/probes/', variables('httpsProbeName'))]" "id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('lbName'), variables('httpsProbePrimaryName'))]"
} }
} }
} }
], ],
"probes": [ "probes": [
{ {
"name": "[variables('httpProbeName')]", "name": "[variables('httpProbePrimaryName')]",
"properties": { "properties": {
"protocol": "Http", "protocol": "Http",
"requestPath": "/artifactory/webapp/", "requestPath": "/artifactory/api/system/ping",
"port": 80, "port": 80,
"intervalInSeconds": 60, "intervalInSeconds": 60,
"numberOfProbes": 5 "numberOfProbes": 5
} }
}, },
{ {
"name": "[variables('httpsProbeName')]", "name": "[variables('httpsProbePrimaryName')]",
"properties": { "properties": {
"protocol": "Tcp", "protocol": "Tcp",
"port": 443, "port": 443,
@@ -479,18 +471,23 @@
} }
}, },
{ {
"apiVersion": "[variables('apiVersion')]", "apiVersion": "2018-07-01",
"type": "Microsoft.Storage/storageAccounts", "type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]", "name": "[variables('storageAccountName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"properties": { "sku": {
"accountType": "[variables('storageAccountType')]" "name": "[parameters('storageAccountType')]"
} },
"tags":{
"displayName": "Artifactory Storage Account"
},
"kind": "Storage",
"properties": {}
}, },
{ {
"type": "Microsoft.Resources/deployments", "type": "Microsoft.Resources/deployments",
"name": "deploySQLDB", "name": "deploySQLDB",
"apiVersion": "2014-04-01", "apiVersion": "2018-07-01",
"properties": { "properties": {
"mode": "Incremental", "mode": "Incremental",
"templateLink": { "templateLink": {
@@ -511,32 +508,38 @@
"value": "[parameters('DB_Name')]" "value": "[parameters('DB_Name')]"
}, },
"db_edition": { "db_edition": {
"value": "[parameters('DB_Edition')]" "value": "[variables('DB_Edition')]"
}, },
"db_location": { "db_location": {
"value": "[parameters('DB_Location')]" "value": "[variables('DB_Location')]"
} }
} }
} }
}, },
{ {
"type": "Microsoft.Compute/virtualMachineScaleSets", "type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[variables('scaleSetName')]", "name": "[variables('scaleSetPrimaryName')]",
"location": "[resourceGroup().location]", "location": "[parameters('location')]",
"apiVersion": "2017-03-30", "apiVersion": "2018-10-01",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]", "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]", "[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]",
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
], ],
"plan": {
"name": "artifactory-jcr-private",
"publisher": "jfrog",
"product": "jfrogcontainerregistry-vm"
},
"sku": { "sku": {
"name": "[parameters('vmSku')]", "name": "[parameters('vmSku')]",
"tier": "Standard", "tier": "Standard",
"capacity": "[1]" "capacity": "1"
}, },
"properties": { "properties": {
"singlePlacementGroup": true, "singlePlacementGroup": true,
"overprovision": "false",
"upgradePolicy": { "upgradePolicy": {
"mode": "Manual" "mode": "Manual"
}, },
@@ -553,12 +556,12 @@
"computerNamePrefix": "[variables('namingInfix')]", "computerNamePrefix": "[variables('namingInfix')]",
"adminUsername": "[parameters('adminUsername')]", "adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]", "adminPassword": "[parameters('adminPassword')]",
"customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nCERTIFICATE_KEY=',parameters('certificateKey'),'\nCERTIFICATE=', parameters('certificate'),'\nCERTIFICATE_DOMAIN=',parameters('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',parameters('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',parameters('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), variables('apiVersion')).key1,'\nARTIFACTORY_EDITION=',variables('artifactoryEdition'),'\nARTIFACTORY_VERSION=',variables('artifactoryVersion'),'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\nIS_PRIMARY=','true','\n'))]" "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nCERTIFICATE_KEY=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nIS_PRIMARY=','true','\n'))]"
}, },
"networkProfile": { "networkProfile": {
"networkInterfaceConfigurations": [ "networkInterfaceConfigurations": [
{ {
"name": "[variables('nicName')]", "name": "[variables('nicPrimaryName')]",
"properties": { "properties": {
"primary": true, "primary": true,
"ipConfigurations": [ "ipConfigurations": [
@@ -566,16 +569,16 @@
"name": "[concat(variables('ipConfigName'),'1')]", "name": "[concat(variables('ipConfigName'),'1')]",
"properties": { "properties": {
"subnet": { "subnet": {
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName')), '/subnets/', variables('subnetName'))]" "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetPrimaryName'))]"
}, },
"loadBalancerBackendAddressPools": [ "loadBalancerBackendAddressPools": [
{ {
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('lbName'), '/backendAddressPools/', variables('bePoolName'))]" "id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('lbName'), variables('bePoolPrimaryName'))]"
} }
], ],
"loadBalancerInboundNatPools": [ "loadBalancerInboundNatPools": [
{ {
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('lbName'), '/inboundNatPools/', variables('natPoolName'))]" "id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatPools', variables('lbName'), variables('natPoolPrimaryName'))]"
} }
] ]
} }
@@ -596,11 +599,11 @@
"autoUpgradeMinorVersion": false, "autoUpgradeMinorVersion": false,
"settings": { "settings": {
"fileUris": [ "fileUris": [
"[concat(parameters('_artifactsLocation'), 'scripts/','install_artifactory.sh')]" "[uri(parameters('_artifactsLocation'), concat('scripts/install_artifactory7.sh', parameters('_artifactsLocationSasToken')))]"
] ]
}, },
"protectedSettings": { "protectedSettings": {
"commandToExecute": "sh install_artifactory.sh" "commandToExecute": "sh install_artifactory7.sh"
} }
} }
} }
@@ -608,24 +611,11 @@
} }
} }
} }
},
{
"apiVersion": "2015-01-01",
"name": "pid-04c1c376-5d4b-4771-9a7f-054f5910dcef",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": []
}
}
} }
], ],
"outputs": { "outputs": {
"fqdn": { "fqdn": {
"value": "[reference(resourceId('Microsoft.Network/publicIPAddresses',variables('pipName')),'2016-03-30').dnsSettings.fqdn]", "value": "[reference(resourceId('Microsoft.Network/publicIPAddresses',variables('pipPrimaryName')),'2018-07-01').dnsSettings.fqdn]",
"type": "string" "type": "string"
} }
} }

View File

@@ -0,0 +1,27 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"clusterName": {
"value": "GEN-UNIQUE"
},
"adminUsername": {
"value": "GEN-UNIQUE"
},
"adminPassword": {
"value": "GEN-PASSWORD"
},
"DB_Admin_User": {
"value": "GEN-UNIQUE"
},
"DB_Admin_Password": {
"value": "GEN-PASSWORD"
},
"DB_Name": {
"value": "GEN-UNIQUE"
},
"masterKey": {
"value": "35767fa0164bac66b6cccb8880babefb"
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

View File

@@ -1,7 +0,0 @@
{
"itemDisplayName": "Artifactory JCR Setup",
"description": "This template helps you setup a Artifactory JCR environment.",
"summary": "This template has setup Artifactory JCR cluster",
"githubUsername": "danielmkn",
"dateUpdated": "2019-11-19"
}

View File

@@ -4,22 +4,18 @@
"parameters": { "parameters": {
"db_user": { "db_user": {
"type": "string", "type": "string",
"minLength": 1, "minLength": 1
"defaultValue": "artifactory"
}, },
"db_password": { "db_password": {
"type": "securestring", "type": "securestring"
"defaultValue": "jFrog123"
}, },
"db_server": { "db_server": {
"type": "string", "type": "string",
"minLength": 1, "minLength": 1
"defaultValue": "artmssqlsrv"
}, },
"db_name": { "db_name": {
"type": "string", "type": "string",
"minLength": 1, "minLength": 1
"defaultValue": "artdb"
}, },
"db_location": { "db_location": {
"type": "string", "type": "string",
@@ -35,9 +31,8 @@
} }
}, },
"variables": { "variables": {
"apiVersion": "2015-05-01-preview",
"rtdbCollation": "Latin1_General_100_CS_AS", "rtdbCollation": "Latin1_General_100_CS_AS",
"db_location": "[if(equals(parameters('db_location'), ''), resourceGroup().location, parameters('db_location'))]" "db_location": "[parameters('db_location')]"
}, },
"resources": [ "resources": [
{ {
@@ -45,7 +40,7 @@
"type": "Microsoft.Sql/servers", "type": "Microsoft.Sql/servers",
"kind": "v12.0", "kind": "v12.0",
"location": "[variables('db_location')]", "location": "[variables('db_location')]",
"apiVersion": "[variables('apiVersion')]", "apiVersion": "2015-05-01-preview",
"dependsOn": [ "dependsOn": [
], ],
@@ -62,7 +57,7 @@
"name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]",
"type": "firewallrules", "type": "firewallrules",
"location": "[variables('db_location')]", "location": "[variables('db_location')]",
"apiVersion": "[variables('apiVersion')]", "apiVersion": "2015-05-01-preview",
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Sql/servers/', parameters('db_server'))]" "[concat('Microsoft.Sql/servers/', parameters('db_server'))]"
], ],
@@ -76,7 +71,7 @@
"type": "databases", "type": "databases",
"kind": "v12.0,user", "kind": "v12.0,user",
"location": "[variables('db_location')]", "location": "[variables('db_location')]",
"apiVersion": "[variables('apiVersion')]", "apiVersion": "2015-05-01-preview",
"dependsOn": [ "dependsOn": [
"[parameters('db_server')]" "[parameters('db_server')]"
], ],

View File

@@ -4,51 +4,21 @@ DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/
DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//") DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//")
DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//") DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//")
STORAGE_ACCT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_NAME=" | sed "s/STO_ACT_NAME=//") STORAGE_ACCT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_NAME=" | sed "s/STO_ACT_NAME=//")
STORAGE_ACT_ENDPOINT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_ENDPOINT=" | sed "s/STO_ACT_ENDPOINT=//")
STORAGE_CONTAINER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_CTR_NAME=" | sed "s/STO_CTR_NAME=//") STORAGE_CONTAINER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_CTR_NAME=" | sed "s/STO_CTR_NAME=//")
STORAGE_ACCT_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_KEY=" | sed "s/STO_ACT_KEY=//") STORAGE_ACCT_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_KEY=" | sed "s/STO_ACT_KEY=//")
ARTIFACTORY_EDITION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_EDITION=" | sed "s/ARTIFACTORY_EDITION=//")
ARTIFACTORY_VERSION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_VERSION=" | sed "s/ARTIFACTORY_VERSION=//")
MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//") MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//")
JFROG_JOIN_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JOIN_KEY=" | sed "s/JOIN_KEY=//")
IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//") IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//")
#disable firewalld, also disable selinux. Both block traffic from load balancer.
systemctl stop firewalld
setenforce Permissive
# install the wget and curl UBUNTU_CODENAME=$(cat /etc/lsb-release | grep "^DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//")
yum -y install wget curl>> /tmp/install-curl.log 2>&1
yum -y install java-1.8.0-openjdk >> /tmp/install-java.log 2>&1 export DEBIAN_FRONTEND=noninteractive
#yum -y install java-11-openjdk >> /tmp/install-java.log 2>&1
#Generate Self-Signed Cert #Generate Self-Signed Cert
mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/ mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/
openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost" openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost"
setenforce 0
sed -i -e "s/SELINUX=.*/SELINUX=permissive/" /etc/sysconfig/selinux
wget https://bintray.com/jfrog/artifactory-pro-rpms/rpm -O bintray-jfrog-artifactory-pro-rpms.repo
mv bintray-jfrog-artifactory-pro-rpms.repo /etc/yum.repos.d/
wget https://bintray.com/jfrog/artifactory-rpms/rpm -O bintray-jfrog-artifactory-rpms.repo;
mv bintray-jfrog-artifactory-rpms.repo /etc/yum.repos.d/
yum -y install ${ARTIFACTORY_EDITION}-${ARTIFACTORY_VERSION} >> /tmp/install-artifactory.log 2>&1
cat > /etc/yum.repos.d/nginx.repo <<EOF
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/rhel/7/\$basearch/
gpgcheck=0
enabled=1
EOF
yum -y install nginx>> /tmp/install-nginx.log 2>&1
#Install database drivers
curl -L -o /opt/jfrog/artifactory/tomcat/lib/mysql-connector-java-5.1.38.jar https://bintray.com/artifact/download/bintray/jcenter/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar
curl -L -o /opt/jfrog/artifactory/tomcat/lib/mssql-jdbc-6.2.1.jre8.jar https://bintray.com/artifact/download/bintray/jcenter/com/microsoft/sqlserver/mssql-jdbc/6.2.1.jre8/mssql-jdbc-6.2.1.jre8.jar
curl -L -o /opt/jfrog/artifactory/tomcat/lib/postgresql-9.4.1212.jar https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar
CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//") CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//")
[ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory [ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory
@@ -100,16 +70,60 @@ cat <<EOF >/etc/nginx/nginx.conf
} }
EOF EOF
rm /etc/nginx/conf.d/default.conf cat <<EOF >/etc/nginx/conf.d/artifactory.conf
ssl_certificate /etc/pki/tls/certs/cert.pem;
ssl_certificate_key /etc/pki/tls/private/cert.key;
mkdir -p /var/opt/jfrog/artifactory/etc/security ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers on;
cat <<EOF >/var/opt/jfrog/artifactory/etc/security/master.key ## server configuration
${MASTER_KEY} server {
listen 443 ssl;
listen 80 ;
server_name ~(?<repo>.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN};
if (\$http_x_forwarded_proto = '') {
set \$http_x_forwarded_proto \$scheme;
}
## Application specific logs
## access_log /var/log/nginx/artifactory-access.log timing;
## error_log /var/log/nginx/artifactory-error.log;
rewrite ^/$ /artifactory/webapp/ redirect;
rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/\$repo/\$1/\$2;
chunked_transfer_encoding on;
client_max_body_size 0;
location /artifactory/ {
proxy_read_timeout 2400;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:8081/artifactory/;
proxy_set_header X-Artifactory-Override-Base-Url
\$http_x_forwarded_proto://\$host:\$server_port/artifactory;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
}
EOF
HOSTNAME=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
if [ "${IS_PRIMARY}" = "true" ]; then
NODE_NAME=art-primary
else
NODE_NAME=art-$(date +%s$RANDOM)
fi
cat <<EOF >/var/opt/jfrog/artifactory/etc/ha-node.properties
node.id=${NODE_NAME}
artifactory.ha.data.dir=/var/opt/jfrog/artifactory/data
context.url=http://${HOSTNAME}:8081/artifactory
access.context.url=http://${HOSTNAME}:8081/access
membership.port=10001
hazelcast.interface=${HOSTNAME}
primary=${IS_PRIMARY}
EOF EOF
# in case of JCR or OSS, use non-ha mode, also use derby, also do not create binary store xml
cat <<EOF >/var/opt/jfrog/artifactory/etc/db.properties cat <<EOF >/var/opt/jfrog/artifactory/etc/db.properties
type=mssql type=mssql
driver=com.microsoft.sqlserver.jdbc.SQLServerDriver driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
@@ -117,6 +131,13 @@ url=${DB_URL};databaseName=${DB_NAME};sendStringParametersAsUnicode=false;applic
username=${DB_USER} username=${DB_USER}
password=${DB_PASSWORD} password=${DB_PASSWORD}
EOF EOF
mkdir -p /var/opt/jfrog/artifactory/etc/security
cat <<EOF >/var/opt/jfrog/artifactory/etc/security/master.key
${MASTER_KEY}
EOF
cat <<EOF >/var/opt/jfrog/artifactory/etc/binarystore.xml cat <<EOF >/var/opt/jfrog/artifactory/etc/binarystore.xml
<config version="2"> <config version="2">
<chain> <chain>
@@ -153,72 +174,12 @@ cat <<EOF >/var/opt/jfrog/artifactory/etc/binarystore.xml
<provider id="azure-blob-storage" type="azure-blob-storage"> <provider id="azure-blob-storage" type="azure-blob-storage">
<accountName>${STORAGE_ACCT}</accountName> <accountName>${STORAGE_ACCT}</accountName>
<accountKey>${STORAGE_ACCT_KEY}</accountKey> <accountKey>${STORAGE_ACCT_KEY}</accountKey>
<endpoint>https://${STORAGE_ACCT}.blob.core.windows.net/</endpoint> <endpoint>${STORAGE_ACT_ENDPOINT}</endpoint>
<containerName>${STORAGE_CONTAINER}</containerName> <containerName>${STORAGE_CONTAINER}</containerName>
</provider> </provider>
</config> </config>
EOF EOF
# begin JCR specific setup
cat <<EOF >/etc/nginx/conf.d/artifactory.conf
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_certificate /etc/pki/tls/certs/cert.pem;
ssl_certificate_key /etc/pki/tls/private/cert.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers on;
## server configuration
server {
listen 443 ssl;
listen 80 ;
server_name ~(?<repo>.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN} ${CERTIFICATE_DOMAIN};
if (\$http_x_forwarded_proto = '') {
set \$http_x_forwarded_proto \$scheme;
}
## Application specific logs
## access_log /var/log/nginx/artifactory-access.log timing;
## error_log /var/log/nginx/artifactory-error.log;
rewrite ^/$ /artifactory/webapp/ redirect;
rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
rewrite ^/(v2)/(.*) /artifactory/\$1/\$2;
chunked_transfer_encoding on;
client_max_body_size 0;
location /artifactory/ {
proxy_read_timeout 2400;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:8081/artifactory/;
proxy_set_header X-Artifactory-Override-Base-Url \$http_x_forwarded_proto://\$host:\$server_port/artifactory;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
}
EOF
# end JCR specific setup
# callhome metadata
mkdir -p /var/opt/jfrog/artifactory/etc/info
cat <<EOF >/var/opt/jfrog/artifactory/etc/info/installer-info.json
{
"productId": "JFrogInstaller_AzureMP/${ARTIFACTORY_VERSION}",
"features": [
{
"featureId": "ArtifactoryVersion/${ARTIFACTORY_EDITION}-${ARTIFACTORY_VERSION}"
},
{
"featureId": "Platform/azure-mp-vm-jcr"
}
]
}
EOF
HOSTNAME=$(hostname -i) HOSTNAME=$(hostname -i)
sed -i -e "s/art1/art-$(date +%s$RANDOM)/" /var/opt/jfrog/artifactory/etc/ha-node.properties sed -i -e "s/art1/art-$(date +%s$RANDOM)/" /var/opt/jfrog/artifactory/etc/ha-node.properties
sed -i -e "s/127.0.0.1/$HOSTNAME/" /var/opt/jfrog/artifactory/etc/ha-node.properties sed -i -e "s/127.0.0.1/$HOSTNAME/" /var/opt/jfrog/artifactory/etc/ha-node.properties
@@ -232,16 +193,14 @@ cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CE
cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key
rm /tmp/temp.key rm /tmp/temp.key
echo "artifactory.ping.allowUnauthenticated=true" >> /var/opt/jfrog/artifactory/etc/artifactory.system.properties
EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//") EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//")
[ -z "$EXTRA_JAVA_OPTS" ] && EXTRA_JAVA_OPTS='-server -Xms2g -Xmx6g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError="kill -9 %p"' [ -z "$EXTRA_JAVA_OPTS" ] && EXTRA_JAVA_OPTS='-server -Xms2g -Xmx6g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError="kill -9 %p"'
echo "export JAVA_OPTIONS=\"${EXTRA_JAVA_OPTS}\"" >> /var/opt/jfrog/artifactory/etc/default echo "export JAVA_OPTIONS=\"${EXTRA_JAVA_OPTS}\"" >> /var/opt/jfrog/artifactory/etc/default
chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/* chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/*
# start Artifactory # start Artifactory
sleep $((RANDOM % 120)) sleep $((RANDOM % 240))
service artifactory start service artifactory start
service nginx start service nginx start
nginx -s reload nginx -s reload
echo "INFO: Artifactory JCR installation completed." echo "INFO: Artifactory installation completed." > /tmp/artifactory-install.log

View File

@@ -0,0 +1,178 @@
#!/bin/bash
DB_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JDBC_STR" | sed "s/JDBC_STR=//")
DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//")
DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//")
DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//")
STORAGE_ACCT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_NAME=" | sed "s/STO_ACT_NAME=//")
STORAGE_ACT_ENDPOINT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_ENDPOINT=" | sed "s/STO_ACT_ENDPOINT=//")
STORAGE_CONTAINER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_CTR_NAME=" | sed "s/STO_CTR_NAME=//")
STORAGE_ACCT_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_KEY=" | sed "s/STO_ACT_KEY=//")
MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//")
IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//")
export DEBIAN_FRONTEND=noninteractive
#Generate Self-Signed Cert
mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/
openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost"
CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//")
[ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory
ARTIFACTORY_SERVER_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_SERVER_NAME=" | sed "s/ARTIFACTORY_SERVER_NAME=//")
[ -z "$ARTIFACTORY_SERVER_NAME" ] && ARTIFACTORY_SERVER_NAME=artifactory
#Configuring nginx
rm /etc/nginx/sites-enabled/default
cat <<EOF >/etc/nginx/nginx.conf
#user nobody;
worker_processes 1;
error_log /var/log/nginx/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
variables_hash_max_size 1024;
variables_hash_bucket_size 64;
server_names_hash_max_size 4096;
server_names_hash_bucket_size 128;
types_hash_max_size 2048;
types_hash_bucket_size 64;
proxy_read_timeout 2400s;
client_header_timeout 2400s;
client_body_timeout 2400s;
proxy_connect_timeout 75s;
proxy_send_timeout 2400s;
proxy_buffer_size 32k;
proxy_buffers 40 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 250m;
proxy_http_version 1.1;
client_body_buffer_size 128k;
include /etc/nginx/conf.d/*.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
}
EOF
cat <<EOF >/etc/nginx/conf.d/artifactory.conf
ssl_certificate /etc/pki/tls/certs/cert.pem;
ssl_certificate_key /etc/pki/tls/private/cert.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers on;
## server configuration
server {
listen 443 ssl;
listen 80 ;
server_name ~(?<repo>.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN};
if (\$http_x_forwarded_proto = '') {
set \$http_x_forwarded_proto \$scheme;
}
## Application specific logs
## access_log /var/log/nginx/artifactory-access.log timing;
## error_log /var/log/nginx/artifactory-error.log;
rewrite ^/$ /artifactory/webapp/ redirect;
rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
chunked_transfer_encoding on;
client_max_body_size 0;
location /artifactory/ {
proxy_read_timeout 2400;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:8081/artifactory/;
proxy_set_header X-Artifactory-Override-Base-Url
\$http_x_forwarded_proto://\$host:\$server_port/artifactory;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
location / {
proxy_read_timeout 2400;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:8082;
proxy_set_header X-Artifactory-Override-Base-Url \$http_x_forwarded_proto://\$host:\$server_port/artifactory;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
}
EOF
HOSTNAME=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
if [ "${IS_PRIMARY}" = "true" ]; then
NODE_NAME=art-primary
else
NODE_NAME=art-$(date +%s$RANDOM)
fi
# Java options
EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//")
sed -i -e "s/#extraJavaOpts: \"-Xms512m -Xmx2g\"/extraJavaOpts: ${EXTRA_JAVA_OPTS}/" /var/opt/jfrog/artifactory/etc/system.yaml
# Set MS SQL configuration
cat <<EOF >>/var/opt/jfrog/artifactory/etc/system.yaml
## One of: mysql, oracle, mssql, postgresql, mariadb
## Default: Embedded derby
## Example for mysql
type: mssql
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: ${DB_URL};databaseName=${DB_NAME};sendStringParametersAsUnicode=false;applicationName=Artifactory Binary Repository
username: ${DB_USER}
password: ${DB_PASSWORD}
EOF
mkdir -p /var/opt/jfrog/artifactory/etc/security
cat <<EOF >/opt/jfrog/artifactory/var/etc/security/master.key
${MASTER_KEY}
EOF
# NOTE: Path is changed in Artifactory 7. Non-HA configuration
mkdir -p /var/opt/jfrog/artifactory/etc/artifactory
cat <<EOF >/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml
<config version="1">
<chain template="azure-blob-storage"/>
<provider id="azure-blob-storage" type="azure-blob-storage">
<accountName>${STORAGE_ACCT}</accountName>
<accountKey>${STORAGE_ACCT_KEY}</accountKey>
<endpoint>https://${STORAGE_ACCT}.blob.core.windows.net/</endpoint>
<containerName>${STORAGE_CONTAINER}</containerName>
</provider>
</config>
EOF
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//" > /tmp/temp.pem
cat /tmp/temp.pem | sed 's/CERTIFICATE----- /&\n/g' | sed 's/ -----END/\n-----END/g' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/certs/cert.pem
rm /tmp/temp.pem
cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_KEY=//" > /tmp/temp.key
cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key
rm /tmp/temp.key
chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/*
# start Artifactory
sleep $((RANDOM % 240))
service artifactory start
service nginx start
nginx -s reload
echo "INFO: Artifactory installation completed." >> /tmp/artifactory-install.log