Deployment Guide¶
This guide covers building and deploying the application to AWS (ECR) or Azure (ACR).
Prerequisites¶
- Python 3.13+
- Node.js and npm
- Docker Desktop (engine must be running)
- AWS CLI configured with a named profile (for AWS deployment)
- Azure CLI with
az acr loginaccess (for Azure deployment)
Configuration¶
All deployment settings are Python constants in app/settings.py — not shell environment variables.
AWS Settings¶
| Variable | Description | Example |
|---|---|---|
AWS_PROFILE |
AWS CLI named profile | "edward_meetgrit" |
AWS_ACCOUNT_ID |
AWS account ID | "907965464542" |
AWS_REGION |
AWS region | "us-east-1" |
IMAGE_NAME |
Local Docker image name | "chatbot" |
ECR_REPOSITORY_NAME |
ECR repository path | "django-apprunner-chatbot/chatbot" |
Azure Settings¶
Azure settings are nested inside the CORE_SETTINGS dictionary:
| Key | Description |
|---|---|
CORE_SETTINGS['AZURE_ACR_REGISTRY_NAME'] |
Azure Container Registry name |
CORE_SETTINGS['AZURE_ACR_REPOSITORY_NAME'] |
ACR repository name |
Build Docker Image¶
Build the Docker image before deploying to either platform:
# For AWS deployment
python scripts.py build_image
# For Azure deployment
python scripts.py build_image_azure
Both commands run the same build steps:
npm install— installs frontend dependenciesnpm run build— compiles frontend assetspython manage.py collectstatic— collects static filesdocker buildx build --platform=linux/amd64— builds the Docker image, tagged aslatest
Deploy¶
AWS (ECR)¶
Steps performed:
- Logs in to ECR using
aws ecr get-login-passwordwith the configuredAWS_PROFILE - Tags the local image for the ECR registry
- Deletes the existing image in ECR (by tag)
- Pushes the new image to ECR
Azure (ACR)¶
Steps performed:
- Logs in to ACR using
az acr login - Tags the local image for the ACR registry
- Pushes the image to ACR (ACR overwrites existing tags, so no delete step is needed)
Troubleshooting¶
Docker not running¶
Open Docker Desktop and ensure the engine is running. The scripts use the desktop-linux Docker context.
npm not installed¶
Install Node.js and npm, then retry the build command.
AWS credentials¶
If ECR login fails, verify that AWS_PROFILE in app/settings.py matches a configured profile in your AWS CLI (~/.aws/credentials).
Azure credentials¶
If ACR login fails, ensure you have run az login and have access to the registry specified in CORE_SETTINGS['AZURE_ACR_REGISTRY_NAME'].