Continuous Integration & Continuous Deployments Best Practices

Source – by.dialexa.com

Today’s environment demands fast deliverables to clients, customers, and partners followed by quick iterations to improve business value and enhance the user experience.  At Dialexa, it’s imperative for us to execute these tasks with excellence and not only satisfy our client’s current needs, but also position them for success when facing tomorrow’s challenges.

Two key pieces help turn this agile principle into a reality: continuous integration and continuous deployments.  We’ll walk through an example approach of how to make this happen using: GitHub, Docker, CircleCI, Coveralls, and Amazon Web Services.

CONTINUOUS INTEGRATION BEST PRACTICES

GitHub serves as a source control, but also provides capabilities for code reviews and issue tracking.  Pull request templates and peer reviews allow you to identify issues before they’re introduced to a client.  Also, GitHub integrates nicely with CircleCI for builds.  For this example, we’ll leverage this integration to kick off a build for each pull request.

Each build starts by creating a Docker image based off the current branch’s codebase.   Next a Docker instance based off the Docker images is spun up and a large number of unit and integration tests are executed against it.  These tests exercise the new functionality as well as other impacted areas of the application.  After a build succeeds the code is merged into the repository.  This can be done automatically or manually, depending on your preference.  If a build fails, the development team is notified on Slack.

Since we rely so heavily on tests for continuous deployments, it’s critical for us at Dialexa to have complete transparency on every project.  Each employee needs to be able to see the health and coverage of any project at any point in time.  This drives accountability into the previous steps and results in higher quality code being committed and reviewed. If you’re team prioritizes transparency as well, CircleCI integrates with Coveralls, a very powerful platform that shows the health and code coverage of a project.

CONTINUOUS DEPLOYMENTS BEST PRACTICES

Anytime code is merged into the main codebase, another build is kicked off on CircleCI.  All of the unit and integration tests are executed again to ensure no surprises have been introduced.

Next the created Docker image is uploaded to a Docker repository and added to AWS Elastic Beanstalk application.  Finally, a script deploys the application on AWS Elastic Beanstalk to existing/new EC2 instances.  With AWS Elastic Beanstalk we’re big fans of immutable deployments for production.  An immutable deployment spins up a new EC2 instance for each deployment and only replaces existing instances if all of the deployments are successful.

If a build requires database migrations or customizations to an EC2 instance, you can leverage Elastic Beanstalk Extensions to execute the appropriate actions.

While this process creates multiple checks and safety nets, you always want a backup plan.  We leverage alerts and notifications via AWS Cloudwatch to notify team members of degrading performance or server errors.  If specific business critical alerts are triggered, an AWS Lambdafunction can rapidly execute appropriate logic to minimize business impact.

Following this approach, you can accelerate your team’s deliverables while at the same time gain confidence you’re shipping code with quality.  For more technical details on how to make the above process work, feel free to check out this article on CircleCI.

Succeeding with digital transformation starts with developing agile thinking through continuous integration and continuous deployments – but to be truely successful it requires a more holistic, company-wide approach. For more information about the keys to implementing an effective digital transformation strategy, download our free ebook, The Pillars of a Successful Digital Transformation Strategy.

 

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x