<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ohcnwiki.tellmey.fyi/index.php?action=history&amp;feed=atom&amp;title=Deployment%2FProviders%2FAws%2FDeploying_Care_on_AWS_ECS</id>
	<title>Deployment/Providers/Aws/Deploying Care on AWS ECS - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://ohcnwiki.tellmey.fyi/index.php?action=history&amp;feed=atom&amp;title=Deployment%2FProviders%2FAws%2FDeploying_Care_on_AWS_ECS"/>
	<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=Deployment/Providers/Aws/Deploying_Care_on_AWS_ECS&amp;action=history"/>
	<updated>2026-07-06T07:15:30Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.4</generator>
	<entry>
		<id>https://ohcnwiki.tellmey.fyi/index.php?title=Deployment/Providers/Aws/Deploying_Care_on_AWS_ECS&amp;diff=366&amp;oldid=prev</id>
		<title>Admin: Add Navbox deployment template before Related (via update-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=Deployment/Providers/Aws/Deploying_Care_on_AWS_ECS&amp;diff=366&amp;oldid=prev"/>
		<updated>2026-07-06T03:59:55Z</updated>

		<summary type="html">&lt;p&gt;Add Navbox deployment template before Related (via update-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:29, 6 July 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 324:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 324:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &#039;&#039;&#039;Netlify&#039;&#039;&#039;: Another static site hosting service that supports automatic deployments from GitHub repositories. See [&amp;lt;nowiki/&amp;gt;https://docs.netlify.com/site-deploys/deploy-previews Netlify deploy previews] for how to deploy preview builds of the frontend.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &#039;&#039;&#039;Netlify&#039;&#039;&#039;: Another static site hosting service that supports automatic deployments from GitHub repositories. See [&amp;lt;nowiki/&amp;gt;https://docs.netlify.com/site-deploys/deploy-previews Netlify deploy previews] for how to deploy preview builds of the frontend.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &#039;&#039;&#039;Vercel&#039;&#039;&#039;: Another static site hosting service that supports automatic deployments from GitHub repositories. See [&amp;lt;nowiki/&amp;gt;https://vercel.com/docs/concepts/deployments/previews Vercel preview deployments] for how to deploy preview builds of the frontend.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &#039;&#039;&#039;Vercel&#039;&#039;&#039;: Another static site hosting service that supports automatic deployments from GitHub repositories. See [&amp;lt;nowiki/&amp;gt;https://vercel.com/docs/concepts/deployments/previews Vercel preview deployments] for how to deploy preview builds of the frontend.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Navbox deployment}}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Related}}&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Related}}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-207:rev-366:wikidiff2=table:1.14.2:bc2a06be --&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://ohcnwiki.tellmey.fyi/index.php?title=Deployment/Providers/Aws/Deploying_Care_on_AWS_ECS&amp;diff=207&amp;oldid=prev</id>
		<title>Admin: OHC identity seed</title>
		<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=Deployment/Providers/Aws/Deploying_Care_on_AWS_ECS&amp;diff=207&amp;oldid=prev"/>
		<updated>2026-07-04T23:08:04Z</updated>

		<summary type="html">&lt;p&gt;OHC identity seed&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Doc header&lt;br /&gt;
|type=guide&lt;br /&gt;
|domain=deployment&lt;br /&gt;
|title=Deploying Care on AWS ECS&lt;br /&gt;
|order=2&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This guide walks through deploying Care on AWS using &amp;#039;&amp;#039;&amp;#039;Elastic Container Service (ECS)&amp;#039;&amp;#039;&amp;#039; with the &amp;#039;&amp;#039;&amp;#039;Fargate&amp;#039;&amp;#039;&amp;#039; serverless launch type. ECS runs the backend, Celery, and Redis containers as serverless tasks, so there are no EC2 instances to provision or manage yourself.&lt;br /&gt;
&lt;br /&gt;
For an overview of the AWS deployment, see the [[Index|AWS overview]].&lt;br /&gt;
&lt;br /&gt;
== Infrastructure ==&lt;br /&gt;
&lt;br /&gt;
Provision the supporting AWS infrastructure first, then create the ECS cluster and services that run the application containers.&lt;br /&gt;
&lt;br /&gt;
=== Configuring the Virtual Private Cloud (VPC) ===&lt;br /&gt;
&lt;br /&gt;
# Access the &amp;#039;&amp;#039;&amp;#039;AWS Console&amp;#039;&amp;#039;&amp;#039; and locate the &amp;#039;&amp;#039;&amp;#039;VPC&amp;#039;&amp;#039;&amp;#039; service.&lt;br /&gt;
# Initiate the creation of a new VPC by selecting the &amp;#039;&amp;#039;&amp;#039;VPC and more&amp;#039;&amp;#039;&amp;#039; option and name it &amp;lt;code&amp;gt;care-vpc&amp;lt;/code&amp;gt;. This action will automatically generate a new VPC, along with associated subnets, route tables, and internet gateways.&lt;br /&gt;
# The default settings will be applied automatically, but you can modify these according to your specific requirements.&lt;br /&gt;
# Ensure that the &amp;#039;&amp;#039;&amp;#039;Internet Gateway&amp;#039;&amp;#039;&amp;#039; is attached to the VPC to enable external communication.&lt;br /&gt;
&lt;br /&gt;
=== Configuring the Relational Database Service (RDS) ===&lt;br /&gt;
&lt;br /&gt;
# From the &amp;#039;&amp;#039;&amp;#039;AWS Console&amp;#039;&amp;#039;&amp;#039;, navigate to the &amp;#039;&amp;#039;&amp;#039;RDS&amp;#039;&amp;#039;&amp;#039; service.&lt;br /&gt;
# Create a new database instance using the &amp;lt;code&amp;gt;PostgreSQL&amp;lt;/code&amp;gt; engine.&lt;br /&gt;
# Assign the &amp;#039;&amp;#039;&amp;#039;DB cluster identifier&amp;#039;&amp;#039;&amp;#039; as &amp;lt;code&amp;gt;care-db&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Set the &amp;#039;&amp;#039;&amp;#039;Credential management&amp;#039;&amp;#039;&amp;#039; as &amp;lt;code&amp;gt;Self managed&amp;lt;/code&amp;gt; and provide the master username and password.&lt;br /&gt;
# Set the &amp;#039;&amp;#039;&amp;#039;Availability Zone&amp;#039;&amp;#039;&amp;#039; as per requirement.&lt;br /&gt;
# Configure the database instance size and storage capacity as needed.&lt;br /&gt;
# Use the same &amp;#039;&amp;#039;&amp;#039;VPC&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;subnet group&amp;#039;&amp;#039;&amp;#039; that was created earlier.&lt;br /&gt;
# Configure the &amp;#039;&amp;#039;&amp;#039;security group&amp;#039;&amp;#039;&amp;#039; to allow inbound traffic on port &amp;lt;code&amp;gt;5432&amp;lt;/code&amp;gt; from all sources. &amp;#039;&amp;#039;(This can be restricted to the VPC to enhance security.)&amp;#039;&amp;#039;&lt;br /&gt;
# Set &amp;#039;&amp;#039;&amp;#039;Public accessibility&amp;#039;&amp;#039;&amp;#039; to &amp;lt;code&amp;gt;No&amp;lt;/code&amp;gt; to restrict access to the database from the internet.&lt;br /&gt;
&lt;br /&gt;
=== Configuring the S3 Bucket ===&lt;br /&gt;
&lt;br /&gt;
# Locate the &amp;#039;&amp;#039;&amp;#039;S3&amp;#039;&amp;#039;&amp;#039; service in the &amp;#039;&amp;#039;&amp;#039;AWS Console&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
# Create two new buckets named &amp;lt;code&amp;gt;facility-data&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;patient-data&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Adjust the &amp;#039;&amp;#039;&amp;#039;permissions&amp;#039;&amp;#039;&amp;#039; settings for each bucket:&lt;br /&gt;
#* Set &amp;lt;code&amp;gt;facility-data&amp;lt;/code&amp;gt; to &amp;#039;&amp;#039;&amp;#039;public&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
#* Set &amp;lt;code&amp;gt;patient-data&amp;lt;/code&amp;gt; to &amp;#039;&amp;#039;&amp;#039;private&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
# Configure the &amp;#039;&amp;#039;&amp;#039;CORS policy&amp;#039;&amp;#039;&amp;#039; for both buckets to restrict access to specific domains after deployment.&lt;br /&gt;
&lt;br /&gt;
=== Setting Up IAM Roles ===&lt;br /&gt;
&lt;br /&gt;
# Navigate to the &amp;#039;&amp;#039;&amp;#039;IAM&amp;#039;&amp;#039;&amp;#039; service in the &amp;#039;&amp;#039;&amp;#039;AWS Console&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
# Create a user named &amp;lt;code&amp;gt;gh-action&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Assign the necessary permissions required to run the deployment commands.&lt;br /&gt;
# Generate access keys and secrets for the user and store them securely.&lt;br /&gt;
&lt;br /&gt;
{{Tip|1=The &amp;lt;code&amp;gt;gh-action&amp;lt;/code&amp;gt; user&amp;#039;s access key and secret are used by the GitHub Actions pipeline as the &amp;lt;code&amp;gt;AWS_ACCESS_KEY_ID&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AWS_SECRET_ACCESS_KEY&amp;lt;/code&amp;gt; secrets. Store them securely and grant only the permissions required for the deployment.}}&lt;br /&gt;
&lt;br /&gt;
=== Setting Up the Load Balancer ===&lt;br /&gt;
&lt;br /&gt;
# Access the &amp;#039;&amp;#039;&amp;#039;Load Balancer&amp;#039;&amp;#039;&amp;#039; service in the &amp;#039;&amp;#039;&amp;#039;AWS Console&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
# Create a new load balancer named &amp;lt;code&amp;gt;care-lb&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Configure the load balancer to use the &amp;#039;&amp;#039;&amp;#039;VPC&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;subnets&amp;#039;&amp;#039;&amp;#039; created earlier.&lt;br /&gt;
# Configure the &amp;#039;&amp;#039;&amp;#039;security group&amp;#039;&amp;#039;&amp;#039; to allow inbound traffic on the required ports.&lt;br /&gt;
# Set up the &amp;#039;&amp;#039;&amp;#039;listener configuration&amp;#039;&amp;#039;&amp;#039; to forward traffic to the &amp;#039;&amp;#039;&amp;#039;target group&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
=== Setting Up the ECS Cluster ===&lt;br /&gt;
&lt;br /&gt;
# Access the &amp;#039;&amp;#039;&amp;#039;ECS&amp;#039;&amp;#039;&amp;#039; service in the &amp;#039;&amp;#039;&amp;#039;AWS Console&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
# Create a new cluster named &amp;lt;code&amp;gt;care-cluster&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Choose &amp;#039;&amp;#039;&amp;#039;Fargate (Serverless)&amp;#039;&amp;#039;&amp;#039; as the launch type.&lt;br /&gt;
# Create &amp;#039;&amp;#039;&amp;#039;service and task definitions&amp;#039;&amp;#039;&amp;#039; for the backend, Celery, and Redis Stack Server.&lt;br /&gt;
# Create a new &amp;#039;&amp;#039;&amp;#039;service&amp;#039;&amp;#039;&amp;#039; for each task definition and configure the desired number of tasks to run.&lt;br /&gt;
# In the &amp;#039;&amp;#039;&amp;#039;Networking&amp;#039;&amp;#039;&amp;#039; tab, select the &amp;#039;&amp;#039;&amp;#039;VPC&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;subnets&amp;#039;&amp;#039;&amp;#039; created earlier.&lt;br /&gt;
# Configure the &amp;#039;&amp;#039;&amp;#039;security group&amp;#039;&amp;#039;&amp;#039; to allow inbound traffic on the required ports.&lt;br /&gt;
# Ensure that the service is linked to the &amp;#039;&amp;#039;&amp;#039;load balancer&amp;#039;&amp;#039;&amp;#039; created earlier.&lt;br /&gt;
&lt;br /&gt;
=== Cost Estimate Table ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Resource&lt;br /&gt;
! Instance Type&lt;br /&gt;
! Region&lt;br /&gt;
! Monthly Cost (INR)&lt;br /&gt;
! Cost Estimation Methodology&lt;br /&gt;
|-&lt;br /&gt;
| ECS Cluster&lt;br /&gt;
| Fargate&lt;br /&gt;
| ap-south-1&lt;br /&gt;
| ~₹4000.00&lt;br /&gt;
| Estimated based on Fargate pricing for minimal usage&lt;br /&gt;
|-&lt;br /&gt;
| RDS Instance&lt;br /&gt;
| db.t2.micro&lt;br /&gt;
| ap-south-1&lt;br /&gt;
| ~₹1245.00&lt;br /&gt;
| Estimated for a single instance with minimal usage&lt;br /&gt;
|-&lt;br /&gt;
| S3 Bucket&lt;br /&gt;
| 20 GB Storage&lt;br /&gt;
| ap-south-1&lt;br /&gt;
| ~₹38.00&lt;br /&gt;
| Calculated for 20 GB of standard storage&lt;br /&gt;
|-&lt;br /&gt;
| Load Balancer&lt;br /&gt;
| ALB&lt;br /&gt;
| ap-south-1&lt;br /&gt;
| ~₹1500.00&lt;br /&gt;
| Estimated based on ALB pricing&lt;br /&gt;
|-&lt;br /&gt;
| Data Transfer&lt;br /&gt;
| 10 GB Outbound&lt;br /&gt;
| ap-south-1&lt;br /&gt;
| ~₹74.00&lt;br /&gt;
| Estimated for 10 GB of outbound data transfer&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;&amp;#039;Total&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| ~₹6857.00&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Note|1=The estimated cost for deploying the &amp;#039;&amp;#039;&amp;#039;Care&amp;#039;&amp;#039;&amp;#039; application on &amp;#039;&amp;#039;&amp;#039;AWS&amp;#039;&amp;#039;&amp;#039; using &amp;#039;&amp;#039;&amp;#039;ECS&amp;#039;&amp;#039;&amp;#039; may vary based on actual usage and traffic patterns.}}&lt;br /&gt;
&lt;br /&gt;
== GitHub Actions pipeline ==&lt;br /&gt;
&lt;br /&gt;
The GitHub workflow file is triggered on every manual trigger, push to the &amp;lt;code&amp;gt;develop&amp;lt;/code&amp;gt; branch, or tags starting with &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt;. It builds the new container image upon the trigger and updates the task definition in the ECS cluster. This ensures that the latest image is deployed to the ECS cluster.&lt;br /&gt;
&lt;br /&gt;
The image is built from &amp;lt;code&amp;gt;docker/prod.Dockerfile&amp;lt;/code&amp;gt; and pushed to both the GitHub Container Registry (&amp;lt;code&amp;gt;ghcr.io&amp;lt;/code&amp;gt;) and Docker Hub. The deploy job then renders the task definitions at &amp;lt;code&amp;gt;./aws/backend.json&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;./aws/celery.json&amp;lt;/code&amp;gt; with the new image and rolls them out to the ECS services.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;yaml&amp;quot;&amp;gt;name: Deploy Care&lt;br /&gt;
&lt;br /&gt;
on:&lt;br /&gt;
  workflow_dispatch:&lt;br /&gt;
  push:&lt;br /&gt;
    tags:&lt;br /&gt;
      - &amp;#039;v*&amp;#039;&lt;br /&gt;
    branches:&lt;br /&gt;
      - develop&lt;br /&gt;
    paths-ignore:&lt;br /&gt;
      - &amp;quot;docs/**&amp;quot;&lt;br /&gt;
&lt;br /&gt;
concurrency:&lt;br /&gt;
  group: ${{ github.workflow }}-${{ github.ref }}&lt;br /&gt;
  cancel-in-progress: true&lt;br /&gt;
&lt;br /&gt;
env:&lt;br /&gt;
  IMAGE_NAME: care&lt;br /&gt;
  AWS_DEFAULT_REGION: ap-south-1&lt;br /&gt;
  AWS_DEFAULT_OUTPUT: json&lt;br /&gt;
  AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} # AWS Access Key ID for authentication&lt;br /&gt;
  AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # AWS Secret Access Key for authentication&lt;br /&gt;
  ECS_SERVICE_BACKEND: &amp;quot;care-backend&amp;quot; # ECS service name for the backend&lt;br /&gt;
  ECS_SERVICE_CELERY: &amp;quot;care-celery&amp;quot; # ECS service name for Celery&lt;br /&gt;
  ECS_CLUSTER: &amp;quot;example_cluster&amp;quot; # Name of the ECS cluster&lt;br /&gt;
  ECS_TASK_DEFINITION_BACKEND: &amp;quot;./aws/backend.json&amp;quot; # Path to the backend task definition&lt;br /&gt;
  ECS_TASK_DEFINITION_CELERY: &amp;quot;./aws/celery.json&amp;quot; # Path to the Celery task definition&lt;br /&gt;
  CONTAINER_NAME_BACKEND: &amp;quot;care-backend&amp;quot; # Container name for the backend&lt;br /&gt;
  CONTAINER_NAME_WORKER: &amp;quot;care-celery-worker&amp;quot; # Container name for the Celery worker&lt;br /&gt;
  CONTAINER_NAME_CRON: &amp;quot;care-celery-beat&amp;quot; # Container name for the Celery beat&lt;br /&gt;
&lt;br /&gt;
jobs:&lt;br /&gt;
  build:&lt;br /&gt;
    name: Build &amp;amp; Push to container registries&lt;br /&gt;
    runs-on: ubuntu-latest&lt;br /&gt;
    steps:&lt;br /&gt;
      - name: Checkout repository&lt;br /&gt;
        uses: actions/checkout@v4&lt;br /&gt;
&lt;br /&gt;
      - name: Generate docker tags&lt;br /&gt;
        id: meta&lt;br /&gt;
        uses: docker/metadata-action@v5&lt;br /&gt;
        with:&lt;br /&gt;
          images: |&lt;br /&gt;
            ghcr.io/${{ github.repository }}&lt;br /&gt;
            ${{ secrets.DOCKER_HUB_USERNAME }}/${{ github.event.repository.name }}&lt;br /&gt;
          tags: |&lt;br /&gt;
            type=raw,value=production-latest,enable=${{ startsWith(github.event.ref, &amp;#039;refs/tags/v&amp;#039;) }}&lt;br /&gt;
            type=raw,value=production-latest-${{ github.run_number }}-{{date &amp;#039;YYYYMMDD&amp;#039;}}-{{sha}},enable=${{ startsWith(github.event.ref, &amp;#039;refs/tags/v&amp;#039;) }}&lt;br /&gt;
            type=raw,value=latest,enable=${{ github.ref == &amp;#039;refs/heads/develop&amp;#039; }}&lt;br /&gt;
            type=raw,value=latest-${{ github.run_number }},enable=${{ github.ref == &amp;#039;refs/heads/develop&amp;#039; }}&lt;br /&gt;
            type=semver,pattern={{version}}&lt;br /&gt;
          flavor: latest=false&lt;br /&gt;
&lt;br /&gt;
      - name: Setup QEMU&lt;br /&gt;
        uses: docker/setup-qemu-action@v3&lt;br /&gt;
&lt;br /&gt;
      - name: Setup Docker Buildx&lt;br /&gt;
        uses: docker/setup-buildx-action@v3&lt;br /&gt;
&lt;br /&gt;
      - name: Login to DockerHub&lt;br /&gt;
        uses: docker/login-action@v3&lt;br /&gt;
        with:&lt;br /&gt;
          username: ${{ secrets.DOCKER_HUB_USERNAME }} # DockerHub username&lt;br /&gt;
          password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} # DockerHub access token&lt;br /&gt;
&lt;br /&gt;
      - name: Login to GitHub Container Registry&lt;br /&gt;
        uses: docker/login-action@v3&lt;br /&gt;
        with:&lt;br /&gt;
          registry: ghcr.io&lt;br /&gt;
          username: ${{ github.actor }}&lt;br /&gt;
          password: ${{ secrets.GITHUB_TOKEN }} # GitHub token for authentication&lt;br /&gt;
&lt;br /&gt;
      - name: Cache Docker layers&lt;br /&gt;
        uses: actions/cache@v4&lt;br /&gt;
        with:&lt;br /&gt;
          path: /tmp/.buildx-cache&lt;br /&gt;
          key: ${{ runner.os }}-buildx-build-${{ hashFiles(&amp;#039;Pipfile.lock&amp;#039;, &amp;#039;docker/prod.Dockerfile&amp;#039;) }}&lt;br /&gt;
          restore-keys: |&lt;br /&gt;
            ${{ runner.os }}-buildx-build-&lt;br /&gt;
&lt;br /&gt;
      - name: Build and push image&lt;br /&gt;
        uses: docker/build-push-action@v6&lt;br /&gt;
        with:&lt;br /&gt;
          context: .&lt;br /&gt;
          file: docker/prod.Dockerfile&lt;br /&gt;
          push: true&lt;br /&gt;
          provenance: false&lt;br /&gt;
          platforms: linux/amd64,linux/arm64&lt;br /&gt;
          tags: ${{ steps.meta.outputs.tags }}&lt;br /&gt;
          build-args: |&lt;br /&gt;
            APP_VERSION=${{ github.sha }}&lt;br /&gt;
            ADDITIONAL_PLUGS=${{ secrets.ADDITIONAL_PLUGS }} # Additional plugins&lt;br /&gt;
          cache-from: type=local,src=/tmp/.buildx-cache&lt;br /&gt;
          cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max&lt;br /&gt;
&lt;br /&gt;
      - name: Move cache&lt;br /&gt;
        run: |&lt;br /&gt;
          rm -rf /tmp/.buildx-cache&lt;br /&gt;
          mv /tmp/.buildx-cache-new /tmp/.buildx-cache&lt;br /&gt;
&lt;br /&gt;
  deploy:&lt;br /&gt;
    name: Deploy to ECS&lt;br /&gt;
    runs-on: ubuntu-latest&lt;br /&gt;
    environment:&lt;br /&gt;
      name: Deployment-ecs&lt;br /&gt;
      url: https://careapi.example.com&lt;br /&gt;
    steps:&lt;br /&gt;
      - name: Checkout repository&lt;br /&gt;
        uses: actions/checkout@v4&lt;br /&gt;
&lt;br /&gt;
      - name: Configure AWS credentials&lt;br /&gt;
        uses: aws-actions/configure-aws-credentials@v4&lt;br /&gt;
        with:&lt;br /&gt;
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} # AWS Access Key ID for authentication&lt;br /&gt;
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # AWS Secret Access Key for authentication&lt;br /&gt;
          aws-region: ${{ env.AWS_DEFAULT_REGION }}&lt;br /&gt;
&lt;br /&gt;
      - name: IMAGE Tagging&lt;br /&gt;
        env:&lt;br /&gt;
          ECR_REGISTRY: ghcr.io/${{ github.repository }}&lt;br /&gt;
          IMAGE_TAG: latest-${{ github.run_number }}&lt;br /&gt;
        run: echo &amp;quot;IMAGE_VALUE=`echo ghcr.io/${{ github.repository }}:$IMAGE_TAG`&amp;quot; &amp;gt;&amp;gt; $GITHUB_ENV&lt;br /&gt;
&lt;br /&gt;
      - name: Fill Celery Cron definition&lt;br /&gt;
        id: task-def-celery-cron&lt;br /&gt;
        uses: aws-actions/amazon-ecs-render-task-definition@v1&lt;br /&gt;
        with:&lt;br /&gt;
          task-definition: ${{ env.ECS_TASK_DEFINITION_CELERY }}&lt;br /&gt;
          container-name: ${{ env.CONTAINER_NAME_CRON }}&lt;br /&gt;
          image: ${{ env.IMAGE_VALUE }}&lt;br /&gt;
&lt;br /&gt;
      - name: Fill Celery Worker definition&lt;br /&gt;
        id: task-def-celery-worker&lt;br /&gt;
        uses: aws-actions/amazon-ecs-render-task-definition@v1&lt;br /&gt;
        with:&lt;br /&gt;
          task-definition: ${{ steps.task-def-celery-cron.outputs.task-definition }}&lt;br /&gt;
          container-name: ${{ env.CONTAINER_NAME_WORKER }}&lt;br /&gt;
          image: ${{ env.IMAGE_VALUE }}&lt;br /&gt;
&lt;br /&gt;
      - name: Deploy Backend Celery&lt;br /&gt;
        uses: aws-actions/amazon-ecs-deploy-task-definition@v2&lt;br /&gt;
        with:&lt;br /&gt;
          task-definition: ${{ steps.task-def-celery-worker.outputs.task-definition }}&lt;br /&gt;
          service: ${{ env.ECS_SERVICE_CELERY }}&lt;br /&gt;
          cluster: ${{ env.ECS_CLUSTER }}&lt;br /&gt;
          wait-for-service-stability: true&lt;br /&gt;
&lt;br /&gt;
      - name: Fill Backend API definition&lt;br /&gt;
        id: task-def-api&lt;br /&gt;
        uses: aws-actions/amazon-ecs-render-task-definition@v1&lt;br /&gt;
        with:&lt;br /&gt;
          task-definition: ${{ env.ECS_TASK_DEFINITION_BACKEND }}&lt;br /&gt;
          container-name: ${{ env.CONTAINER_NAME_BACKEND }}&lt;br /&gt;
          image: ${{ env.IMAGE_VALUE }}&lt;br /&gt;
&lt;br /&gt;
      - name: Deploy Backend API&lt;br /&gt;
        uses: aws-actions/amazon-ecs-deploy-task-definition@v2&lt;br /&gt;
        with:&lt;br /&gt;
          task-definition: ${{ steps.task-def-api.outputs.task-definition }}&lt;br /&gt;
          service: ${{ env.ECS_SERVICE_BACKEND }}&lt;br /&gt;
          cluster: ${{ env.ECS_CLUSTER }}&lt;br /&gt;
          wait-for-service-stability: true&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== Secrets and Variables Used ===&lt;br /&gt;
&lt;br /&gt;
==== Secrets ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;AWS_ACCESS_KEY_ID&amp;lt;/code&amp;gt;: AWS Access Key ID for authentication&lt;br /&gt;
* &amp;lt;code&amp;gt;AWS_SECRET_ACCESS_KEY&amp;lt;/code&amp;gt;: AWS Secret Access Key for authentication&lt;br /&gt;
* &amp;lt;code&amp;gt;DOCKER_HUB_USERNAME&amp;lt;/code&amp;gt;: DockerHub username&lt;br /&gt;
* &amp;lt;code&amp;gt;DOCKER_HUB_ACCESS_TOKEN&amp;lt;/code&amp;gt;: DockerHub access token&lt;br /&gt;
* &amp;lt;code&amp;gt;GITHUB_TOKEN&amp;lt;/code&amp;gt;: GitHub token for authentication&lt;br /&gt;
* &amp;lt;code&amp;gt;ADDITIONAL_PLUGS&amp;lt;/code&amp;gt;: Additional plugins specified in JSON format to include in the build&lt;br /&gt;
&lt;br /&gt;
==== Variables ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;IMAGE_NAME&amp;lt;/code&amp;gt;: Name of the image to be built&lt;br /&gt;
* &amp;lt;code&amp;gt;AWS_DEFAULT_REGION&amp;lt;/code&amp;gt;: AWS region&lt;br /&gt;
* &amp;lt;code&amp;gt;AWS_DEFAULT_OUTPUT&amp;lt;/code&amp;gt;: AWS output format&lt;br /&gt;
* &amp;lt;code&amp;gt;ECS_SERVICE_BACKEND&amp;lt;/code&amp;gt;: ECS service name for the backend (&amp;lt;code&amp;gt;care-backend&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;ECS_SERVICE_CELERY&amp;lt;/code&amp;gt;: ECS service name for the Celery service (&amp;lt;code&amp;gt;care-celery&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;ECS_CLUSTER&amp;lt;/code&amp;gt;: ECS cluster name (&amp;lt;code&amp;gt;care-cluster&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;ECS_TASK_DEFINITION_BACKEND&amp;lt;/code&amp;gt;: Path to the backend task definition (&amp;lt;code&amp;gt;./aws/backend.json&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;ECS_TASK_DEFINITION_CELERY&amp;lt;/code&amp;gt;: Path to the Celery task definition (&amp;lt;code&amp;gt;./aws/celery.json&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;CONTAINER_NAME_BACKEND&amp;lt;/code&amp;gt;: Container name for the backend (&amp;lt;code&amp;gt;care-backend&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;CONTAINER_NAME_WORKER&amp;lt;/code&amp;gt;: Container name for the Celery worker (&amp;lt;code&amp;gt;care-worker&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;CONTAINER_NAME_CRON&amp;lt;/code&amp;gt;: Container name for the Celery cron (&amp;lt;code&amp;gt;care-cron&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &amp;lt;code&amp;gt;IMAGE_TAG&amp;lt;/code&amp;gt;: Tag for the built image&lt;br /&gt;
* &amp;lt;code&amp;gt;IMAGE_VALUE&amp;lt;/code&amp;gt;: Value of the built image&lt;br /&gt;
&lt;br /&gt;
== Frontend ==&lt;br /&gt;
&lt;br /&gt;
The development deployment for Care relies on ECS for its backend deployment. The API provided by the backend can be used by all development frontends, including localhost and [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care_fe Care_FE] deploy previews.&lt;br /&gt;
&lt;br /&gt;
You can use any of the following methods to deploy the frontend for both production and deployment previews:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Cloudflare Pages&amp;#039;&amp;#039;&amp;#039;: A static site hosting service that supports automatic deployments from GitHub repositories. See [&amp;lt;nowiki/&amp;gt;https://developers.cloudflare.com/pages/configuration/preview-deployments Cloudflare Pages preview deployments] for how to deploy preview builds of the frontend.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Netlify&amp;#039;&amp;#039;&amp;#039;: Another static site hosting service that supports automatic deployments from GitHub repositories. See [&amp;lt;nowiki/&amp;gt;https://docs.netlify.com/site-deploys/deploy-previews Netlify deploy previews] for how to deploy preview builds of the frontend.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Vercel&amp;#039;&amp;#039;&amp;#039;: Another static site hosting service that supports automatic deployments from GitHub repositories. See [&amp;lt;nowiki/&amp;gt;https://vercel.com/docs/concepts/deployments/previews Vercel preview deployments] for how to deploy preview builds of the frontend.&lt;br /&gt;
&lt;br /&gt;
{{Related}}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>