Update Production Application

To update the production application:

  1. Update the image repository
  2. Build and push a new image
  3. Update ECS Task Definition
  4. Update ECS Service

Update the image repository

  • Open workspace/settings.py file
  • Update the image_repo to your image repository
  • Set build_images=True and push_images=True

workspace/settings.py

    # -*- Image Settings
    # Repository for images
    image_repo="your-image-repo",
    # Build images locally
    build_images=True,
    # Push images after building
    push_images=True,

Build and push a new image

Build a new image using the phi cli

Build production image

phi ws up --env prd --config docker --type image

To force rebuild images, use the --force or -f flag

phi ws up --env prd --config docker --type image --force

ECR Authentication

If you are using ECR, authenticate with ECR before pushing images.

Authenticate with ECR

aws ecr get-login-password --region [region] | docker login --username AWS --password-stdin [account].dkr.ecr.[region].amazonaws.com

Update ECS Task Definition

If you updated the Image, CPU, Memory or Environment Variables, update the task definition

phi ws patch --env prd --config aws --name td

Update ECS Service

Update the ECS Service to pick up the new task or image

phi ws patch --env prd --config aws --name service