Update Production Application
To update the production application:
- Update the image repository
- Build and push a new image
- Update ECS Task Definition
- Update ECS Service
Update the image repository
- Open
workspace/settings.py
file - Update the
image_repo
to your image repository - Set
build_images=True
andpush_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
If you ONLY rebuilt the image, you do not need to update the task definition and can just patch the service to pickup the new image.