質問編集履歴
1
タスクの起動順序とタスク定義のJSONを追記いたしました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,6 +17,321 @@
|
|
17
17
|
|
18
18
|

|
19
19
|
|
20
|
+
#### 起動順序
|
21
|
+
|
22
|
+
1. MariaDB
|
23
|
+
2. Laravel
|
24
|
+
|
25
|
+
MariaDBがHEALTHを確認した後、Laravelが起動
|
26
|
+
|
27
|
+
```
|
28
|
+
mysqladmin ping -u root -ppassword -h 127.0.0.1
|
29
|
+
```
|
30
|
+
|
31
|
+
この後、Laravelコンテナ起動
|
32
|
+
↓ 初期スクリプト
|
33
|
+
|
34
|
+
```sh
|
35
|
+
#!/usr/bin/env bash
|
36
|
+
php artisan migrate --force
|
37
|
+
chmod -R 777 bootstrap
|
38
|
+
chmod -R 777 storage
|
39
|
+
/usr/sbin/apache2ctl -D FOREGROUND
|
40
|
+
```
|
41
|
+
|
42
|
+
といった流れでタスクが起動していきます。
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
#### タスク定義
|
47
|
+
|
48
|
+
```json
|
49
|
+
{
|
50
|
+
"ipcMode": null,
|
51
|
+
"executionRoleArn": "arn:aws:iam::****:role/ecsTaskExecutionRole",
|
52
|
+
"containerDefinitions": [
|
53
|
+
{
|
54
|
+
"dnsSearchDomains": null,
|
55
|
+
"environmentFiles": null,
|
56
|
+
"logConfiguration": {
|
57
|
+
"logDriver": "awslogs",
|
58
|
+
"secretOptions": null,
|
59
|
+
"options": {
|
60
|
+
"awslogs-group": "/ecs/simplememo",
|
61
|
+
"awslogs-region": "ap-northeast-1",
|
62
|
+
"awslogs-stream-prefix": "ecs"
|
63
|
+
}
|
64
|
+
},
|
65
|
+
"entryPoint": null,
|
66
|
+
"portMappings": [
|
67
|
+
{
|
68
|
+
"hostPort": 80,
|
69
|
+
"protocol": "tcp",
|
70
|
+
"containerPort": 80
|
71
|
+
}
|
72
|
+
],
|
73
|
+
"command": null,
|
74
|
+
"linuxParameters": null,
|
75
|
+
"cpu": 0,
|
76
|
+
"environment": [],
|
77
|
+
"resourceRequirements": null,
|
78
|
+
"ulimits": null,
|
79
|
+
"dnsServers": null,
|
80
|
+
"mountPoints": [],
|
81
|
+
"workingDirectory": null,
|
82
|
+
"secrets": null,
|
83
|
+
"dockerSecurityOptions": null,
|
84
|
+
"memory": null,
|
85
|
+
"memoryReservation": 128,
|
86
|
+
"volumesFrom": [],
|
87
|
+
"stopTimeout": null,
|
88
|
+
"image": "****.dkr.ecr.ap-northeast-1.amazonaws.com/laravelecs:latest",
|
89
|
+
"startTimeout": null,
|
90
|
+
"firelensConfiguration": null,
|
91
|
+
"dependsOn": [
|
92
|
+
{
|
93
|
+
"containerName": "mariadb",
|
94
|
+
"condition": "HEALTHY"
|
95
|
+
}
|
96
|
+
],
|
97
|
+
"disableNetworking": null,
|
98
|
+
"interactive": null,
|
99
|
+
"healthCheck": null,
|
100
|
+
"essential": true,
|
101
|
+
"links": null,
|
102
|
+
"hostname": null,
|
103
|
+
"extraHosts": null,
|
104
|
+
"pseudoTerminal": null,
|
105
|
+
"user": null,
|
106
|
+
"readonlyRootFilesystem": null,
|
107
|
+
"dockerLabels": null,
|
108
|
+
"systemControls": null,
|
109
|
+
"privileged": null,
|
110
|
+
"name": "laravel"
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"dnsSearchDomains": null,
|
114
|
+
"environmentFiles": null,
|
115
|
+
"logConfiguration": {
|
116
|
+
"logDriver": "awslogs",
|
117
|
+
"secretOptions": null,
|
118
|
+
"options": {
|
119
|
+
"awslogs-group": "/ecs/simplememo",
|
120
|
+
"awslogs-region": "ap-northeast-1",
|
121
|
+
"awslogs-stream-prefix": "ecs"
|
122
|
+
}
|
123
|
+
},
|
124
|
+
"entryPoint": null,
|
125
|
+
"portMappings": [
|
126
|
+
{
|
127
|
+
"hostPort": 3306,
|
128
|
+
"protocol": "tcp",
|
129
|
+
"containerPort": 3306
|
130
|
+
}
|
131
|
+
],
|
132
|
+
"command": null,
|
133
|
+
"linuxParameters": null,
|
134
|
+
"cpu": 0,
|
135
|
+
"environment": [
|
136
|
+
{
|
137
|
+
"name": "MYSQL_DATABASE",
|
138
|
+
"value": "simplememo"
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"name": "MYSQL_PASSWORD",
|
142
|
+
"value": "simplememodbuser"
|
143
|
+
},
|
144
|
+
{
|
145
|
+
"name": "MYSQL_ROOT_PASSWORD",
|
146
|
+
"value": "password"
|
147
|
+
},
|
148
|
+
{
|
149
|
+
"name": "MYSQL_USER",
|
150
|
+
"value": "dbuser"
|
151
|
+
}
|
152
|
+
],
|
153
|
+
"resourceRequirements": null,
|
154
|
+
"ulimits": null,
|
155
|
+
"dnsServers": null,
|
156
|
+
"mountPoints": [
|
157
|
+
{
|
158
|
+
"readOnly": null,
|
159
|
+
"containerPath": "/var/lib/mysql/simplememo",
|
160
|
+
"sourceVolume": "efs"
|
161
|
+
}
|
162
|
+
],
|
163
|
+
"workingDirectory": null,
|
164
|
+
"secrets": null,
|
165
|
+
"dockerSecurityOptions": null,
|
166
|
+
"memory": null,
|
167
|
+
"memoryReservation": 256,
|
168
|
+
"volumesFrom": [],
|
169
|
+
"stopTimeout": null,
|
170
|
+
"image": "******.dkr.ecr.ap-northeast-1.amazonaws.com/mariadbecs:latest",
|
171
|
+
"startTimeout": null,
|
172
|
+
"firelensConfiguration": null,
|
173
|
+
"dependsOn": null,
|
174
|
+
"disableNetworking": null,
|
175
|
+
"interactive": null,
|
176
|
+
"healthCheck": {
|
177
|
+
"retries": 5,
|
178
|
+
"command": [
|
179
|
+
"CMD-SHELL",
|
180
|
+
"mysqladmin ping -u dbuser -psimplememodbuser -h 127.0.0.1 || exit 1"
|
181
|
+
],
|
182
|
+
"timeout": 3,
|
183
|
+
"interval": 10,
|
184
|
+
"startPeriod": null
|
185
|
+
},
|
186
|
+
"essential": true,
|
187
|
+
"links": null,
|
188
|
+
"hostname": null,
|
189
|
+
"extraHosts": null,
|
190
|
+
"pseudoTerminal": null,
|
191
|
+
"user": null,
|
192
|
+
"readonlyRootFilesystem": null,
|
193
|
+
"dockerLabels": null,
|
194
|
+
"systemControls": null,
|
195
|
+
"privileged": null,
|
196
|
+
"name": "mariadb"
|
197
|
+
}
|
198
|
+
],
|
199
|
+
"placementConstraints": [],
|
200
|
+
"memory": "512",
|
201
|
+
"taskRoleArn": "arn:aws:iam::200144044244:role/ecsTaskExecutionRole",
|
202
|
+
"compatibilities": [
|
203
|
+
"EC2",
|
204
|
+
"FARGATE"
|
205
|
+
],
|
206
|
+
"taskDefinitionArn": "arn:aws:ecs:ap-northeast-1:200144044244:task-definition/simplememo:39",
|
207
|
+
"family": "simplememo",
|
208
|
+
"requiresAttributes": [
|
209
|
+
{
|
210
|
+
"targetId": null,
|
211
|
+
"targetType": null,
|
212
|
+
"value": null,
|
213
|
+
"name": "ecs.capability.execution-role-awslogs"
|
214
|
+
},
|
215
|
+
{
|
216
|
+
"targetId": null,
|
217
|
+
"targetType": null,
|
218
|
+
"value": null,
|
219
|
+
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
220
|
+
},
|
221
|
+
{
|
222
|
+
"targetId": null,
|
223
|
+
"targetType": null,
|
224
|
+
"value": null,
|
225
|
+
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
|
226
|
+
},
|
227
|
+
{
|
228
|
+
"targetId": null,
|
229
|
+
"targetType": null,
|
230
|
+
"value": null,
|
231
|
+
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
232
|
+
},
|
233
|
+
{
|
234
|
+
"targetId": null,
|
235
|
+
"targetType": null,
|
236
|
+
"value": null,
|
237
|
+
"name": "ecs.capability.container-health-check"
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"targetId": null,
|
241
|
+
"targetType": null,
|
242
|
+
"value": null,
|
243
|
+
"name": "ecs.capability.execution-role-ecr-pull"
|
244
|
+
},
|
245
|
+
{
|
246
|
+
"targetId": null,
|
247
|
+
"targetType": null,
|
248
|
+
"value": null,
|
249
|
+
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
250
|
+
},
|
251
|
+
{
|
252
|
+
"targetId": null,
|
253
|
+
"targetType": null,
|
254
|
+
"value": null,
|
255
|
+
"name": "ecs.capability.task-eni"
|
256
|
+
},
|
257
|
+
{
|
258
|
+
"targetId": null,
|
259
|
+
"targetType": null,
|
260
|
+
"value": null,
|
261
|
+
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
262
|
+
},
|
263
|
+
{
|
264
|
+
"targetId": null,
|
265
|
+
"targetType": null,
|
266
|
+
"value": null,
|
267
|
+
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.24"
|
268
|
+
},
|
269
|
+
{
|
270
|
+
"targetId": null,
|
271
|
+
"targetType": null,
|
272
|
+
"value": null,
|
273
|
+
"name": "ecs.capability.efsAuth"
|
274
|
+
},
|
275
|
+
{
|
276
|
+
"targetId": null,
|
277
|
+
"targetType": null,
|
278
|
+
"value": null,
|
279
|
+
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
280
|
+
},
|
281
|
+
{
|
282
|
+
"targetId": null,
|
283
|
+
"targetType": null,
|
284
|
+
"value": null,
|
285
|
+
"name": "ecs.capability.efs"
|
286
|
+
},
|
287
|
+
{
|
288
|
+
"targetId": null,
|
289
|
+
"targetType": null,
|
290
|
+
"value": null,
|
291
|
+
"name": "ecs.capability.container-ordering"
|
292
|
+
},
|
293
|
+
{
|
294
|
+
"targetId": null,
|
295
|
+
"targetType": null,
|
296
|
+
"value": null,
|
297
|
+
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.25"
|
298
|
+
}
|
299
|
+
],
|
300
|
+
"pidMode": null,
|
301
|
+
"requiresCompatibilities": [
|
302
|
+
"FARGATE"
|
303
|
+
],
|
304
|
+
"networkMode": "awsvpc",
|
305
|
+
"runtimePlatform": {
|
306
|
+
"operatingSystemFamily": "LINUX",
|
307
|
+
"cpuArchitecture": null
|
308
|
+
},
|
309
|
+
"cpu": "256",
|
310
|
+
"revision": 39,
|
311
|
+
"status": "ACTIVE",
|
312
|
+
"inferenceAccelerators": null,
|
313
|
+
"proxyConfiguration": null,
|
314
|
+
"volumes": [
|
315
|
+
{
|
316
|
+
"fsxWindowsFileServerVolumeConfiguration": null,
|
317
|
+
"efsVolumeConfiguration": {
|
318
|
+
"transitEncryptionPort": null,
|
319
|
+
"fileSystemId": "fs-004f119dfa09acb35",
|
320
|
+
"authorizationConfig": {
|
321
|
+
"iam": "DISABLED",
|
322
|
+
"accessPointId": null
|
323
|
+
},
|
324
|
+
"transitEncryption": "DISABLED",
|
325
|
+
"rootDirectory": "/"
|
326
|
+
},
|
327
|
+
"name": "efs",
|
328
|
+
"host": null,
|
329
|
+
"dockerVolumeConfiguration": null
|
330
|
+
}
|
331
|
+
]
|
332
|
+
}
|
333
|
+
```
|
334
|
+
|
20
335
|
### 発生している問題・エラーメッセージ
|
21
336
|
|
22
337
|
タスクの再起動および、2つ目以降のタスク起動時に下記エラーが出まして、DBのエンジン関係だと思いますが、なぜ発生するのか理由がわかりません。
|