Documentation Index

Fetch the complete documentation index at: https://supporthub.usheru.com/llms.txt

Use this file to discover all available pages before exploring further.

usheru geo-locator Deployment

Prev Next

The geo-locator service resides under the usheru-common account. We use a deployment pipeline that picks any commit in the main/master branch of the usheru-geocoder Github repo. 

 

The pipeline picks up the lastest code and stores as source artifact in a S3 bucket. The build stage creates a dummy docker image in a linux environment. This stage is for checking syntax and vulnerabilities, if any, in the docker and buildspec files. If the pipline fails in this stage, we can check the logs under Code Build service. 

 

Once this stage is completed the pipeline moves into Deploy stage where it tries to deploy 2 new tasks under the usheru-geolocator cluster in ECS(Elastic Container Service). The build stage puts it output as Build Artifact in the same S3 bucket, this is a json file pointing to the latest docker images deployed in Elastic Container Registry(ECR). This new json file is used to create a new task definition in ECS which in turn deploys new tasks under the geo-locator cluster. 

 

Under ECS(Elastic Container Service) we use the Fargate option which is a serverless option, i.e., the server is managed by AWS and it scales down and up as per API reuests coming in. These tasks have a private IP which are registered as targets for the Application Load Balancer(ALB). The ALB endpoint is registered as an orign for a Cloudfront Distribution. The cloudfront distribution with active edge locations makes the API more efficient and improves the timing. We also implement the CORS policy using a Cloudfront Function during 'Viewer Response' time. The distribution ID is registered as CNAME record for geo.usheru.com(Route 53 in usheru-common account)

 

On-boarding new clients - 

When we onboard a new client we need to add their production domain for the CORS to work, else there will be a CORS error. We have a Cloudfront function associated with the distribution for geo.usheru.com. We need to add the client's domain to the list of 'acceptedDomains'. Save changes and publish the function. The changes take place instantly and geo.usheru.com can be used on new client's domain now. 

AWS account - usheru-common