@@ -148,8 +148,11 @@ Resources:
148
148
- Type : s3
149
149
Value : !Ref "EnvFileArn"
150
150
Environment :
151
+ # because they are on the same TaskDefinition, they can communicate
152
+ # using `localhost`, otherwise, they would have to go through
153
+ # Service to talk to each other, or even through the internet!
151
154
- Name : REDIS_HOST
152
- Value : !Ref RedisContainerName
155
+ Value : localhost
153
156
- Name : PORT
154
157
Value : !Ref "ServiceOneContainerPort"
155
158
- Name : APP_PREFIX
@@ -186,7 +189,7 @@ Resources:
186
189
Value : !Ref "EnvFileArn"
187
190
Environment :
188
191
- Name : REDIS_HOST
189
- Value : !Ref RedisContainerName
192
+ Value : localhost
190
193
- Name : PORT
191
194
Value : !Ref "ServiceTwoContainerPort"
192
195
- Name : APP_PREFIX
@@ -236,6 +239,8 @@ Resources:
236
239
Value : !Ref "ServiceThreeContainerPort"
237
240
- Name : APP_PREFIX
238
241
Value : !Ref "ServiceThreeUriPrefix"
242
+ - Name : DB_CONNECTION_STRING
243
+ Value : !Sub postgres://postgres:postgres@localhost:5432/${ServiceThreeDatabaseName}
239
244
DependsOn :
240
245
- ContainerName : !Sub ${ServiceThreeContainerName}-bootstrap
241
246
Condition : SUCCESS
@@ -251,6 +256,8 @@ Resources:
251
256
- " -c"
252
257
- " alembic upgrade head && exit 0"
253
258
DependsOn :
259
+ # this HEALTHY condition requires that you either specify it in the
260
+ # Dockerfile or here in the CloudFormation template
254
261
- ContainerName : !Ref PostgresContainerName
255
262
Condition : HEALTHY
256
263
LogConfiguration :
@@ -302,9 +309,13 @@ Resources:
302
309
awslogs-group : !Sub ${EnvTag}-${StackName}
303
310
awslogs-region : !Ref "AWS::Region"
304
311
awslogs-stream-prefix : !Ref PostgresContainerName
305
- EnvironmentFiles :
306
- - Type : s3
307
- Value : !Ref "EnvFileArn"
312
+ Environment :
313
+ - Name : POSTGRES_DB
314
+ Value : !Ref ServiceThreeDatabaseName
315
+ - Name : POSTGRES_USER
316
+ Value : postgres
317
+ - Name : POSTGRES_PASSWORD
318
+ Value : postgres
308
319
MountPoints :
309
320
- ContainerPath : /var/lib/postgresql/data
310
321
SourceVolume : postgres-data
0 commit comments