Search⌘ K
AI Features

Design of a Code Deployment System

The design of a code deployment system encompasses a high-level workflow where users submit code to a Version Control System (VCS), triggering a Continuous Integration (CI) platform that builds and tests the code. Key APIs facilitate code submission, build triggering, artifact access, and deployment management. The system operates in two phases: code-building, which integrates and tests changes, and code-deployment, which updates application servers with new binaries. The design prioritizes reliability, scalability, and observability while accommodating various deployment strategies, impacting overall system architecture and performance.

The previous lesson covered the fundamentals of the code deployment system, including requirements, resources, and key components. Now, we examine the high-level design.

High-level design

The high-level design integrates the components identified previously to meet functional and non-functional requirements.

High-level design of the code deployment system
High-level design of the code deployment system

The workflow operates as follows:

  • Users submit code to the version control system (VCS)Tool for managing and tracking code changes across versions.

  • The VCS triggers the continuous integration (CIPlatform that automatically builds and tests code changes after each commit) service. The CI system integrates code changes from multiple developers into a shared repository.

  • The code is placed in the pub-sub system. The code build service retrieves it from the queue and converts it to a binary.

  • Generated artifacts (binaries) are stored in primary blob storage.

  • Deployment triggers the download and installation of artifacts on machines in each region.

The following API design details the system’s functional operations.

API design

Essential APIs for the code-building and deployment process include:

Code-build APIs

Key APIs for the code-build process:

  • Submit code: Submits code to a specified repository in the VCS.

submitCode(code, repository, branch, message)

submitCode() returns a commit hash that uniquely identifies the new commit within the repository. This hash references and later retrieves the commit. The API uses the following parameters:

Parameter

Description

code

The code submitted to the VCS.

repository

This shows a path to a repository where the code is being submitted.

branch

Within a VCS, a branch represents an independent instance of the primary code or repository, typically identified by a unique name. In our case, it shows the branch name where the code is submitted or edited.

message

An optional message during a commit.

  • Trigger build: Triggers the build and preparation of the codebase for deployment.

triggerBuild(project_id, branch, commit_hash, configuration)

The triggerBuild() initiates the build process asynchronously ...