Get images from the Docker Hub:
Docker
Docker Hub is a service provided by Docker for finding and sharing container images. This is a public repository storing image templates without codes.
Add code to the images:
Open Bitbucket pipeline:
bitbucket-pipelines.yml
Add new methods in the bitbucket-pipelines.yml file :
In API: Add these three methods
*build-app-for-load-deployment
,*deploy-app-to-ecs
, and*run-migration-on-
load
Create a Docker file in the repositories under load-deploy branches and pass environment argument, image definition, and vhost configurations
Update the existing application environment to run the latest image.
AWS ECS application Setup:
Create different repositories in Elastic Container Registry for all three servers; API
Create a cluster in Elastic Container Service to host the docker image and run the container by creating task definitions in it. The one created for load testing is named as load-testing
During the creation of the cluster create a new vpc for load testing
Create container instances for load testing and update the scaling policies as per the requirement
Create task definitions in ECS for all different servers
Create services for different servers and while creating service create new target group then deploy service to the latest version of the task
While creating services select the load balancer as 'Application load balancer'
Create a security group to be used for load testing and add inbound rules for it then configure it to instances created
Do domain name registration for all three servers. API - https://apiv2.com and configured the domain in app_staging.ini file
Add rules under Loadbalancer - listener for HTTP:80 and HTTPS:443
Note : For load testing we are using staging codebase and taking production database dump by updating all the real data to test one
Database setup done for load testing environment
Configure all the DB related variable names in Bitbucket for each of the repositories; web, LumenApi, and ZendApi. Similarly define all the variables in bitbucket-pipelines.yml file
Restore snapshot of the prod-master database instance and create new vpc security group for load testing during restoring DB instance
Add inbound rules for load testing DB instance
Creation of Virtual Machine
Create a Linux machine to trigger our load testing script
Created a key pair and give access to able to ssh from the local machine to instance where we can run our load testing
There should be two security groups added to the instance. One is to create SSH access and other to get a connection with DB access
Use Elastic Beanstalk to host the server for load testing just to get the replica of production environment setup
Create an environment by selecting the environment tier : Web server environment
Add an Application name and environment name
Add a domain for elastic beanstalk
Add similar platform details present for api
Configure more options :
Add existing security group of API for instance
Configure system capacity of load testing environment
Configure rolling updates and deployments
Configure Load balancer and add 2 listerners : HTTP 80 and HTTPS 443. Add SSL certificate and SSL Policy with the latest one i.e TLS 1.3
Modify security options - Update Virtual machine EC2 key pair
Update the monitoring health reporting option to Basic as Enchaced would be chargeable
Under Network option it would have already selected the default vpc so no need to do any additional configuration here
Configure container options by comparing them with the API environment
Repository updates needed :
Add a new step
deploy-to-eb-load-env
in bitbucket-pipeline.yml for the API repo and update the environment name, Application name, Version Label and Artifacts
Database Access :
Under the security group of load testing add the inbound rule to give access to the database for the instance
No comments:
Post a Comment