ciinabox-ecs 0.3.0.alpha.1612412532 → 0.3.1.alpha.1622698898

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0c757f7bd31538bddd7834491413db7d5748ca7944e1796f6779a1806abd16c
4
- data.tar.gz: bd1b8aea5d676333fc569fa47dc6160a42878a8b479ef1311d34db106e253006
3
+ metadata.gz: 0abdb55ba421e1ca32b4863da34398e6b301cb1b8aa26c804f434603e540a18f
4
+ data.tar.gz: 19524b3f753dcea4077f0ac65f6af8848e711d410407afcee38776d989900c69
5
5
  SHA512:
6
- metadata.gz: 44312cfb402dd20e0e001c10d84f479c164471fb4cc4bd9de7ffcc8592e97bb3feaae252fdd42b69f33dd132d88db54e0a3347f1e3e4e7700a7c86ed6f4d10d1
7
- data.tar.gz: 5d97aee7e73853e9825f2717e78d6beb5ad0a890b97e2ffd93e002df6074c869bcff57dc633b934442a2b7d78533fdadf672a10ee9ec0691f87ff1972f0c9ef8
6
+ metadata.gz: 31b14e819855f75aa59569765c74777355dc409213c44a8dc85aba1148037df2d56b618ce90b72700092279d41a9afe6bdaf554e7af93115b46e81b54d736153
7
+ data.tar.gz: 72228109787271ddc4961c185af54dfce7810263b4931c9417641424982de4f562eeda8c099f80cbdd9997630e8b9aa4487b51f496765d2c23870c3e30f5cc3e
@@ -190,6 +190,8 @@ CloudFormation {
190
190
  "echo ECS_ENABLE_TASK_CPU_MEM_LIMIT=false >> /etc/ecs/ecs.config\n",
191
191
  "INSTANCE_ID=$(echo `/opt/aws/bin/ec2-metadata -i | cut -f2 -d:`)\n",
192
192
  "PRIVATE_IP=`/opt/aws/bin/ec2-metadata -o | cut -f2 -d: | cut -f2 -d-`\n",
193
+ "echo 'vm.max_map_count=262144' >> /etc/sysctl.conf\n",
194
+ "sysctl -p\n",
193
195
  "hostname ciinabox-ecs-xx\n",
194
196
  "#{proxy_config_userdata}",
195
197
  "yum install -y python-pip\n",
@@ -1,6 +1,7 @@
1
1
  require 'cfndsl'
2
2
  require 'securerandom'
3
3
  require 'deep_merge'
4
+ require_relative '../../ext/helper'
4
5
 
5
6
  # default values
6
7
  shared_envs = {
@@ -1,4 +1,5 @@
1
1
  require 'cfndsl'
2
+ require_relative '../../ext/helper'
2
3
 
3
4
  if !defined? timezone
4
5
  timezone = 'GMT'
@@ -0,0 +1,166 @@
1
+ require 'cfndsl'
2
+ require_relative '../../ext/helper'
3
+
4
+ if !defined? timezone
5
+ timezone = 'GMT'
6
+ end
7
+
8
+ image = 'sonarqube:lts'
9
+ java_opts = ''
10
+ memory = 2048
11
+ cpu = 300
12
+ container_port = 0
13
+ service = lookup_service('sonarqube', services)
14
+ if service
15
+ java_opts = service['JAVA_OPTS'] || ''
16
+ image = service['ContainerImage'] || image
17
+ memory = service['ContainerMemory'] || 2048
18
+ cpu = service['ContainerCPU'] || 300
19
+ container_port = service['InstancePort'] || 0
20
+ postgres_url_param_arn = service['PostgresUrlParamArn'] || nil
21
+ postgres_user_param_arn = service['PostgresUserParamArn'] || nil
22
+ postgres_password_param_arn = service['PostgresPasswordParamArn'] || nil
23
+ end
24
+
25
+ CloudFormation {
26
+
27
+ AWSTemplateFormatVersion "2010-09-09"
28
+ Description "ciinabox - ECS Service SonarQube v#{ciinabox_version}"
29
+
30
+ Parameter("ECSCluster"){ Type 'String' }
31
+ Parameter("ECSRole"){ Type 'String' }
32
+ Parameter("ServiceELB"){ Type 'String' }
33
+
34
+ Resource('SonarQubeTask') {
35
+ Type "AWS::ECS::TaskDefinition"
36
+ Property('ExecutionRoleArn', FnGetAtt('TaskExecutionRole', 'Arn'))
37
+ sonarqube_container_def = {
38
+ Name: 'sonarqube',
39
+ MemoryReservation: memory,
40
+ Cpu: cpu,
41
+ Image: image,
42
+ Environment: [
43
+ {
44
+ Name: 'VIRTUAL_HOST',
45
+ Value: "sonar.#{dns_domain}"
46
+ },
47
+ {
48
+ Name: 'VIRTUAL_PORT',
49
+ Value: '9000'
50
+ }
51
+ ],
52
+ Ulimits: [
53
+ {
54
+ Name: "nofile",
55
+ SoftLimit: 65536,
56
+ HardLimit: 65536
57
+ }
58
+ ],
59
+ Essential: true,
60
+ MountPoints: [
61
+ {
62
+ ContainerPath: '/etc/localtime',
63
+ SourceVolume: 'timezone',
64
+ ReadOnly: true
65
+ },
66
+ {
67
+ ContainerPath: '/opt/sonarqube/extensions',
68
+ SourceVolume: 'sonarqube_extensions',
69
+ ReadOnly: false
70
+ },
71
+ {
72
+ ContainerPath: '/opt/sonarqube/logs',
73
+ SourceVolume: 'sonarqube_logs',
74
+ ReadOnly: false
75
+ },
76
+ {
77
+ ContainerPath: '/opt/sonarqube/data',
78
+ SourceVolume: 'sonarqube_data',
79
+ ReadOnly: false
80
+ }
81
+ ]
82
+ }
83
+ if postgres_user_param_arn then
84
+ sonarqube_container_def[:Secrets] = [
85
+ {
86
+ Name: 'SONARQUBE_JDBC_URL',
87
+ ValueFrom: postgres_url_param_arn
88
+ },
89
+ {
90
+ Name: 'SONARQUBE_JDBC_USERNAME',
91
+ ValueFrom: postgres_user_param_arn
92
+ },
93
+ {
94
+ Name: 'SONARQUBE_JDBC_PASSWORD',
95
+ ValueFrom: postgres_password_param_arn
96
+ }
97
+ ]
98
+ end
99
+ Property('ContainerDefinitions', [sonarqube_container_def])
100
+ Property('Volumes', [
101
+ {
102
+ Name: 'timezone',
103
+ Host: {
104
+ SourcePath: '/etc/localtime'
105
+ }
106
+ },
107
+ {
108
+ Name: 'sonarqube_conf',
109
+ Host: {
110
+ SourcePath: '/data/sonarqube/conf'
111
+ }
112
+ },
113
+ {
114
+ Name: 'sonarqube_extensions',
115
+ Host: {
116
+ SourcePath: '/data/sonarqube/extensions'
117
+ }
118
+ },
119
+ {
120
+ Name: 'sonarqube_logs',
121
+ Host: {
122
+ SourcePath: '/data/sonarqube/logs'
123
+ }
124
+ },
125
+ {
126
+ Name: 'sonarqube_data',
127
+ Host: {
128
+ SourcePath: '/data/sonarqube/data'
129
+ }
130
+ }
131
+ ])
132
+ }
133
+
134
+ Resource('TaskExecutionRole') {
135
+ Type 'AWS::IAM::Role'
136
+ Property('AssumeRolePolicyDocument', {
137
+ "Version": "2012-10-17",
138
+ "Statement": [
139
+ {
140
+ "Effect": "Allow",
141
+ "Principal": {
142
+ "Service": "ecs-tasks.amazonaws.com"
143
+ },
144
+ "Action": "sts:AssumeRole"
145
+ }
146
+ ]
147
+ })
148
+ Property('ManagedPolicyArns', [
149
+ 'arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess',
150
+ 'arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy'
151
+ ])
152
+ }
153
+
154
+ Resource('SonarQubeService') {
155
+ Type 'AWS::ECS::Service'
156
+ Property('Cluster', Ref('ECSCluster'))
157
+ Property('DesiredCount', 1)
158
+ Property('TaskDefinition', Ref('SonarQubeTask'))
159
+ Property('Role', Ref('ECSRole')) unless container_port == 0
160
+ Property('LoadBalancers', [
161
+ { ContainerName: 'sonarqube', ContainerPort: container_port, LoadBalancerName: Ref('ServiceELB') }
162
+ ]) unless container_port == 0
163
+
164
+ }
165
+
166
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ciinabox-ecs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.alpha.1612412532
4
+ version: 0.3.1.alpha.1622698898
5
5
  platform: ruby
6
6
  authors:
7
7
  - Base2Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-04 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -147,6 +147,7 @@ files:
147
147
  - templates/services/icinga2.rb
148
148
  - templates/services/jenkins.rb
149
149
  - templates/services/nexus.rb
150
+ - templates/services/sonarqube.rb
150
151
  - templates/vpc.rb
151
152
  - templates/vpn.rb
152
153
  homepage: https://github.com/base2Services/ciinabox-ecs
@@ -168,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
169
  - !ruby/object:Gem::Version
169
170
  version: 1.3.1
170
171
  requirements: []
171
- rubygems_version: 3.2.8
172
+ rubygems_version: 3.2.19
172
173
  signing_key:
173
174
  specification_version: 4
174
175
  summary: Manage ciinabox on Aws Ecs