From a6f7227fa0372937b84bc1bd14c5c2e34a406591 Mon Sep 17 00:00:00 2001 From: Vysakh Premkumar <84713473+tellmeY18@users.noreply.github.com> Date: Tue, 14 Jan 2025 22:45:49 +0530 Subject: [PATCH 1/2] updated deploy workflow The GitHub action is updated to use currently active ecs task definition instead of the one defined in the repo. This ensures changes made in ecs cluster stay there instead of getting reset. --- .github/workflows/deploy.yml | 73 +++-- aws/backend.json | 295 ------------------- aws/celery.json | 541 ----------------------------------- 3 files changed, 34 insertions(+), 875 deletions(-) delete mode 100644 aws/backend.json delete mode 100644 aws/celery.json diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5de8105165..2cae4314ad 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,7 +7,6 @@ on: - 'v*' branches: - develop - - staging paths-ignore: - "docs/**" @@ -16,17 +15,11 @@ concurrency: cancel-in-progress: true env: - IMAGE_NAME: care AWS_DEFAULT_REGION: ap-south-1 AWS_DEFAULT_OUTPUT: json - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID}} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - EKS_CLUSTER_NAME: ${{ secrets.AWS_EKS_CLUSTER_NAME }} ECS_SERVICE_BACKEND: "care-backend" ECS_SERVICE_CELERY: "care-celery" ECS_CLUSTER: "egov" - ECS_TASK_DEFINITION_BACKEND: "./aws/backend.json" - ECS_TASK_DEFINITION_CELERY: "./aws/celery.json" CONTAINER_NAME_BACKEND: "care-backend" CONTAINER_NAME_WORKER: "care-celery-worker" CONTAINER_NAME_CRON: "care-celery-beat" @@ -70,12 +63,6 @@ jobs: - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -91,6 +78,11 @@ jobs: restore-keys: | ${{ runner.os }}-buildx-build- + - name: Create new cache + run: | + mkdir -p /tmp/.buildx-cache + mkdir -p /tmp/.buildx-cache-new + - name: Build and push image uses: docker/build-push-action@v6 with: @@ -114,11 +106,13 @@ jobs: SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} with: version: ${{ github.sha }} - - - name: Move cache + - name: Update cache + if: always() # Run even if previous steps fail run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache + if [ -d "/tmp/.buildx-cache-new" ]; then + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + fi notify-release: needs: build @@ -130,6 +124,8 @@ jobs: run: | echo "Release ${{ github.sha }} is ready to be deployed to production" + + deploy-staging-egov: needs: build if: github.ref == 'refs/heads/develop' @@ -139,9 +135,6 @@ jobs: name: Staging-egov url: https://careapi.ohc.network steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: @@ -155,42 +148,44 @@ jobs: IMAGE_TAG: latest-${{ github.run_number }} run: echo "IMAGE_VALUE=`echo ghcr.io/${{ github.repository }}:$IMAGE_TAG`" >> $GITHUB_ENV - - name: Fill Celery Cron definition - id: task-def-celery-cron - uses: aws-actions/amazon-ecs-render-task-definition@v1 - with: - task-definition: ${{ env.ECS_TASK_DEFINITION_CELERY }} - container-name: ${{ env.CONTAINER_NAME_CRON }} - image: ${{env.IMAGE_VALUE}} - - name: Fill Celery Worker definition - id: task-def-celery-worker + - name: Download task definition for Celery Service + run: | + aws ecs describe-task-definition --task-definition ${{ env.ECS_SERVICE_CELERY }} --query taskDefinition > celery-task-definition.json + + + - name: Fill in the new image ID in the Celery task definition + id: celery-task-def uses: aws-actions/amazon-ecs-render-task-definition@v1 with: - task-definition: ${{ steps.task-def-celery-cron.outputs.task-definition }} + task-definition: celery-task-definition.json container-name: ${{ env.CONTAINER_NAME_WORKER }} - image: ${{env.IMAGE_VALUE}} + image: ${{ env.IMAGE_VALUE }} - - name: Deploy Backend Celery + - name: Deploy Celery task definition uses: aws-actions/amazon-ecs-deploy-task-definition@v2 with: - task-definition: ${{ steps.task-def-celery-worker.outputs.task-definition }} + task-definition: ${{ steps.celery-task-def.outputs.task-definition }} service: ${{ env.ECS_SERVICE_CELERY }} cluster: ${{ env.ECS_CLUSTER }} wait-for-service-stability: true - - name: Fill Backend Api definition - id: task-def-api + - name: Download task definition for Backend Service + run: | + aws ecs describe-task-definition --task-definition ${{ env.ECS_SERVICE_BACKEND }} --query taskDefinition > backend-task-definition.json + + - name: Fill in the new image ID in the Backend task definition + id: backend-task-def uses: aws-actions/amazon-ecs-render-task-definition@v1 with: - task-definition: ${{ env.ECS_TASK_DEFINITION_BACKEND }} + task-definition: backend-task-definition.json container-name: ${{ env.CONTAINER_NAME_BACKEND }} - image: ${{env.IMAGE_VALUE}} + image: ${{ env.IMAGE_VALUE }} - - name: Deploy Backend Api + - name: Deploy Backend task definition uses: aws-actions/amazon-ecs-deploy-task-definition@v2 with: - task-definition: ${{ steps.task-def-api.outputs.task-definition }} + task-definition: ${{ steps.backend-task-def.outputs.task-definition }} service: ${{ env.ECS_SERVICE_BACKEND }} cluster: ${{ env.ECS_CLUSTER }} wait-for-service-stability: true diff --git a/aws/backend.json b/aws/backend.json deleted file mode 100644 index 8b4d9bf195..0000000000 --- a/aws/backend.json +++ /dev/null @@ -1,295 +0,0 @@ -{ - "executionRoleArn": "arn:aws:iam::299650323339:role/ecsTaskExecutionRole", - "containerDefinitions": [ - { - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": "/ecs/care-backend", - "awslogs-region": "ap-south-1", - "awslogs-stream-prefix": "ecs" - } - }, - "portMappings": [ - { - "containerPort": 9000, - "hostPort": 9000, - "protocol": "tcp" - } - ], - "command": [ - "/app/start-ecs.sh" - ], - "environment": [ - { - "name": "AUDIT_LOG_ENABLED", - "value": "1" - }, - { - "name": "AWS_STORAGE_BUCKET_NAME", - "value": "egov-s3-assets-10bedicu" - }, - { - "name": "CSRF_TRUSTED_ORIGINS", - "value": "[\"http://care-django-staging\", \"https://care.coronasafe.in\", \"https://careapi.coronasafe.in\", \"https://care.ohc.network\", \"https://careapi.ohc.network\"]" - }, - { - "name": "CORS_ALLOWED_ORIGINS", - "value": "[\"https://care.coronasafe.in\", \"https://careapi.coronasafe.in\", \"https://care.ohc.network\", \"https://careapi.ohc.network\", \"https://status.10bedicu.org\", \"http://localhost:4000\"]" - }, - { - "name": "CORS_ALLOWED_ORIGIN_REGEXES", - "value": "[\"^https://[a-zA-Z0-9-]+--care-ohc\\\\.netlify\\\\.app$\", \"^https://[a-zA-Z0-9-]+\\\\.care-fe\\\\.pages\\\\.dev$\"]" - }, - { - "name": "CURRENT_DOMAIN", - "value": "https://care.ohc.network" - }, - { - "name": "BACKEND_DOMAIN", - "value": "https://careapi.ohc.network" - }, - { - "name": "DJANGO_ADMIN_URL", - "value": "w8BYTTYRkxqAsbS2iU9Yd2ZgQy6D3uws" - }, - { - "name": "DJANGO_ALLOWED_HOSTS", - "value": "[\"care-django-staging\", \"care.coronasafe.in\", \"careapi.coronasafe.in\", \"care.ohc.network\", \"careapi.ohc.network\"]" - }, - { - "name": "DJANGO_SECURE_SSL_REDIRECT", - "value": "False" - }, - { - "name": "DJANGO_SETTINGS_MODULE", - "value": "config.settings.staging" - }, - { - "name": "EMAIL_FROM", - "value": "Open Healthcare Network " - }, - { - "name": "EMAIL_HOST", - "value": "email-smtp.ap-south-1.amazonaws.com" - }, - { - "name": "FACILITY_S3_BUCKET", - "value": "egov-s3-facility-10bedicu" - }, - { - "name": "FACILITY_S3_BUCKET_ENDPOINT", - "value": "https://egov-s3-facility-10bedicu.s3.amazonaws.com" - }, - { - "name": "FACILITY_S3_STATIC_PREFIX", - "value": "https://egov-s3-facility-10bedicu.s3.ap-south-1.amazonaws.com/egov-s3-facility-10bedicu" - }, - { - "name": "FILE_UPLOAD_BUCKET", - "value": "egov-s3-patient-data-10bedicu" - }, - { - "name": "FILE_UPLOAD_BUCKET_ENDPOINT", - "value": "https://egov-s3-patient-data-10bedicu.s3.amazonaws.com" - }, - { - "name": "MAINTENANCE_MODE", - "value": "0" - }, - { - "name": "POSTGRES_DB", - "value": "care_staging1" - }, - { - "name": "POSTGRES_USER", - "value": "postgres" - }, - { - "name": "RATE_LIMIT", - "value": "5/10m" - }, - { - "name": "USE_S3", - "value": "True" - }, - { - "name": "ABDM_GATEWAY_URL", - "value": "https://dev.abdm.gov.in" - }, - { - "name": "ABDM_ABHA_URL", - "value": "https://abhasbx.abdm.gov.in" - }, - { - "name": "ABDM_FACILITY_URL", - "value": "https://facilitysbx.abdm.gov.in" - }, - { - "name": "ABDM_CM_ID", - "value": "sbx" - }, - { - "name": "SENTRY_TRACES_SAMPLE_RATE", - "value": "1.0" - }, - { - "name": "SENTRY_PROFILES_SAMPLE_RATE", - "value": "1.0" - }, - { - "name": "SENTRY_ENVIRONMENT", - "value": "staging" - } - ], - "repositoryCredentials": { - "credentialsParameter": "arn:aws:secretsmanager:ap-south-1:299650323339:secret:/github/pat-UHmr0B" - }, - "workingDirectory": "/app", - "secrets": [ - { - "valueFrom": "/care/backend/POSTGRES_PORT", - "name": "POSTGRES_PORT" - }, - { - "valueFrom": "/care/backend/POSTGRES_HOST", - "name": "POSTGRES_HOST" - }, - { - "valueFrom": "/care/backend/POSTGRES_PASSWORD", - "name": "POSTGRES_PASSWORD" - }, - { - "valueFrom": "/care/backend/DATABASE_URL", - "name": "DATABASE_URL" - }, - { - "valueFrom": "/care/backend/SENTRY_DSN", - "name": "SENTRY_DSN" - }, - { - "valueFrom": "/care/backend/DJANGO_SECRET_KEY", - "name": "DJANGO_SECRET_KEY" - }, - { - "valueFrom": "/care/backend/AWS_ACCESS_KEY_ID", - "name": "AWS_ACCESS_KEY_ID" - }, - { - "valueFrom": "/care/backend/AWS_SECRET_ACCESS_KEY", - "name": "AWS_SECRET_ACCESS_KEY" - }, - { - "valueFrom": "/care/backend/CELERY_BROKER_URL", - "name": "CELERY_BROKER_URL" - }, - { - "valueFrom": "/care/backend/CELERY_BROKER_URL", - "name": "REDIS_URL" - }, - { - "valueFrom": "/care/backend/EMAIL_USER", - "name": "EMAIL_USER" - }, - { - "valueFrom": "/care/backend/EMAIL_PASSWORD", - "name": "EMAIL_PASSWORD" - }, - { - "valueFrom": "/care/backend/SNS_ACCESS_KEY", - "name": "SNS_ACCESS_KEY" - }, - { - "valueFrom": "/care/backend/SNS_SECRET_KEY", - "name": "SNS_SECRET_KEY" - }, - { - "valueFrom": "/care/backend/FILE_UPLOAD_KEY", - "name": "FILE_UPLOAD_KEY" - }, - { - "valueFrom": "/care/backend/FILE_UPLOAD_SECRET", - "name": "FILE_UPLOAD_SECRET" - }, - { - "valueFrom": "/care/backend/GOOGLE_RECAPTCHA_SITE_KEY", - "name": "GOOGLE_RECAPTCHA_SITE_KEY" - }, - { - "valueFrom": "/care/backend/GOOGLE_RECAPTCHA_SECRET_KEY", - "name": "GOOGLE_RECAPTCHA_SECRET_KEY" - }, - { - "valueFrom": "/care/backend/FACILITY_S3_KEY", - "name": "FACILITY_S3_KEY" - }, - { - "valueFrom": "/care/backend/FACILITY_S3_SECRET", - "name": "FACILITY_S3_SECRET" - }, - { - "valueFrom": "/care/backend/VAPID_PUBLIC_KEY", - "name": "VAPID_PUBLIC_KEY" - }, - { - "valueFrom": "/care/backend/VAPID_PRIVATE_KEY", - "name": "VAPID_PRIVATE_KEY" - }, - { - "valueFrom": "/care/backend/HCX_PROTOCOL_BASE_PATH", - "name": "HCX_PROTOCOL_BASE_PATH" - }, - { - "valueFrom": "/care/backend/HCX_PARTICIPANT_CODE", - "name": "HCX_PARTICIPANT_CODE" - }, - { - "valueFrom": "/care/backend/HCX_AUTH_BASE_PATH", - "name": "HCX_AUTH_BASE_PATH" - }, - { - "valueFrom": "/care/backend/HCX_USERNAME", - "name": "HCX_USERNAME" - }, - { - "valueFrom": "/care/backend/HCX_PASSWORD", - "name": "HCX_PASSWORD" - }, - { - "valueFrom": "/care/backend/HCX_ENCRYPTION_PRIVATE_KEY_URL", - "name": "HCX_ENCRYPTION_PRIVATE_KEY_URL" - }, - { - "valueFrom": "/care/backend/HCX_IG_URL", - "name": "HCX_IG_URL" - }, - { - "valueFrom": "/care/backend/HCX_CERT_URL", - "name": "HCX_CERT_URL" - }, - { - "valueFrom": "/care/backend/ABDM_CLIENT_ID", - "name": "ABDM_CLIENT_ID" - }, - { - "valueFrom": "/care/backend/ABDM_CLIENT_SECRET", - "name": "ABDM_CLIENT_SECRET" - }, - { - "valueFrom": "/care/backend/JWKS_BASE64", - "name": "JWKS_BASE64" - } - ], - "name": "care-backend" - } - ], - "memory": "1024", - "taskRoleArn": "arn:aws:iam::299650323339:role/ecsTaskExecutionRole", - "family": "care", - "requiresCompatibilities": [ - "FARGATE" - ], - "networkMode": "awsvpc", - "cpu": "512", - "volumes": [] -} diff --git a/aws/celery.json b/aws/celery.json deleted file mode 100644 index fdaa13d908..0000000000 --- a/aws/celery.json +++ /dev/null @@ -1,541 +0,0 @@ -{ - "executionRoleArn": "arn:aws:iam::299650323339:role/ecsTaskExecutionRole", - "containerDefinitions": [ - { - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": "/ecs/care-celery-beat", - "awslogs-region": "ap-south-1", - "awslogs-stream-prefix": "ecs" - } - }, - "portMappings": [], - "command": ["/app/celery_beat-ecs.sh"], - "cpu": 128, - "environment": [ - { - "name": "AUDIT_LOG_ENABLED", - "value": "1" - }, - { - "name": "AWS_STORAGE_BUCKET_NAME", - "value": "egov-s3-assets-10bedicu" - }, - { - "name": "CSRF_TRUSTED_ORIGINS", - "value": "[\"http://care-django-staging\", \"https://care.coronasafe.in\", \"https://careapi.coronasafe.in\", \"https://care.ohc.network\", \"https://careapi.ohc.network\"]" - }, - { - "name": "CURRENT_DOMAIN", - "value": "https://care.ohc.network" - }, - { - "name": "BACKEND_DOMAIN", - "value": "https://careapi.ohc.network" - }, - { - "name": "DJANGO_ADMIN_URL", - "value": "w8BYTTYRkxqAsbS2iU9Yd2ZgQy6D3uws" - }, - { - "name": "DJANGO_ALLOWED_HOSTS", - "value": "[\"care-django-staging\", \"care.coronasafe.in\", \"careapi.coronasafe.in\", \"care.ohc.network\", \"careapi.ohc.network\"]" - }, - { - "name": "DJANGO_SECURE_SSL_REDIRECT", - "value": "False" - }, - { - "name": "DJANGO_SETTINGS_MODULE", - "value": "config.settings.staging" - }, - { - "name": "EMAIL_FROM", - "value": "Open Healthcare Network " - }, - { - "name": "EMAIL_HOST", - "value": "email-smtp.ap-south-1.amazonaws.com" - }, - { - "name": "FACILITY_S3_BUCKET", - "value": "egov-s3-facility-10bedicu" - }, - { - "name": "FACILITY_S3_BUCKET_ENDPOINT", - "value": "https://egov-s3-facility-10bedicu.s3.amazonaws.com" - }, - { - "name": "FILE_UPLOAD_BUCKET", - "value": "egov-s3-patient-data-10bedicu" - }, - { - "name": "FILE_UPLOAD_BUCKET_ENDPOINT", - "value": "https://egov-s3-patient-data-10bedicu.s3.amazonaws.com" - }, - { - "name": "MAINTENANCE_MODE", - "value": "0" - }, - { - "name": "POSTGRES_DB", - "value": "care_staging" - }, - { - "name": "POSTGRES_USER", - "value": "postgres" - }, - { - "name": "RATE_LIMIT", - "value": "5/10m" - }, - { - "name": "USE_S3", - "value": "True" - }, - { - "name": "ABDM_GATEWAY_URL", - "value": "https://dev.abdm.gov.in" - }, - { - "name": "ABDM_ABHA_URL", - "value": "https://abhasbx.abdm.gov.in" - }, - { - "name": "ABDM_FACILITY_URL", - "value": "https://facilitysbx.abdm.gov.in" - }, - { - "name": "ABDM_CM_ID", - "value": "sbx" - }, - { - "name": "SENTRY_TRACES_SAMPLE_RATE", - "value": "1.0" - }, - { - "name": "SENTRY_PROFILES_SAMPLE_RATE", - "value": "1.0" - }, - { - "name": "SENTRY_ENVIRONMENT", - "value": "staging" - } - ], - "repositoryCredentials": { - "credentialsParameter": "arn:aws:secretsmanager:ap-south-1:299650323339:secret:/github/pat-UHmr0B" - }, - "memory": 512, - "memoryReservation": 512, - "workingDirectory": "/app", - "secrets": [ - { - "valueFrom": "/care/backend/POSTGRES_PORT", - "name": "POSTGRES_PORT" - }, - { - "valueFrom": "/care/backend/POSTGRES_HOST", - "name": "POSTGRES_HOST" - }, - { - "valueFrom": "/care/backend/POSTGRES_PASSWORD", - "name": "POSTGRES_PASSWORD" - }, - { - "valueFrom": "/care/backend/DATABASE_URL", - "name": "DATABASE_URL" - }, - { - "valueFrom": "/care/backend/SENTRY_DSN", - "name": "SENTRY_DSN" - }, - { - "valueFrom": "/care/backend/DJANGO_SECRET_KEY", - "name": "DJANGO_SECRET_KEY" - }, - { - "valueFrom": "/care/backend/AWS_ACCESS_KEY_ID", - "name": "AWS_ACCESS_KEY_ID" - }, - { - "valueFrom": "/care/backend/AWS_SECRET_ACCESS_KEY", - "name": "AWS_SECRET_ACCESS_KEY" - }, - { - "valueFrom": "/care/backend/CELERY_BROKER_URL", - "name": "CELERY_BROKER_URL" - }, - { - "valueFrom": "/care/backend/CELERY_BROKER_URL", - "name": "REDIS_URL" - }, - { - "valueFrom": "/care/backend/EMAIL_USER", - "name": "EMAIL_USER" - }, - { - "valueFrom": "/care/backend/EMAIL_PASSWORD", - "name": "EMAIL_PASSWORD" - }, - { - "valueFrom": "/care/backend/SNS_ACCESS_KEY", - "name": "SNS_ACCESS_KEY" - }, - { - "valueFrom": "/care/backend/SNS_SECRET_KEY", - "name": "SNS_SECRET_KEY" - }, - { - "valueFrom": "/care/backend/FILE_UPLOAD_KEY", - "name": "FILE_UPLOAD_KEY" - }, - { - "valueFrom": "/care/backend/FILE_UPLOAD_SECRET", - "name": "FILE_UPLOAD_SECRET" - }, - { - "valueFrom": "/care/backend/GOOGLE_RECAPTCHA_SITE_KEY", - "name": "GOOGLE_RECAPTCHA_SITE_KEY" - }, - { - "valueFrom": "/care/backend/GOOGLE_RECAPTCHA_SECRET_KEY", - "name": "GOOGLE_RECAPTCHA_SECRET_KEY" - }, - { - "valueFrom": "/care/backend/FACILITY_S3_KEY", - "name": "FACILITY_S3_KEY" - }, - { - "valueFrom": "/care/backend/FACILITY_S3_SECRET", - "name": "FACILITY_S3_SECRET" - }, - { - "valueFrom": "/care/backend/VAPID_PUBLIC_KEY", - "name": "VAPID_PUBLIC_KEY" - }, - { - "valueFrom": "/care/backend/VAPID_PRIVATE_KEY", - "name": "VAPID_PRIVATE_KEY" - }, - { - "valueFrom": "/care/backend/HCX_PROTOCOL_BASE_PATH", - "name": "HCX_PROTOCOL_BASE_PATH" - }, - { - "valueFrom": "/care/backend/HCX_PARTICIPANT_CODE", - "name": "HCX_PARTICIPANT_CODE" - }, - { - "valueFrom": "/care/backend/HCX_AUTH_BASE_PATH", - "name": "HCX_AUTH_BASE_PATH" - }, - { - "valueFrom": "/care/backend/HCX_USERNAME", - "name": "HCX_USERNAME" - }, - { - "valueFrom": "/care/backend/HCX_PASSWORD", - "name": "HCX_PASSWORD" - }, - { - "valueFrom": "/care/backend/HCX_ENCRYPTION_PRIVATE_KEY_URL", - "name": "HCX_ENCRYPTION_PRIVATE_KEY_URL" - }, - { - "valueFrom": "/care/backend/HCX_IG_URL", - "name": "HCX_IG_URL" - }, - { - "valueFrom": "/care/backend/HCX_CERT_URL", - "name": "HCX_CERT_URL" - }, - { - "valueFrom": "/care/backend/ABDM_CLIENT_ID", - "name": "ABDM_CLIENT_ID" - }, - { - "valueFrom": "/care/backend/ABDM_CLIENT_SECRET", - "name": "ABDM_CLIENT_SECRET" - }, - { - "valueFrom": "/care/backend/JWKS_BASE64", - "name": "JWKS_BASE64" - } - ], - "name": "care-celery-beat" - }, - { - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": "/ecs/care-celery-worker", - "awslogs-region": "ap-south-1", - "awslogs-stream-prefix": "ecs" - } - }, - "command": ["/app/celery_worker-ecs.sh"], - "cpu": 384, - "memory": 1536, - "memoryReservation": 1536, - "environment": [ - { - "name": "AUDIT_LOG_ENABLED", - "value": "1" - }, - { - "name": "AWS_STORAGE_BUCKET_NAME", - "value": "egov-s3-assets-10bedicu" - }, - { - "name": "CSRF_TRUSTED_ORIGINS", - "value": "[\"http://care-django-staging\", \"https://care.coronasafe.in\", \"https://careapi.coronasafe.in\", \"https://care.ohc.network\", \"https://careapi.ohc.network\"]" - }, - { - "name": "CURRENT_DOMAIN", - "value": "https://care.ohc.network" - }, - { - "name": "BACKEND_DOMAIN", - "value": "https://careapi.ohc.network" - }, - { - "name": "DJANGO_ADMIN_URL", - "value": "w8BYTTYRkxqAsbS2iU9Yd2ZgQy6D3uws" - }, - { - "name": "DJANGO_ALLOWED_HOSTS", - "value": "[\"care-django-staging\", \"care.coronasafe.in\", \"careapi.coronasafe.in\", \"care.ohc.network\", \"careapi.ohc.network\"]" - }, - { - "name": "DJANGO_SECURE_SSL_REDIRECT", - "value": "False" - }, - { - "name": "DJANGO_SETTINGS_MODULE", - "value": "config.settings.staging" - }, - { - "name": "EMAIL_FROM", - "value": "Open Healthcare Network " - }, - { - "name": "EMAIL_HOST", - "value": "email-smtp.ap-south-1.amazonaws.com" - }, - { - "name": "FACILITY_S3_BUCKET", - "value": "egov-s3-facility-10bedicu" - }, - { - "name": "FACILITY_S3_BUCKET_ENDPOINT", - "value": "https://egov-s3-facility-10bedicu.s3.amazonaws.com" - }, - { - "name": "FILE_UPLOAD_BUCKET", - "value": "egov-s3-patient-data-10bedicu" - }, - { - "name": "FILE_UPLOAD_BUCKET_ENDPOINT", - "value": "https://egov-s3-patient-data-10bedicu.s3.amazonaws.com" - }, - { - "name": "MAINTENANCE_MODE", - "value": "0" - }, - { - "name": "POSTGRES_DB", - "value": "care_staging" - }, - { - "name": "POSTGRES_USER", - "value": "postgres" - }, - { - "name": "RATE_LIMIT", - "value": "5/10m" - }, - { - "name": "USE_S3", - "value": "True" - }, - { - "name": "ABDM_GATEWAY_URL", - "value": "https://dev.abdm.gov.in" - }, - { - "name": "ABDM_ABHA_URL", - "value": "https://abhasbx.abdm.gov.in" - }, - { - "name": "ABDM_FACILITY_URL", - "value": "https://facilitysbx.abdm.gov.in" - }, - { - "name": "ABDM_CM_ID", - "value": "sbx" - }, - { - "name": "SENTRY_TRACES_SAMPLE_RATE", - "value": "1.0" - }, - { - "name": "SENTRY_PROFILES_SAMPLE_RATE", - "value": "1.0" - }, - { - "name": "SENTRY_ENVIRONMENT", - "value": "staging" - } - ], - "repositoryCredentials": { - "credentialsParameter": "arn:aws:secretsmanager:ap-south-1:299650323339:secret:/github/pat-UHmr0B" - }, - "workingDirectory": "/app", - "secrets": [ - { - "valueFrom": "/care/backend/POSTGRES_PORT", - "name": "POSTGRES_PORT" - }, - { - "valueFrom": "/care/backend/POSTGRES_HOST", - "name": "POSTGRES_HOST" - }, - { - "valueFrom": "/care/backend/POSTGRES_PASSWORD", - "name": "POSTGRES_PASSWORD" - }, - { - "valueFrom": "/care/backend/DATABASE_URL", - "name": "DATABASE_URL" - }, - { - "valueFrom": "/care/backend/SENTRY_DSN", - "name": "SENTRY_DSN" - }, - { - "valueFrom": "/care/backend/DJANGO_SECRET_KEY", - "name": "DJANGO_SECRET_KEY" - }, - { - "valueFrom": "/care/backend/AWS_ACCESS_KEY_ID", - "name": "AWS_ACCESS_KEY_ID" - }, - { - "valueFrom": "/care/backend/AWS_SECRET_ACCESS_KEY", - "name": "AWS_SECRET_ACCESS_KEY" - }, - { - "valueFrom": "/care/backend/CELERY_BROKER_URL", - "name": "CELERY_BROKER_URL" - }, - { - "valueFrom": "/care/backend/CELERY_BROKER_URL", - "name": "REDIS_URL" - }, - { - "valueFrom": "/care/backend/EMAIL_USER", - "name": "EMAIL_USER" - }, - { - "valueFrom": "/care/backend/EMAIL_PASSWORD", - "name": "EMAIL_PASSWORD" - }, - { - "valueFrom": "/care/backend/SNS_ACCESS_KEY", - "name": "SNS_ACCESS_KEY" - }, - { - "valueFrom": "/care/backend/SNS_SECRET_KEY", - "name": "SNS_SECRET_KEY" - }, - { - "valueFrom": "/care/backend/FILE_UPLOAD_KEY", - "name": "FILE_UPLOAD_KEY" - }, - { - "valueFrom": "/care/backend/FILE_UPLOAD_SECRET", - "name": "FILE_UPLOAD_SECRET" - }, - { - "valueFrom": "/care/backend/GOOGLE_RECAPTCHA_SITE_KEY", - "name": "GOOGLE_RECAPTCHA_SITE_KEY" - }, - { - "valueFrom": "/care/backend/GOOGLE_RECAPTCHA_SECRET_KEY", - "name": "GOOGLE_RECAPTCHA_SECRET_KEY" - }, - { - "valueFrom": "/care/backend/FACILITY_S3_KEY", - "name": "FACILITY_S3_KEY" - }, - { - "valueFrom": "/care/backend/FACILITY_S3_SECRET", - "name": "FACILITY_S3_SECRET" - }, - { - "valueFrom": "/care/backend/VAPID_PUBLIC_KEY", - "name": "VAPID_PUBLIC_KEY" - }, - { - "valueFrom": "/care/backend/VAPID_PRIVATE_KEY", - "name": "VAPID_PRIVATE_KEY" - }, - { - "valueFrom": "/care/backend/HCX_PROTOCOL_BASE_PATH", - "name": "HCX_PROTOCOL_BASE_PATH" - }, - { - "valueFrom": "/care/backend/HCX_PARTICIPANT_CODE", - "name": "HCX_PARTICIPANT_CODE" - }, - { - "valueFrom": "/care/backend/HCX_AUTH_BASE_PATH", - "name": "HCX_AUTH_BASE_PATH" - }, - { - "valueFrom": "/care/backend/HCX_USERNAME", - "name": "HCX_USERNAME" - }, - { - "valueFrom": "/care/backend/HCX_PASSWORD", - "name": "HCX_PASSWORD" - }, - { - "valueFrom": "/care/backend/HCX_ENCRYPTION_PRIVATE_KEY_URL", - "name": "HCX_ENCRYPTION_PRIVATE_KEY_URL" - }, - { - "valueFrom": "/care/backend/HCX_IG_URL", - "name": "HCX_IG_URL" - }, - { - "valueFrom": "/care/backend/HCX_CERT_URL", - "name": "HCX_CERT_URL" - }, - { - "valueFrom": "/care/backend/ABDM_CLIENT_ID", - "name": "ABDM_CLIENT_ID" - }, - { - "valueFrom": "/care/backend/ABDM_CLIENT_SECRET", - "name": "ABDM_CLIENT_SECRET" - }, - { - "valueFrom": "/care/backend/JWKS_BASE64", - "name": "JWKS_BASE64" - } - ], - "name": "care-celery-worker" - } - ], - "memory": "2048", - "taskRoleArn": "arn:aws:iam::299650323339:role/ecsTaskExecutionRole", - "family": "care-celery", - "requiresCompatibilities": [ - "FARGATE" - ], - "networkMode": "awsvpc", - "cpu": "512", - "volumes": [] -} From 9116a30d64f4604f51645f8438b6eb5064bc5cef Mon Sep 17 00:00:00 2001 From: Vysakh Premkumar <84713473+tellmeY18@users.noreply.github.com> Date: Tue, 14 Jan 2025 23:17:02 +0530 Subject: [PATCH 2/2] Coderabbit updates --- .github/workflows/deploy.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2cae4314ad..712adc415e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: tags: - - 'v*' + - "v*" branches: - develop paths-ignore: @@ -124,8 +124,6 @@ jobs: run: | echo "Release ${{ github.sha }} is ready to be deployed to production" - - deploy-staging-egov: needs: build if: github.ref == 'refs/heads/develop' @@ -148,11 +146,15 @@ jobs: IMAGE_TAG: latest-${{ github.run_number }} run: echo "IMAGE_VALUE=`echo ghcr.io/${{ github.repository }}:$IMAGE_TAG`" >> $GITHUB_ENV - - name: Download task definition for Celery Service run: | - aws ecs describe-task-definition --task-definition ${{ env.ECS_SERVICE_CELERY }} --query taskDefinition > celery-task-definition.json - + set -e + if aws ecs describe-task-definition --task-definition ${{ env.ECS_SERVICE_CELERY }} --query taskDefinition > celery-task-definition.json; then + echo "Successfully downloaded Celery task definition." + else + echo "Failed to download Celery task definition." >&2 + exit 1 + fi - name: Fill in the new image ID in the Celery task definition id: celery-task-def @@ -172,8 +174,13 @@ jobs: - name: Download task definition for Backend Service run: | - aws ecs describe-task-definition --task-definition ${{ env.ECS_SERVICE_BACKEND }} --query taskDefinition > backend-task-definition.json - + set -e + if aws ecs describe-task-definition --task-definition ${{ env.ECS_SERVICE_BACKEND }} --query taskDefinition > backend-task-definition.json; then + echo "Successfully downloaded Backend task definition." + else + echo "Failed to download Backend task definition." >&2 + exit 1 + fi - name: Fill in the new image ID in the Backend task definition id: backend-task-def uses: aws-actions/amazon-ecs-render-task-definition@v1