diff --git a/JFrogContainerRegistry/AzureResourceManager/LICENSE b/JFrogContainerRegistry/AzureResourceManager/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/JFrogContainerRegistry/AzureResourceManager/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/JFrogContainerRegistry/AzureResourceManager/README.md b/JFrogContainerRegistry/AzureResourceManager/README.md new file mode 100755 index 0000000..5cfcd7d --- /dev/null +++ b/JFrogContainerRegistry/AzureResourceManager/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. + + + diff --git a/JFrogContainerRegistry/AzureResourceManager/createUiDefinition.json b/JFrogContainerRegistry/AzureResourceManager/createUiDefinition.json new file mode 100644 index 0000000..56ad946 --- /dev/null +++ b/JFrogContainerRegistry/AzureResourceManager/createUiDefinition.json @@ -0,0 +1,352 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", + "handler": "Microsoft.Compute.MultiVm", + "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-Z])(?=.*[a-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": "privateRepoUsername", + "type": "Microsoft.Compute.UserNameTextBox", + "label": "Private Repo username", + "osPlatform": "Linux", + "constraints": { + "required": false, + "regex": "^[a-z0-9A-Z]{1,30}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long." + }, + "toolTip": "If you were provided a repo username and apikey by JFrog, enter it here" + }, + { + "name": "privateRepoApiKey", + "type": "Microsoft.Compute.UserNameTextBox", + "label": "Private Repo api key", + "osPlatform": "Linux", + "constraints": { + "required": false, + "regex": "^[a-z0-9A-Z]{1,100}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-100 characters long." + }, + "toolTip": "If you were provided a repo username and apikey by JFrog, enter it here" + } + ] + }, + { + "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_A2_v2" + ], + "constraints": { + "allowedSizes": [ + "Standard_A2_v2", + "Standard_A4_v2", + "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": "Artifactory-vm image version to deploy.", + "defaultValue": "6.15.0", + "toolTip": "", + "constraints": { + "allowedValues": [ + { + "label": "6.15.0", + "value": "6.15.0" + } + ], + "required": true + }, + "visible": true + }, + { + "name": "masterKey", + "type": "Microsoft.Common.TextBox", + "label": "Artifactory master Key", + "defaultValue": "1ce2be4490ca2c662cb79636cf9b7b8e", + "toolTip": "Master key for Artifactory 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." + } + }, + { + "name": "certificate", + "type": "Microsoft.Common.TextBox", + "label": "Provide your SSL Certificate.", + "defaultValue": "-----BEGIN CERTIFICATE----- MIIFhzCCA2+gAwIBAgIJALC4r5BQWZE4MA0GCSqGSIb3DQEBCwUAMFoxCzAJBgNV BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQHDApTYW50YUNsYXJh MQswCQYDVQQKDAJJVDEUMBIGA1UEAwwLKi5sb2NhbGhvc3QwHhcNMTgwMTE3MTk0 NjI4WhcNMTkwMTA4MTk0NjI4WjBaMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs aWZvcm5pYTETMBEGA1UEBwwKU2FudGFDbGFyYTELM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dW0JPnOEEmuMgGORKeLy4J6Ik8iSeFY1SZVcOI +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-----", + "toolTip": "To use Artifactory 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." + } + }, + { + "name": "certificateKey", + "type": "Microsoft.Common.TextBox", + "label": "Provide your SSL Certificate key.", + "defaultValue": "-----BEGIN PRIVATE KEY----- MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDsp85YNCWi/xwx ryv+VwmqJZlof2bJALvhVt7Qdeye1Bty+WOSMbY/t5ubl130HNyxq404mlsp/kCE UrWLAlQCRyIZzUtHiTzB9aZAzc09LyGuqu0fbTOo2l0VGk1iONomh/Bxw82bTfQa GFmRn3lOmu6+azAwPCymXeN+p1xz96JCwdwrIadXZr5QB6ip7smYeGaFHLUwuoCM XlTUatRhQ40D7baJEMlvhz0H3VCha+ydel0D00pX+aYDf+sh3Hot3Yg9F2sjDYrm wCd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g3K0MF 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-----", + "toolTip": "Provide your SSL Certificate key", + "constraints": { + "required": true, + "regex": "^(-----BEGIN PRIVATE KEY-----)(.+)(-----END PRIVATE KEY-----)$", + "validationMessage": "Provide SSL Certificate Key." + } + }, + { + "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 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 -Xms512m -Xmx2g -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": true, + "regex": "^.{1,10000}", + "validationMessage": "Provide SSL Certificate Key." + } + } + ] + }, + { + "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-Z])(?=.*[a-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": "", + "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": "Premium_LRS", + "value": "Premium_LRS" + }, + { + "label": "Standard_LRS", + "value": "Standard_LRS" + }, + { + "label": "Standard_GRS", + "value": "Standard_GRS" + } + ], + "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]", + "privateRepoUsername": "[steps('vmCredentials').privateRepoUsername]", + "privateRepoApiKey": "[steps('vmCredentials').privateRepoApiKey]", + "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/JFrogContainerRegistry/AzureResourceManager/images/HA_Diagram.png b/JFrogContainerRegistry/AzureResourceManager/images/HA_Diagram.png new file mode 100644 index 0000000..98cd3ee Binary files /dev/null and b/JFrogContainerRegistry/AzureResourceManager/images/HA_Diagram.png differ diff --git a/JFrogContainerRegistry/AzureResourceManager/images/Parameters.png b/JFrogContainerRegistry/AzureResourceManager/images/Parameters.png new file mode 100644 index 0000000..a735cef Binary files /dev/null and b/JFrogContainerRegistry/AzureResourceManager/images/Parameters.png differ diff --git a/JFrogContainerRegistry/AzureResourceManager/images/add_licenses.png b/JFrogContainerRegistry/AzureResourceManager/images/add_licenses.png new file mode 100644 index 0000000..3a06f9d Binary files /dev/null and b/JFrogContainerRegistry/AzureResourceManager/images/add_licenses.png differ diff --git a/JFrogContainerRegistry/AzureResourceManager/mainTemplate.json b/JFrogContainerRegistry/AzureResourceManager/mainTemplate.json new file mode 100755 index 0000000..70d6d33 --- /dev/null +++ b/JFrogContainerRegistry/AzureResourceManager/mainTemplate.json @@ -0,0 +1,632 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "vmSku": { + "type": "string", + "defaultValue": "Standard_A2_v2", + "metadata": { + "description": "Size of VMs in the VM Scale Set." + } + }, + "clusterName": { + "type": "string", + "metadata": { + "description": "String used as a base for naming resources. Must be 3-16 characters in length, use numbers and lower-case letters only and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended." + }, + "maxLength": 61 + }, + "artifactoryEdition": { + "type": "string", + "defaultValue": "jfrog-artifactory-jcr", + "metadata": { + "description": "Artifactory edition to deploy. Supported edition is jfrog-artifactory-jcr." + } + }, + "artifactoryVersion": { + "type": "string", + "defaultValue": "6.15.0", + "metadata": { + "description": "Artifactory -vm image version to deploy. Supported from 6.15.0 and above." + } + }, + "masterKey": { + "type": "string", + "defaultValue": "1ce2be4490ca2c662cb79636cf9b7b8e", + "metadata": { + "description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'" + }, + "maxLength": 64 + }, + "joinKey": { + "type": "string", + "defaultValue": "abcdef1234567890abcdef1234567890", + "metadata": { + "description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'" + }, + "maxLength": 64 + }, + "adminUsername": { + "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." + } + }, + "rhelOSVersion": { + "type": "string", + "defaultValue": "7.6.2019072418", + "metadata": { + "description": "The RHEL version for the VM." + } + }, + "rhelOSsku": { + "type": "string", + "defaultValue": "7-RAW-CI", + "metadata": { + "description": "The RHEL sku for the VM." + } + }, + "certificate": { + "type": "string", + "defaultValue": "-----BEGIN CERTIFICATE----- MIIFhzCCA2+gAwIBAgIJALC4r5BQWZE4MA0GCSqGSIb3DQEBCwUAMFoxCzAJBgNV BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQHDApTYW50YUNsYXJh MQswCQYDVQQKDAJJVDEUMBIGA1UEAwwLKi5sb2NhbGhvc3QwHhcNMTgwMTE3MTk0 NjI4WhcNMTkwMTA4MTk0NjI4WjBaMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs aWZvcm5pYTETMBEGA1UEBwwKU2FudGFDbGFyYTELMAkGA1UECgwCSVQxFDASBgNV BAMMCyoubG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA 7KfOWDQlov8cMa8r/lcJqiWZaH9myQC74Vbe0HXsntQbcvljkjG2P7ebm5dd9Bzc sauNOJpbKf5AhFK1iwJUAkciGc1LR4k8wfWmQM3NPS8hrqrtH20zqNpdFRpNYjja JofwccPNm030GhhZkZ95TpruvmswMDwspl3jfqdcc/eiQsHcKyGnV2a+UAeoqe7J mHhmhRy1MLqAjF5U1GrUYUON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hzJONC8 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/wR44KhQIDA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+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, + "defaultValue": "artifactory", + "metadata": { + "description": "Database Admin user name" + } + }, + "DB_Admin_Password": { + "type": "securestring", + "minLength": 1, + "defaultValue": "jFrog123", + "metadata": { + "description": "Database Admin password" + } + }, + "DB_Name": { + "type": "string", + "minLength": 1, + "defaultValue": "artdb", + "metadata": { + "description": "Database name" + } + }, + "DB_Edition": { + "type": "string", + "minLength": 1, + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ], + "metadata": { + "description": "Database Edition" + } + }, + "DB_Location": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Database location. Default to resource group location if blank." + } + }, + "_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/master/JFrogContainerRegistry/AzureResourceManager/" + }, + "_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", + "subnetPrefix": "10.0.1.0/24", + "virtualNetworkName": "[concat(variables('namingInfix'), 'vnet')]", + "subnetName": "[concat(variables('namingInfix'), 'subnet')]", + "scaleSetName": "[concat(variables('namingInfix'), 'scaleset')]", + "lbName": "[concat(variables('namingInfix'), 'lb')]", + "bepoolName": "[concat(variables('lbName'), 'bepool')]", + "fepoolName": "[concat(variables('lbName'), 'fepool')]", + "lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbName'))]", + "bepoolID": "[concat(variables('lbID'),'/backendAddressPools/', variables('bepoolName'))]", + "feIpConfigName": "[concat(variables('fepoolName'), 'IpConfig')]", + "feIpConfigId": "[concat(variables('lbID'),'/frontendIPConfigurations/', variables('feIpConfigName'))]", + "pipName": "[concat(variables('namingInfix'), 'pip')]", + "nicName": "[concat(variables('namingInfix'), 'nic')]", + "natPoolName": "[concat(variables('lbName'), 'natpool')]", + "ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]", + "httpProbeName": "httpProbe", + "httpsProbeName": "httpsProbe", + "storageAccountName": "[concat(variables('namingInfix'), 'storage')]", + "storageAccountType": "Standard_LRS", + "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('DB_Location')]", + "artifactoryEdition": "[parameters('artifactoryEdition')]", + "artifactoryVersion": "[parameters('artifactoryVersion')]", + "masterKey": "[parameters('masterKey')]", + "joinKey": "[parameters('joinKey')]", + "certificate": "[parameters('certificate')]", + "certificateKey": "[parameters('certificateKey')]", + "certificateDomain": "[parameters('certificateDomain')]", + "artifactoryServerName": "[parameters('artifactoryServerName')]", + "extraJavaOptions": "[parameters('extraJavaOptions')]", + "osType": { + "publisher": "RedHat", + "offer": "RHEL", + "sku": "[parameters('rhelOSsku')]", + "version": "[parameters('rhelOSVersion')]" + }, + "apiVersion": "2015-06-15", + "imageReference": "[variables('osType')]", + "dbTemplate": "azureDBDeploy.json", + "dbTemplateLocation": "[concat(parameters('_artifactsLocation'), 'nested', '/', variables('dbTemplate'))]", + "nsgName": "[concat(variables('namingInfix'), 'nsg')]" + }, + "resources": [ + { + "type": "Microsoft.Network/networkSecurityGroups", + "location": "[resourceGroup().location]", + "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-rule", + "properties": { + "description": "Allow HTTP", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "8081", + "sourceAddressPrefix": "Internet", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 101, + "direction": "Inbound" + } + }, + { + "name": "http-rule-1", + "properties": { + "description": "Allow HTTP", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "80", + "sourceAddressPrefix": "Internet", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 102, + "direction": "Inbound" + } + }, + { + "name": "https-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" + } + } + ] + }, + "name": "[variables('nsgName')]", + "apiVersion": "2016-03-30" + }, + { + "type": "Microsoft.Network/virtualNetworks", + "name": "[variables('virtualNetworkName')]", + "location": "[resourceGroup().location]", + "apiVersion": "2016-03-30", + "dependsOn": [ + "[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" + ], + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[variables('addressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[variables('subnetName')]", + "properties": { + "addressPrefix": "[variables('subnetPrefix')]", + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + } + } + } + ] + } + }, + { + "apiVersion": "[variables('apiVersion')]", + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[concat('Microsoft.Network/publicIPAddresses/', variables('pipName'))]", + "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + ], + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[concat(resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName')), '/subnets/', variables('subnetName'))]" + } + } + } + ], + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + } + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('pipName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "Standard" + }, + "apiVersion": "2017-08-01", + "properties": { + "publicIPAllocationMethod": "Static", + "dnsSettings": { + "domainNameLabel": "[variables('namingInfix')]" + } + } + }, + { + "type": "Microsoft.Network/loadBalancers", + "name": "[variables('lbName')]", + "location": "[resourceGroup().location]", + "apiVersion": "2017-08-01", + "sku": { + "name": "Standard" + }, + "dependsOn": [ + "[concat('Microsoft.Network/publicIPAddresses/', variables('pipName'))]" + ], + "tags": { + "displayName": "Load Balancer" + }, + "properties": { + "frontendIPConfigurations": [ + { + "name": "[variables('feIpConfigName')]", + "properties": { + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('pipName'))]" + } + } + } + ], + "backendAddressPools": [ + { + "name": "[variables('bepoolName')]" + } + ], + "inboundNatPools": [ + { + "name": "[variables('natPoolName')]", + "properties": { + "frontendIPConfiguration": { + "id": "[variables('feIpConfigId')]" + }, + "protocol": "tcp", + "frontendPortRangeStart": 10022, + "frontendPortRangeEnd": 11022, + "backendPort": 22 + } + } + ], + "loadBalancingRules": [ + { + "name": "HTTPRule", + "properties": { + "loadDistribution": "Default", + "frontendIPConfiguration": { + "id": "[variables('feIpConfigId')]" + }, + "backendAddressPool": { + "id": "[variables('bepoolID')]" + }, + "protocol": "Tcp", + "frontendPort": 80, + "backendPort": 80, + "enableFloatingIP": false, + "idleTimeoutInMinutes": 5, + "probe": { + "id": "[concat(variables('lbId'), '/probes/', variables('httpProbeName'))]" + } + } + }, + { + "name": "HTTPSRule", + "properties": { + "loadDistribution": "Default", + "frontendIPConfiguration": { + "id": "[variables('feIpConfigId')]" + }, + "backendAddressPool": { + "id": "[variables('bepoolID')]" + }, + "protocol": "Tcp", + "frontendPort": 443, + "backendPort": 443, + "enableFloatingIP": false, + "idleTimeoutInMinutes": 5, + "probe": { + "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('lbName')), '/probes/', variables('httpsProbeName'))]" + } + } + } + ], + "probes": [ + { + "name": "[variables('httpProbeName')]", + "properties": { + "protocol": "Http", + "requestPath": "/artifactory/webapp/", + "port": 80, + "intervalInSeconds": 60, + "numberOfProbes": 5 + } + }, + { + "name": "[variables('httpsProbeName')]", + "properties": { + "protocol": "Tcp", + "port": 443, + "intervalInSeconds": 60, + "numberOfProbes": 5 + } + } + ] + } + }, + { + "apiVersion": "[variables('apiVersion')]", + "type": "Microsoft.Storage/storageAccounts", + "name": "[variables('storageAccountName')]", + "location": "[resourceGroup().location]", + "properties": { + "accountType": "[variables('storageAccountType')]" + } + }, + { + "type": "Microsoft.Resources/deployments", + "name": "deploySQLDB", + "apiVersion": "2014-04-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": "[parameters('DB_Edition')]" + }, + "db_location": { + "value": "[parameters('DB_Location')]" + } + } + } + }, + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "name": "[variables('scaleSetName')]", + "location": "[resourceGroup().location]", + "apiVersion": "2017-03-30", + "dependsOn": [ + "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" + ], + "sku": { + "name": "[parameters('vmSku')]", + "tier": "Standard", + "capacity": "[1]" + }, + "properties": { + "singlePlacementGroup": true, + "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=',parameters('certificateKey'),'\nCERTIFICATE=', parameters('certificate'),'\nCERTIFICATE_DOMAIN=',parameters('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',parameters('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',parameters('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), variables('apiVersion')).key1,'\nARTIFACTORY_EDITION=',variables('artifactoryEdition'),'\nARTIFACTORY_VERSION=',variables('artifactoryVersion'),'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\nIS_PRIMARY=','true','\n'))]" + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "[variables('nicName')]", + "properties": { + "primary": true, + "ipConfigurations": [ + { + "name": "[concat(variables('ipConfigName'),'1')]", + "properties": { + "subnet": { + "id": "[concat(resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName')), '/subnets/', variables('subnetName'))]" + }, + "loadBalancerBackendAddressPools": [ + { + "id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('lbName'), '/backendAddressPools/', variables('bePoolName'))]" + } + ], + "loadBalancerInboundNatPools": [ + { + "id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('lbName'), '/inboundNatPools/', variables('natPoolName'))]" + } + ] + } + } + ] + } + } + ] + }, + "extensionProfile": { + "extensions": [ + { + "name": "extension1", + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "CustomScript", + "typeHandlerVersion": "2.0", + "autoUpgradeMinorVersion": false, + "settings": { + "fileUris": [ + "[concat(parameters('_artifactsLocation'), 'scripts/','install_artifactory.sh')]" + ] + }, + "protectedSettings": { + "commandToExecute": "sh install_artifactory.sh" + } + } + } + ] + } + } + } + }, + { + "apiVersion": "2015-01-01", + "name": "pid-04c1c376-5d4b-4771-9a7f-054f5910dcef", + "type": "Microsoft.Resources/deployments", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [] + } + } + } + ], + "outputs": { + "fqdn": { + "value": "[reference(resourceId('Microsoft.Network/publicIPAddresses',variables('pipName')),'2016-03-30').dnsSettings.fqdn]", + "type": "string" + } + } +} diff --git a/JFrogContainerRegistry/AzureResourceManager/metadata.json b/JFrogContainerRegistry/AzureResourceManager/metadata.json new file mode 100644 index 0000000..e5a92b7 --- /dev/null +++ b/JFrogContainerRegistry/AzureResourceManager/metadata.json @@ -0,0 +1,7 @@ +{ + "itemDisplayName": "Artifactory JCR Setup", + "description": "This template helps you setup a Artifactory JCR environment.", + "summary": "This template has setup Artifactory JCR cluster", + "githubUsername": "danielmkn", + "dateUpdated": "2019-11-19" +} \ No newline at end of file diff --git a/JFrogContainerRegistry/AzureResourceManager/nested/azureDBDeploy.json b/JFrogContainerRegistry/AzureResourceManager/nested/azureDBDeploy.json new file mode 100644 index 0000000..141c277 --- /dev/null +++ b/JFrogContainerRegistry/AzureResourceManager/nested/azureDBDeploy.json @@ -0,0 +1,100 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2018-06-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "minLength": 1 + }, + "db_password": { + "type": "securestring", + "defaultValue": "jFrog123" + }, + "db_server": { + "type": "string", + "minLength": 1, + "defaultValue": "artmssqlsrv" + }, + "db_name": { + "type": "string", + "minLength": 1, + "defaultValue": "artdb" + }, + "db_location": { + "type": "string", + "defaultValue": "" + }, + "db_edition": { + "type": "string", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + } + }, + "variables": { + "apiVersion": "2018-06-01-preview", + "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": "[variables('apiVersion')]", + "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": "[variables('apiVersion')]", + "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": "[variables('apiVersion')]", + "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/JFrogContainerRegistry/AzureResourceManager/scripts/install_artifactory.sh b/JFrogContainerRegistry/AzureResourceManager/scripts/install_artifactory.sh new file mode 100755 index 0000000..8ca98d6 --- /dev/null +++ b/JFrogContainerRegistry/AzureResourceManager/scripts/install_artifactory.sh @@ -0,0 +1,247 @@ +#!/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_EDITION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_EDITION=" | sed "s/ARTIFACTORY_EDITION=//") +ARTIFACTORY_VERSION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_VERSION=" | sed "s/ARTIFACTORY_VERSION=//") +MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//") +JFROG_JOIN_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JOIN_KEY=" | sed "s/JOIN_KEY=//") +IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//") + +#disable firewalld, also disable selinux. Both block traffic from load balancer. +systemctl stop firewalld +setenforce Permissive + +# install the wget and curl +yum -y install wget curl>> /tmp/install-curl.log 2>&1 + +yum -y install java-1.8.0-openjdk >> /tmp/install-java.log 2>&1 +#yum -y install java-11-openjdk >> /tmp/install-java.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" + +setenforce 0 +sed -i -e "s/SELINUX=.*/SELINUX=permissive/" /etc/sysconfig/selinux +wget https://bintray.com/jfrog/artifactory-pro-rpms/rpm -O bintray-jfrog-artifactory-pro-rpms.repo +mv bintray-jfrog-artifactory-pro-rpms.repo /etc/yum.repos.d/ +wget https://bintray.com/jfrog/artifactory-rpms/rpm -O bintray-jfrog-artifactory-rpms.repo; +mv bintray-jfrog-artifactory-rpms.repo /etc/yum.repos.d/ + +yum -y install ${ARTIFACTORY_EDITION}-${ARTIFACTORY_VERSION} >> /tmp/install-artifactory.log 2>&1 + +cat > /etc/yum.repos.d/nginx.repo <> /tmp/install-nginx.log 2>&1 + +#Install database drivers +curl -L -o /opt/jfrog/artifactory/tomcat/lib/mysql-connector-java-5.1.38.jar https://bintray.com/artifact/download/bintray/jcenter/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar +curl -L -o /opt/jfrog/artifactory/tomcat/lib/mssql-jdbc-6.2.1.jre8.jar https://bintray.com/artifact/download/bintray/jcenter/com/microsoft/sqlserver/mssql-jdbc/6.2.1.jre8/mssql-jdbc-6.2.1.jre8.jar +curl -L -o /opt/jfrog/artifactory/tomcat/lib/postgresql-9.4.1212.jar https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar + +CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//") +[ -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 + +rm /etc/nginx/conf.d/default.conf + + +mkdir -p /var/opt/jfrog/artifactory/etc/security + +cat </var/opt/jfrog/artifactory/etc/security/master.key +${MASTER_KEY} +EOF + +# in case of JCR or OSS, use non-ha mode, also use derby, also do not create binary store xml +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 +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 + +# begin JCR specific setup + +cat </etc/nginx/conf.d/artifactory.conf +ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; +ssl_certificate /etc/pki/tls/certs/cert.pem; +ssl_certificate_key /etc/pki/tls/private/cert.key; +ssl_session_cache shared:SSL:1m; +ssl_prefer_server_ciphers on; +## server configuration +server { + listen 443 ssl; + listen 80 ; + server_name ~(?.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN} ${CERTIFICATE_DOMAIN}; + if (\$http_x_forwarded_proto = '') { + set \$http_x_forwarded_proto \$scheme; + } + ## Application specific logs + ## access_log /var/log/nginx/artifactory-access.log timing; + ## error_log /var/log/nginx/artifactory-error.log; + rewrite ^/$ /artifactory/webapp/ redirect; + rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect; + + rewrite ^/(v2)/(.*) /artifactory/\$1/\$2; + + chunked_transfer_encoding on; + client_max_body_size 0; + location /artifactory/ { + proxy_read_timeout 2400; + proxy_pass_header Server; + proxy_cookie_path ~*^/.* /; + + proxy_pass http://127.0.0.1:8081/artifactory/; + proxy_set_header X-Artifactory-Override-Base-Url \$http_x_forwarded_proto://\$host:\$server_port/artifactory; + proxy_set_header X-Forwarded-Port \$server_port; + proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto; + proxy_set_header Host \$http_host; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + } +} +EOF + +# end JCR specific setup + + +# callhome metadata +mkdir -p /var/opt/jfrog/artifactory/etc/info +cat </var/opt/jfrog/artifactory/etc/info/installer-info.json +{ + "productId": "JFrogInstaller_AzureMP/${ARTIFACTORY_VERSION}", + "features": [ + { + "featureId": "ArtifactoryVersion/${ARTIFACTORY_EDITION}-${ARTIFACTORY_VERSION}" + }, + { + "featureId": "Platform/azure-mp-vm-jcr" + } + ] +} +EOF + +HOSTNAME=$(hostname -i) +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 + +echo "artifactory.ping.allowUnauthenticated=true" >> /var/opt/jfrog/artifactory/etc/artifactory.system.properties +EXTRA_JAVA_OPTS=$(cat /var/lib/cloud/instance/user-data.txt | grep "^EXTRA_JAVA_OPTS=" | sed "s/EXTRA_JAVA_OPTS=//") +[ -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 JCR installation completed." +