ciinabox-ecs 0.2.14 → 0.2.17.alpha.1612322070

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: 04febb0149037a1e97b7915b6ff48a9b938e7957f83a002a9619a4070ab6884b
4
- data.tar.gz: ebac557858a0a4cb4af4d35671ba9e0d338a82012a7f1152ce32758dc032eab6
3
+ metadata.gz: 950c9d5e0c1f37277b1c365f72315fb1d0807b8cbde7db116517569f850cc196
4
+ data.tar.gz: 6ca4a35410b7e9a553b9bddedaaf6805b681403023b7ac106e7bca68a43f2f2b
5
5
  SHA512:
6
- metadata.gz: a9d48c5c4245060688d5b9ed3a735bf192f482a2fa8372393f2484e29a6d830dd08741b109f17b5eb66681f4664a7f26ff1468c621f0d5586b3ba2d1fd38c222
7
- data.tar.gz: 1ab590f337848330cb17e520a6983d74b1faad2309d25b441003e9c4d867058d44624ceb27a88c81f82d468ea0c17b9eb218c5a01671a1e76435e5184e02c22c
6
+ metadata.gz: d35fa68e01405d1f5ca917a8a6f7b13138a924305c1e2aa6d3b71215d6bd66bb39deb3d68660644b0fbda3a3f8f271d738a87c997476c5d906b4a2424188e783
7
+ data.tar.gz: 55da6021f706b50bd0c68ef6a6aa506eddfab2b5826a83ef1e08a84b0aea3ee9c4532303643f2bda52f709555c9a38d2b04ba65b877ddb0407c5f0c87f234889
data/Rakefile CHANGED
@@ -40,6 +40,8 @@ namespace :ciinabox do
40
40
  config = default_params
41
41
  end
42
42
 
43
+ config.merge!('current_dir'=>current_dir)
44
+
43
45
  Dir["#{ciinaboxes_dir}/#{ciinabox_name}/config/*.yml"].each {|config_file|
44
46
  if not config_file.include?('params.yml')
45
47
  config = config.merge(YAML.load(File.read(config_file)))
@@ -57,6 +57,9 @@ ciinabox_iam_role_name: <%= ciinabox_iam_role_name %>
57
57
  #set the size of the ecs data volume -- NOTE: would take a new volume - i.e. change volume name
58
58
  #ecs_data_volume_size: 250
59
59
 
60
+ #set the spot price for the ECS instance -- NOTE: The default value below is the on-demand price for a t2.large
61
+ #ecs_instance_spot_price: 0.1168
62
+
60
63
  #optional ciinabox name if you need more than one or you want a different name
61
64
  #stack_name: ciinabox-tools
62
65
 
@@ -174,6 +174,8 @@ data_volume_retain_daily_backups: 7
174
174
  data_volume_retain_weekly_backups: 4
175
175
  data_volume_reatin_monthly_backups: 12
176
176
 
177
+ # Install the CloudWatch agent and configure it to push metrics (disk, memory)
178
+ enable_cloudwatch_agent: false
177
179
 
178
180
  ecs_iam_role_permissions_default:
179
181
  - name: assume-role
@@ -0,0 +1,55 @@
1
+ {
2
+ "agent": {
3
+ "metrics_collection_interval": 60,
4
+ "logfile": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log",
5
+ "debug": false
6
+ },
7
+ "metrics": {
8
+ "metrics_collected": {
9
+ "disk": {
10
+ "resources": [
11
+ "/",
12
+ "/data",
13
+ "/var/lib/docker"
14
+ ],
15
+ "measurement": [
16
+ {
17
+ "name": "used_percent",
18
+ "rename": "DiskSpaceUsedPercent"
19
+ },
20
+ {
21
+ "name": "inodes_used",
22
+ "rename": "INodesUsedCount"
23
+ },
24
+ {
25
+ "name": "inodes_total",
26
+ "rename": "INodesTotalCount"
27
+ }
28
+ ]
29
+ },
30
+ "mem": {
31
+ "measurement": [
32
+ {
33
+ "name": "used_percent",
34
+ "rename": "MemoryUsedPercent"
35
+ }
36
+ ]
37
+ }
38
+ }
39
+ },
40
+ "logs": {
41
+ "logs_collected": {
42
+ "files": {
43
+ "collect_list": [
44
+ {
45
+ "file_path": "/var/log/cloud-init-output.log",
46
+ "log_group_name": "/aws/cloudwatch-agent/ciinabox-ecs-xx",
47
+ "log_stream_name": "cloud-init-output.log-{instance_id}",
48
+ "timezone": "UTC"
49
+ }
50
+ ]
51
+ }
52
+ }
53
+ }
54
+ }
55
+
@@ -5,7 +5,7 @@ cd $DIR/..
5
5
  rm -rf lib
6
6
 
7
7
  function pipinstall () {
8
- if [ $(which pip) == '' ]; then
8
+ if [[ $(which pip) == '' ]]; then
9
9
  echo "ERROR! No pip installed. Try installing either python3 pip or docker"
10
10
  exit -1
11
11
  fi
@@ -13,7 +13,7 @@ function pipinstall () {
13
13
  pip install aws-acm-cert-validator==0.1.11 -t lib
14
14
  }
15
15
 
16
- if [ $(which docker) == '' ]; then
16
+ if [[ $(which docker) == '' ]]; then
17
17
  pipinstall
18
18
  else
19
19
  docker run --rm -v $DIR/..:/dst -w /dst -u $UID python:3.6-alpine pip install aws-acm-cert-validator==0.1.11 -t lib
@@ -140,6 +140,19 @@ CloudFormation {
140
140
  "echo \"#{proxy_config}\" >> /opt/proxy/proxy_config.conf\n"
141
141
  end
142
142
 
143
+ enable_cloudwatch_agent_userdata = []
144
+ if defined? enable_cloudwatch_agent and enable_cloudwatch_agent
145
+ enable_cloudwatch_agent_userdata = [
146
+ "mkdir -p /opt/aws/amazon-cloudwatch-agent/etc/\n",
147
+ "echo '#{File.open("#{config['current_dir']}/config/files/amazon-cloudwatch-agent.json").read()}' > /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json\n",
148
+ "wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm\n",
149
+ "echo 'Installing CloudWatch agent...'\n",
150
+ "rpm -U amazon-cloudwatch-agent.rpm\n",
151
+ "/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json -s\n"]
152
+ end
153
+
154
+
155
+
143
156
  ecs_allow_sg_ingress = [
144
157
  { IpProtocol: 'tcp', FromPort: '32768', ToPort: '65535', CidrIp: FnJoin( "", [ FnFindInMap('EnvironmentType','ciinabox','NetworkPrefix'),".", FnFindInMap('EnvironmentType','ciinabox','StackOctet'), ".0.0/",FnFindInMap('EnvironmentType','ciinabox','StackMask') ] ) },
145
158
  ]
@@ -168,31 +181,35 @@ CloudFormation {
168
181
  if not ecs_block_device_mapping.empty?
169
182
  Property("BlockDeviceMappings", ecs_block_device_mapping)
170
183
  end
184
+ if defined? ecs_instance_spot_price
185
+ SpotPrice ecs_instance_spot_price
186
+ end
171
187
  UserData FnBase64(FnJoin("", [
172
188
  "#!/bin/bash\n",
173
189
  "echo ECS_CLUSTER=", Ref('ECSCluster'), " >> /etc/ecs/ecs.config\n",
174
190
  "echo ECS_ENABLE_TASK_CPU_MEM_LIMIT=false >> /etc/ecs/ecs.config\n",
175
191
  "INSTANCE_ID=$(echo `/opt/aws/bin/ec2-metadata -i | cut -f2 -d:`)\n",
176
192
  "PRIVATE_IP=`/opt/aws/bin/ec2-metadata -o | cut -f2 -d: | cut -f2 -d-`\n",
193
+ "hostname ciinabox-ecs-xx\n",
177
194
  "#{proxy_config_userdata}",
178
195
  "yum install -y python-pip\n",
179
- "python-pip install --upgrade awscli\n",
180
- "/usr/local/bin/aws --region ", Ref("AWS::Region"), " ec2 attach-volume --volume-id ", Ref(volume_name), " --instance-id ${INSTANCE_ID} --device /dev/sdf\n",
196
+ "aws --region ", Ref("AWS::Region"), " ec2 attach-volume --volume-id ", Ref(volume_name), " --instance-id ${INSTANCE_ID} --device /dev/sdf\n",
181
197
  "echo 'waiting for ECS Data volume to attach' && sleep 20\n",
182
- "/usr/local/bin/aws --region ", Ref("AWS::Region"), " ec2 attach-network-interface --network-interface-id ", Ref('ECSENI'), " --instance-id ${INSTANCE_ID} --device-index 1\n",
198
+ "aws --region ", Ref("AWS::Region"), " ec2 attach-network-interface --network-interface-id ", Ref('ECSENI'), " --instance-id ${INSTANCE_ID} --device-index 1\n",
183
199
  "echo 'waiting for ECS ENI to attach' && sleep 20\n",
184
200
  "echo '/dev/xvdf /data ext4 defaults,nofail 0 2' >> /etc/fstab\n",
185
201
  "mkdir -p /data\n",
186
202
  "mount /data && echo \"ECS Data volume already formatted\" || mkfs -t ext4 /dev/xvdf\n",
187
203
  "mount -a && echo 'mounting ECS Data volume' || echo 'failed to mount ECS Data volume'\n",
188
- "#{user_data_init_devices}",
189
204
  "export BOOTSTRAP=/data/bootstrap \n",
190
205
  "if [ ! -e \"$BOOTSTRAP\" ]; then echo \"boostrapping\"; chmod -R 777 /data; mkdir -p /data/jenkins; chown -R 1000:1000 /data/jenkins; touch $BOOTSTRAP; fi \n",
191
206
  "ifconfig eth0 mtu 1500\n",
192
207
  "curl https://amazon-ssm-", Ref("AWS::Region"), ".s3.amazonaws.com/latest/linux_amd64/amazon-ssm-agent.rpm -o /tmp/amazon-ssm-agent.rpm\n",
193
208
  "yum install -y /tmp/amazon-ssm-agent.rpm\n",
209
+ *enable_cloudwatch_agent_userdata,
194
210
  "stop ecs\n",
195
211
  "service docker stop\n",
212
+ "#{user_data_init_devices}",
196
213
  "service docker start\n",
197
214
  "start ecs\n",
198
215
  "echo 'done!!!!'\n"
@@ -18,7 +18,7 @@ if not defined? ciinabox_repo
18
18
  ciinabox_repo=''
19
19
  end
20
20
 
21
- image = "#{ciinabox_repo}base2/ciinabox-jenkins:lts"
21
+ image = "#{ciinabox_repo}ghcr.io/base2services/ciinabox-jenkins:lts"
22
22
 
23
23
  jenkins_java_opts = ''
24
24
  memory = 2048
@@ -110,7 +110,7 @@ if defined? include_diind_slave and include_diind_slave
110
110
  dind_definition = {
111
111
  Name: 'jenkins-docker-dind-slave',
112
112
  Memory: slave_memory,
113
- Image: "#{ciinabox_repo}base2/ciinabox-docker-slave:#{docker_slave_version}",
113
+ Image: "#{ciinabox_repo}ghcr.io/base2services/ciinabox-docker-slave:#{docker_slave_version}",
114
114
  Environment: [{Name: 'RUN_DOCKER_IN_DOCKER', Value: 1}],
115
115
  Essential: false,
116
116
  Privileged: true
@@ -141,7 +141,7 @@ if defined? include_dood_slave and include_dood_slave
141
141
  dood_definition = {
142
142
  Name: 'jenkins-docker-dood-slave',
143
143
  Memory: slave_memory,
144
- Image: "#{ciinabox_repo}base2/ciinabox-docker-slave:#{docker_slave_version}",
144
+ Image: "#{ciinabox_repo}ghcr.io/base2services/ciinabox-docker-slave:#{docker_slave_version}",
145
145
  Environment: [{Name: 'RUN_DOCKER_IN_DOCKER', Value: 0}],
146
146
  MountPoints: [
147
147
  {
@@ -5,7 +5,7 @@ if !defined? timezone
5
5
  timezone = 'GMT'
6
6
  end
7
7
 
8
- image = 'base2/ciinabox-nexus'
8
+ image = 'ghcr.io/base2services/ciinabox-nexus'
9
9
  container_path = '/sonatype-work'
10
10
  java_opts = ''
11
11
  memory = 1024
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.2.14
4
+ version: 0.2.17.alpha.1612322070
5
5
  platform: ruby
6
6
  authors:
7
7
  - Base2Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-19 00:00:00.000000000 Z
11
+ date: 2021-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: cfndsl
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '0.16'
61
+ version: 0.17.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: '0.16'
68
+ version: 0.17.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cfn_manage
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -127,6 +127,7 @@ files:
127
127
  - config/default_params.yml
128
128
  - config/default_params.yml.example
129
129
  - config/default_services.yml
130
+ - config/files/amazon-cloudwatch-agent.json
130
131
  - ext/common_helper.rb
131
132
  - ext/config/managed_policies.yml
132
133
  - ext/helper.rb
@@ -163,11 +164,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
164
  version: '0'
164
165
  required_rubygems_version: !ruby/object:Gem::Requirement
165
166
  requirements:
166
- - - ">="
167
+ - - ">"
167
168
  - !ruby/object:Gem::Version
168
- version: '0'
169
+ version: 1.3.1
169
170
  requirements: []
170
- rubygems_version: 3.0.0
171
+ rubygems_version: 3.2.8
171
172
  signing_key:
172
173
  specification_version: 4
173
174
  summary: Manage ciinabox on Aws Ecs