Skip to content

Instantly share code, notes, and snippets.

@mbbx6spp
Last active December 7, 2016 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbbx6spp/4119d46fb18e9e424f04391e0a06b36c to your computer and use it in GitHub Desktop.
Save mbbx6spp/4119d46fb18e9e424f04391e0a06b36c to your computer and use it in GitHub Desktop.
Interface to defining services that can build dev VM, AMI, container, etc. images or deploy production-oriented ASGs, or other programmable infrastructure constructs. An artifact would have a specific structure based on a contract such that service runtime could be configured and built from it.
# Abstract
{ mkService, serviceArtifact, privateIfc, lbSource, authService, dataService, logService, logPath, secretsPath }:
mkService {
name = "service-name";
version = "0.1.2";
artifacts = [ serviceArtifact ];
listens = [ { type = "tcp"; port = 9999; interface = privateIfc; } ];
accepts = [ lbSource ]; # traffic sources to accept traffic from.
talks = [ authService dataService logService ]; # this allows auto configuration given the service definitions of those in the specific environment.
writes = [ logPath ];
reads = [ secretsPath ];
}
# Needs to built with a "target" definition for runnable output, e.g. AWS-ASG, AWS-AMI, VirutalBox-VM, or whatever.
# Also needs list of constraints such as "stripe across available availability zones in region R0", or "multi-region where primary in R0 and forwarded secondary system in R1"
# So we have a signature like: Service -> Constraints -> Target -> RunnableInfrastructure
# The above will be codified into dependent types to ensure basic sanity (at least) prevails in your running infrastructure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment