<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Architecture Archives - Ronnie Schaniel</title>
	<atom:link href="https://ronnieschaniel.com/category/architecture/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Blog</description>
	<lastBuildDate>Wed, 28 Sep 2022 05:46:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>An Abstract CI/CD Architecture</title>
		<link>https://ronnieschaniel.com/architecture/an-abstract-ci-cd-architecture/</link>
		
		<dc:creator><![CDATA[ronnieschaniel@hey.com]]></dc:creator>
		<pubDate>Sun, 18 Sep 2022 13:06:17 +0000</pubDate>
				<category><![CDATA[Architecture]]></category>
		<guid isPermaLink="false">https://ronnieschaniel.com/?p=1541</guid>

					<description><![CDATA[<p>Incrementally constructed abstract CI/CD Architecture.</p>
<p>The post <a href="https://ronnieschaniel.com/architecture/an-abstract-ci-cd-architecture/">An Abstract CI/CD Architecture</a> appeared first on <a href="https://ronnieschaniel.com">Ronnie Schaniel</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="681" src="https://ronnieschaniel.com/wp-content/uploads/2022/09/abstract_CI_CD_architecture_title_image-1024x681.jpg" alt="Abstract CI/CD Architecture title image" class="wp-image-1543" srcset="https://ronnieschaniel.com/wp-content/uploads/2022/09/abstract_CI_CD_architecture_title_image-1024x681.jpg 1024w, https://ronnieschaniel.com/wp-content/uploads/2022/09/abstract_CI_CD_architecture_title_image-300x199.jpg 300w, https://ronnieschaniel.com/wp-content/uploads/2022/09/abstract_CI_CD_architecture_title_image-768x510.jpg 768w, https://ronnieschaniel.com/wp-content/uploads/2022/09/abstract_CI_CD_architecture_title_image-1536x1021.jpg 1536w, https://ronnieschaniel.com/wp-content/uploads/2022/09/abstract_CI_CD_architecture_title_image.jpg 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>A CI/CD architecture or infrastructure helps development teams to deliver software. Of course a manual and local build and deploy from the command line is always possible. But sooner or later a more sophisticated setup is beneficial. More sophistication means here that more steps in the whole CI/CD pipeline are automated or steps are added to the pipeline or somehow extended. CI/CD setups come in many different shapes and forms. In this article we take an abstract view on them and build them from simple to more sophisticated in an incremental way.<br>Please note that CD in this article summarises continuous delivery as well as continuous deployment. </p>



<h2 class="wp-block-heading">#1 The most basic setup with local build and deployment</h2>



<p>We start simple with local source code where the build task is executed also locally by the required build system. Locally here means on the developers machine. After having built the software artefact the deployment also happens from local by uploading the artefact onto the application run environment. Finally the application is restarted.</p>


<div class="wp-block-image pt-5">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_basic_local_setup-1-1024x341.png" alt="Most basic CI/CD setup" class="wp-image-1550" width="768" height="256" srcset="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_basic_local_setup-1-1024x341.png 1024w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_basic_local_setup-1-300x100.png 300w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_basic_local_setup-1-768x256.png 768w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_basic_local_setup-1-1536x511.png 1536w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_basic_local_setup-1-2048x682.png 2048w" sizes="(max-width: 768px) 100vw, 768px" /></figure>
</div>


<h2 class="wp-block-heading">#2 Code repository and build server added</h2>



<p>In a first step we add two systems into our infrastructure. This allows us to automate and outsource some tasks:</p>



<ul class="wp-block-list"><li>The source code is no longer kept only locally but is stored in a distributed <strong>source code repository</strong>.</li><li>The build task is not executed anymore locally but on a <strong>build server</strong>. Also the deployment is done by the build server. The build server is just another machine and ideally optimised for building software.</li><li>A connection is setup between the <strong>source code repository </strong>and the <strong>build server.</strong> This allows us to retrieve the source code.</li></ul>



<p>Once we trigger the build (manually) on the build server the source code is loaded and the build tasks are executed on that code. After the build is done the created artefact is moved onto the application run environment where a restart happens. The new version is available. </p>


<div class="wp-block-image pt-5">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_setup_with_code_repo_and_build_server-2-1024x329.png" alt="CI/CD setup with code repository and build server added." class="wp-image-1551" width="768" height="247" srcset="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_setup_with_code_repo_and_build_server-2-1024x329.png 1024w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_setup_with_code_repo_and_build_server-2-300x96.png 300w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_setup_with_code_repo_and_build_server-2-768x247.png 768w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_setup_with_code_repo_and_build_server-2-1536x493.png 1536w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_setup_with_code_repo_and_build_server-2-2048x658.png 2048w" sizes="(max-width: 768px) 100vw, 768px" /></figure>
</div>


<p>In above variant no developer&#8217;s machine is involved anymore. Of course developers push the code into the distributed source code repository, but for the CI/CD flow itself the work is outsourced.</p>



<p>Outsourcing the build task helps to keep the developer&#8217;s machine free for other tasks. Additionally there is an independence introduced such that the build can be started at any point in time. </p>



<h2 class="wp-block-heading">#3 Notification about new source code for the build server</h2>



<p>In a next variant we bring in some automation. We setup a second connection between code repository and build server to <strong>notify</strong> the build server about a new code state. So, whenever a new state is ready to be built the build server will automatically trigger a build.</p>


<div class="wp-block-image pt-5">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notify_build_server-1024x329.png" alt="" class="wp-image-1559" width="768" height="247" srcset="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notify_build_server-1024x329.png 1024w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notify_build_server-300x96.png 300w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notify_build_server-768x247.png 768w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notify_build_server-1536x493.png 1536w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notify_build_server-2048x658.png 2048w" sizes="(max-width: 768px) 100vw, 768px" /></figure>
</div>


<p>This allows us to get rid of the manual trigger for the build. Hence, forgetting to trigger the build is not an issue anymore.</p>



<p>Still the deploy task is automatically executed at the end of the build and a new application version is available soon after a build.</p>



<h2 class="wp-block-heading">#4 Separate build and deployment</h2>



<p>Until now a new build always meant a new deployment. Hence, there was really Continuous Deployment. A new artefact was built directly on the build server, kept there temporarily and put onto the application run environment. Now we separate the build from the deployment:</p>



<ul class="wp-block-list"><li>An <strong>artifactory</strong> is introduced as additional system into our CI/CD architecture. The function of this artifactory is primarily to store software artefacts and allow a later retrieval, also repeatedly.</li></ul>


<div class="wp-block-image pt-5">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_build_and_deploy_separated-1024x566.png" alt="" class="wp-image-1564" width="768" height="425" srcset="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_build_and_deploy_separated-1024x566.png 1024w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_build_and_deploy_separated-300x166.png 300w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_build_and_deploy_separated-768x425.png 768w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_build_and_deploy_separated-1536x849.png 1536w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_build_and_deploy_separated-2048x1132.png 2048w" sizes="(max-width: 768px) 100vw, 768px" /></figure>
</div>


<p>This brings us the following advantages:</p>



<ul class="wp-block-list"><li>Build and deploy step can be separated also in time. The build step stores the artefact and some time later the deploy step can retrieve the artefact independently of the build step. </li><li>Build and deploy step could be separated physically. Infrastructure that is optimised for the build task can be used entirely for the build. While the deploy step can again be on a separated physical infrastructure. This deploy infrastructure could then exclusively have access to the application&#8217;s run environment improving security.</li><li>Artefacts are not lost after deployment but stored for a certain amount of time. This allows also a later retrieval, e.g. for another deployment or rollbacks. </li></ul>



<p>Integrating code, building the software and storing into the artifactory is basically Continuous Delivery. When we connect these steps with the deployment we have Continuous Deployment.</p>



<h2 class="wp-block-heading">#5 More quality checks</h2>



<p>We want to ensure a certain standard whenever we integrate new code or at least before delivering or deploying new software artefacts.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_with_code_analysis-1024x730.png" alt="" class="wp-image-1571" width="768" height="548" srcset="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_with_code_analysis-1024x730.png 1024w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_with_code_analysis-300x214.png 300w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_with_code_analysis-768x547.png 768w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_with_code_analysis-1536x1094.png 1536w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_with_code_analysis-2048x1459.png 2048w" sizes="(max-width: 768px) 100vw, 768px" /></figure>
</div>


<p>To check the quality of our software artefacts the CI/CD architecture is extended by the following:</p>



<ul class="wp-block-list"><li>The software is not only built but also tested by executing <strong>automated tests</strong> during the build. Whenever tests fail the build fails too and no new artefact is created.</li><li>In addition to basic checks, further code analysis tools can be integrated into or directly after the build step. External <strong>code analysis system</strong>s give the build server feedback about the code or the artefact. This feedback can concern for example code quality, but also security. Also a negative result here will fail the build and prevent shipping software that doesn&#8217;t adhere to defined standards.</li></ul>



<h2 class="wp-block-heading">#6 Deployment could equal artefact retrieval</h2>



<p>What if the deployment is not triggered from the build server and the artefact is not pushed towards the application run environment? There certainly exist such cases where it is rather a pull form the run environment, e.g. mobile app download onto the device via app store. Then our CI/CD architecture view needs to be extended:</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" src="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_pull_and_push_deploy-1024x699.png" alt="CI/CD architecture or infrastructure showing multiple variants of deploy." class="wp-image-1578" width="768" height="524" srcset="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_pull_and_push_deploy-1024x699.png 1024w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_pull_and_push_deploy-300x205.png 300w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_pull_and_push_deploy-768x524.png 768w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_pull_and_push_deploy-1536x1049.png 1536w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_pull_and_push_deploy-2048x1398.png 2048w" sizes="(max-width: 768px) 100vw, 768px" /></figure>
</div>


<p>The following changes were applied:</p>



<ul class="wp-block-list"><li>We definitely separated the build and deploy and renamed them to <strong>build system </strong>and <strong>deploy system.</strong> </li><li>There are two variants for deployments shown:<ul><li>Either it is a push deployment from the deploy system that puts the artefact onto the application run environment -&gt;<strong> deploy (a)</strong></li><li>Or it is a kind of pull deployment where the run environment pulls the artefact directly from the artifactory -&gt; <strong>deploy (b)</strong>. In this case no deploy system is needed. Or you could say that the deploy system is actually running on the application run environment.</li></ul></li></ul>



<h2 class="wp-block-heading">#7 Deployment without interruption</h2>



<p>Until now the deployment was just about putting a new version onto the run environment and restarting. This usually causes an interruption for the user of our software. We can do better than that!</p>



<ul class="wp-block-list"><li>During deployment a second instance or set of instances of the <strong>application run environment</strong> is created where the new version is installed.</li><li>A <strong>router </strong>is part of the run environment or sits in front of it. This router controls the access of the users to the right version of the application.</li><li>After deployment the end-users are routed to the instance(s) with the new version and the old version&#8217;s instances are removed.</li></ul>



<figure class="wp-block-image size-large pt-5"><a href="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_interruption_free_deployment.png"><img decoding="async" width="1024" height="550" src="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_interruption_free_deployment-1024x550.png" alt="" class="wp-image-1582" srcset="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_interruption_free_deployment-1024x550.png 1024w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_interruption_free_deployment-300x161.png 300w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_interruption_free_deployment-768x412.png 768w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_interruption_free_deployment-1536x825.png 1536w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_interruption_free_deployment-2048x1100.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>Continuous deployment ideally means that a deployment can happen anytime without the users really noticing. The users should only see the new features or the fixed bugs. This is achieved by above extensions.</p>



<h2 class="wp-block-heading">#8 Deploy with quality check</h2>



<p>It is time for a bit more quality again. We already have the tests that are run during the build and the additional code analysis done after that. Now we will introduce an incremental rollout (canary deployment).</p>



<ul class="wp-block-list"><li>Like in #7 a second instance or set of instances is used during deployment</li><li>This time the <strong>router</strong> is a bit more intelligent and routes a certain subset of users towards the <strong>new </strong>version of the application.</li><li>A <strong>monitoring system</strong> is introduced that allows us to check the quality of the <strong>new </strong>version. The <strong>deploy system </strong>has access to this monitoring system to check the quality metrics regularly and proceed or abort with deployment. </li></ul>



<figure class="wp-block-image size-large pt-5"><a href="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_canary.png"><img decoding="async" width="1024" height="550" src="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_canary-1024x550.png" alt="CI/CD with canary" class="wp-image-1588" srcset="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_canary-1024x550.png 1024w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_canary-300x161.png 300w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_canary-768x413.png 768w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_canary-1536x825.png 1536w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_canary-2048x1101.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>This allows us to only send a subset of users onto the new version of our application in the beginning of the deployment. Once the quality checks are giving us good feedback we can increase the amount of users routed to the new instance(s). When our monitoring system detects issues on the new version the deployment can be automatically cancelled. Luckily only a subset of users where then affected by problems and not everyone.</p>



<h2 class="wp-block-heading">#9 We want to know what is happening</h2>



<p>Above CI/CD setup already looks quite good. But we want to know during the whole process if certain steps fail or maybe also when everything went fine. This is why a <strong>notification system </strong>is introduced that can interact with various communication channels. Notifications can be triggered from several systems in the setup:</p>



<figure class="wp-block-image size-large pt-5"><a href="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notifications.png"><img decoding="async" width="1024" height="640" src="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notifications-1024x640.png" alt="CI/CD infrastructure with notifications" class="wp-image-1592" srcset="https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notifications-1024x640.png 1024w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notifications-300x187.png 300w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notifications-768x480.png 768w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notifications-1536x960.png 1536w, https://ronnieschaniel.com/wp-content/uploads/2022/09/ci_cd_notifications-2048x1280.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>This is it for now! In 9 steps we have constructed an abstract view for CI/CD infrastructures. Further systems could be added of course, for example:</p>



<ul class="wp-block-list"><li>user management integration to control which users have access to which systems and to provide SSO</li><li>integrations with systems that publish release notes, API updates, etc.</li><li>to further improve security we could scan the artifactory regularly to detect vulnerable artefacts or dependencies</li></ul>



<h2 class="wp-block-heading">Quality aspects of a CI/CD architecture and infrastructure</h2>



<p>Above you have seen different variants on how to achieve CI and CD. Like every other architecture also this CI/CD architecture has some quality aspects you should pay attention to. To name a few:</p>



<ul class="wp-block-list"><li><strong>Physical characteristics </strong>of each system and their influence on <strong>throughput, speed, storage</strong>, etc. Connected to that the <strong>scalability</strong> of the single parts and the whole system. </li><li><strong>Security</strong> aspects for the connections between the systems</li><li><strong>Extensibility</strong> of the setup and <strong>adaptability</strong> to other scenarios, run environments, deploy paradigms, etc.</li><li><strong>Recoverability</strong> during the process to ensure that a step can be restarted rather than having to start the whole process again</li></ul>



<h2 class="wp-block-heading">Final thoughts</h2>



<p>Probably you have not agreed with every detail of this CI/CD architecture or infrastructure. And this is okay. There are so many ways on how to setup such an architecture. Importantly is to understand your or your organisation&#8217;s needs and do the right trade offs. By keeping above elements and connections abstract we can discuss the architecture independently of tools and implementation details. <br>This gives us later on the flexibility to implement it with our favourite tools. Only then Jenkins, TeamCity, AWS CodePipeline and co. come into play.</p>



<p></p>
<p>The post <a href="https://ronnieschaniel.com/architecture/an-abstract-ci-cd-architecture/">An Abstract CI/CD Architecture</a> appeared first on <a href="https://ronnieschaniel.com">Ronnie Schaniel</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
