{"id":17114479,"url":"https://github.com/anthonychu/20240809-aca-async-http-api","last_synced_at":"2026-01-04T09:51:35.283Z","repository":{"id":252901029,"uuid":"841839701","full_name":"anthonychu/20240809-aca-async-http-api","owner":"anthonychu","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-13T07:29:15.000Z","size":25,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T06:47:16.904Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anthonychu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-13T06:33:20.000Z","updated_at":"2024-11-05T00:12:55.000Z","dependencies_parsed_at":"2024-08-13T07:57:51.966Z","dependency_job_id":null,"html_url":"https://github.com/anthonychu/20240809-aca-async-http-api","commit_stats":null,"previous_names":["anthonychu/20240809-aca-async-http-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonychu%2F20240809-aca-async-http-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonychu%2F20240809-aca-async-http-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonychu%2F20240809-aca-async-http-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonychu%2F20240809-aca-async-http-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anthonychu","download_url":"https://codeload.github.com/anthonychu/20240809-aca-async-http-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245186374,"owners_count":20574549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T17:17:18.886Z","updated_at":"2026-01-04T09:51:35.237Z","avatar_url":"https://github.com/anthonychu.png","language":"HTML","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"## Deployment script\n\n```bash\nexport RESOURCE_GROUP_NAME=aca-async-http-api\nexport SUBSCRIPTION_ID=$(az account show --query id --output tsv)\nexport JOB_NAME=processor-job\nCOSMOS_DB_ACCOUNT_NAME=aca-async-http-api\nENVIRONMENT_NAME=aca-async-http-api\nAPP_NAME=http-api\nACR_NAME=acaasynchttpapi\nLOCATION=westus\n\naz group create --name $RESOURCE_GROUP_NAME --location $LOCATION\n\n# Create a Cosmos DB account (serverless)\naz cosmosdb create --name $COSMOS_DB_ACCOUNT_NAME --resource-group $RESOURCE_GROUP_NAME --capabilities EnableServerless\n\naz cosmosdb sql database create --account-name $COSMOS_DB_ACCOUNT_NAME --name async-api --resource-group $RESOURCE_GROUP_NAME\n\naz cosmosdb sql container create --account-name $COSMOS_DB_ACCOUNT_NAME --database-name async-api --name statuses --partition-key-path /id --resource-group $RESOURCE_GROUP_NAME\n\n# assign role to the current user\naz cosmosdb sql role assignment create --account-name $COSMOS_DB_ACCOUNT_NAME --role-definition-name \"Cosmos DB Built-in Data Contributor\" --resource-group $RESOURCE_GROUP_NAME --scope /dbs/async-api --principal-id $(az ad signed-in-user show --query id --output tsv)\n\nexport COSMOSDB_ENDPOINT=$(az cosmosdb show --name $COSMOS_DB_ACCOUNT_NAME --resource-group $RESOURCE_GROUP_NAME --query documentEndpoint --output tsv)\n\n# create Container Apps environment\naz containerapp env create -n $ENVIRONMENT_NAME -g $RESOURCE_GROUP_NAME -l $LOCATION --mi-system-assigned\n\n# create a registry\naz acr create --name $ACR_NAME --resource-group $RESOURCE_GROUP_NAME --location $LOCATION --sku Basic\n\n# build and push the image\naz acr build --registry $ACR_NAME --image aca-async-http-api:1.0 .\n\n# assign acrPull role to the environment's system-assigned identity\naz role assignment create --role acrpull --assignee $(az containerapp env show -n $ENVIRONMENT_NAME -g $RESOURCE_GROUP_NAME --query identity.principalId --output tsv) --scope $(az acr show -n $ACR_NAME -g $RESOURCE_GROUP_NAME --query id --output tsv)\n\n# create a user-assigned identity\naz identity create -n \"$ENVIRONMENT_NAME-identity\" -g $RESOURCE_GROUP_NAME\n\nUSER_IDENTITY_PRINCIPAL_ID=$(az identity show -n \"$ENVIRONMENT_NAME-identity\" -g $RESOURCE_GROUP_NAME --query principalId --output tsv)\n\nUSER_IDENTITY_ID=$(az identity show -n \"$ENVIRONMENT_NAME-identity\" -g $RESOURCE_GROUP_NAME --query id --output tsv)\n\nUSER_IDENTITY_CLIENT_ID=$(az identity show -n \"$ENVIRONMENT_NAME-identity\" -g $RESOURCE_GROUP_NAME --query clientId --output tsv)\n\n# assign acrPull role to the user-assigned identity\naz role assignment create --role acrpull --assignee-object-id $USER_IDENTITY_PRINCIPAL_ID --assignee-principal-type ServicePrincipal --scope $(az acr show -n $ACR_NAME -g $RESOURCE_GROUP_NAME --query id --output tsv)\n\naz cosmosdb sql role assignment create --account-name $COSMOS_DB_ACCOUNT_NAME --role-definition-name \"Cosmos DB Built-in Data Contributor\" --resource-group $RESOURCE_GROUP_NAME --scope /dbs/async-api --principal-id $USER_IDENTITY_PRINCIPAL_ID\n\naz containerapp job create -n $JOB_NAME -g $RESOURCE_GROUP_NAME --environment $ENVIRONMENT_NAME --image $ACR_NAME.azurecr.io/aca-async-http-api:1.0 --command 'npm' 'run' 'start:job' --cpu 0.5 --memory 1Gi --env-vars \"COSMOSDB_ENDPOINT=$COSMOSDB_ENDPOINT\" \"AZURE_CLIENT_ID=$USER_IDENTITY_CLIENT_ID\" --trigger-type Manual --registry-identity $USER_IDENTITY_ID --registry-server $ACR_NAME.azurecr.io --mi-user-assigned $USER_IDENTITY_ID\n\naz containerapp create -n $APP_NAME -g $RESOURCE_GROUP_NAME --environment $ENVIRONMENT_NAME --image $ACR_NAME.azurecr.io/aca-async-http-api:1.0 --cpu 0.5 --memory 1Gi --env-vars \"COSMOSDB_ENDPOINT=$COSMOSDB_ENDPOINT\" \"AZURE_CLIENT_ID=$USER_IDENTITY_CLIENT_ID\" \"SUBSCRIPTION_ID=$SUBSCRIPTION_ID\" \"RESOURCE_GROUP_NAME=$RESOURCE_GROUP_NAME\" \"JOB_NAME=$JOB_NAME\" --registry-identity $USER_IDENTITY_ID --registry-server $ACR_NAME.azurecr.io  --user-assigned $USER_IDENTITY_ID --ingress external --target-port 3000\n\n# give the user-assigned identity the contributor role to the job so it can start the job\naz role assignment create --role \"Contributor\" --assignee-object-id $USER_IDENTITY_PRINCIPAL_ID --assignee-principal-type ServicePrincipal --scope $(az containerapp job show -n $JOB_NAME -g $RESOURCE_GROUP_NAME --query id --output tsv)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonychu%2F20240809-aca-async-http-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanthonychu%2F20240809-aca-async-http-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonychu%2F20240809-aca-async-http-api/lists"}