metaparticle-io / metaparticle-ast

MIT License
27 stars 7 forks source link

Metaparticle Compiler

This compiler transforms the metaparticle domain-specific language into execution on various backends (e.g. Kubernetes)

Status

This documentation is woefully incomplete, but fortunately, this tool is an implementation detail.

Schema

The OpenAPI Schema for the metaparticle DSL can be found here

Specification examples

Simple server

{
    "name": "server",
    "guid": 1234567, 
    "services": [ 
        {
                "name": "server",
            "replicas": 4,
            "containers": [
                { "image": "nginx" }
            ],
            "ports": [{
                "number": 80
            }]
        }
    ],
    "serve": {
        "name": "server",
        "public": true
    }
}

Sharded server

{
    "name": "name",
    "guid": 1234567, 
    "services": [ 
        {
            "name": "server",
            "shardSpec": {
                "shards": 4,
                "urlPattern": "user/(.*)/"
            },
            "containers": [
                { "image": "brendanburns/node-hostname" }
            ],
            "ports": [{
                "number": 80
            }]
        }
    ],
    "serve": {
        "name": "server",
        "public": true
    }
}

Command line examples

# Run a file in kubernetes
mp-compiler -f metaparticle-spec.json

# Attach to the logs, but don't re-deploy
mp-compiler -f metaparticle-spec.json --attach=true --deploy=false

# Tear down an existing service
mp-compiler -f metaparticle-spec.json --deploy=false --delete=true

Contribute

There are many ways to contribute to Metaparticle

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.