File tree Expand file tree Collapse file tree 2 files changed +44
-23
lines changed
infrastructure/applications/pycon_backend Expand file tree Collapse file tree 2 files changed +44
-23
lines changed Original file line number Diff line number Diff line change @@ -306,11 +306,6 @@ jobs:
306
306
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
307
307
AWS_DEFAULT_REGION : eu-central-1
308
308
309
- # TODO Temporary workaround the fact that the lambda takes a bit to update
310
- # so to avoid calling the old deployment, we want 20 seconds
311
- # the 20 seconds is not a meaningful value, it is a random delay
312
- # it might or might not be enough. This is just an hack until we add a solution for this
313
- # e.g lambda versions?
314
309
wait-aws-update :
315
310
runs-on : ubuntu-latest
316
311
needs : [terraform]
@@ -330,24 +325,6 @@ jobs:
330
325
done
331
326
shell : bash
332
327
333
- # Migrate the database
334
- migrate-pycon-backend-db :
335
- runs-on : ubuntu-latest
336
- needs : [terraform, wait-aws-update]
337
- steps :
338
- - uses : actions/checkout@v4
339
- with :
340
- ref : ${{ github.ref }}
341
- - name : Migrate PyCon Backend DB
342
- run : |
343
- aws lambda invoke --function-name ${{ env.TF_WORKSPACE }}-pycon-backend --cli-binary-format raw-in-base64-out --payload '{ "_serverless-wsgi": { "command": "manage", "data": "migrate" } }' response.json
344
- cat response.json
345
- env :
346
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
347
- AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
348
- AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
349
- AWS_DEFAULT_REGION : ${{ secrets.AWS_DEFAULT_REGION }}
350
-
351
328
deploy-fe :
352
329
runs-on : ubuntu-latest
353
330
needs : [migrate-pycon-backend-db]
Original file line number Diff line number Diff line change @@ -281,6 +281,50 @@ resource "aws_ecs_task_definition" "worker" {
281
281
interval = 10
282
282
}
283
283
284
+ stopTimeout = 300
285
+ },
286
+ {
287
+ name = " migrations"
288
+ image = " ${ data . aws_ecr_repository . be_repo . repository_url } @${ data . aws_ecr_image . be_arm_image . image_digest } "
289
+ memoryReservation = 200
290
+ essential = false
291
+ entrypoint = [
292
+ " /home/app/.venv/bin/python" ,
293
+ ]
294
+
295
+ command = [
296
+ " manage.py" , " migrate"
297
+ ]
298
+
299
+ environment = local.env_vars
300
+
301
+ mountPoints = []
302
+ systemControls = [
303
+ {
304
+ " namespace" : " net.core.somaxconn" ,
305
+ " value" : " 4096"
306
+ }
307
+ ]
308
+
309
+ logConfiguration = {
310
+ logDriver = " awslogs"
311
+ options = {
312
+ " awslogs-group" = var.logs_group_name
313
+ " awslogs-region" = " eu-central-1"
314
+ " awslogs-stream-prefix" = " backend-migrations"
315
+ }
316
+ }
317
+
318
+ healthCheck = {
319
+ retries = 3
320
+ command = [
321
+ " CMD-SHELL" ,
322
+ " echo 1"
323
+ ]
324
+ timeout = 3
325
+ interval = 10
326
+ }
327
+
284
328
stopTimeout = 300
285
329
}
286
330
])
You can’t perform that action at this time.
0 commit comments