ciinabox-ecs 0.2.14 → 0.2.15.alpha.1565746583

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04febb0149037a1e97b7915b6ff48a9b938e7957f83a002a9619a4070ab6884b
4
- data.tar.gz: ebac557858a0a4cb4af4d35671ba9e0d338a82012a7f1152ce32758dc032eab6
3
+ metadata.gz: e06414541dbf636fe3ec840412afed06d29bd30c9181802bdc92352f54c07798
4
+ data.tar.gz: 7b9373b3f602ff49dd8a20b5cf34c2031f71ec5ad84629e4948f78b878e9df06
5
5
  SHA512:
6
- metadata.gz: a9d48c5c4245060688d5b9ed3a735bf192f482a2fa8372393f2484e29a6d830dd08741b109f17b5eb66681f4664a7f26ff1468c621f0d5586b3ba2d1fd38c222
7
- data.tar.gz: 1ab590f337848330cb17e520a6983d74b1faad2309d25b441003e9c4d867058d44624ceb27a88c81f82d468ea0c17b9eb218c5a01671a1e76435e5184e02c22c
6
+ metadata.gz: f013fc69dda31b22ea86febd543b285b82850fcee7cd6f9a12d219791a69b3758cb80614fedbb4ebbe6b511317000e836008ef82e28dff5ec119b466466118e8
7
+ data.tar.gz: 035a2b8da6d07da56c37cc31eede7247ea01f750b500832d1c21b61673a79aaf62929c462cf05da163cbbdee3994284cf97f0efc8710dbbf03c8388ecca32e44
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)))
@@ -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
+
@@ -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
  ]
@@ -174,6 +187,7 @@ CloudFormation {
174
187
  "echo ECS_ENABLE_TASK_CPU_MEM_LIMIT=false >> /etc/ecs/ecs.config\n",
175
188
  "INSTANCE_ID=$(echo `/opt/aws/bin/ec2-metadata -i | cut -f2 -d:`)\n",
176
189
  "PRIVATE_IP=`/opt/aws/bin/ec2-metadata -o | cut -f2 -d: | cut -f2 -d-`\n",
190
+ "hostname ciinabox-ecs-xx\n",
177
191
  "#{proxy_config_userdata}",
178
192
  "yum install -y python-pip\n",
179
193
  "python-pip install --upgrade awscli\n",
@@ -185,14 +199,15 @@ CloudFormation {
185
199
  "mkdir -p /data\n",
186
200
  "mount /data && echo \"ECS Data volume already formatted\" || mkfs -t ext4 /dev/xvdf\n",
187
201
  "mount -a && echo 'mounting ECS Data volume' || echo 'failed to mount ECS Data volume'\n",
188
- "#{user_data_init_devices}",
189
202
  "export BOOTSTRAP=/data/bootstrap \n",
190
203
  "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
204
  "ifconfig eth0 mtu 1500\n",
192
205
  "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
206
  "yum install -y /tmp/amazon-ssm-agent.rpm\n",
207
+ *enable_cloudwatch_agent_userdata,
194
208
  "stop ecs\n",
195
209
  "service docker stop\n",
210
+ "#{user_data_init_devices}",
196
211
  "service docker start\n",
197
212
  "start ecs\n",
198
213
  "echo 'done!!!!'\n"
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.15.alpha.1565746583
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: 2019-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -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.0.4
171
172
  signing_key:
172
173
  specification_version: 4
173
174
  summary: Manage ciinabox on Aws Ecs