diff --git a/AzureResourceManager/Artifactory/LICENSE b/AzureResourceManager/Artifactory/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/AzureResourceManager/Artifactory/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/AzureResourceManager/Artifactory/MP_submission/artifactory-pro-7-2-1-4.zip b/AzureResourceManager/Artifactory/MP_submission/artifactory-pro-7-2-1-4.zip new file mode 100644 index 0000000..6f92258 Binary files /dev/null and b/AzureResourceManager/Artifactory/MP_submission/artifactory-pro-7-2-1-4.zip differ diff --git a/AzureResourceManager/Artifactory/MP_submission/artifactory-pro-7-4-3-2.zip b/AzureResourceManager/Artifactory/MP_submission/artifactory-pro-7-4-3-2.zip new file mode 100644 index 0000000..29fc302 Binary files /dev/null and b/AzureResourceManager/Artifactory/MP_submission/artifactory-pro-7-4-3-2.zip differ diff --git a/AzureResourceManager/Artifactory/MP_submission/artifactory-pro-7-6-2-5.zip b/AzureResourceManager/Artifactory/MP_submission/artifactory-pro-7-6-2-5.zip new file mode 100644 index 0000000..7663e76 Binary files /dev/null and b/AzureResourceManager/Artifactory/MP_submission/artifactory-pro-7-6-2-5.zip differ diff --git a/AzureResourceManager/Artifactory/MP_submission/createUiDefinition.json b/AzureResourceManager/Artifactory/MP_submission/createUiDefinition.json new file mode 100644 index 0000000..acfeb1a --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/createUiDefinition.json @@ -0,0 +1,528 @@ +{ + "$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": "Artifactory Cluster settings", + "subLabel": { + "preValidation": "Configure Artifactory Cluster settings", + "postValidation": "Done!" + }, + "bladeTitle": "Artifactory 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 Artifactory", + "recommendedSizes": [ + "Standard_D4s_v3" + ], + "constraints": { + "allowedSizes": [ + "Standard_A4_v2", + "Standard_A4", + "Standard_D2s_v3", + "Standard_D4s_v3", + "Standard_D8s_v3", + "Standard_D16s_v3", + "Standard_D32s_v3", + "Standard_DS3_v2", + "Standard_D2_v2", + "Standard_D3_v2", + "Standard_DC2s", + "Standard_DC4s" + ] + }, + "osPlatform": "Linux", + "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", + "type": "Microsoft.Common.DropDown", + "label": "Artifactory-vm image version to deploy.", + "defaultValue": "7.6.2", + "toolTip": "Version of Artifactory to deploy", + "constraints": { + "allowedValues": [ + { + "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.30" + }, + { + "label": "7.6.2", + "value": "0.0.1" + } + ], + "required": true + }, + "visible": true + }, + { + "name": "masterKey", + "type": "Microsoft.Common.PasswordBox", + "label": { + "password": "Artifactory master Key", + "confirmPassword": "Confirm master Key" + }, + "toolTip": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'", + "constraints": { + "required": true, + "regex": "^[a-z0-9A-Z]{12,32}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long." + }, + "options": { + "hideConfirmation": true + } + }, + { + "name": "joinKey", + "type": "Microsoft.Common.PasswordBox", + "label": { + "password": "Artifactory join Key", + "confirmPassword": "Confirm join Key" + }, + "toolTip": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'", + "constraints": { + "required": false, + "regex": "^[a-z0-9A-Z]{12,32}$", + "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", + "type": "Microsoft.Common.PasswordBox", + "label": { + "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.", + "constraints": { + "required": false, + "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": false, + "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": false, + "regex": "^(\\*)*([\\w-\\.])+$", + "validationMessage": "Must be a valid fully-qualified domain name." + } + }, + { + "name": "artifactoryServerName", + "type": "Microsoft.Common.TextBox", + "label": "Provide artifactory server name to be used in Nginx.", + "defaultValue": "artifactory", + "toolTip": "Provide artifactory 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 Artifactory", + "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.", + "constraints": { + "required": false, + "regex": "[^a-zA-Z0-9]+\\S+\\D", + "validationMessage": "Example: -server -Xms2g -Xmx12g -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": "infoMessage", + "type": "Microsoft.Common.InfoBox", + "visible": true, + "options": { + "icon": "Info", + "text": "You can deploy a new Database or use your existing Postgres or MSSQL Databeses" + } + }, + { + "name": "db_type", + "type": "Microsoft.Common.DropDown", + "label": "Database options", + "toolTip": "Deploy a new DB instance or use an existing DB", + "constraints": { + "required": true, + "allowedValues": [ + { + "label": "Deploy a new Postgresql instance", + "value": "Postgresql_deploy.json" + }, + { + "label": "Use existing Postgresql instance", + "value": "Postgresql_existing.json" + }, + { + "label": "Deploy a new MSSQL instance", + "value": "MSSQL_deploy.json" + }, + { + "label": "Use existing MSSQL instance", + "value": "MSSQL_existing.json" + } + ] + }, + "visible": true + }, + { + "name": "db_name", + "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": "db_server", + "type": "Microsoft.Common.TextBox", + "label": "Database server name. Skip if a new deployment is selected", + "toolTip": "Database server name", + "constraints": { + "required": false, + "regex": "^[a-z0-9A-Z]{1,15}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-15 characters long." + } + }, + { + "name": "manual_db_url", + "type": "Microsoft.Common.TextBox", + "label": "Database connection string. Skip if a new deployment is selected", + "toolTip": "Jdbc connection string for MSSQL or Postgresql", + "constraints": { + "required": false, + "regex": "..*", + "validationMessage": "DB connection string is not valid" + } + }, + { + "name": "db_user", + "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": "db_password", + "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": "db_edition", + "type": "Microsoft.Common.DropDown", + "label": "Database Edition", + "defaultValue": "Basic", + "toolTip": "MSSQL. Edition of Database to use", + "constraints": { + "allowedValues": [ + { + "label": "Basic", + "value": "Basic" + }, + { + "label": "Standard", + "value": "Standard" + }, + { + "label": "Premium", + "value": "Premium" + } + ], + "required": false + }, + "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()]", + "nodeCount": "[steps('clusterConfig').nodeCount]", + "artifactoryVersion": "[steps('clusterConfig').artifactoryVersion]", + "masterKey": "[steps('clusterConfig').masterKey]", + "joinKey": "[steps('clusterConfig').joinKey]", + "artifactoryLicense1": "[steps('clusterConfig').artifactoryLicense1]", + "artifactoryLicense2": "[steps('clusterConfig').artifactoryLicense2]", + "artifactoryLicense3": "[steps('clusterConfig').artifactoryLicense3]", + "artifactoryLicense4": "[steps('clusterConfig').artifactoryLicense4]", + "artifactoryLicense5": "[steps('clusterConfig').artifactoryLicense5]", + "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_type": "[steps('databaseConfig').db_type]", + "db_name": "[steps('databaseConfig').db_name]", + "db_server": "[steps('databaseConfig').db_server]", + "manual_db_url": "[steps('databaseConfig').manual_db_url]", + "db_user": "[steps('databaseConfig').db_user]", + "db_password": "[steps('databaseConfig').db_password]", + "db_edition": "[steps('databaseConfig').db_edition]", + "storageAccountType": "[steps('storageConfig').storageAccountsType]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/MP_submission/mainTemplate.json b/AzureResourceManager/Artifactory/MP_submission/mainTemplate.json new file mode 100644 index 0000000..1c04533 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/mainTemplate.json @@ -0,0 +1,979 @@ +{ + "$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." + } + }, + "db_type": { + "type": "string", + "defaultValue": "Postgresql_deploy.json", + "allowedValues": [ + "Postgresql_deploy.json", + "MSSQL_deploy.json", + "Postgresql_existing.json", + "MSSQL_existing.json" + ], + "metadata": { + "description": "Deploy new Postgresql, MSSQL or use existing DB" + } + }, + "manual_db_url": { + "type": "string", + "metadata": { + "description": "DB server URL, if existing DB server is used instead of a new deployment (jdbc:sqlserver://.. or jdbc:postgresql://..)" + } + }, + "db_server": { + "type": "string", + "metadata": { + "description": "DB server name, if pre-existing DB is used" + } + }, + "db_name": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "MSSQL Database name" + } + }, + "db_edition": { + "type": "string", + "minLength": 1, + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ], + "metadata": { + "description": "MSSQL Database Edition" + } + }, + "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": "0.0.1", + "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", + "7.4.30", + "0.0.1" + ], + "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'" + } + }, + "joinKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Join key for Artifactory cluster. Generate join.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_user": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Database Admin user name" + } + }, + "db_password": { + "type": "securestring", + "minLength": 1, + "metadata": { + "description": "Database Admin password" + } + }, + "databases": { + "type": "object", + "defaultValue": { + "properties": [ + { + "name": "artdb", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + }, + "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": "[if(or(equals(parameters('db_type'), 'MSSQL_existing.json'),equals(parameters('db_type'),'Postgresql_existing.json')), parameters('db_server'), concat(variables('namingInfix'), 'sqlsrv'))]", + "artDBname": "[parameters('databases').properties[0].name]", + "postgres_db_user": "[concat(parameters('db_user'), '@', variables('azureSqlServerName'))]", + "db_user": "[if(or(equals(parameters('db_type'), 'Postgresql_deploy.json'),equals(parameters('db_type'),'Postgresql_existing.json')), variables('postgres_db_user'), parameters('db_user'))]", + "db_password": "[parameters('db_password')]", + "db_location": "[parameters('location')]", + "db_name": "[parameters('db_name')]", + "db_edition": "[parameters('db_edition')]", + "masterKey": "[parameters('masterKey')]", + "joinKey": "[parameters('joinKey')]", + "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": "[parameters('db_type')]", + "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": "2020-03-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": "2020-03-01", + "dependsOn": [ + "[resourceId('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": "2020-03-01", + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicPrimaryName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", + "[resourceId('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": "2020-03-01", + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicMemberName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]", + "[resourceId('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": "2020-03-01", + "properties": { + "publicIPAllocationMethod": "Static", + "dnsSettings": { + "domainNameLabel": "[variables('namingInfix')]" + } + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('pipMemberName')]", + "location": "[parameters('location')]", + "sku": { + "name": "Standard" + }, + "apiVersion": "2020-03-01", + "properties": { + "publicIPAllocationMethod": "Static", + "dnsSettings": { + "domainNameLabel": "[concat(variables('namingInfix'),'2')]" + } + } + }, + { + "type": "Microsoft.Network/loadBalancers", + "name": "[variables('lbName')]", + "location": "[parameters('location')]", + "apiVersion": "2020-03-01", + "sku": { + "name": "Standard" + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", + "[resourceId('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": "2019-06-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": "2019-09-01", + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('dbTemplateLocation')]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "db_user": { + "value": "[parameters('db_user')]" + }, + "db_password": { + "value": "[variables('db_password')]" + }, + "db_server": { + "value": "[variables('azureSqlServerName')]" + }, + "db_location": { + "value": "[variables('db_location')]" + }, + "databases": { + "value": "[parameters('databases')]" + }, + "db_name": { + "value": "[variables('db_name')]" + }, + "db_edition": { + "value": "[variables('db_edition')]" + }, + "manual_db_url": { + "value": "[parameters('manual_db_url')]" + } + } + } + }, + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "name": "[variables('scaleSetPrimaryName')]", + "location": "[parameters('location')]", + "apiVersion": "2018-10-01", + "dependsOn": [ + "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[resourceId('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'),'\nDB_TYPE=',parameters('db_type'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('artDBname'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_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": { + "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": [ + "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Compute/virtualMachineScaleSets/', variables('scaleSetPrimaryName'))]", + "[resourceId('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[resourceId('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=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nDB_TYPE=',parameters('db_type'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('artDBname'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_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": { + "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" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_deploy.json b/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_deploy.json new file mode 100644 index 0000000..2a96758 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_deploy.json @@ -0,0 +1,109 @@ +{ + "$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" + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + "rtdbCollation": "Latin1_General_100_CS_AS" + }, + "resources": [ + { + "name": "[parameters('db_server')]", + "type": "Microsoft.Sql/servers", + "kind": "v12.0", + "location": "[parameters('db_location')]", + "apiVersion": "2020-02-02-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": "[parameters('db_location')]", + "apiVersion": "2020-02-02-preview", + "dependsOn": [ + "[resourceId('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": "[parameters('db_location')]", + "apiVersion": "2020-02-02-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(resourceId('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + } + } +} diff --git a/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_existing.json b/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_existing.json new file mode 100644 index 0000000..4d7aa07 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_existing.json @@ -0,0 +1,76 @@ +{ + "$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": "mssqlsrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_deploy.json b/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_deploy.json new file mode 100644 index 0000000..464ebd5 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_deploy.json @@ -0,0 +1,178 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "xray", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artrtdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "skuCapacity": { + "type": "int", + "defaultValue": 2 + }, + "skuFamily": { + "type": "string", + "defaultValue": "Gen5" + }, + "skuName": { + "type": "string", + "defaultValue": "GP_Gen5_2" + }, + "skuSizeMB": { + "type": "int", + "defaultValue": 5120 + }, + "skuTier": { + "type": "string", + "defaultValue": "GeneralPurpose" + }, + "version": { + "type": "string", + "defaultValue": "9.6" + }, + "backupRetentionDays": { + "type": "int", + "defaultValue": 7 + }, + "geoRedundantBackup": { + "type": "string", + "defaultValue": "Disabled" + }, + "databases": { + "type": "object" + }, + "sslEnforcement": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Disabled", + "metadata": { + "description": "SSL Enforcement" + } + }, + "publicNetworkAccess": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Enabled", + "metadata": { + "description": "Public Network Access" + } + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/servers", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "name": "[parameters('db_server')]", + "properties": { + "version": "[parameters('version')]", + "administratorLogin": "[parameters('db_user')]", + "administratorLoginPassword": "[parameters('db_password')]", + "publicNetworkAccess": "[parameters('publicNetworkAccess')]", + "sslEnforcement": "[parameters('sslEnforcement')]", + "storageProfile": { + "storageMB": "[parameters('skuSizeMB')]", + "backupRetentionDays": "[parameters('backupRetentionDays')]", + "geoRedundantBackup": "[parameters('geoRedundantBackup')]" + } + }, + "sku": { + "name": "[parameters('skuName')]", + "tier": "[parameters('skuTier')]", + "capacity": "[parameters('skuCapacity')]", + "size": "[parameters('skuSizeMB')]", + "family": "[parameters('skuFamily')]" + }, + "resources": [ + { + "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", + "type": "firewallRules", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[0].name)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[0].charset]", + "collation": "[parameters('databases').properties[0].collation]" + } + } + ] + } + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[concat('jdbc:postgresql://', reference(resourceId('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + }, + "dbServerName": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "xrayConnString": { + "type": "string", + "value": "[concat('postgres://', reference(resourceId('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_existing.json b/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_existing.json new file mode 100644 index 0000000..e8757f3 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_existing.json @@ -0,0 +1,76 @@ +{ + "$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": "xraypostgressrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory.sh b/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory.sh new file mode 100644 index 0000000..12238a9 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory.sh @@ -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 </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 </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 ~(?.+)\\.${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 </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 </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 </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 </var/opt/jfrog/artifactory/etc/security/master.key +${MASTER_KEY} +EOF + +cat </var/opt/jfrog/artifactory/etc/binarystore.xml + + + + + + + + + + + + + + + + + crossNetworkStrategy + crossNetworkStrategy + 2 + 1 + + + + + remote + + + + local + + + + + ${STORAGE_ACCT} + ${STORAGE_ACCT_KEY} + https://${STORAGE_ACCT}.blob.core.windows.net/ + ${STORAGE_CONTAINER} + + +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." diff --git a/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory7.sh b/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory7.sh new file mode 100644 index 0000000..75bf714 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory7.sh @@ -0,0 +1,267 @@ +#!/bin/bash + +# Script stdout and stderr are stored in /var/lib/waagent/custom-script/download on the VM +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_TYPE=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_TYPE=" | sed "s/DB_TYPE=//") +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=//") +CERTIFICATE=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//") +CERTIFICATE_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_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=//") +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" + +# Install Postgresql driver +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/postgresql-9.4.1212.jar https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar >> /tmp/install-databse-driver.log 2>&1 + +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 </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 + +if [[ -n "${CERTIFICATE}" ]] || [[ -n "${CERTIFICATE_KEY}" ]]; then + +cat </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 ~(?.+)\\.${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 +else + +cat </etc/nginx/conf.d/artifactory.conf +## server configuration +server { + listen 80 ; + server_name ~(?.+)\\.${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 + +fi + +mkdir -p /opt/jfrog/artifactory/var/etc/artifactory/ +cat </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 + + +if [[ $DB_TYPE =~ "MSSQL" ]]; then + # Set MS SQL configuration + cat <>/var/opt/jfrog/artifactory/etc/system.yaml + ## One of: mysql, oracle, mssql, postgresql, mariadb + ## Default: Embedded derby + ## Example for mssql + 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 +elif [[ $DB_TYPE =~ "Postgresql" ]]; then + # Set Postgresql settings (add if/else for Postgres/MSSQL) ATTENTION - RT VM 7.5.5 doesn't have Postgres driver!! + cat <>/var/opt/jfrog/artifactory/etc/system.yaml + ## One of: mysql, oracle, mssql, postgresql, mariadb + ## Default: Embedded derby + ## Example for postgresql + type: postgresql + driver: org.postgresql.Driver + url: ${DB_URL}/${DB_NAME} + username: ${DB_USER} + password: ${DB_PASSWORD} + +EOF +fi + +# Create master.key on each node +mkdir -p /opt/jfrog/artifactory/var/etc/security/ +cat </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 </var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml + + + + ${STORAGE_ACCT} + ${STORAGE_ACCT_KEY} + https://${STORAGE_ACCT}.blob.core.windows.net/ + ${STORAGE_CONTAINER} + + +EOF + +if [[ -n "${CERTIFICATE}" ]] || [[ -n "${CERTIFICATE_KEY}" ]]; then +cat </tmp/temp.pem +${CERTIFICATE} +EOF +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 </tmp/temp.key +${CERTIFICATE_KEY} +EOF +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 +fi + +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 "" diff --git a/AzureResourceManager/Artifactory/MP_submission/scripts/version_selector.sh b/AzureResourceManager/Artifactory/MP_submission/scripts/version_selector.sh new file mode 100644 index 0000000..aab3104 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/scripts/version_selector.sh @@ -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 + ./install_artifactory.sh + echo "\ninstall_artifactory.sh was selected" >> user-data.txt +else + ./install_artifactory7.sh + echo "\ninstall_artifactory7.sh was selected" >> user-data.txt +fi \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/README.md b/AzureResourceManager/Artifactory/README.md new file mode 100644 index 0000000..66d7be3 --- /dev/null +++ b/AzureResourceManager/Artifactory/README.md @@ -0,0 +1,81 @@ +# Setup Artifactory Enterprise + + + + + + + + +This template can help you setup the [Artifactory Enterprise](https://jfrog.com/artifactory) on Azure. + +## A. Deploy Artifactory Enterprise on Azure +![screenshot](images/HA_Diagram.png) + + +1. Click "Deploy to Azure" button. If you haven't got an Azure subscription, it will guide you on how to signup for a free trial. + +2. Enter a valid values to parameters. At least 1 license has to be provided. + + +![screenshot](images/Parameters.png) + +3. Click on Review + Create, then on Create to start deploying resources. It will deploy MsSQL or Postgresql database (or it can use existing), Azure Blob storage container, VM installing Nginx and Artifactory and Load balancer. + +4. Once deployment is done. Copy FQDN from Output of deployment template. + +5. Access artifactory using FQDN. + +6. You will see specified artifactory member nodes in 'Admin -> High Availability' page. + +### Note: +1. This template only supports Artifactory version 6.18.x and above. +2. Turn off daily backups. Read Documentation provided [here](https://www.jfrog.com/confluence/display/RTF/Managing+Backups) +3. Use SSL Certificate with valid wild card to you artifactory as docker registry with subdomain method. +4. Input values for 'adminUsername' and 'adminPassword' parameters needs to follow azure VM access rules. +5. One primary node is configured automatically. And, Minimum 1 member node is expected for the Artifactory HA installation. +6. This template provides support for max 5 licenses. To add more licenses, Edit the template (input fields, CustomScript sections) and install_artifactory.sh script. +7. Refer to [System Requirements](https://www.jfrog.com/confluence/display/RTF/System+Requirements) for changing 'extraJavaOptions' input parameter value. + +### Steps to setup Artifactory as secure docker registry +considering you have SSL certificate for `*.jfrog.team` +1. Pass your SSL Certificate in parameter `Certificate` as string +2. Pass your SSL Certificate Key in parameter `CertificateKey` as string +3. Set `CertificateDomain` as `jfrog.team` +4. Set `ArtifactoryServerName` as `artifactory` if you want to access artifactory with `https://artifactory.jfrog.team` +5. Create DNS record with entry `artifactory.jfrog.team` pointing to load balancer value provided as output in template deployment. +6. Create DNS record with entry `*.jfrog.team` pointing to load balancer value provided as output in template deployment. +7. If you have virtual docker registry with name `docker-virtual` in artifactory. You can access it via `docker-virtual.jfrog.team` + e.g ```docker pull docker-virtual.jfrog.team/nginx``` + +### Steps to upgrade Artifactory Version + +1. Login into Primary VM instance and sudo as root. Use the admin credentials provided in the install setup. +Note: Use load balancer's NAT entries under Azure resources, to get the allocated NAT port for accessing the VM instance. + +2. Stop nginx and artifactory services. + ``` + service nginx stop + service artifactory stop + ``` + +3. Upgrade artifactory with following apt-get install command. + ``` + apt-get update + apt-get -y install jfrog-artifactory-pro=${ARTIFACTORY_VERSION} + ``` +4. Start artifactory and nginx services. + ``` + service artifactory start + service nginx start + ``` +5. Repeat above steps for all member nodes. + +------ +#### Note: +Supported locations: `East US 2`, `Central US`, `West Central US` and `West Europe`. +Please check the Azure region support for `Standard Sku` property in load balancer for this template to work properly. +Check for SQL server support on specified location. If SQL server is not available in the location, Use 'DB_Location' to specify the location with SQL server support. + + + diff --git a/AzureResourceManager/Artifactory/azuredeploy_ms_ps.json b/AzureResourceManager/Artifactory/azuredeploy_ms_ps.json new file mode 100644 index 0000000..daf1497 --- /dev/null +++ b/AzureResourceManager/Artifactory/azuredeploy_ms_ps.json @@ -0,0 +1,982 @@ +{ + "$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." + } + }, + "db_type": { + "type": "string", + "defaultValue": "Postgresql_deploy.json", + "allowedValues": [ + "Postgresql_deploy.json", + "MSSQL_deploy.json", + "Postgresql_existing.json", + "MSSQL_existing.json" + ], + "metadata": { + "description": "Deploy new Postgresql, MSSQL or use existing DB" + } + }, + "manual_db_url": { + "type": "string", + "metadata": { + "description": "DB server URL, if existing DB server is used instead of a new deployment (jdbc:sqlserver://.. or jdbc:postgresql://..)" + } + }, + "db_server": { + "type": "string", + "metadata": { + "description": "DB server name, if pre-existing DB is used" + } + }, + "db_name": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "MSSQL Database name" + } + }, + "db_edition": { + "type": "string", + "minLength": 1, + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ], + "metadata": { + "description": "MSSQL Database Edition" + } + }, + "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": "0.0.1", + "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", + "7.5.7", + "0.0.1" + ], + "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'" + } + }, + "joinKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Join key for Artifactory cluster. Generate join.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_user": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Database Admin user name" + } + }, + "db_password": { + "type": "securestring", + "minLength": 1, + "metadata": { + "description": "Database Admin password" + } + }, + "databases": { + "type": "object", + "defaultValue": { + "properties": [ + { + "name": "artdb", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + }, + "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": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/arm-xray/AzureResourceManager/Artifactory/" + }, + "_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": "[if(or(equals(parameters('db_type'), 'MSSQL_existing.json'),equals(parameters('db_type'),'Postgresql_existing.json')), parameters('db_server'), concat(variables('namingInfix'), 'sqlsrv'))]", + "artDBname": "[parameters('databases').properties[0].name]", + "postgres_db_user": "[concat(parameters('db_user'), '@', variables('azureSqlServerName'))]", + "db_user": "[if(or(equals(parameters('db_type'), 'Postgresql_deploy.json'),equals(parameters('db_type'),'Postgresql_existing.json')), variables('postgres_db_user'), parameters('db_user'))]", + "db_password": "[parameters('db_password')]", + "db_location": "[parameters('location')]", + "db_name": "[parameters('db_name')]", + "db_edition": "[parameters('db_edition')]", + "masterKey": "[parameters('masterKey')]", + "joinKey": "[parameters('joinKey')]", + "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": "[parameters('db_type')]", + "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": "2020-03-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": "2020-03-01", + "dependsOn": [ + "[resourceId('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": "2020-03-01", + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicPrimaryName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", + "[resourceId('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": "2020-03-01", + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicMemberName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]", + "[resourceId('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": "2020-03-01", + "properties": { + "publicIPAllocationMethod": "Static", + "dnsSettings": { + "domainNameLabel": "[variables('namingInfix')]" + } + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('pipMemberName')]", + "location": "[parameters('location')]", + "sku": { + "name": "Standard" + }, + "apiVersion": "2020-03-01", + "properties": { + "publicIPAllocationMethod": "Static", + "dnsSettings": { + "domainNameLabel": "[concat(variables('namingInfix'),'2')]" + } + } + }, + { + "type": "Microsoft.Network/loadBalancers", + "name": "[variables('lbName')]", + "location": "[parameters('location')]", + "apiVersion": "2020-03-01", + "sku": { + "name": "Standard" + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", + "[resourceId('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": "2019-06-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": "2019-09-01", + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('dbTemplateLocation')]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "db_user": { + "value": "[parameters('db_user')]" + }, + "db_password": { + "value": "[variables('db_password')]" + }, + "db_server": { + "value": "[variables('azureSqlServerName')]" + }, + "db_location": { + "value": "[variables('db_location')]" + }, + "databases": { + "value": "[parameters('databases')]" + }, + "db_name": { + "value": "[variables('db_name')]" + }, + "db_edition": { + "value": "[variables('db_edition')]" + }, + "manual_db_url": { + "value": "[parameters('manual_db_url')]" + } + } + } + }, + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "name": "[variables('scaleSetPrimaryName')]", + "location": "[parameters('location')]", + "apiVersion": "2018-10-01", + "dependsOn": [ + "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[resourceId('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'),'\nDB_TYPE=',parameters('db_type'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('artDBname'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_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": { + "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": [ + "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Compute/virtualMachineScaleSets/', variables('scaleSetPrimaryName'))]", + "[resourceId('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[resourceId('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=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nDB_TYPE=',parameters('db_type'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('artDBname'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_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": { + "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" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/azuredeploy_ms_ps.parameters.json b/AzureResourceManager/Artifactory/azuredeploy_ms_ps.parameters.json new file mode 100644 index 0000000..182f9f0 --- /dev/null +++ b/AzureResourceManager/Artifactory/azuredeploy_ms_ps.parameters.json @@ -0,0 +1,68 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "clusterName": { + "value": "rtha" + }, + "adminUsername": { + "value": "vmuser" + }, + "adminPassword": { + "value": "password" + }, + "db_type": { + "value": "Postgresql_deploy.json" + }, + "db_user": { + "value": "artifactory" + }, + "db_password": { + "value": "password" + }, + "db_name": { + "value": "artdb" + }, + "db_edition": { + "value": "Basic" + }, + "databases": { + "value": { + "properties": [ + { + "name": "artdb", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + }, + "manual_db_url": { + "value": "jdbc:postgresql://postgressrvr.postgres.database.azure.com:5432" + }, + "db_server": { + "value": "postgressrvr" + }, + "masterKey": { + "value": "GEN-UNIQUE" + }, + "joinKey": { + "value": "GEN-UNIQUE" + }, + "certificate": { + "value": "-----BEGIN CERTIFICATE----- -----END CERTIFICATE-----" + }, + "certificateKey": { + "value": "-----BEGIN PRIVATE KEY----- -----END PRIVATE KEY-----" + }, + "artifactoryLicense1": { + "value": "" + }, + "artifactoryLicense2": { + "value": "" + }, + "artifactoryLicense3": { + "value": "" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/images/HA_Diagram.png b/AzureResourceManager/Artifactory/images/HA_Diagram.png new file mode 100644 index 0000000..98cd3ee Binary files /dev/null and b/AzureResourceManager/Artifactory/images/HA_Diagram.png differ diff --git a/AzureResourceManager/Artifactory/images/Parameters.png b/AzureResourceManager/Artifactory/images/Parameters.png new file mode 100644 index 0000000..a735cef Binary files /dev/null and b/AzureResourceManager/Artifactory/images/Parameters.png differ diff --git a/AzureResourceManager/Artifactory/images/add_licenses.png b/AzureResourceManager/Artifactory/images/add_licenses.png new file mode 100644 index 0000000..3a06f9d Binary files /dev/null and b/AzureResourceManager/Artifactory/images/add_licenses.png differ diff --git a/AzureResourceManager/Artifactory/nested/MSSQL_deploy.json b/AzureResourceManager/Artifactory/nested/MSSQL_deploy.json new file mode 100644 index 0000000..2a96758 --- /dev/null +++ b/AzureResourceManager/Artifactory/nested/MSSQL_deploy.json @@ -0,0 +1,109 @@ +{ + "$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" + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + "rtdbCollation": "Latin1_General_100_CS_AS" + }, + "resources": [ + { + "name": "[parameters('db_server')]", + "type": "Microsoft.Sql/servers", + "kind": "v12.0", + "location": "[parameters('db_location')]", + "apiVersion": "2020-02-02-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": "[parameters('db_location')]", + "apiVersion": "2020-02-02-preview", + "dependsOn": [ + "[resourceId('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": "[parameters('db_location')]", + "apiVersion": "2020-02-02-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(resourceId('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + } + } +} diff --git a/AzureResourceManager/Artifactory/nested/MSSQL_existing.json b/AzureResourceManager/Artifactory/nested/MSSQL_existing.json new file mode 100644 index 0000000..4d7aa07 --- /dev/null +++ b/AzureResourceManager/Artifactory/nested/MSSQL_existing.json @@ -0,0 +1,76 @@ +{ + "$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": "mssqlsrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/nested/Postgresql_deploy.json b/AzureResourceManager/Artifactory/nested/Postgresql_deploy.json new file mode 100644 index 0000000..464ebd5 --- /dev/null +++ b/AzureResourceManager/Artifactory/nested/Postgresql_deploy.json @@ -0,0 +1,178 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "xray", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artrtdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "skuCapacity": { + "type": "int", + "defaultValue": 2 + }, + "skuFamily": { + "type": "string", + "defaultValue": "Gen5" + }, + "skuName": { + "type": "string", + "defaultValue": "GP_Gen5_2" + }, + "skuSizeMB": { + "type": "int", + "defaultValue": 5120 + }, + "skuTier": { + "type": "string", + "defaultValue": "GeneralPurpose" + }, + "version": { + "type": "string", + "defaultValue": "9.6" + }, + "backupRetentionDays": { + "type": "int", + "defaultValue": 7 + }, + "geoRedundantBackup": { + "type": "string", + "defaultValue": "Disabled" + }, + "databases": { + "type": "object" + }, + "sslEnforcement": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Disabled", + "metadata": { + "description": "SSL Enforcement" + } + }, + "publicNetworkAccess": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Enabled", + "metadata": { + "description": "Public Network Access" + } + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/servers", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "name": "[parameters('db_server')]", + "properties": { + "version": "[parameters('version')]", + "administratorLogin": "[parameters('db_user')]", + "administratorLoginPassword": "[parameters('db_password')]", + "publicNetworkAccess": "[parameters('publicNetworkAccess')]", + "sslEnforcement": "[parameters('sslEnforcement')]", + "storageProfile": { + "storageMB": "[parameters('skuSizeMB')]", + "backupRetentionDays": "[parameters('backupRetentionDays')]", + "geoRedundantBackup": "[parameters('geoRedundantBackup')]" + } + }, + "sku": { + "name": "[parameters('skuName')]", + "tier": "[parameters('skuTier')]", + "capacity": "[parameters('skuCapacity')]", + "size": "[parameters('skuSizeMB')]", + "family": "[parameters('skuFamily')]" + }, + "resources": [ + { + "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", + "type": "firewallRules", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[0].name)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[0].charset]", + "collation": "[parameters('databases').properties[0].collation]" + } + } + ] + } + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[concat('jdbc:postgresql://', reference(resourceId('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + }, + "dbServerName": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "xrayConnString": { + "type": "string", + "value": "[concat('postgres://', reference(resourceId('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/nested/Postgresql_existing.json b/AzureResourceManager/Artifactory/nested/Postgresql_existing.json new file mode 100644 index 0000000..e8757f3 --- /dev/null +++ b/AzureResourceManager/Artifactory/nested/Postgresql_existing.json @@ -0,0 +1,76 @@ +{ + "$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": "xraypostgressrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/scripts/install_artifactory.sh b/AzureResourceManager/Artifactory/scripts/install_artifactory.sh new file mode 100644 index 0000000..12238a9 --- /dev/null +++ b/AzureResourceManager/Artifactory/scripts/install_artifactory.sh @@ -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 </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 </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 ~(?.+)\\.${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 </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 </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 </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 </var/opt/jfrog/artifactory/etc/security/master.key +${MASTER_KEY} +EOF + +cat </var/opt/jfrog/artifactory/etc/binarystore.xml + + + + + + + + + + + + + + + + + crossNetworkStrategy + crossNetworkStrategy + 2 + 1 + + + + + remote + + + + local + + + + + ${STORAGE_ACCT} + ${STORAGE_ACCT_KEY} + https://${STORAGE_ACCT}.blob.core.windows.net/ + ${STORAGE_CONTAINER} + + +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." diff --git a/AzureResourceManager/Artifactory/scripts/install_artifactory7.sh b/AzureResourceManager/Artifactory/scripts/install_artifactory7.sh new file mode 100644 index 0000000..75bf714 --- /dev/null +++ b/AzureResourceManager/Artifactory/scripts/install_artifactory7.sh @@ -0,0 +1,267 @@ +#!/bin/bash + +# Script stdout and stderr are stored in /var/lib/waagent/custom-script/download on the VM +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_TYPE=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_TYPE=" | sed "s/DB_TYPE=//") +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=//") +CERTIFICATE=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//") +CERTIFICATE_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_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=//") +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" + +# Install Postgresql driver +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/postgresql-9.4.1212.jar https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar >> /tmp/install-databse-driver.log 2>&1 + +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 </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 + +if [[ -n "${CERTIFICATE}" ]] || [[ -n "${CERTIFICATE_KEY}" ]]; then + +cat </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 ~(?.+)\\.${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 +else + +cat </etc/nginx/conf.d/artifactory.conf +## server configuration +server { + listen 80 ; + server_name ~(?.+)\\.${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 + +fi + +mkdir -p /opt/jfrog/artifactory/var/etc/artifactory/ +cat </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 + + +if [[ $DB_TYPE =~ "MSSQL" ]]; then + # Set MS SQL configuration + cat <>/var/opt/jfrog/artifactory/etc/system.yaml + ## One of: mysql, oracle, mssql, postgresql, mariadb + ## Default: Embedded derby + ## Example for mssql + 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 +elif [[ $DB_TYPE =~ "Postgresql" ]]; then + # Set Postgresql settings (add if/else for Postgres/MSSQL) ATTENTION - RT VM 7.5.5 doesn't have Postgres driver!! + cat <>/var/opt/jfrog/artifactory/etc/system.yaml + ## One of: mysql, oracle, mssql, postgresql, mariadb + ## Default: Embedded derby + ## Example for postgresql + type: postgresql + driver: org.postgresql.Driver + url: ${DB_URL}/${DB_NAME} + username: ${DB_USER} + password: ${DB_PASSWORD} + +EOF +fi + +# Create master.key on each node +mkdir -p /opt/jfrog/artifactory/var/etc/security/ +cat </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 </var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml + + + + ${STORAGE_ACCT} + ${STORAGE_ACCT_KEY} + https://${STORAGE_ACCT}.blob.core.windows.net/ + ${STORAGE_CONTAINER} + + +EOF + +if [[ -n "${CERTIFICATE}" ]] || [[ -n "${CERTIFICATE_KEY}" ]]; then +cat </tmp/temp.pem +${CERTIFICATE} +EOF +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 </tmp/temp.key +${CERTIFICATE_KEY} +EOF +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 +fi + +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 "" diff --git a/AzureResourceManager/Artifactory/scripts/version_selector.sh b/AzureResourceManager/Artifactory/scripts/version_selector.sh new file mode 100644 index 0000000..aab3104 --- /dev/null +++ b/AzureResourceManager/Artifactory/scripts/version_selector.sh @@ -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 + ./install_artifactory.sh + echo "\ninstall_artifactory.sh was selected" >> user-data.txt +else + ./install_artifactory7.sh + echo "\ninstall_artifactory7.sh was selected" >> user-data.txt +fi \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/vm_install/install_pro7_to_vm.sh b/AzureResourceManager/Artifactory/vm_install/install_pro7_to_vm.sh new file mode 100644 index 0000000..41d33cc --- /dev/null +++ b/AzureResourceManager/Artifactory/vm_install/install_pro7_to_vm.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# Upgrade version for every release +ARTIFACTORY_VERSION=7.6.2 +UBUNTU_CODENAME=$(cat /etc/lsb-release | grep "^DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//") + +export DEBIAN_FRONTEND=noninteractive + +# install the wget and curl +apt-get update +apt-get -y install wget curl>> /tmp/install-curl.log 2>&1 + +#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" + +# install the Artifactory PRO and Nginx +echo "deb https://jfrog.bintray.com/artifactory-pro-debs ${UBUNTU_CODENAME} main" | tee -a /etc/apt/sources.list +curl --retry 5 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 + +# Add callhome metadata (allow us to collect information) +mkdir -p /var/opt/jfrog/artifactory/etc/info +cat </var/opt/jfrog/artifactory/etc/info/installer-info.json +{ + "productId": "ARM_artifactory-pro/1.0.0", + "features": [ + { + "featureId": "Partner/ACC-007221" + } + ] +} +EOF + +#Install database drivers (for Java 11, path is different for RT6 and RT7) +curl --retry 5 -L -o /opt/jfrog/artifactory/app/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 >> /tmp/install-databse-driver.log 2>&1 +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/mssql-jdbc-7.4.1.jre11.jar https://bintray.com/artifact/download/bintray/jcenter/com/microsoft/sqlserver/mssql-jdbc/7.4.1.jre11/mssql-jdbc-7.4.1.jre11.jar >> /tmp/install-databse-driver.log 2>&1 +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/postgresql-9.4.1212.jar https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar >> /tmp/install-databse-driver.log 2>&1 + +#Configuring nginx +rm /etc/nginx/sites-enabled/default + +printf "\nartifactory.ping.allowUnauthenticated=true" >> /var/opt/jfrog/artifactory/etc/artifactory/artifactory.system.properties + +chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/* + +# Remove Artifactory service from boot up run +systemctl disable artifactory +systemctl disable nginx \ No newline at end of file diff --git a/AzureResourceManager/JCR/LICENSE b/AzureResourceManager/JCR/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/AzureResourceManager/JCR/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/AzureResourceManager/JCR/MP_submission_6/createUiDefinition.json b/AzureResourceManager/JCR/MP_submission_6/createUiDefinition.json new file mode 100644 index 0000000..a0b103d --- /dev/null +++ b/AzureResourceManager/JCR/MP_submission_6/createUiDefinition.json @@ -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]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/JCR/MP_submission_6/jfrog-container-registry-artifactory-6-16-0-7.zip b/AzureResourceManager/JCR/MP_submission_6/jfrog-container-registry-artifactory-6-16-0-7.zip new file mode 100644 index 0000000..c73b5e9 Binary files /dev/null and b/AzureResourceManager/JCR/MP_submission_6/jfrog-container-registry-artifactory-6-16-0-7.zip differ diff --git a/AzureResourceManager/JCR/MP_submission_6/mainTemplate.json b/AzureResourceManager/JCR/MP_submission_6/mainTemplate.json new file mode 100644 index 0000000..08f765c --- /dev/null +++ b/AzureResourceManager/JCR/MP_submission_6/mainTemplate.json @@ -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" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/JCR/MP_submission_6/nested/azureDBDeploy.json b/AzureResourceManager/JCR/MP_submission_6/nested/azureDBDeploy.json new file mode 100644 index 0000000..70c31a5 --- /dev/null +++ b/AzureResourceManager/JCR/MP_submission_6/nested/azureDBDeploy.json @@ -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')]" + } + } +} diff --git a/AzureResourceManager/JCR/MP_submission_6/scripts/install_artifactory.sh b/AzureResourceManager/JCR/MP_submission_6/scripts/install_artifactory.sh new file mode 100644 index 0000000..d033b1d --- /dev/null +++ b/AzureResourceManager/JCR/MP_submission_6/scripts/install_artifactory.sh @@ -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 </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 </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 ~(?.+)\\.${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 </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 </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 </var/opt/jfrog/artifactory/etc/security/master.key +${MASTER_KEY} +EOF + +cat </var/opt/jfrog/artifactory/etc/binarystore.xml + + + + + + + + + + + + + + + + + crossNetworkStrategy + crossNetworkStrategy + 2 + 1 + + + + + remote + + + + local + + + + + ${STORAGE_ACCT} + ${STORAGE_ACCT_KEY} + ${STORAGE_ACT_ENDPOINT} + ${STORAGE_CONTAINER} + + +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 diff --git a/AzureResourceManager/JCR/MP_submission_7/createUiDefinition.json b/AzureResourceManager/JCR/MP_submission_7/createUiDefinition.json new file mode 100644 index 0000000..e61080f --- /dev/null +++ b/AzureResourceManager/JCR/MP_submission_7/createUiDefinition.json @@ -0,0 +1,340 @@ +{ + "$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_D2s_v3" + ], + "constraints": { + "allowedSizes": [ + "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]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/JCR/MP_submission_7/jfrog-container-registry-artifactory-7-2-1-7.zip b/AzureResourceManager/JCR/MP_submission_7/jfrog-container-registry-artifactory-7-2-1-7.zip new file mode 100644 index 0000000..11a7727 Binary files /dev/null and b/AzureResourceManager/JCR/MP_submission_7/jfrog-container-registry-artifactory-7-2-1-7.zip differ diff --git a/AzureResourceManager/JCR/MP_submission_7/jfrog-container-registry-artifactory-7-4-3-1.zip b/AzureResourceManager/JCR/MP_submission_7/jfrog-container-registry-artifactory-7-4-3-1.zip new file mode 100644 index 0000000..f36955f Binary files /dev/null and b/AzureResourceManager/JCR/MP_submission_7/jfrog-container-registry-artifactory-7-4-3-1.zip differ diff --git a/AzureResourceManager/JCR/MP_submission_7/mainTemplate.json b/AzureResourceManager/JCR/MP_submission_7/mainTemplate.json new file mode 100644 index 0000000..bd39da3 --- /dev/null +++ b/AzureResourceManager/JCR/MP_submission_7/mainTemplate.json @@ -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_D2s_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." + } + }, + "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" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/JCR/MP_submission_7/nested/azureDBDeploy.json b/AzureResourceManager/JCR/MP_submission_7/nested/azureDBDeploy.json new file mode 100644 index 0000000..70c31a5 --- /dev/null +++ b/AzureResourceManager/JCR/MP_submission_7/nested/azureDBDeploy.json @@ -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')]" + } + } +} diff --git a/AzureResourceManager/JCR/MP_submission_7/scripts/install_artifactory7.sh b/AzureResourceManager/JCR/MP_submission_7/scripts/install_artifactory7.sh new file mode 100644 index 0000000..77a62b7 --- /dev/null +++ b/AzureResourceManager/JCR/MP_submission_7/scripts/install_artifactory7.sh @@ -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 </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 </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 ~(?.+)\\.${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 <>/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 </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 </var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml + + + + ${STORAGE_ACCT} + ${STORAGE_ACCT_KEY} + https://${STORAGE_ACCT}.blob.core.windows.net/ + ${STORAGE_CONTAINER} + + +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 diff --git a/AzureResourceManager/JCR/README.md b/AzureResourceManager/JCR/README.md new file mode 100644 index 0000000..5408864 --- /dev/null +++ b/AzureResourceManager/JCR/README.md @@ -0,0 +1,58 @@ +# Setup JFrog Container Registry + + + + + + + + +This template can help you setup the [JFrog Container Registry](https://www.jfrog.com/confluence/display/JCR/Welcome+to+JFrog+Container+Registry) on Azure. + +## A. Deploy JFrog Container Registry on Azure + +1. Click the "Deploy to Azure" button. + +2. Fill out the settings. Make sure to provide a valid SSL certificate. If using no certificate or one that is self-signed, see [Docker's documentation on client configuration](https://docs.docker.com/registry/insecure/). + +3. Click on "Purchase" to start deploying resources. It will deploy: + * Microsoft SQL database + * Azure Blob storage service + * A VM with NGINX and JFrog Container Registry + * Azure Load Balancer + +4. Once deployment is done. Copy FQDN from Output of deployment template. + +5. Access artifactory using FQDN. + +### Note: +1. Turn off daily backups. Read Documentation provided [here](https://www.jfrog.com/confluence/display/RTF/Managing+Backups) +2. Add an SSL Certificate to access Docker without using the insecure option +3. Input values for 'adminUsername' and 'adminPassword' parameters needs to follow azure VM access rules. +4. Refer to [System Requirements](https://www.jfrog.com/confluence/display/RTF/System+Requirements) for changing 'extraJavaOptions' input parameter value. + +### Steps to setup Artifactory as secure docker registry +You will need a valid SSL certificate for a domain name (for example, artifactory.jfrog.team) +1. Pass your SSL Certificate in parameter `Certificate` as string +2. Pass your SSL Certificate Key in parameter `CertificateKey` as string +3. Create DNS record with an entry that matches your domain name pointing to the load balancer value provided as output in template deployment. +4. You should now be able to access any docker registry using the path method. + * Login: `docker login [domain name]` in our example, that would be `docker login artifactory.jfrog.team` + * Pull/Push to a particular repository: `docker pull [domain name]/[repository name]/[image name]:[tag]` + * Example with our domain, pull from repository `docker-local`, the `latest` `busybox` image + * `docker pull artifactory.jfrog.team/docker-local/busybox:latest` + +### Steps to upgrade Artifactory Version + +1. Login into the VM instance and sudo as root. Use the admin credentials provided in the install setup. +Note: Use load balancer's NAT entries under Azure resources, to get the allocated NAT port for accessing the VM instance. + +2. Upgrade artifactory with following [RPM instructions](https://www.jfrog.com/confluence/display/JCR/Upgrading+JFrog+Container+Registry#UpgradingJFrogContainerRegistry-RPMInstallation). +------ +#### Note: +Supported locations: `East US 2`, `Central US`, `West Central US` and `West Europe`. +Please check the Azure region support for `Standard Sku` property in load balancer for this template to work properly. +Check for SQL server support on specified location. If SQL server is not available in the location, Use 'DB_Location' to specify the location with SQL server support. + + + \ No newline at end of file diff --git a/AzureResourceManager/JCR/azuredeploy.json b/AzureResourceManager/JCR/azuredeploy.json new file mode 100644 index 0000000..1a5878c --- /dev/null +++ b/AzureResourceManager/JCR/azuredeploy.json @@ -0,0 +1,622 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "vmSku": { + "type": "string", + "defaultValue": "Standard_D2s_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." + } + }, + "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": "string", + "defaultValue": "1ce2be4490ca2c662cb79636cf9b7b8e", + "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": "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-----", + "metadata": { + "description": "To use Artifactory as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate." + } + }, + "certificateKey": { + "type": "string", + "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-----", + "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": "https://raw.githubusercontent.com/JFrogDev/JFrog-Cloud-Installers/master/AzureResourceManager/JCR/" + }, + "_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-private", + "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-private", + "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" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/JCR/azuredeploy.parameters.json b/AzureResourceManager/JCR/azuredeploy.parameters.json new file mode 100644 index 0000000..c73c281 --- /dev/null +++ b/AzureResourceManager/JCR/azuredeploy.parameters.json @@ -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": "GEN-UNIQUE" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/JCR/images/HA_Diagram.png b/AzureResourceManager/JCR/images/HA_Diagram.png new file mode 100644 index 0000000..98cd3ee Binary files /dev/null and b/AzureResourceManager/JCR/images/HA_Diagram.png differ diff --git a/AzureResourceManager/JCR/images/add_licenses.png b/AzureResourceManager/JCR/images/add_licenses.png new file mode 100644 index 0000000..3a06f9d Binary files /dev/null and b/AzureResourceManager/JCR/images/add_licenses.png differ diff --git a/AzureResourceManager/JCR/nested/azureDBDeploy.json b/AzureResourceManager/JCR/nested/azureDBDeploy.json new file mode 100644 index 0000000..8c608f5 --- /dev/null +++ b/AzureResourceManager/JCR/nested/azureDBDeploy.json @@ -0,0 +1,96 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "minLength": 1 + }, + "db_name": { + "type": "string", + "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": "2015-05-01-preview", + "dependsOn": [ + + ], + "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": "2015-05-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": "2015-05-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')]" + } + } +} diff --git a/AzureResourceManager/JCR/scripts/install_artifactory.sh b/AzureResourceManager/JCR/scripts/install_artifactory.sh new file mode 100644 index 0000000..d033b1d --- /dev/null +++ b/AzureResourceManager/JCR/scripts/install_artifactory.sh @@ -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 </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 </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 ~(?.+)\\.${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 </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 </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 </var/opt/jfrog/artifactory/etc/security/master.key +${MASTER_KEY} +EOF + +cat </var/opt/jfrog/artifactory/etc/binarystore.xml + + + + + + + + + + + + + + + + + crossNetworkStrategy + crossNetworkStrategy + 2 + 1 + + + + + remote + + + + local + + + + + ${STORAGE_ACCT} + ${STORAGE_ACCT_KEY} + ${STORAGE_ACT_ENDPOINT} + ${STORAGE_CONTAINER} + + +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 diff --git a/AzureResourceManager/JCR/scripts/install_artifactory7.sh b/AzureResourceManager/JCR/scripts/install_artifactory7.sh new file mode 100644 index 0000000..77a62b7 --- /dev/null +++ b/AzureResourceManager/JCR/scripts/install_artifactory7.sh @@ -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 </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 </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 ~(?.+)\\.${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 <>/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 </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 </var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml + + + + ${STORAGE_ACCT} + ${STORAGE_ACCT_KEY} + https://${STORAGE_ACCT}.blob.core.windows.net/ + ${STORAGE_CONTAINER} + + +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 diff --git a/AzureResourceManager/Postgresql/azurePostgresDBDeploy.json b/AzureResourceManager/Postgresql/azurePostgresDBDeploy.json new file mode 100644 index 0000000..b06316e --- /dev/null +++ b/AzureResourceManager/Postgresql/azurePostgresDBDeploy.json @@ -0,0 +1,175 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "xray", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "xrayrtdb", + "minLength": 1 + }, + "db_location": { + "type": "string", + "defaultValue": "" + }, + "skuCapacity": { + "type": "int", + "defaultValue": 2 + }, + "skuFamily": { + "type": "string", + "defaultValue": "Gen5" + }, + "skuName": { + "type": "string", + "defaultValue": "GP_Gen5_2" + }, + "skuSizeMB": { + "type": "int", + "defaultValue": 5120 + }, + "skuTier": { + "type": "string", + "defaultValue": "GeneralPurpose" + }, + "version": { + "type": "string", + "defaultValue": "9.6" + }, + "backupRetentionDays": { + "type": "int", + "defaultValue": 7 + }, + "geoRedundantBackup": { + "type": "string", + "defaultValue": "Disabled" + }, + "databases": { + "type": "object", + "defaultValue": + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + }, + "sslEnforcement": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Disabled", + "metadata": { + "description": "SSL Enforcement" + } + }, + "publicNetworkAccess": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Enabled", + "metadata": { + "description": "Public Network Access" + } + } + }, + "variables": { + "db_location": "[if(equals(parameters('db_location'), ''), resourceGroup().location, parameters('db_location'))]" + }, + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/servers", + "apiVersion": "2017-12-01", + "location": "[variables('db_location')]", + "name": "[parameters('db_server')]", + "properties": { + "version": "[parameters('version')]", + "administratorLogin": "[parameters('db_user')]", + "administratorLoginPassword": "[parameters('db_password')]", + "publicNetworkAccess": "[parameters('publicNetworkAccess')]", + "sslEnforcement": "[parameters('sslEnforcement')]", + "storageProfile": { + "storageMB": "[parameters('skuSizeMB')]", + "backupRetentionDays": "[parameters('backupRetentionDays')]", + "geoRedundantBackup": "[parameters('geoRedundantBackup')]" + } + }, + "sku": { + "name": "[parameters('skuName')]", + "tier": "[parameters('skuTier')]", + "capacity": "[parameters('skuCapacity')]", + "size": "[parameters('skuSizeMB')]", + "family": "[parameters('skuFamily')]" + }, + "resources": [ + { + "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", + "type": "firewallRules", + "apiVersion": "2017-12-01", + "location": "[variables('db_location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[0].name)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[0].charset]", + "collation": "[parameters('databases').properties[0].collation]" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[1].name)]", + "condition": "[greater(length(parameters('databases').properties), 0)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[1].charset]", + "collation": "[parameters('databases').properties[1].collation]" + } + } + ] + } + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[concat('jdbc:postgresql://', reference(concat('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + }, + "dbServerName": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "xrayConnString": { + "type": "string", + "value": "[concat('postgres://', reference(concat('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Postgresql/postgres.parameters.json b/AzureResourceManager/Postgresql/postgres.parameters.json new file mode 100644 index 0000000..5aad362 --- /dev/null +++ b/AzureResourceManager/Postgresql/postgres.parameters.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "value": "GEN-UNIQUE" + }, + "db_password": { + "value": "GEN-UNIQUE" + }, + "db_server": { + "value": "postgressrvr" + }, + "databases": { + "value": { + "properties": [ + { + "name": "artdb", + "charset": "UTF8", + "collation": "English_United States.1252" + }, + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/LICENSE b/AzureResourceManager/Xray/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/AzureResourceManager/Xray/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/AzureResourceManager/Xray/MP_submission/createUiDefinition.json b/AzureResourceManager/Xray/MP_submission/createUiDefinition.json new file mode 100644 index 0000000..e27c5ed --- /dev/null +++ b/AzureResourceManager/Xray/MP_submission/createUiDefinition.json @@ -0,0 +1,315 @@ +{ + "$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": "vmCredential", + "label": "VM Credential", + "bladeTitle": "VM Credential", + "subLabel": { + "preValidation": "Provide VM credentials", + "postValidation": "Great - let's move on!" + }, + "elements": [ + { + "name": "virtualMachine", + "type": "Microsoft.Common.Section", + "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 + } + ], + "visible": true + }, + { + "name": "vnet", + "type": "Microsoft.Network.VirtualNetworkCombo", + "toolTip": "Provide Virtual Network information", + "label": { + "virtualNetwork": "Virtual Network", + "subnets": "Subnets" + }, + "defaultValue": { + "name": "vmx-vnet", + "addressPrefixSize": "/16" + }, + "constraints": { + "minAddressPrefixSize": "/24" + }, + "subnets": { + "subnet1": { + "label": "Subnet", + "defaultValue": { + "name": "vmx-subnet", + "addressPrefixSize": "/24" + }, + "constraints": { + "minAddressPrefixSize": "/29", + "minAddressCount": 8, + "requireContiguousAddresses": true + } + } + } + }, + { + "name": "vmSku", + "type": "Microsoft.Compute.SizeSelector", + "label": "Virtual machine size", + "toolTip": "The size of the virtual machine for Xray", + "recommendedSizes": [ + "Standard_D4s_v3" + ], + "constraints": { + "allowedSizes": [ + "Standard_A4_v2", + "Standard_A4", + "Standard_D4s_v3", + "Standard_D8s_v3", + "Standard_D16s_v3", + "Standard_D32s_v3", + "Standard_DS3_v2", + "Standard_D3_v2", + "Standard_DC4s" + ] + }, + "osPlatform": "Linux", + "count": 1 + } + ] + }, + { + "name": "xrayConfig", + "label": "Xray settings", + "subLabel": { + "preValidation": "Configure Xray Deployment", + "postValidation": "Done!" + }, + "bladeTitle": "Xray Settings", + "elements": [ + { + "name": "xrayVersion", + "type": "Microsoft.Common.DropDown", + "label": "Xray-vm image version to deploy.", + "defaultValue": "3.6.2", + "toolTip": "Version of Xray to deploy", + "constraints": { + "allowedValues": [ + { + "label": "3.6.2", + "value": "0.0.3" + } + ], + "required": true + }, + "visible": true + }, + { + "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": "masterKey", + "type": "Microsoft.Common.PasswordBox", + "label": { + "password": "Xray master Key", + "confirmPassword": "Confirm master Key" + }, + "toolTip": "Master key for Xray instance. 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": "joinKey", + "type": "Microsoft.Common.PasswordBox", + "label": { + "password": "Artifactory join Key", + "confirmPassword": "Confirm join Key" + }, + "toolTip": "Join key from Artifactory cluster. You can copy Join key from the Artifactory UI, Security -> Settings -> Connection details", + "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": "artifactoryURL", + "type": "Microsoft.Common.TextBox", + "label": "Provide artifactory URL to connect Xray instance", + "defaultValue": "https://myorgartifactory.com", + "toolTip": "Provide Artifactory URL", + "constraints": { + "required": true, + "regex": "^(https?)://[^\\s/$.?#].[^\\s]*$", + "validationMessage": "URL is not valid" + } + } + ] + }, + { + "name": "databaseConfig", + "label": "Database Configuration", + "subLabel": { + "preValidation": "Configure the Database", + "postValidation": "Done" + }, + "bladeTitle": "Database Credential", + "elements": [ + { + "name": "infoMessage", + "type": "Microsoft.Common.InfoBox", + "visible": true, + "options": { + "icon": "Info", + "text": "You can deploy a new Postgresql server or use your existing Postgres server and database. Please make sure Postgresql instance is set up correctly before Xray deployment. Check README.md https://github.com/jfrog/JFrog-Cloud-Installers/blob/arm-xray/AzureResourceManager/Xray/README.md#postgresql-deployment. You can use Postgresql template from here https://github.com/jfrog/JFrog-Cloud-Installers/tree/arm-xray/AzureResourceManager/Postgresql" + } + }, + { + "name": "db_type", + "type": "Microsoft.Common.DropDown", + "label": "Database options", + "toolTip": "Deploy a new DB instance or use an existing DB", + "constraints": { + "required": true, + "allowedValues": [ + { + "label": "Deploy a new Postgresql instance", + "value": "Postgresql_deploy.json" + }, + { + "label": "Use existing Postgresql instance", + "value": "Postgresql_existing.json" + } + ] + }, + "visible": true + }, + { + "name": "db_server", + "type": "Microsoft.Common.TextBox", + "label": "Database server name. Skip if a new deployment is selected", + "toolTip": "Database server name", + "constraints": { + "required": false, + "regex": "^[a-z0-9A-Z]{1,15}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-15 characters long." + } + }, + { + "name": "manual_db_url", + "type": "Microsoft.Common.TextBox", + "label": "Database connection string. Skip if a new deployment is selected", + "toolTip": "Jdbc connection string for MSSQL or Postgresql", + "constraints": { + "required": false, + "regex": "..*", + "validationMessage": "DB connection string is not valid" + } + }, + { + "name": "db_user", + "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": "db_password", + "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 + } + ] + } + ], + "outputs": { + "location": "[location()]", + "adminUsername": "[steps('vmCredential').virtualMachine.adminUsername]", + "adminPassword": "[steps('vmCredential').virtualMachine.adminPassword.password]", + "virtualNetworkName": "[steps('vmCredential').vnet.name]", + "virtualNetworkNewOrExisting": "[steps('vmCredential').vnet.newOrExisting]", + "virtualNetworkAddressPrefix": "[first(steps('vmCredential').vnet.addressPrefixes)]", + "virtualNetworkResourceGroup": "[steps('vmCredential').vnet.resourceGroup]", + "virtualMachineSize": "[steps('vmCredential').vmSku]", + "subnetName": "[steps('vmCredential').vnet.subnets.subnet1.name]", + "subnetAddressPrefix": "[steps('vmCredential').vnet.subnets.subnet1.addressPrefix]", + "xrayVersion": "[steps('xrayConfig').xrayVersion]", + "clusterName": "[steps('xrayConfig').clusterName]", + "artifactoryURL": "[steps('xrayConfig').artifactoryURL]", + "masterKey": "[steps('xrayConfig').masterKey]", + "joinKey": "[steps('xrayConfig').joinKey]", + "db_type": "[steps('databaseConfig').db_type]", + "db_server": "[steps('databaseConfig').db_server]", + "manual_db_url": "[steps('databaseConfig').manual_db_url]", + "db_user": "[steps('databaseConfig').db_user]", + "db_password": "[steps('databaseConfig').db_password]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/MP_submission/jfrog-xray-3-6-2-0.zip b/AzureResourceManager/Xray/MP_submission/jfrog-xray-3-6-2-0.zip new file mode 100644 index 0000000..14c300e Binary files /dev/null and b/AzureResourceManager/Xray/MP_submission/jfrog-xray-3-6-2-0.zip differ diff --git a/AzureResourceManager/Xray/MP_submission/jfrog-xray-3-6-2-1.zip b/AzureResourceManager/Xray/MP_submission/jfrog-xray-3-6-2-1.zip new file mode 100644 index 0000000..3c56419 Binary files /dev/null and b/AzureResourceManager/Xray/MP_submission/jfrog-xray-3-6-2-1.zip differ diff --git a/AzureResourceManager/Xray/MP_submission/mainTemplate.json b/AzureResourceManager/Xray/MP_submission/mainTemplate.json new file mode 100644 index 0000000..9232cc5 --- /dev/null +++ b/AzureResourceManager/Xray/MP_submission/mainTemplate.json @@ -0,0 +1,400 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for the resources." + } + }, + "clusterName": { + "type": "string", + "defaultValue": "xray", + "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." + } + }, + "xrayVersion": { + "type": "string", + "defaultValue": "0.0.3", + "allowedValues": [ + "0.0.3" + ], + "metadata": { + "description": "Xray-vm image version to deploy." + } + }, + "artifactoryURL": { + "type": "string", + "metadata": { + "description": "Artifactory URL" + } + }, + "masterKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'" + } + }, + "joinKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'" + } + }, + "adminUsername": { + "type": "string", + "defaultValue": "testadmin", + "metadata": { + "description": "Username for the Virtual Machine." + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Password for the Virtual Machine." + } + }, + "virtualNetworkName": { + "type": "string", + "metadata": { + "description": "New or Existing VNet Name" + } + }, + "virtualNetworkNewOrExisting": { + "type": "string", + "metadata": { + "description": "Boolean indicating whether the VNet is new or existing" + } + }, + "virtualNetworkAddressPrefix": { + "type": "string", + "metadata": { + "description": "VNet address prefix" + } + }, + "virtualNetworkResourceGroup": { + "type": "string", + "metadata": { + "description": "Resource group of the VNet" + } + }, + "virtualMachineSize": { + "type": "string", + "metadata": { + "description": "The size of the VM" + } + }, + "subnetName": { + "type": "string", + "metadata": { + "description": "New or Existing subnet Name" + } + }, + "subnetAddressPrefix": { + "type": "string", + "metadata": { + "description": "Subnet address prefix" + } + }, + "db_type": { + "type": "string", + "defaultValue": "Postgresql_deploy.json", + "allowedValues": [ + "Postgresql_deploy.json", + "Postgresql_existing.json" + ], + "metadata": { + "description": "Deploy new Postgresql, MSSQL or use existing DB" + } + }, + "manual_db_url": { + "type": "string", + "metadata": { + "description": "DB server URL, if existing DB server is used instead of a new deployment (jdbc:sqlserver://.. or jdbc:postgresql://..)" + } + }, + "db_server": { + "type": "string", + "metadata": { + "description": "DB server name, if pre-existing DB is used" + } + }, + "db_user": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Database Admin user name" + } + }, + "db_password": { + "type": "securestring", + "minLength": 1, + "metadata": { + "description": "Database Admin password" + } + }, + "databases": { + "type": "object", + "defaultValue": { + "properties": [ + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + }, + "_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))]", + "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'sawinvm')]", + "publicIPAddressName": "[concat(uniqueString(resourceGroup().id),'IP')]", + "clusterName": "[parameters('clusterName')]", + "nicName": "[concat(variables('clusterName'),'Nic')]", + "ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]", + "vnetId": { + "new": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]", + "existing": "[resourceId(parameters('virtualNetworkResourceGroup'),'Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]" + }, + "subnetId": "[concat(variables('vnetId')[parameters('virtualNetworkNewOrExisting')],'/subnets/',parameters('subnetName'))]", + "publicIPAddressType": "Dynamic", + "db_server": "[parameters('db_server')]", + "db_user": "[concat(parameters('db_user'), '@', parameters('db_server'))]", + "db_password": "[parameters('db_password')]", + "db_location": "[parameters('location')]", + "db_name": "[parameters('databases').properties[0].name]", + "masterKey": "[parameters('masterKey')]", + "joinKey": "[parameters('joinKey')]", + "osType": { + "publisher": "jfrog", + "offer": "x-ray-vm", + "sku": "x-ray-vm", + "version": "[parameters('xrayVersion')]" + }, + "imageReference": "[variables('osType')]", + "dbTemplate": "[parameters('db_type')]", + "dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]", + "artifactoryURL": "[parameters('artifactoryURL')]" + }, + "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": [] + } + } + }, + { + "condition": "[equals(parameters('virtualNetworkNewOrExisting'),'new')]", + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2020-05-01", + "name": "[parameters('virtualNetworkName')]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[parameters('virtualNetworkAddressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[parameters('subnetName')]", + "properties": { + "addressPrefix": "[parameters('subnetAddressPrefix')]" + } + } + ] + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('publicIPAddressName')]", + "apiVersion": "2020-05-01", + "location": "[parameters('location')]", + "properties": { + "publicIPAllocationMethod": "[variables('publicIPAddressType')]" + } + }, + { + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "apiVersion": "2020-05-01", + "location": "[parameters('location')]", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "subnet": { + "id": "[variables('subnetId')]" + } + } + } + ], + "enableIPForwarding": true + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]" + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-11-01", + "name": "[variables('storageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage", + "properties": {} + }, + { + "type": "Microsoft.Resources/deployments", + "name": "deploySQLDB", + "apiVersion": "2019-09-01", + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('dbTemplateLocation')]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "db_user": { + "value": "[parameters('db_user')]" + }, + "db_password": { + "value": "[variables('db_password')]" + }, + "db_server": { + "value": "[variables('db_server')]" + }, + "db_location": { + "value": "[variables('db_location')]" + }, + "databases": { + "value": "[parameters('databases')]" + }, + "manual_db_url": { + "value": "[parameters('manual_db_url')]" + } + } + } + }, + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "name": "[concat(variables('namingInfix'), 'xrayScaleset')]", + "location": "[parameters('location')]", + "apiVersion": "2018-10-01", + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", + "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]" + ], + "plan": { + "name": "x-ray-vm", + "publisher": "jfrog", + "product": "x-ray-vm" + }, + "sku": { + "name": "[parameters('virtualMachineSize')]", + "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\nXRAY_VERSION=', parameters('xrayVersion'),'\nARTIFACTORY_URL=',variables('artifactoryURL'),'\nDB_SERVER=',variables('db_server'),'\nDB_NAME=',variables('db_name'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\n'))]" + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "[variables('nicName')]", + "properties": { + "primary": true, + "ipConfigurations": [ + { + "name": "[concat(variables('ipConfigName'),'1')]", + "properties": { + "subnet": { + "id": "[variables('subnetId')]" + } + } + } + ] + } + } + ] + }, + "extensionProfile": { + "extensions": [ + { + "name": "extension1", + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "CustomScript", + "typeHandlerVersion": "2.0", + "autoUpgradeMinorVersion": false, + "settings": { + "fileUris": [ + "[uri(parameters('_artifactsLocation'), concat('scripts/install_xray.sh', parameters('_artifactsLocationSasToken')))]" + ] + }, + "protectedSettings": { + "commandToExecute": "./install_xray.sh >> /opt/installation_log1.txt" + } + } + } + ] + } + } + } + } + ] +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/MP_submission/nested/Postgresql_deploy.json b/AzureResourceManager/Xray/MP_submission/nested/Postgresql_deploy.json new file mode 100644 index 0000000..4f6d8ce --- /dev/null +++ b/AzureResourceManager/Xray/MP_submission/nested/Postgresql_deploy.json @@ -0,0 +1,161 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "xray", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "skuCapacity": { + "type": "int", + "defaultValue": 2 + }, + "skuFamily": { + "type": "string", + "defaultValue": "Gen5" + }, + "skuName": { + "type": "string", + "defaultValue": "GP_Gen5_2" + }, + "skuSizeMB": { + "type": "int", + "defaultValue": 5120 + }, + "skuTier": { + "type": "string", + "defaultValue": "GeneralPurpose" + }, + "version": { + "type": "string", + "defaultValue": "9.6" + }, + "backupRetentionDays": { + "type": "int", + "defaultValue": 7 + }, + "geoRedundantBackup": { + "type": "string", + "defaultValue": "Disabled" + }, + "databases": { + "type": "object" + }, + "sslEnforcement": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Disabled", + "metadata": { + "description": "SSL Enforcement" + } + }, + "publicNetworkAccess": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Enabled", + "metadata": { + "description": "Public Network Access" + } + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/servers", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "name": "[parameters('db_server')]", + "properties": { + "version": "[parameters('version')]", + "administratorLogin": "[parameters('db_user')]", + "administratorLoginPassword": "[parameters('db_password')]", + "publicNetworkAccess": "[parameters('publicNetworkAccess')]", + "sslEnforcement": "[parameters('sslEnforcement')]", + "storageProfile": { + "storageMB": "[parameters('skuSizeMB')]", + "backupRetentionDays": "[parameters('backupRetentionDays')]", + "geoRedundantBackup": "[parameters('geoRedundantBackup')]" + } + }, + "sku": { + "name": "[parameters('skuName')]", + "tier": "[parameters('skuTier')]", + "capacity": "[parameters('skuCapacity')]", + "size": "[parameters('skuSizeMB')]", + "family": "[parameters('skuFamily')]" + }, + "resources": [ + { + "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", + "type": "firewallRules", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[0].name)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[0].charset]", + "collation": "[parameters('databases').properties[0].collation]" + } + } + ] + } + ], + "outputs": { + "dbServerName": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "manual_db_url": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/MP_submission/nested/Postgresql_existing.json b/AzureResourceManager/Xray/MP_submission/nested/Postgresql_existing.json new file mode 100644 index 0000000..6e8be3a --- /dev/null +++ b/AzureResourceManager/Xray/MP_submission/nested/Postgresql_existing.json @@ -0,0 +1,54 @@ +{ + "$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": "xraypostgressrv", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh b/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh new file mode 100644 index 0000000..5828c61 --- /dev/null +++ b/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh @@ -0,0 +1,35 @@ +#!/bin/bash +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=//") +DB_SERVER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_SERVER=" | sed "s/DB_SERVER=//") +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=//") +ARTIFACTORY_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_URL=" | sed "s/ARTIFACTORY_URL=//") + +export DEBIAN_FRONTEND=noninteractive + +# Create master.key on each node +sudo mkdir -p /opt/jfrog/xray/var/etc/security/ +cat </opt/jfrog/xray/var/etc/security/master.key +${MASTER_KEY} +EOF + +# Xray should have the same join key as the Artifactory instance +# Both application should be deployed in the same Virtual Networks +HOSTNAME=$(hostname -i) +sed -i -e "s/ip:..*/ip: ${HOSTNAME}/" /var/opt/jfrog/xray/etc/system.yaml +sed -i -e "s#jfrogUrl:..*#jfrogUrl: \"${ARTIFACTORY_URL}\"#" /var/opt/jfrog/xray/etc/system.yaml +sed -i -e "s/joinKey:..*/joinKey: ${JOIN_KEY}/" /var/opt/jfrog/xray/etc/system.yaml +# DB configuration +sed -i -e "s/url: postgres:..*/url: \"postgres:\/\/${DB_SERVER}.postgres.database.azure.com:5432\/${DB_NAME}?sslmode=disable\"/" /var/opt/jfrog/xray/etc/system.yaml +sed -i -e "s/username:..*/username: \"${DB_USER}\"/" /var/opt/jfrog/xray/etc/system.yaml +sed -i -e "s/password:..*/password: \"${DB_PASSWORD}\"/" /var/opt/jfrog/xray/etc/system.yaml + +chown xray:xray -R /opt/jfrog/xray/var/etc/security/* && chown xray:xray -R /opt/jfrog/xray/var/etc/security/ + + +# Enable and start Xray service +sudo systemctl enable xray.service +sudo systemctl start xray.service +sudo systemctl restart xray.service diff --git a/AzureResourceManager/Xray/README.md b/AzureResourceManager/Xray/README.md new file mode 100644 index 0000000..6c6a61e --- /dev/null +++ b/AzureResourceManager/Xray/README.md @@ -0,0 +1,101 @@ +# Setup JFrog Xray +The recommended way of deploying is through the Azure marketplace. + + + + + +This template can help you setup [JFrog Xray](https://jfrog.com/xray/) on Azure. + +## Prerequisites +1. JFrog Xray is an addition to JFrog Artifactory. + * To be able to use it, you need to have an Artifactory instance deployed in Azure with the appropriate license. If you do not have an Xray compatible license, you can [get a free trial](https://jfrog.com/xray/free-trial/). + +2. Deployed Postgresql instance (if "existing DB" is selected as a parameter). + +## Postgresql deployment +Xray could fail to connect to "out of the box" Azure Postgresql. You can deploy a compatible Postgresql instance using this link: + + + + + +In the Databases field, use the object: + +``` + { + "properties": [ + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } +``` +Before deploying Xray, please do following steps: +1. Use the admin role given by Azure that you initially connected with to PSDB (for example xray) - Remember the password of this role to connect when setting up with Xray. + +2. Create a new role named xray@{hostname}, where {hostname} is a DB server name. + +3. Add xray@{hostname} membership to the base Azure user. In the client tab (PgAdmin for example) right click on properties of role "azure_pg_admin" and under Membership tab, add the relevant "xray@{hostname}", click on the checkbox on the tag, save. + +4. Change ownership of Xray database. Right click On the name of the database and change owner to "xray@{hostname}" + +After these steps are done, run Xray deployment. + +## Installation +1. Click "Deploy to Azure" button. If you don't have an Azure subscription, it will guide you on how to signup for a free trial. + +2. Fill out the form. Make sure to use the Artifactory Join key, which you can copy from the Artifactory UI, Security -> Settings -> Connection details + +3. Click Review + Create, then click Create to start the deployment + +4. Once deployment is done, access Xray thru Artifactory UI, Security & Compliance menu + + + + +### Note: +1. This template only supports Xray versions 3.2.x and above. +2. Input values for 'adminUsername' and 'adminPassword' parameters needs to follow azure VM access rules. + +### Steps to upgrade JFrog Xray version + +ARM templates uses a debian installation and you can follow the [official instructions](https://www.jfrog.com/confluence/display/JFROG/Upgrading+Xray#UpgradingXray-InteractiveScriptUpgrade(recommended).1) but for your convenience, you can use this method. + +SSH to the Xray VM and CD to the /opt/ folder. Create an empty file upgrade.sh + +``touch upgrade.sh`` + +Make the file executable: + +```chmod +x upgrade.sh``` + +Open the file + +```vi upgrade.sh``` + +Paste the commands below (check the version of Xray you want to upgrade to): +``` +cd /opt/ +echo "### Stopping Xray service before upgrade ###" +systemctl stop xray.service +XRAY_VERSION=3.6.2 +wget -O jfrog-xray-${XRAY_VERSION}-deb.tar.gz https://api.bintray.com/content/jfrog/jfrog-xray/xray-deb/${XRAY_VERSION}/jfrog-xray-${XRAY_VERSION}-deb.tar.gz?bt_package=jfrog-xray +tar -xvf jfrog-xray-${XRAY_VERSION}-deb.tar.gz +rm jfrog-xray-${XRAY_VERSION}-deb.tar.gz +cd jfrog-xray-${XRAY_VERSION}-deb +echo "### Run Xray installation script ###" +echo "y" | ./install.sh +echo "### Start Xray service ###" +systemctl start xray.service +``` +Run the script + +```./upgrade.sh``` + +The script will upgrade existing 3.x version of Xray to the given version. Check /var/opt/jfrog/xray/console.log to make sure that the service was properly started. Look for the message: +```All services started successfully in 10.743 seconds``` +and check the application version in the log. + diff --git a/AzureResourceManager/Xray/azuredeploy_xray.json b/AzureResourceManager/Xray/azuredeploy_xray.json new file mode 100644 index 0000000..fa5829a --- /dev/null +++ b/AzureResourceManager/Xray/azuredeploy_xray.json @@ -0,0 +1,389 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for the resources." + } + }, + "vmName": { + "type": "string", + "metadata": { + "title": "VM Name", + "description": "This is the name of the your VM" + } + }, + "xrayVersion": { + "type": "string", + "defaultValue": "3.5.2", + "allowedValues": [ + "3.5.2" + ], + "metadata": { + "description": "Xray-vm image version to deploy." + } + }, + "artifactoryURL": { + "type": "string", + "metadata": { + "description": "Artifactory URL" + } + }, + "masterKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'" + } + }, + "joinKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'" + } + }, + "adminUsername": { + "type": "string", + "defaultValue": "testadmin", + "metadata": { + "description": "Username for the Virtual Machine." + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Password for the Virtual Machine." + } + }, + "virtualNetworkName": { + "type": "string", + "metadata": { + "description": "New or Existing VNet Name" + } + }, + "virtualNetworkNewOrExisting": { + "type": "string", + "metadata": { + "description": "Boolean indicating whether the VNet is new or existing" + } + }, + "virtualNetworkAddressPrefix": { + "type": "string", + "metadata": { + "description": "VNet address prefix" + } + }, + "virtualNetworkResourceGroup": { + "type": "string", + "metadata": { + "description": "Resource group of the VNet" + } + }, + "virtualMachineSize": { + "type": "string", + "metadata": { + "description": "The size of the VM" + } + }, + "subnetName": { + "type": "string", + "metadata": { + "description": "New or Existing subnet Name" + } + }, + "subnetAddressPrefix": { + "type": "string", + "metadata": { + "description": "Subnet address prefix" + } + }, + "db_type": { + "type": "string", + "defaultValue": "Postgresql_deploy.json", + "allowedValues": [ + "Postgresql_deploy.json", + "Postgresql_existing.json" + ], + "metadata": { + "description": "Deploy new Postgresql, MSSQL or use existing DB" + } + }, + "manual_db_url": { + "type": "string", + "metadata": { + "description": "DB server URL, if existing DB server is used instead of a new deployment (jdbc:sqlserver://.. or jdbc:postgresql://..)" + } + }, + "db_server": { + "type": "string", + "metadata": { + "description": "DB server name, if pre-existing DB is used" + } + }, + "db_user": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Database Admin user name" + } + }, + "db_password": { + "type": "securestring", + "minLength": 1, + "metadata": { + "description": "Database Admin password" + } + }, + "databases": { + "type": "object", + "defaultValue": { + "properties": [ + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + }, + "_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": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/arm-xray/AzureResourceManager/Xray/" + }, + "_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": { + "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'sawinvm')]", + "publicIPAddressName": "[concat(uniqueString(resourceGroup().id),'IP')]", + "vmName": "[parameters('vmName')]", + "nicName": "[concat(parameters('vmName'),'Nic')]", + "vnetId": { + "new": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]", + "existing": "[resourceId(parameters('virtualNetworkResourceGroup'),'Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]" + }, + "subnetId": "[concat(variables('vnetId')[parameters('virtualNetworkNewOrExisting')],'/subnets/',parameters('subnetName'))]", + "publicIPAddressType": "Dynamic", + "db_server": "[parameters('db_server')]", + "db_user": "[concat(parameters('db_user'), '@', parameters('db_server'))]", + "db_password": "[parameters('db_password')]", + "db_location": "[parameters('location')]", + "db_name": "[parameters('databases').properties[0].name]", + "masterKey": "[parameters('masterKey')]", + "joinKey": "[parameters('joinKey')]", + "osType": { + "publisher": "Canonical", + "offer": "UbuntuServer", + "sku": "18.04-LTS", + "version": "latest" + }, + "imageReference": "[variables('osType')]", + "dbTemplate": "[parameters('db_type')]", + "dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]", + "artifactoryURL": "[parameters('artifactoryURL')]" + }, + "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": [] + } + } + }, + { + "condition": "[equals(parameters('virtualNetworkNewOrExisting'),'new')]", + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2017-09-01", + "name": "[parameters('virtualNetworkName')]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[parameters('virtualNetworkAddressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[parameters('subnetName')]", + "properties": { + "addressPrefix": "[parameters('subnetAddressPrefix')]" + } + } + ] + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('publicIPAddressName')]", + "apiVersion": "2015-06-15", + "location": "[parameters('location')]", + "properties": { + "publicIPAllocationMethod": "[variables('publicIPAddressType')]" + } + }, + { + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "apiVersion": "2016-03-30", + "location": "[parameters('location')]", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "subnet": { + "id": "[variables('subnetId')]" + } + } + } + ], + "enableIPForwarding": true + }, + "dependsOn": [ + "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]" + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-11-01", + "name": "[variables('storageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "Standard_LRS" + }, + "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_user')]" + }, + "db_password": { + "value": "[variables('db_password')]" + }, + "db_server": { + "value": "[variables('db_server')]" + }, + "db_location": { + "value": "[variables('db_location')]" + }, + "databases": { + "value": "[parameters('databases')]" + }, + "manual_db_url": { + "value": "[parameters('manual_db_url')]" + } + } + } + }, + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2018-10-01", + "name": "[variables('vmName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", + "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('virtualMachineSize')]" + }, + "osProfile": { + "computerName": "[variables('vmName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]", + "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nXRAY_VERSION=', parameters('xrayVersion'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nARTIFACTORY_URL=',variables('artifactoryURL'),'\nDB_SERVER=',variables('db_server'),'\nDB_NAME=',variables('db_name'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\n'))]" + }, + "storageProfile": { + "imageReference": "[variables('imageReference')]", + "osDisk": { + "createOption": "FromImage" + }, + "dataDisks": [ + { + "diskSizeGB": 1023, + "lun": 0, + "createOption": "Empty" + } + ] + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" + } + ] + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": true, + "storageUri": "[reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob]" + } + } + }, + "resources": [ + { + "apiVersion": "2019-03-01", + "type": "extensions", + "name": "config-app", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]" + ], + "tags": { + "displayName": "config-app" + }, + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "CustomScript", + "typeHandlerVersion": "2.1", + "autoUpgradeMinorVersion": true, + "settings": { + }, + "protectedSettings": { + "commandToExecute": "echo 'hello!' >> /opt/installation_log.txt", + "fileUris": [ + "[uri(parameters('_artifactsLocation'), concat('vm_install/install_xray_to_vm.sh', parameters('_artifactsLocationSasToken')))]", + "[uri(parameters('_artifactsLocation'), concat('scripts/install_xray.sh', parameters('_artifactsLocationSasToken')))]" + ] + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/azuredeploy_xray.parameters.json b/AzureResourceManager/Xray/azuredeploy_xray.parameters.json new file mode 100644 index 0000000..2af13e3 --- /dev/null +++ b/AzureResourceManager/Xray/azuredeploy_xray.parameters.json @@ -0,0 +1,63 @@ +{ + "$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-UNIQUE" + }, + "virtualNetworkName": { + "value": "existing-vm-network-name" + }, + "subnetName": { + "value": "existing-subnet-name" + }, + "virtualNetworkNewOrExisting": { + "value": "existing" + }, + "virtualNetworkAddressPrefix": { + "value": "10.0.0.0/16" + }, + "virtualNetworkResourceGroup": { + "value": "resource-group-name" + }, + "virtualMachineSize": { + "value": "Standard_D4s_v3" + }, + "subnetAddressPrefix": { + "value": "10.0.1.0/24" + }, + "xrayVersion": { + "value": "0.0.3" + }, + "artifactoryURL": { + "value": "http://artifactory-url.cloudapp.azure.com" + }, + "masterKey": { + "value": "GEN-UNIQUE" + }, + "joinKey": { + "value": "GEN-UNIQUE" + }, + "db_type": { + "value": "Postgresql_existing.json" + }, + "db_user": { + "value": "GEN-UNIQUE" + }, + "db_password": { + "value": "GEN-UNIQUE" + }, + "manual_db_url": { + "value": "jdbc:postgresql://postgressrvr.postgres.database.azure.com:5432" + }, + "db_server": { + "value": "postgressrvr" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/azuredeploy_xray_vmss.json b/AzureResourceManager/Xray/azuredeploy_xray_vmss.json new file mode 100644 index 0000000..711d6bb --- /dev/null +++ b/AzureResourceManager/Xray/azuredeploy_xray_vmss.json @@ -0,0 +1,400 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for the resources." + } + }, + "clusterName": { + "type": "string", + "defaultValue": "xray", + "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." + } + }, + "xrayVersion": { + "type": "string", + "defaultValue": "0.0.3", + "allowedValues": [ + "0.0.3" + ], + "metadata": { + "description": "Xray-vm image version to deploy." + } + }, + "artifactoryURL": { + "type": "string", + "metadata": { + "description": "Artifactory URL" + } + }, + "masterKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'" + } + }, + "joinKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'" + } + }, + "adminUsername": { + "type": "string", + "defaultValue": "testadmin", + "metadata": { + "description": "Username for the Virtual Machine." + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Password for the Virtual Machine." + } + }, + "virtualNetworkName": { + "type": "string", + "metadata": { + "description": "New or Existing VNet Name" + } + }, + "virtualNetworkNewOrExisting": { + "type": "string", + "metadata": { + "description": "Boolean indicating whether the VNet is new or existing" + } + }, + "virtualNetworkAddressPrefix": { + "type": "string", + "metadata": { + "description": "VNet address prefix" + } + }, + "virtualNetworkResourceGroup": { + "type": "string", + "metadata": { + "description": "Resource group of the VNet" + } + }, + "virtualMachineSize": { + "type": "string", + "metadata": { + "description": "The size of the VM" + } + }, + "subnetName": { + "type": "string", + "metadata": { + "description": "New or Existing subnet Name" + } + }, + "subnetAddressPrefix": { + "type": "string", + "metadata": { + "description": "Subnet address prefix" + } + }, + "db_type": { + "type": "string", + "defaultValue": "Postgresql_deploy.json", + "allowedValues": [ + "Postgresql_deploy.json", + "Postgresql_existing.json" + ], + "metadata": { + "description": "Deploy new Postgresql, MSSQL or use existing DB" + } + }, + "manual_db_url": { + "type": "string", + "metadata": { + "description": "DB server URL, if existing DB server is used instead of a new deployment (jdbc:sqlserver://.. or jdbc:postgresql://..)" + } + }, + "db_server": { + "type": "string", + "metadata": { + "description": "DB server name, if pre-existing DB is used" + } + }, + "db_user": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Database Admin user name" + } + }, + "db_password": { + "type": "securestring", + "minLength": 1, + "metadata": { + "description": "Database Admin password" + } + }, + "databases": { + "type": "object", + "defaultValue": { + "properties": [ + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + }, + "_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": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/arm-xray/AzureResourceManager/Xray/" + }, + "_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))]", + "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'sawinvm')]", + "publicIPAddressName": "[concat(uniqueString(resourceGroup().id),'IP')]", + "clusterName": "[parameters('clusterName')]", + "nicName": "[concat(variables('clusterName'),'Nic')]", + "ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]", + "vnetId": { + "new": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]", + "existing": "[resourceId(parameters('virtualNetworkResourceGroup'),'Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]" + }, + "subnetId": "[concat(variables('vnetId')[parameters('virtualNetworkNewOrExisting')],'/subnets/',parameters('subnetName'))]", + "publicIPAddressType": "Dynamic", + "db_server": "[parameters('db_server')]", + "db_user": "[concat(parameters('db_user'), '@', parameters('db_server'))]", + "db_password": "[parameters('db_password')]", + "db_location": "[parameters('location')]", + "db_name": "[parameters('databases').properties[0].name]", + "masterKey": "[parameters('masterKey')]", + "joinKey": "[parameters('joinKey')]", + "osType": { + "publisher": "jfrog", + "offer": "x-ray-vm", + "sku": "x-ray-vm", + "version": "[parameters('xrayVersion')]" + }, + "imageReference": "[variables('osType')]", + "dbTemplate": "[parameters('db_type')]", + "dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]", + "artifactoryURL": "[parameters('artifactoryURL')]" + }, + "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": [] + } + } + }, + { + "condition": "[equals(parameters('virtualNetworkNewOrExisting'),'new')]", + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2020-05-01", + "name": "[parameters('virtualNetworkName')]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[parameters('virtualNetworkAddressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[parameters('subnetName')]", + "properties": { + "addressPrefix": "[parameters('subnetAddressPrefix')]" + } + } + ] + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('publicIPAddressName')]", + "apiVersion": "2020-05-01", + "location": "[parameters('location')]", + "properties": { + "publicIPAllocationMethod": "[variables('publicIPAddressType')]" + } + }, + { + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "apiVersion": "2020-05-01", + "location": "[parameters('location')]", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "subnet": { + "id": "[variables('subnetId')]" + } + } + } + ], + "enableIPForwarding": true + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]" + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-11-01", + "name": "[variables('storageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage", + "properties": {} + }, + { + "type": "Microsoft.Resources/deployments", + "name": "deploySQLDB", + "apiVersion": "2019-09-01", + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('dbTemplateLocation')]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "db_user": { + "value": "[parameters('db_user')]" + }, + "db_password": { + "value": "[variables('db_password')]" + }, + "db_server": { + "value": "[variables('db_server')]" + }, + "db_location": { + "value": "[variables('db_location')]" + }, + "databases": { + "value": "[parameters('databases')]" + }, + "manual_db_url": { + "value": "[parameters('manual_db_url')]" + } + } + } + }, + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "name": "[concat(variables('namingInfix'), 'xrayScaleset')]", + "location": "[parameters('location')]", + "apiVersion": "2018-10-01", + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", + "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]" + ], + "plan": { + "name": "x-ray-vm", + "publisher": "jfrog", + "product": "x-ray-vm" + }, + "sku": { + "name": "[parameters('virtualMachineSize')]", + "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\nXRAY_VERSION=', parameters('xrayVersion'),'\nARTIFACTORY_URL=',variables('artifactoryURL'),'\nDB_SERVER=',variables('db_server'),'\nDB_NAME=',variables('db_name'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\n'))]" + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "[variables('nicName')]", + "properties": { + "primary": true, + "ipConfigurations": [ + { + "name": "[concat(variables('ipConfigName'),'1')]", + "properties": { + "subnet": { + "id": "[variables('subnetId')]" + } + } + } + ] + } + } + ] + }, + "extensionProfile": { + "extensions": [ + { + "name": "extension1", + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "CustomScript", + "typeHandlerVersion": "2.0", + "autoUpgradeMinorVersion": false, + "settings": { + "fileUris": [ + "[uri(parameters('_artifactsLocation'), concat('scripts/install_xray.sh', parameters('_artifactsLocationSasToken')))]" + ] + }, + "protectedSettings": { + "commandToExecute": "./install_xray.sh >> /opt/installation_log1.txt" + } + } + } + ] + } + } + } + } + ] +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/nested/Postgresql_deploy.json b/AzureResourceManager/Xray/nested/Postgresql_deploy.json new file mode 100644 index 0000000..4f6d8ce --- /dev/null +++ b/AzureResourceManager/Xray/nested/Postgresql_deploy.json @@ -0,0 +1,161 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "xray", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "skuCapacity": { + "type": "int", + "defaultValue": 2 + }, + "skuFamily": { + "type": "string", + "defaultValue": "Gen5" + }, + "skuName": { + "type": "string", + "defaultValue": "GP_Gen5_2" + }, + "skuSizeMB": { + "type": "int", + "defaultValue": 5120 + }, + "skuTier": { + "type": "string", + "defaultValue": "GeneralPurpose" + }, + "version": { + "type": "string", + "defaultValue": "9.6" + }, + "backupRetentionDays": { + "type": "int", + "defaultValue": 7 + }, + "geoRedundantBackup": { + "type": "string", + "defaultValue": "Disabled" + }, + "databases": { + "type": "object" + }, + "sslEnforcement": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Disabled", + "metadata": { + "description": "SSL Enforcement" + } + }, + "publicNetworkAccess": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Enabled", + "metadata": { + "description": "Public Network Access" + } + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/servers", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "name": "[parameters('db_server')]", + "properties": { + "version": "[parameters('version')]", + "administratorLogin": "[parameters('db_user')]", + "administratorLoginPassword": "[parameters('db_password')]", + "publicNetworkAccess": "[parameters('publicNetworkAccess')]", + "sslEnforcement": "[parameters('sslEnforcement')]", + "storageProfile": { + "storageMB": "[parameters('skuSizeMB')]", + "backupRetentionDays": "[parameters('backupRetentionDays')]", + "geoRedundantBackup": "[parameters('geoRedundantBackup')]" + } + }, + "sku": { + "name": "[parameters('skuName')]", + "tier": "[parameters('skuTier')]", + "capacity": "[parameters('skuCapacity')]", + "size": "[parameters('skuSizeMB')]", + "family": "[parameters('skuFamily')]" + }, + "resources": [ + { + "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", + "type": "firewallRules", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[0].name)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[0].charset]", + "collation": "[parameters('databases').properties[0].collation]" + } + } + ] + } + ], + "outputs": { + "dbServerName": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "manual_db_url": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/nested/Postgresql_existing.json b/AzureResourceManager/Xray/nested/Postgresql_existing.json new file mode 100644 index 0000000..6e8be3a --- /dev/null +++ b/AzureResourceManager/Xray/nested/Postgresql_existing.json @@ -0,0 +1,54 @@ +{ + "$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": "xraypostgressrv", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/scripts/install_xray.sh b/AzureResourceManager/Xray/scripts/install_xray.sh new file mode 100644 index 0000000..5828c61 --- /dev/null +++ b/AzureResourceManager/Xray/scripts/install_xray.sh @@ -0,0 +1,35 @@ +#!/bin/bash +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=//") +DB_SERVER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_SERVER=" | sed "s/DB_SERVER=//") +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=//") +ARTIFACTORY_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_URL=" | sed "s/ARTIFACTORY_URL=//") + +export DEBIAN_FRONTEND=noninteractive + +# Create master.key on each node +sudo mkdir -p /opt/jfrog/xray/var/etc/security/ +cat </opt/jfrog/xray/var/etc/security/master.key +${MASTER_KEY} +EOF + +# Xray should have the same join key as the Artifactory instance +# Both application should be deployed in the same Virtual Networks +HOSTNAME=$(hostname -i) +sed -i -e "s/ip:..*/ip: ${HOSTNAME}/" /var/opt/jfrog/xray/etc/system.yaml +sed -i -e "s#jfrogUrl:..*#jfrogUrl: \"${ARTIFACTORY_URL}\"#" /var/opt/jfrog/xray/etc/system.yaml +sed -i -e "s/joinKey:..*/joinKey: ${JOIN_KEY}/" /var/opt/jfrog/xray/etc/system.yaml +# DB configuration +sed -i -e "s/url: postgres:..*/url: \"postgres:\/\/${DB_SERVER}.postgres.database.azure.com:5432\/${DB_NAME}?sslmode=disable\"/" /var/opt/jfrog/xray/etc/system.yaml +sed -i -e "s/username:..*/username: \"${DB_USER}\"/" /var/opt/jfrog/xray/etc/system.yaml +sed -i -e "s/password:..*/password: \"${DB_PASSWORD}\"/" /var/opt/jfrog/xray/etc/system.yaml + +chown xray:xray -R /opt/jfrog/xray/var/etc/security/* && chown xray:xray -R /opt/jfrog/xray/var/etc/security/ + + +# Enable and start Xray service +sudo systemctl enable xray.service +sudo systemctl start xray.service +sudo systemctl restart xray.service diff --git a/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh b/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh new file mode 100644 index 0000000..79a0d15 --- /dev/null +++ b/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Upgrade version for every release +XRAY_VERSION=3.6.2 + +export DEBIAN_FRONTEND=noninteractive + +apt-get update -y +apt-get upgrade -y + +# Download Xray +cd /opt/ +wget -O jfrog-xray-${XRAY_VERSION}-deb.tar.gz 'https://bintray.com/jfrog/jfrog-xray/download_file?agree=true&artifactPath=/jfrog/jfrog-xray/xray-deb/'${XRAY_VERSION}'/jfrog-xray-'${XRAY_VERSION}'-deb.tar.gz&callback_id=&product=org.grails.taglib.NamespacedTagDispatcher' \ +>> /var/log/download-xray.log 2>&1 +tar -xvf jfrog-xray-${XRAY_VERSION}-deb.tar.gz +rm jfrog-xray-${XRAY_VERSION}-deb.tar.gz +cd jfrog-xray-${XRAY_VERSION}-deb + +# Generate txt file with the parameters to use in the interactive installation script +cat </opt/jfrog-xray-${XRAY_VERSION}-deb/input.txt +/var/opt/jfrog/xray +http:// +EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +replace_with_host_ip +N +n +postgres://{postgres_server_name}.postgres.database.azure.com:5432/xray?sslmode=disable +xray@postgres_server_name +password +EOF + +# Run interactive installation script with default parameters +cat "/opt/jfrog-xray-${XRAY_VERSION}-deb/input.txt" | ./install.sh >> /var/log/install-xray.log 2>&1 + +# Add Callhome to the Xray instance +cat <>/opt/jfrog/xray/app/bin/xray.default +export PARTNER_ID=Partner/ACC-007221 +export INTEGRATION_NAME=ARM_xray/1.0.0 +EOF + +# Remove Xray service from boot up run +sudo systemctl disable xray.service \ No newline at end of file