mirror of
https://github.com/ZwareBear/JFrog-Cloud-Installers.git
synced 2026-01-21 05:06:56 -06:00
Azure, Artifactory and Xray templates. Major ARM template refactoring
This commit is contained in:
201
AzureResourceManager/Xray/LICENSE
Normal file
201
AzureResourceManager/Xray/LICENSE
Normal file
@@ -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.
|
||||
315
AzureResourceManager/Xray/MP_submission/createUiDefinition.json
Normal file
315
AzureResourceManager/Xray/MP_submission/createUiDefinition.json
Normal file
@@ -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]"
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
AzureResourceManager/Xray/MP_submission/jfrog-xray-3-6-2-0.zip
Normal file
BIN
AzureResourceManager/Xray/MP_submission/jfrog-xray-3-6-2-0.zip
Normal file
Binary file not shown.
BIN
AzureResourceManager/Xray/MP_submission/jfrog-xray-3-6-2-1.zip
Normal file
BIN
AzureResourceManager/Xray/MP_submission/jfrog-xray-3-6-2-1.zip
Normal file
Binary file not shown.
400
AzureResourceManager/Xray/MP_submission/mainTemplate.json
Normal file
400
AzureResourceManager/Xray/MP_submission/mainTemplate.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 <<EOF >/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
|
||||
101
AzureResourceManager/Xray/README.md
Normal file
101
AzureResourceManager/Xray/README.md
Normal file
@@ -0,0 +1,101 @@
|
||||
# Setup JFrog Xray
|
||||
The recommended way of deploying is through the Azure marketplace.
|
||||
|
||||
<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fjfrog%2FJFrog-Cloud-Installers%2Farm-xray%2FAzureResourceManager%2FXray%2Fazuredeploy_xray_vmss.json" target="_blank">
|
||||
<img src="https://aka.ms/deploytoazurebutton"/>
|
||||
</a>
|
||||
|
||||
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:
|
||||
|
||||
<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fjfrog%2FJFrog-Cloud-Installers%2Farm-xray%2FAzureResourceManager%2FPostgresql%2FazurePostgresDBDeploy.json" target="_blank">
|
||||
<img src="https://aka.ms/deploytoazurebutton"/>
|
||||
</a>
|
||||
|
||||
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.
|
||||
|
||||
389
AzureResourceManager/Xray/azuredeploy_xray.json
Normal file
389
AzureResourceManager/Xray/azuredeploy_xray.json
Normal file
@@ -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')))]"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
63
AzureResourceManager/Xray/azuredeploy_xray.parameters.json
Normal file
63
AzureResourceManager/Xray/azuredeploy_xray.parameters.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
400
AzureResourceManager/Xray/azuredeploy_xray_vmss.json
Normal file
400
AzureResourceManager/Xray/azuredeploy_xray_vmss.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
161
AzureResourceManager/Xray/nested/Postgresql_deploy.json
Normal file
161
AzureResourceManager/Xray/nested/Postgresql_deploy.json
Normal file
@@ -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')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
54
AzureResourceManager/Xray/nested/Postgresql_existing.json
Normal file
54
AzureResourceManager/Xray/nested/Postgresql_existing.json
Normal file
@@ -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')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
35
AzureResourceManager/Xray/scripts/install_xray.sh
Normal file
35
AzureResourceManager/Xray/scripts/install_xray.sh
Normal file
@@ -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 <<EOF >/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
|
||||
42
AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh
Normal file
42
AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh
Normal file
@@ -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 <<EOF >/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 <<EOF >>/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
|
||||
Reference in New Issue
Block a user