Example

Webpage deployment illustration

Lets consider a simple static website with a single index.html page hosted in an AWS S3 bucket. While this is unrealistically simple, it suffices to showcase our approach. You can find the full source code and instructions to execute it yourself in our repository.

In descriptive infrastructure as code (IaC) systems, users define a directed acyclic graph (DAG) where each node is a resource, e.g., a db, container, load balancer, or network ACL entry, and arcs are dependencies between them. These dependencies are transitive and order the deployment, i.e., if resource R depends on S, S must be deployed before R and R must not be deployed when S is not deployed. For the webpage, the index must be deployed after and undeployed before the bucket. Have a look at the deployment graph and code describing it for µs using regular TypeScript.

Webpage deployment graph
const bucket = new Bucket('bucket', {
    website: { indexDocument: 'index.html' }
}); // Creates the S3 bucket of the website
const index = new BucketObject('index', {
    bucket: bucket,
    content: content,
    key: 'index.html',
    contentType: 'text/html; charset=utf-8'
}); // Saves the index.html in the bucket

In DevOps organizations, ideally, each team operates its own resources, including deployment. To ensure correct deployment and undeployment order, teams need to manually coordinate whenever resources are deployed, updated or undeployed. This decreases the flexibility of the teams and wastes time due to synchronization. To decouple the deployment times, µs treats deployments not as one-off tasks – as it is the case with all common IaC systems – but as continuously running processes, updating the deployed resources reactively based on the deployment definition and external signals, e.g., changes in another deployment.

In the website example, the provider could be responsible for the bucket and the editor for the index page in it. To ensure that the page is only and correctly deployed when the bucket is, both teams need to manually coordinate whenever the bucket is deployed, updated or undeployed. This means that the editor starts their deployment independently and runs it continuously. Whenever the provider starts or updates their deployment, the editor’s deployment automatically deploys, updates and undeploys the index page, without manual intervention or synchronization.

To enable such behavior, the connections between deployments and inter-deployment dependencies of their resources must be explicit in the deployment definitions. µs introduces three new resource types: RemoteConnection for connections to other deployments, Offer to provide resources or information to a connected deployment, and Wish to access the offer of a connected deployment. Using them, the provider and editor specify their connection to the other deployment. The provider offers its bucket to the editor deployment. The editor specifies its expectation of the offer by defining a wish, allowing to use the offered bucket via wish.offer.

Decentralized webpage deployment graph using µs
const editor = new RemoteConnection('editor');
const bucket = new Bucket('bucket', {
    website: { indexDocument: 'index.html' }
});
new Offer(editor, 'bucket', bucket);
const provider = new RemoteConnection('provider');
const wish = new Wish<Bucket>(provider, 'bucket');
const index = new BucketObject('index', {
    bucket: wish.offer,
    content: content,
    key: 'index.html',
    contentType: 'text/html; charset=utf-8'
});