[S1-A&D] How to automate software-architecture, using architecture-as-code (SAaC) approach
Rajesh Verma
Enterprise Architect | Telecom CRM, Billing/OSS Transformation | Digital Transformation | Gen AI | Entrepreneur | Socialpreneure
Software architecture of any application or platform is usually evolved throughout the software development journey. There are several challenges faced during this architecture evolution process e.g. it is very difficult to track changes introduced or incorporated from the beginning of the architecture. Like automated deployment process of functional stories makes the things in software development easy to manage or view the change history throughout various versions and enables implementation-team to map code changes with actual requirement since beginning, sameway infrastructure-as-code (IaC) brings opportunity to practice automated CI/CD pipeline for coding required for infrastructure setup, which can further be extended to other types of software-architecture like functional-architecture, deployment-architecture etc. In this article, I will touch-base a few important aspects of software-architecture-as-code including some of popular tools.
#softwarearchitecture #softwarearchitectureascode #infrastructureascode #cicdpipelineforsoftwarearchitecture #toolsforinfrastructureascode
Software-architecture-as-code (SAaC)
During any software project implementation, various types of architectures are written as following
These are different types of software-architectures used for relevant purposes and are considered as master-architecture or foundation-architecture which will remain same for implementation of any use-case e.g. say application having use-cases onboarding-of-a-new-employee, exit-of-an-existing-employee, the foundation-architecture will remain the same including other use-cases.
During the execution of large-complex-long (LCL) projects, many architectural-changes will be incorporated in the foundation-architectures e.g. some of the upcoming use-cases may require a new ABB (architecture-building-block) to be added in the foundation-architecture, then a new version of foundation-architecture will be added to artifacts repository and published to stakeholders.?
Let’s talk by some examples regarding changes in the foundation-architecture, suppose cache-layer (ABB) was not incorporated in the system-architecture of foundation-architecture. Reason behind the same was that none of the use-cases needed the cache-layer (ABB) in the initial version of foundation-architecture and considering simplicity in architecture, budget priority, incorporation of cache-layer in the foundation-architecture was deferred to the time when need will occur.
Let’s consider some sample architecture-diagrams of system-architecture & functional-architecture which will be referred multiple times in this article.?
System architecture diagram
Functional architecture diagram
Closer view on setting up the software-architecture
Just to show the bigger picture or top view of overall software-architecture to the readers of this article, any software-architecture will have two high level sets of activities:?
So in nutshell software-architecture-as-code (SAaC) concept can be defined as writing code for setting up infrastructure & application as follows?
Adopt Infrastructure-as-code (IaC/IASaC) over conventional approach
Let’s understand how the infrastructure is setup in conventional methods i.e. configuring infrastructure before IaC.
Now if we analyze all of the above steps closely, only step-1 will require human intervention at the location of physical-machines and remaining steps (2,3,4,5) can be performed remotely via command-line or API or admin console.?
So the steps which can be performed remotely via command-line or API, can be bundled into one or more executable-programming-scripts which can be executed in a logical sequence of steps. This is the actual idea behind infrastructure-as-code and the many popular tools can be used to write infrastructure-as-code (IaC).?
Steps (4 & 5) are comparatively more frequent tasks be it the first time setup or be it the regular upgrade, so these tasks are very suitable candidates which can be achieved via IaC approach. Below diagram explains the life-cycle of infrastructure-as-code (IaC).
IaC standard workflow
** For the sake of simplicity in the article, the above table is not considered for containerized and cloud environments. Maybe the same will be covered in some other article.
Adopt application-architecture-setup-as-code (AASaC) over conventional approach
Let’s understand how the application is setup in a given infrastructure using conventional approaches i.e. installing applications before AASaC.
Now let’s understand how an application should be defined. Definition or size of an application will vary based on the architecture style, but the approach of software-architecture-as-code does not differ by any application’s architecture style e.g. monolith or microservice or micro-frontend for all approach of software-architecture-as-code will remain same. In order to be focused with the objective of this article, it is not important to discuss various architecture-styles.
For the sake of understanding, we shall refer to the functional-architecture diagram provided in the above section. From the functional-architecture diagram, every component is called functional-component, which can also be called functional-application or domain. Each functional-application can further be decomposed into smaller-functional-application or sub-domain. For this article, we don’t need to be bothered about scope or boundary of functional-application or domain or smaller-functional-application or sub-domain, for us everything is a micro-application which will consist of micro-frontend, micro-service & micro-database.
AASaC standard workflow
领英推荐
Now we have a fair understanding of how the concept of software-architecture-as-code can be leveraged into your project to bring architecture level automation. In order to write code for any piece, there are many tools as explained in the next section [Popular tools].?
Please also apply modular design & separation-of-concern design approach in software-architecture-as-code i.e. code & execution of IaC/IASaC or AASaC should be isolated from each other, so that codes for setting-up infrastructure or application will remain completely independent and manageable in isolation.
Popular tools to write your IaC/IASaC & AASaC code
Above IaC standard workflow is very similar to functional code of any functional-epic-or-user-stories during sprint development. IaC’s code-&-review-stages will remain same as functional-epic-or-user-stories i.e. IaC code would be written freshly or existing code would be updated, unit-testing would be performed, code-coverage & test-coverage would be verified at local level, PR request would be raised for review and code-merge in the higher environment. Same time the IaC’s apply-stage is a very critical task and since these are not frequent tasks, it is nowhere mandatory to automate the deployment of IaC build.
Reference links : Popular IaC tools
Terraform?
Terraform is an open-source tool for infrastructure-as-code developed by HashiCorp. One can write configuration-files (equivalent to installation script) in Terraform for both kinds of deployment platforms on-premises & cloud.?
HashiCorp Terraform write-to-apply workflow
Terraform configuration-files are human-readable and can be managed via version-management-tool like Github, Gitlab etc., only the apply stage has to be very careful as this will change the existing infrastructure setup and any small mistake may stop the already working production environment.?
Example during foundation-architecture, Terraform scripts for postgres DB setup were written as per active-passive high-availability setup e.g. after 1 or 2 years now customer wants to change HA strategy to A-P to Multi-master replication topology based database architecture. Writing Terraform scripts is the most easy part while applying the target terraform script comes lots of activity including export-import of database and outage for export & important.
Other reference
Ansible
Ansible is an open-source tool for infrastructure-as-code developed by RedHat. One can write configuration-files (equivalent to installation script) in Ansible for both kinds of deployment platforms on-premises & cloud.?
RedHat Ansible provides a rich workflow creation feature, where one can create an ansible project, select workflow templates, define jobs under workflow for actual provisioning.
Other reference
Puluni?
Puluni is an open-source tool for infrastructure-as-code developed by Pului. One can write configuration-files (equivalent to installation script) using Puluni packages for both kinds of deployment platforms on-premises & cloud.?
Puluni comes with a great benefit that one can write infrastructure-as-code in any programming language including Python, Java, Node-JS and so on.
Puluni write-to-apply workflow
Other reference
Cloud vendor specific tools (e.g. AWS CloudFormation, Azure ResourceManager, GCP Deployment Manager)
Apart from above open-source IaC tools, every cloud provides their own IaC tool compatible with their own & others cloud-platforms.? These cloud specific IaC tools also provide an automated CI/CD pipeline.?
Reference link?
Operating system level scripting language (e.g. Shell script for Unix, Linux or Windows)
This is a very conventional way of writing installer scripts for any ABB layer, most of COTS products come with <installer.sh or installer.bat> scripts which are nothing but the infrastructure-as-code only. Many readers should be able to refresh their memory for start.sh or start.bat for Apache Tomcat, install.sh or install.bat for Oracle database, similarly for mysql & postgres.?
If someone does not want to go with any of available tools to avoid 3rd parties tools dependencies, they can write custom IaC capabilities with the implementation of decomposition tasks for each activity that is performed manually in order to setup the specific ABB’s infrastructure.
Which IaC tool?
The whole idea of this article was to provide high-level understanding about infrastructure-as-code and what are popular tools available to automate your infrastructure-as-code.?
All of the above tools are popular & stable in market, and decision on which IaC tool will vary depending upon?
About author
Profile : Rajesh Verma - Brief profile
Source : link for this article here
Series : S1 (Architecture & design)
Episode : S1E2 ([S1-A&D] How to automate software-architecture, using architecture-as-code (SAaC) approach)
Author’s approach : Rajesh wants to share his learning & experience gained throughout his career from various sources. Author started the series on architectural topics and this article is one of the episodes in that attempt. Author feels that lots of information is available on various forums, but scattered here & there. Episodes in this series will be designed for most of the relevant topics in architecture-&-design, published gradually and organized in logical sequence. Principally episodes will have linkage with other episodes, so that readers can have proper connection among the topics and would be able to correlate with ongoing activities in their software life. Topics for example will be related to functional architecture, integration architecture, deployment architecture, microscopic view of mostly architecture-building-blocks (ABBs), security guidelines & approach to comply, performance KPIs & engineering, git branch & DevOps enabled automation strategy, NFR aspects (e.g. scalability, high-availability, stability, resiliency, etc.), commonly used architecture styles & design patterns, cloudification approaches, multi-tenancy approach, data migration, channel-cutover & rollout strategy, process standardization & simplification, greenfield rollout & brownfield transformation journeys, etc.
Thank you for reading the post, please stay connected.