mirror of
https://github.com/ZwareBear/JFrog-Cloud-Installers.git
synced 2026-01-21 00:06:55 -06:00
adding private listing
This commit is contained in:
committed by
Alex Hung
parent
5bdc205704
commit
341a8d2ee6
@@ -0,0 +1,378 @@
|
||||
AWSTemplateFormatVersion: '2010-09-09'
|
||||
Description: 'JFrog Artifactory Quick Start Deployment (qs-1qpmmjh61)'
|
||||
Parameters:
|
||||
VpcId:
|
||||
Type: AWS::EC2::VPC::Id
|
||||
VpcCidr:
|
||||
Description: CIDR block for the VPC
|
||||
AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$
|
||||
ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
|
||||
Default: 10.0.0.0/16
|
||||
Type: String
|
||||
PrivateSubnet1Cidr:
|
||||
AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$
|
||||
ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
|
||||
Default: 10.0.0.0/19
|
||||
Type: String
|
||||
PrivateSubnet2Cidr:
|
||||
AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$
|
||||
ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
|
||||
Default: 10.0.32.0/19
|
||||
Type: String
|
||||
PrivateSubnet3Cidr:
|
||||
AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$
|
||||
ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28
|
||||
Default: 10.0.64.0/19
|
||||
Type: String
|
||||
SubnetIds:
|
||||
Type: List<AWS::EC2::Subnet::Id>
|
||||
DatabaseAllocatedStorage:
|
||||
Type: Number
|
||||
MultiAzDatabase:
|
||||
Type: String
|
||||
DatabaseEngine:
|
||||
Type: String
|
||||
DatabaseUser:
|
||||
Type: String
|
||||
DatabasePassword:
|
||||
NoEcho: 'true'
|
||||
Type: String
|
||||
DatabaseInstance:
|
||||
Type: String
|
||||
DatabaseName:
|
||||
Type: String
|
||||
ArtifactoryS3IAMUser:
|
||||
NoEcho: 'true'
|
||||
Type: String
|
||||
ArtifactoryProduct:
|
||||
Default: JFrog-Artifactory-Pro
|
||||
Type: String
|
||||
ReleaseStage:
|
||||
Default: GA
|
||||
Type: String
|
||||
InstanceType:
|
||||
Default: m5.xlarge
|
||||
Type: String
|
||||
|
||||
Mappings:
|
||||
DatabaseMap:
|
||||
Postgres:
|
||||
Name: postgresql
|
||||
DatabaseVersion: 11.5
|
||||
Driver: "org.postgresql.Driver"
|
||||
Plugin: postgresql-42.2.9.jar
|
||||
PluginURL: https://jdbc.postgresql.org/download/
|
||||
port: "5432"
|
||||
extraDatabaseOps: ""
|
||||
ReleaseStageMap:
|
||||
BETA:
|
||||
ProDockerRepo: "earlyaccess-docker.jfrog.io/jfrog/artifactory-pro"
|
||||
JcrDockerRepo: "earlyaccess-docker.jfrog.io/jfrog/artifactory-jcr"
|
||||
NginxDockerRepo: "earlyaccess-docker.jfrog.io/jfrog/nginx-artifactory-pro"
|
||||
GA:
|
||||
ProDockerRepo: "docker.bintray.io/jfrog/artifactory-pro"
|
||||
JcrDockerRepo: "docker.bintray.io/jfrog/artifactory-jcr"
|
||||
NginxDockerRepo: "docker.bintray.io/jfrog/nginx-artifactory-pro"
|
||||
ProductMap:
|
||||
JFrog-Container-Registry:
|
||||
RepoName: JcrDockerRepo
|
||||
JFrog-Artifactory-Pro:
|
||||
RepoName: ProDockerRepo
|
||||
JavaOptionstoInstance:
|
||||
m5.large:
|
||||
Min: 4
|
||||
Max: 4
|
||||
DeploymentSize: xxSmall
|
||||
m5.xlarge:
|
||||
Min: 8
|
||||
Max: 12
|
||||
DeploymentSize: xSmall
|
||||
m5.2xlarge:
|
||||
Min: 16
|
||||
Max: 24
|
||||
DeploymentSize: Small
|
||||
m5.4xlarge:
|
||||
Min: 32
|
||||
Max: 48
|
||||
DeploymentSize: Medium
|
||||
m5.8xlarge:
|
||||
Min: 64
|
||||
Max: 96
|
||||
DeploymentSize: Large
|
||||
m5.12xlarge:
|
||||
Min: 96
|
||||
Max: 144
|
||||
DeploymentSize: xLarge
|
||||
m5.16xlarge:
|
||||
Min: 128
|
||||
Max: 192
|
||||
DeploymentSize: xxLarge
|
||||
m5.24xlarge:
|
||||
Min: 192
|
||||
Max: 288
|
||||
DeploymentSize: xxxLarge
|
||||
m5.metal:
|
||||
Min: 192
|
||||
Max: 288
|
||||
DeploymentSize: xxxLarge
|
||||
m5d.large:
|
||||
Min: 4
|
||||
Max: 4
|
||||
DeploymentSize: xxSmall
|
||||
m5d.xlarge:
|
||||
Min: 8
|
||||
Max: 12
|
||||
DeploymentSize: xSmall
|
||||
m5d.2xlarge:
|
||||
Min: 16
|
||||
Max: 24
|
||||
DeploymentSize: Small
|
||||
m5d.4xlarge:
|
||||
Min: 32
|
||||
Max: 48
|
||||
DeploymentSize: Medium
|
||||
m5d.8xlarge:
|
||||
Min: 64
|
||||
Max: 96
|
||||
DeploymentSize: Large
|
||||
m5d.12xlarge:
|
||||
Min: 96
|
||||
Max: 144
|
||||
DeploymentSize: xLarge
|
||||
m5d.16xlarge:
|
||||
Min: 128
|
||||
Max: 192
|
||||
DeploymentSize: xxLarge
|
||||
m5d.24xlarge:
|
||||
Min: 192
|
||||
Max: 288
|
||||
DeploymentSize: xxxLarge
|
||||
m5d.metal:
|
||||
Min: 192
|
||||
Max: 288
|
||||
DeploymentSize: xxxLarge
|
||||
m5a.large:
|
||||
Min: 4
|
||||
Max: 4
|
||||
DeploymentSize: xxSmall
|
||||
m5a.xlarge:
|
||||
Min: 8
|
||||
Max: 12
|
||||
DeploymentSize: xSmall
|
||||
m5a.2xlarge:
|
||||
Min: 16
|
||||
Max: 24
|
||||
DeploymentSize: Small
|
||||
m5a.4xlarge:
|
||||
Min: 32
|
||||
Max: 48
|
||||
DeploymentSize: Medium
|
||||
m5a.8xlarge:
|
||||
Min: 64
|
||||
Max: 96
|
||||
DeploymentSize: Large
|
||||
m5a.12xlarge:
|
||||
Min: 96
|
||||
Max: 144
|
||||
DeploymentSize: xLarge
|
||||
m5a.16xlarge:
|
||||
Min: 128
|
||||
Max: 192
|
||||
DeploymentSize: xxLarge
|
||||
m5a.24xlarge:
|
||||
Min: 192
|
||||
Max: 288
|
||||
DeploymentSize: xxxLarge
|
||||
m5ad.large:
|
||||
Min: 4
|
||||
Max: 4
|
||||
DeploymentSize: xxSmall
|
||||
m5ad.xlarge:
|
||||
Min: 8
|
||||
Max: 12
|
||||
DeploymentSize: xSmall
|
||||
m5ad.2xlarge:
|
||||
Min: 16
|
||||
Max: 24
|
||||
DeploymentSize: Small
|
||||
m5ad.4xlarge:
|
||||
Min: 32
|
||||
Max: 48
|
||||
DeploymentSize: Medium
|
||||
m5ad.12xlarge:
|
||||
Min: 96
|
||||
Max: 144
|
||||
DeploymentSize: xLarge
|
||||
m5ad.24xlarge:
|
||||
Min: 192
|
||||
Max: 288
|
||||
DeploymentSize: xxxLarge
|
||||
Resources:
|
||||
ArtifactoryDatabaseSubnetGroup:
|
||||
Type: AWS::RDS::DBSubnetGroup
|
||||
Properties:
|
||||
DBSubnetGroupDescription: Private Subnets available to the RDS Instance(s)
|
||||
SubnetIds: !Ref SubnetIds
|
||||
ArtifactoryDatabase:
|
||||
Type: AWS::RDS::DBInstance
|
||||
Properties:
|
||||
AllocatedStorage: !Ref DatabaseAllocatedStorage
|
||||
MultiAZ: !Ref MultiAzDatabase
|
||||
Engine: !Ref DatabaseEngine
|
||||
EngineVersion: !FindInMap
|
||||
- DatabaseMap
|
||||
- !Ref DatabaseEngine
|
||||
- DatabaseVersion
|
||||
MasterUsername: !Ref DatabaseUser
|
||||
MasterUserPassword: !Ref DatabasePassword
|
||||
DBInstanceClass: !Ref DatabaseInstance
|
||||
DBName: !Ref DatabaseName
|
||||
DBSubnetGroupName: !Ref ArtifactoryDatabaseSubnetGroup
|
||||
VPCSecurityGroups:
|
||||
- !Ref ArtifactoryDatabaseSG
|
||||
ArtifactoryDatabaseSG:
|
||||
Type: AWS::EC2::SecurityGroup
|
||||
Properties:
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: artifactory-rds-sg
|
||||
GroupDescription: SG for RDS Instance to allow communication from the Bastion and Artifactory servers.
|
||||
VpcId: !Ref VpcId
|
||||
SecurityGroupIngress:
|
||||
- IpProtocol: tcp
|
||||
FromPort: 22
|
||||
ToPort: 22
|
||||
CidrIp: !Ref VpcCidr
|
||||
- IpProtocol: tcp
|
||||
FromPort: !FindInMap
|
||||
- DatabaseMap
|
||||
- !Ref DatabaseEngine
|
||||
- port
|
||||
ToPort: !FindInMap
|
||||
- DatabaseMap
|
||||
- !Ref DatabaseEngine
|
||||
- port
|
||||
CidrIp: !Ref PrivateSubnet1Cidr
|
||||
- IpProtocol: tcp
|
||||
FromPort: !FindInMap
|
||||
- DatabaseMap
|
||||
- !Ref DatabaseEngine
|
||||
- port
|
||||
ToPort: !FindInMap
|
||||
- DatabaseMap
|
||||
- !Ref DatabaseEngine
|
||||
- port
|
||||
CidrIp: !Ref PrivateSubnet2Cidr
|
||||
- IpProtocol: tcp
|
||||
FromPort: !FindInMap
|
||||
- DatabaseMap
|
||||
- !Ref DatabaseEngine
|
||||
- port
|
||||
ToPort: !FindInMap
|
||||
- DatabaseMap
|
||||
- !Ref DatabaseEngine
|
||||
- port
|
||||
CidrIp: !Ref PrivateSubnet3Cidr
|
||||
SecurityGroupEgress:
|
||||
- IpProtocol: tcp
|
||||
FromPort: 22
|
||||
ToPort: 22
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 80
|
||||
ToPort: 80
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 443
|
||||
ToPort: 443
|
||||
CidrIp: 0.0.0.0/0
|
||||
ArtifactoryS3Bucket:
|
||||
Type: AWS::S3::Bucket
|
||||
Properties:
|
||||
AccessControl: Private
|
||||
BucketEncryption:
|
||||
ServerSideEncryptionConfiguration:
|
||||
- ServerSideEncryptionByDefault:
|
||||
SSEAlgorithm: AES256
|
||||
ArtifactoryS3IAMPolicy:
|
||||
Type: AWS::IAM::Policy
|
||||
Properties:
|
||||
PolicyName: S3BucketPermissions
|
||||
PolicyDocument:
|
||||
Version: 2012-10-17
|
||||
Statement:
|
||||
- Sid: S3BucketPermissions
|
||||
Effect: Allow
|
||||
Action:
|
||||
- s3:*
|
||||
Resource:
|
||||
- Fn::Join:
|
||||
- ''
|
||||
- - !Sub "arn:${AWS::Partition}:s3:::"
|
||||
- !Ref ArtifactoryS3Bucket
|
||||
- Fn::Join:
|
||||
- ''
|
||||
- - !Sub "arn:${AWS::Partition}:s3:::"
|
||||
- !Ref ArtifactoryS3Bucket
|
||||
- "/*"
|
||||
Users:
|
||||
- !Ref ArtifactoryS3IAMUser
|
||||
Outputs:
|
||||
S3Bucket:
|
||||
Value: !Ref ArtifactoryS3Bucket
|
||||
Description: Actual S3 bucket created for Artifactory
|
||||
DatabaseDriver:
|
||||
Value: !FindInMap [DatabaseMap, !Ref DatabaseEngine, Driver]
|
||||
DatabasePlugin:
|
||||
Value: !FindInMap [DatabaseMap, !Ref DatabaseEngine, Plugin]
|
||||
DatabasePluginUrl:
|
||||
Value: !Sub
|
||||
- "${MainURL}${PluginVersion}"
|
||||
- {
|
||||
MainURL: !FindInMap [DatabaseMap, !Ref DatabaseEngine, PluginURL],
|
||||
PluginVersion: !FindInMap [DatabaseMap, !Ref DatabaseEngine, Plugin]
|
||||
}
|
||||
DatabaseType:
|
||||
Value: !FindInMap [DatabaseMap, !Ref DatabaseEngine, Name]
|
||||
DatabaseUrl:
|
||||
Value: !Sub
|
||||
- "jdbc:${DatabaseType}://${ArtifactoryDatabaseEndpointAddress}:${port}/${DatabaseName}${extraDatabaseOps}"
|
||||
- {
|
||||
DatabaseType: !FindInMap [DatabaseMap, !Ref DatabaseEngine, Name],
|
||||
ArtifactoryDatabaseEndpointAddress: !GetAtt ArtifactoryDatabase.Endpoint.Address,
|
||||
port: !FindInMap [DatabaseMap, !Ref DatabaseEngine, port],
|
||||
extraDatabaseOps: !FindInMap [DatabaseMap, !Ref DatabaseEngine, extraDatabaseOps],
|
||||
}
|
||||
XrayMasterDatabaseUrl:
|
||||
Value: !Sub
|
||||
- "${ArtifactoryDatabaseEndpointAddress}:${port}/${DatabaseName}?sslmode=disable"
|
||||
- {
|
||||
ArtifactoryDatabaseEndpointAddress: !GetAtt ArtifactoryDatabase.Endpoint.Address,
|
||||
port: !FindInMap [DatabaseMap, !Ref DatabaseEngine, port],
|
||||
}
|
||||
XrayDatabaseUrl:
|
||||
Value: !Sub
|
||||
- "${ArtifactoryDatabaseEndpointAddress}:${port}/xraydb?sslmode=disable"
|
||||
- {
|
||||
ArtifactoryDatabaseEndpointAddress: !GetAtt ArtifactoryDatabase.Endpoint.Address,
|
||||
port: !FindInMap [DatabaseMap, !Ref DatabaseEngine, port],
|
||||
}
|
||||
ProDockerRepo:
|
||||
Value: !FindInMap
|
||||
- ReleaseStageMap
|
||||
- !Ref ReleaseStage
|
||||
- !FindInMap
|
||||
- ProductMap
|
||||
- !Ref ArtifactoryProduct
|
||||
- RepoName
|
||||
NginxDockerRepo:
|
||||
Value: !FindInMap [ReleaseStageMap, !Ref ReleaseStage, NginxDockerRepo]
|
||||
JavaOpts:
|
||||
Value: !Sub
|
||||
- "-Xms${min}g -Xmx${max}g"
|
||||
- {
|
||||
min: !FindInMap [JavaOptionstoInstance, !Ref InstanceType, Min],
|
||||
max: !FindInMap [JavaOptionstoInstance, !Ref InstanceType, Max]
|
||||
}
|
||||
DeploymentSize:
|
||||
Value: !FindInMap [JavaOptionstoInstance, !Ref InstanceType, DeploymentSize]
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,345 @@
|
||||
AWSTemplateFormatVersion: "2010-09-09"
|
||||
Description: "Deploys the EC2 Autoscaling, LaunchConfig and Instance for Artifactory (qs-1qpmmjh5o)"
|
||||
Parameters:
|
||||
PrivateSubnet1Id:
|
||||
Type: 'AWS::EC2::Subnet::Id'
|
||||
PrivateSubnet2Id:
|
||||
Type: 'AWS::EC2::Subnet::Id'
|
||||
MinScalingNodes:
|
||||
Type: Number
|
||||
MaxScalingNodes:
|
||||
Type: Number
|
||||
DeploymentTag:
|
||||
Type: String
|
||||
HostRole:
|
||||
Type: String
|
||||
AmiId:
|
||||
Type: String
|
||||
ArtifactoryProduct:
|
||||
Type: String
|
||||
QsS3BucketName:
|
||||
Type: String
|
||||
QsS3KeyPrefix:
|
||||
Type: String
|
||||
QsS3Uri:
|
||||
Type: String
|
||||
ArtifactoryLicense1:
|
||||
Type: String
|
||||
ArtifactoryLicense2:
|
||||
Type: String
|
||||
ArtifactoryLicense3:
|
||||
Type: String
|
||||
ArtifactoryLicense4:
|
||||
Type: String
|
||||
ArtifactoryLicense5:
|
||||
Type: String
|
||||
ArtifactoryLicense6:
|
||||
Type: String
|
||||
ArtifactoryServerName:
|
||||
Type: String
|
||||
Certificate:
|
||||
Type: String
|
||||
CertificateKey:
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
CertificateDomain:
|
||||
Type: String
|
||||
EnableSSL:
|
||||
Type: String
|
||||
ArtifactoryIamAcessKey:
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
SecretAccessKey:
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
ArtifactoryS3Bucket:
|
||||
Type: String
|
||||
DatabaseUrl:
|
||||
Type: String
|
||||
DatabaseDriver:
|
||||
Type: String
|
||||
DatabasePluginUrl:
|
||||
Type: String
|
||||
DatabasePlugin:
|
||||
Type: String
|
||||
DatabaseType:
|
||||
Type: String
|
||||
DatabaseUser:
|
||||
Type: String
|
||||
DatabasePassword:
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
ArtifactoryPrimary:
|
||||
Type: String
|
||||
MasterKey:
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
ExtraJavaOptions:
|
||||
Type: String
|
||||
ArtifactoryVersion:
|
||||
Type: String
|
||||
KeyPairName:
|
||||
Type: AWS::EC2::KeyPair::KeyName
|
||||
TargetGroupARN:
|
||||
Type: String
|
||||
SSLTargetGroupARN:
|
||||
Type: String
|
||||
InternalTargetGroupARN:
|
||||
Type: String
|
||||
HostProfile:
|
||||
Type: String
|
||||
SecurityGroups:
|
||||
Type: String
|
||||
InstanceType:
|
||||
Type: String
|
||||
VolumeSize:
|
||||
Type: Number
|
||||
KeystorePassword:
|
||||
Description: Default Keystore from Java in which we upgrade.
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
AnsibleVaultPass:
|
||||
Description: Ansiblevault Password to secure the artifactory.yml
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
Mappings:
|
||||
AWSAMIRegionMap:
|
||||
us-east-1:
|
||||
"Artifactory7112": ami-0ea7d62825c941e92
|
||||
us-east-2:
|
||||
"Artifactory7112": ami-0a282b74eef1c84b5
|
||||
us-west-1:
|
||||
"Artifactory7112": ami-02fa6dd21f023b9e3
|
||||
us-west-2:
|
||||
"Artifactory7112": ami-0ea26f5ddc490f184
|
||||
ca-central-1:
|
||||
"Artifactory7112": ami-0f422f5980aeba60f
|
||||
eu-central-1:
|
||||
"Artifactory7112": ami-05df4fbab56afe702
|
||||
eu-west-1:
|
||||
"Artifactory7112": ami-05386b580a110a49a
|
||||
eu-west-2:
|
||||
"Artifactory7112": ami-094b79d303c9e1e0d
|
||||
eu-west-3:
|
||||
"Artifactory7112": ami-0ed4d6971439caf27
|
||||
ap-southeast-1:
|
||||
"Artifactory7112": ami-01ec4e8b4ffbf7dc1
|
||||
ap-southeast-2:
|
||||
"Artifactory7112": ami-0ccb1a939c83d8062
|
||||
ap-south-1:
|
||||
"Artifactory7112": ami-078c43a083b6500be
|
||||
ap-northeast-1:
|
||||
"Artifactory7112": ami-0695fd32ca193cccd
|
||||
ap-northeast-2:
|
||||
"Artifactory7112": ami-0a03d23e6dc213b5e
|
||||
sa-east-1:
|
||||
"Artifactory7112": ami-0b831f8403d6979d4
|
||||
us-gov-west-1:
|
||||
"Artifactory7112": ami-0842d7e7becc59c39
|
||||
ArtifactoryProductMap:
|
||||
JFrog-Container-Registry:
|
||||
"7112": "Jcr7112"
|
||||
product: "jcr"
|
||||
JFrog-Artifactory-Pro:
|
||||
"7112": "Artifactory7112"
|
||||
product: "artifactory"
|
||||
Resources:
|
||||
ArtifactoryScalingGroup:
|
||||
Type: 'AWS::AutoScaling::AutoScalingGroup'
|
||||
Properties:
|
||||
LaunchConfigurationName: !Ref ArtifactoryLaunchConfiguration
|
||||
VPCZoneIdentifier:
|
||||
- !Ref PrivateSubnet1Id
|
||||
- !Ref PrivateSubnet2Id
|
||||
MinSize: !Ref MinScalingNodes
|
||||
MaxSize: !Ref MaxScalingNodes
|
||||
Cooldown: '300'
|
||||
DesiredCapacity: !Ref MinScalingNodes
|
||||
TargetGroupARNs:
|
||||
- !Ref TargetGroupARN
|
||||
- !Ref SSLTargetGroupARN
|
||||
- !Ref InternalTargetGroupARN
|
||||
HealthCheckType: ELB
|
||||
HealthCheckGracePeriod: 900
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Ref DeploymentTag
|
||||
PropagateAtLaunch: true
|
||||
CreationPolicy:
|
||||
ResourceSignal:
|
||||
Count: 1
|
||||
Timeout: PT30M
|
||||
|
||||
ArtifactoryLaunchConfiguration:
|
||||
Type: 'AWS::AutoScaling::LaunchConfiguration'
|
||||
Metadata:
|
||||
'AWS::CloudFormation::Authentication':
|
||||
S3AccessCreds:
|
||||
type: S3
|
||||
roleName:
|
||||
- !Ref HostRole # !Ref ArtifactoryHostRole
|
||||
buckets:
|
||||
- !Ref QsS3BucketName
|
||||
'AWS::CloudFormation::Init':
|
||||
configSets:
|
||||
artifactory_install:
|
||||
- "config-artifactory-master"
|
||||
- "secure-artifactory"
|
||||
config-artifactory-master:
|
||||
files:
|
||||
/root/.jfrog_ami/artifactory.yml:
|
||||
content: !Sub
|
||||
- |
|
||||
# Base install for Artifactory
|
||||
- import_playbook: site-artifactory.yml
|
||||
vars:
|
||||
artifactory_license1: ${ArtifactoryLicense1}
|
||||
artifactory_license2: ${ArtifactoryLicense2}
|
||||
artifactory_license3: ${ArtifactoryLicense3}
|
||||
artifactory_license4: ${ArtifactoryLicense4}
|
||||
artifactory_license5: ${ArtifactoryLicense5}
|
||||
artifactory_license6: ${ArtifactoryLicense6}
|
||||
artifactory_product: ${product}
|
||||
artifactory_flavour: "{{ 'pro' if '${product}' == 'artifactory' else 'jcr' if '${product}' == 'jcr' }}"
|
||||
artifactory_server_name: ${ArtifactoryServerName}
|
||||
server_name: ${ArtifactoryServerName}.${CertificateDomain}
|
||||
s3_region: ${AWS::Region}
|
||||
s3_access_key: ${ArtifactoryIamAcessKey}
|
||||
s3_access_secret_key: ${SecretAccessKey}
|
||||
s3_bucket: ${ArtifactoryS3Bucket}
|
||||
certificate: ${Certificate}
|
||||
certificate_key: ${CertificateKey}
|
||||
certificate_domain: ${CertificateDomain}
|
||||
enable_ssl: ${EnableSSL}
|
||||
ssl_dir: /etc/pki/tls/certs
|
||||
db_type: ${DatabaseType}
|
||||
db_driver: ${DatabaseDriver}
|
||||
db_url: ${DatabaseUrl}
|
||||
db_user: ${DatabaseUser}
|
||||
db_password: ${DatabasePassword}
|
||||
# db_download_url: https://jdbc.postgresql.org/download/postgresql-42.2.12.jar
|
||||
art_primary: ${ArtifactoryPrimary}
|
||||
master_key: ${MasterKey}
|
||||
join_key: ${MasterKey}
|
||||
extra_java_opts: ${ExtraJavaOptions}
|
||||
artifactory_version: ${ArtifactoryVersion}
|
||||
artifactory_keystore:
|
||||
path: /opt/jfrog/artifactory/app/third-party/java/lib/security/cacerts
|
||||
default_password: changeit
|
||||
new_keystore_pass: ${KeystorePassword}
|
||||
artifactory_java_db_drivers:
|
||||
- name: ${DatabasePlugin}
|
||||
url: ${DatabasePluginUrl}
|
||||
owner: artifactory
|
||||
group: artifactory
|
||||
- {
|
||||
product: !FindInMap [ArtifactoryProductMap, !Ref ArtifactoryProduct, product]
|
||||
}
|
||||
mode: "0400"
|
||||
/root/.vault_pass.txt:
|
||||
content: !Sub |
|
||||
${AnsibleVaultPass}
|
||||
mode: "0400"
|
||||
/root/.secureit.sh:
|
||||
content:
|
||||
ansible-vault encrypt /root/.jfrog_ami/artifactory.yml --vault-id /root/.vault_pass.txt
|
||||
mode: "0770"
|
||||
secure-artifactory:
|
||||
commands:
|
||||
'secure ansible playbook':
|
||||
command: '/root/.secureit.sh'
|
||||
ignoreErrors: 'false'
|
||||
Properties:
|
||||
AssociatePublicIpAddress: false
|
||||
KeyName: !Ref KeyPairName
|
||||
IamInstanceProfile: !Ref HostProfile
|
||||
ImageId: !FindInMap
|
||||
- AWSAMIRegionMap
|
||||
- !Ref 'AWS::Region'
|
||||
- !FindInMap
|
||||
- ArtifactoryProductMap
|
||||
- !Ref ArtifactoryProduct
|
||||
- !Ref AmiId
|
||||
SecurityGroups:
|
||||
- !Ref SecurityGroups
|
||||
InstanceType: !Ref InstanceType
|
||||
BlockDeviceMappings:
|
||||
- DeviceName: /dev/xvda
|
||||
Ebs:
|
||||
VolumeSize: !Ref VolumeSize
|
||||
VolumeType: gp2
|
||||
DeleteOnTermination: true
|
||||
UserData:
|
||||
'Fn::Base64':
|
||||
!Sub |
|
||||
#!/bin/bash -x
|
||||
|
||||
#CFN Functions
|
||||
|
||||
function cfn_fail
|
||||
|
||||
{
|
||||
|
||||
cfn-signal -e 1 --stack ${AWS::StackName} --region ${AWS::Region} --resource ArtifactoryScalingGroup
|
||||
|
||||
exit 1
|
||||
|
||||
}
|
||||
|
||||
function cfn_success
|
||||
|
||||
{
|
||||
|
||||
cfn-signal -e 0 --stack ${AWS::StackName} --region ${AWS::Region} --resource ArtifactoryScalingGroup
|
||||
|
||||
exit 0
|
||||
|
||||
}
|
||||
|
||||
S3URI=${QsS3Uri}
|
||||
|
||||
# yum install -y git
|
||||
|
||||
echo $PATH
|
||||
|
||||
PATH=/opt/aws/bin:$PATH
|
||||
|
||||
echo $PATH
|
||||
echo \'[Cloning: Load QuickStart Common Utils]\'
|
||||
|
||||
# git clone https://github.com/aws-quickstart/quickstart-linux-utilities.git
|
||||
|
||||
source /quickstart-linux-utilities/quickstart-cfn-tools.source
|
||||
|
||||
echo \'[Loaded: Load QuickStart Common Utils]\'
|
||||
|
||||
echo \'[Update Operating System]\'
|
||||
|
||||
qs_update-os || qs_err
|
||||
|
||||
qs_bootstrap_pip || qs_err
|
||||
|
||||
qs_aws-cfn-bootstrap || qs_err
|
||||
|
||||
source ~/venv/bin/activate &> /var/log/userdata.activate_venv.log || qs_err " activate venv failed "
|
||||
|
||||
# CentOS cloned virtual machines do not create a new machine id
|
||||
# https://www.thegeekdiary.com/centos-rhel-7-how-to-change-the-machine-id/
|
||||
rm -f /etc/machine-id
|
||||
systemd-machine-id-setup
|
||||
|
||||
# mkdir ~/.artifactory_ansible
|
||||
|
||||
# aws s3 --region ${AWS::Region} sync s3://${QsS3BucketName}/${QsS3KeyPrefix}cloudInstallerScripts/ ~/.artifactory_ansible/
|
||||
|
||||
cfn-init -v --stack ${AWS::StackName} --resource ArtifactoryLaunchConfiguration --configsets artifactory_install --region ${AWS::Region} || cfn_fail
|
||||
|
||||
export ANSIBLE_VAULT_PASSWORD_FILE="/root/.vault_pass.txt"
|
||||
|
||||
setsebool httpd_can_network_connect 1 -P
|
||||
|
||||
ansible-playbook /root/.jfrog_ami/artifactory.yml || qs_err " ansible execution failed "
|
||||
|
||||
rm -rf /root/.secureit.sh
|
||||
|
||||
[ $(qs_status) == 0 ] && cfn_success || cfn_fail
|
||||
@@ -0,0 +1,259 @@
|
||||
AWSTemplateFormatVersion: "2010-09-09"
|
||||
Description: "Deploys the EC2 Autoscaling, LaunchConfig and Instance for Xray"
|
||||
Parameters:
|
||||
PrivateSubnet1Id:
|
||||
Type: 'AWS::EC2::Subnet::Id'
|
||||
PrivateSubnet2Id:
|
||||
Type: 'AWS::EC2::Subnet::Id'
|
||||
KeyPairName:
|
||||
Type: AWS::EC2::KeyPair::KeyName
|
||||
MinScalingNodes:
|
||||
Type: Number
|
||||
MaxScalingNodes:
|
||||
Type: Number
|
||||
DeploymentTag:
|
||||
Type: String
|
||||
QsS3BucketName:
|
||||
Type: String
|
||||
QsS3KeyPrefix:
|
||||
Type: String
|
||||
QsS3Uri:
|
||||
Type: String
|
||||
DatabaseDriver:
|
||||
Type: String
|
||||
DatabaseType:
|
||||
Type: String
|
||||
DatabaseUser:
|
||||
Type: String
|
||||
DatabasePassword:
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
MasterKey:
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
SecurityGroups:
|
||||
Type: String
|
||||
VolumeSize:
|
||||
Type: Number
|
||||
XrayHostProfile:
|
||||
Type: String
|
||||
XrayHostRole:
|
||||
Type: String
|
||||
XrayInstanceType:
|
||||
Type: String
|
||||
JfrogInternalUrl:
|
||||
Type: String
|
||||
AnsibleVaultPass:
|
||||
Description: Ansiblevault Password to secure the artifactory.yml
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
XrayDatabaseUser:
|
||||
Type: String
|
||||
XrayDatabasePassword:
|
||||
Type: String
|
||||
NoEcho: 'true'
|
||||
XrayMasterDatabaseUrl:
|
||||
Type: String
|
||||
XrayDatabaseUrl:
|
||||
Type: String
|
||||
XrayFirstNode:
|
||||
Description: Runs database scripts if this is the first node
|
||||
Type: String
|
||||
XrayVersion:
|
||||
Type: String
|
||||
XrayAmiId:
|
||||
Type: String
|
||||
# To populate additional mappings use the following with the desired --region
|
||||
# aws --region us-west-2 ec2 describe-images --owners amazon --filters 'Name=name,Values=amzn-ami-hvm-2018.03.0.20181129-x86_64-gp2' 'Name=state,Values=available' --output json | jq -r '.Images | sort_by(.CreationDate) | last(.[]).ImageId'
|
||||
Mappings:
|
||||
AWSAMIRegionMap:
|
||||
us-east-1:
|
||||
"3112": ami-04954176e0e714377
|
||||
us-east-2:
|
||||
"3112": ami-0dde651cd599d64e8
|
||||
us-west-1:
|
||||
"3112": ami-0926fb027c339d991
|
||||
us-west-2:
|
||||
"3112": ami-0e48dd6310c205c33
|
||||
ca-central-1:
|
||||
"3112": ami-056bafb407aa8e445
|
||||
eu-central-1:
|
||||
"3112": ami-05ab6de966f830b8a
|
||||
eu-west-1:
|
||||
"3112": ami-055507b35a350806d
|
||||
eu-west-2:
|
||||
"3112": ami-007c8adf17c3bee79
|
||||
eu-west-3:
|
||||
"3112": ami-033e74f7f2e7b43ae
|
||||
ap-southeast-1:
|
||||
"3112": ami-0114ff3241c5a86a8
|
||||
ap-southeast-2:
|
||||
"3112": ami-0c753f85c64c4169d
|
||||
ap-south-1:
|
||||
"3112": ami-09f40817a8786b93c
|
||||
ap-northeast-1:
|
||||
"3112": ami-00f6ec6314c6ddd27
|
||||
ap-northeast-2:
|
||||
"3112": ami-05a10d14c3289f2b3
|
||||
sa-east-1:
|
||||
"3112": ami-0c2acb2f23c3e6743
|
||||
us-gov-west-1:
|
||||
"3112": ami-0f0208b759ab47734
|
||||
|
||||
Resources:
|
||||
XrayScalingGroup:
|
||||
Type: 'AWS::AutoScaling::AutoScalingGroup'
|
||||
Properties:
|
||||
LaunchConfigurationName: !Ref XrayLaunchConfiguration
|
||||
VPCZoneIdentifier:
|
||||
- !Ref PrivateSubnet1Id
|
||||
- !Ref PrivateSubnet2Id
|
||||
MinSize: !Ref MinScalingNodes
|
||||
MaxSize: !Ref MaxScalingNodes
|
||||
Cooldown: '300'
|
||||
DesiredCapacity: !Ref MinScalingNodes
|
||||
HealthCheckType: EC2
|
||||
HealthCheckGracePeriod: 900
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Ref DeploymentTag
|
||||
PropagateAtLaunch: true
|
||||
CreationPolicy:
|
||||
ResourceSignal:
|
||||
Count: 1
|
||||
Timeout: PT60M
|
||||
XrayLaunchConfiguration:
|
||||
Type: 'AWS::AutoScaling::LaunchConfiguration'
|
||||
Metadata:
|
||||
'AWS::CloudFormation::Authentication':
|
||||
S3AccessCreds:
|
||||
type: S3
|
||||
roleName:
|
||||
- !Ref XrayHostRole
|
||||
buckets:
|
||||
- !Ref QsS3BucketName
|
||||
'AWS::CloudFormation::Init':
|
||||
configSets:
|
||||
xray_install:
|
||||
- "config-xray"
|
||||
config-xray:
|
||||
files:
|
||||
/root/.xray_ami/xray.yml:
|
||||
content: !Sub
|
||||
- |
|
||||
# Base install for Xray
|
||||
- import_playbook: site-xray.yml
|
||||
vars:
|
||||
jfrog_url: ${JfrogInternalUrl}
|
||||
master_key: ${MasterKey}
|
||||
join_key: ${MasterKey}
|
||||
db_type: ${DatabaseType}
|
||||
db_driver: ${DatabaseDriver}
|
||||
db_url: postgres://${XrayDatabaseUrl}
|
||||
db_user: ${XrayDatabaseUser}
|
||||
db_password: ${XrayDatabasePassword}
|
||||
xray_version: ${XrayVersion}
|
||||
- {
|
||||
product: Xray
|
||||
}
|
||||
mode: "0400"
|
||||
/root/.vault_pass.txt:
|
||||
content: !Sub |
|
||||
${AnsibleVaultPass}
|
||||
mode: "0400"
|
||||
Properties:
|
||||
AssociatePublicIpAddress: false
|
||||
KeyName: !Ref KeyPairName
|
||||
IamInstanceProfile: !Ref XrayHostProfile
|
||||
ImageId: !FindInMap
|
||||
- AWSAMIRegionMap
|
||||
- !Ref 'AWS::Region'
|
||||
- !Ref XrayAmiId
|
||||
SecurityGroups:
|
||||
- !Ref SecurityGroups
|
||||
InstanceType: !Ref XrayInstanceType
|
||||
BlockDeviceMappings:
|
||||
- DeviceName: /dev/xvda
|
||||
Ebs:
|
||||
VolumeSize: !Ref VolumeSize
|
||||
VolumeType: gp2
|
||||
DeleteOnTermination: true
|
||||
UserData:
|
||||
'Fn::Base64':
|
||||
!Sub |
|
||||
#!/bin/bash -x
|
||||
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
|
||||
|
||||
#CFN Functions
|
||||
|
||||
function cfn_fail
|
||||
|
||||
{
|
||||
|
||||
cfn-signal -e 1 --stack ${AWS::StackName} --region ${AWS::Region} --resource XrayScalingGroup
|
||||
|
||||
exit 1
|
||||
|
||||
}
|
||||
|
||||
function cfn_success
|
||||
|
||||
{
|
||||
|
||||
cfn-signal -e 0 --stack ${AWS::StackName} --region ${AWS::Region} --resource XrayScalingGroup
|
||||
|
||||
exit 0
|
||||
|
||||
}
|
||||
|
||||
S3URI=${QsS3Uri}
|
||||
|
||||
# yum install -y git
|
||||
|
||||
echo $PATH
|
||||
|
||||
PATH=/opt/aws/bin:$PATH
|
||||
|
||||
echo $PATH
|
||||
echo \'[Cloning: Load QuickStart Common Utils]\'
|
||||
|
||||
# git clone https://github.com/aws-quickstart/quickstart-linux-utilities.git
|
||||
|
||||
source /quickstart-linux-utilities/quickstart-cfn-tools.source
|
||||
|
||||
echo \'[Loaded: Load QuickStart Common Utils]\'
|
||||
|
||||
echo \'[Update Operating System]\'
|
||||
|
||||
qs_update-os || qs_err
|
||||
|
||||
qs_bootstrap_pip || qs_err
|
||||
|
||||
qs_aws-cfn-bootstrap || qs_err
|
||||
|
||||
source ~/venv/bin/activate &> /var/log/userdata.activate_venv.log || qs_err " activate venv failed "
|
||||
|
||||
# mkdir ~/.xray_ansible
|
||||
|
||||
# aws s3 --region ${AWS::Region} sync s3://${QsS3BucketName}/${QsS3KeyPrefix}cloudInstallerScripts/ ~/.xray_ansible/
|
||||
|
||||
cfn-init -v --stack ${AWS::StackName} --resource XrayLaunchConfiguration --configsets xray_install --region ${AWS::Region} || cfn_fail
|
||||
|
||||
# CentOS cloned virtual machines do not create a new machine id
|
||||
# https://www.thegeekdiary.com/centos-rhel-7-how-to-change-the-machine-id/
|
||||
rm -f /etc/machine-id
|
||||
systemd-machine-id-setup
|
||||
|
||||
if "true" == "${XrayFirstNode}"
|
||||
then
|
||||
psql postgresql://${DatabaseUser}:${DatabasePassword}@${XrayMasterDatabaseUrl} -c "CREATE USER ${XrayDatabaseUser} WITH PASSWORD '${XrayDatabasePassword}'" &>> /var/log/userdata.xray_database.log;
|
||||
psql postgresql://${DatabaseUser}:${DatabasePassword}@${XrayMasterDatabaseUrl} -c "grant ${XrayDatabaseUser} to ${DatabaseUser}" &>> /var/log/userdata.xray_database.log;
|
||||
psql postgresql://${DatabaseUser}:${DatabasePassword}@${XrayMasterDatabaseUrl} -c "CREATE DATABASE xraydb WITH OWNER=${XrayDatabaseUser} ENCODING='UTF8'" &>> /var/log/userdata.xray_database.log;
|
||||
psql postgresql://${DatabaseUser}:${DatabasePassword}@${XrayMasterDatabaseUrl} -c "GRANT ALL PRIVILEGES ON DATABASE xraydb TO ${XrayDatabaseUser}" &>> /var/log/userdata.xray_database.log;
|
||||
fi
|
||||
|
||||
ansible-playbook /root/.xray_ami/xray.yml || qs_err " ansible execution failed "
|
||||
|
||||
$(qs_status) &> /var/log/qs_status.log
|
||||
cfn_success &> /var/log/cfn_success.log
|
||||
[ $(qs_status) == 0 ] && cfn_success || cfn_fail
|
||||
Reference in New Issue
Block a user