A web frontend to Juju SVG

Hello. This is a web service to allow anyone with a bundle.yaml file to have it translated into an SVG as you would see in the Juju GUI or Charm Store

Enter a bundle.yaml URL and format type to get started:

Accepted Formats

This service only accepts one of two formatted bundles. The preferred bundle format is a "flat" bundle, one which only consists of "services", "relations", and optionally a "series" key. An example of this follows.

Preferred format

services:
  mediawiki:
    charm: cs:trusty/mediawiki
    num_units: 3
    options:
      debug: true
    annotations:
      gui-x: "750"
      gui-y: "500"
  mariadb:
    charm: cs:trusty/mariadb
    num_units: 1
    annotations:
      gui-x: "500"
      gui-y: "250"
series: trusty
relations:
- - wordpress:db
  - mariadb:database
    

Other format

This, older, format is also accepted, but you can only present ONE deployment routine.

my-blog:
  services:
    mediawiki:
      charm: cs:trusty/mediawiki
      num_units: 3
      options:
        debug: true
      annotations:
        gui-x: "750"
        gui-y: "500"
    mariadb:
      charm: cs:trusty/mariadb
      num_units: 1
      annotations:
        gui-x: "500"
        gui-y: "250"
  series: trusty
  relations:
  - - wordpress:db
    - mariadb:database
    

Generating an SVG

There are two ways to get a bundle generated. One is using a GET request and one is using a POST.

GET bundle

For the GET requests two quereis are supported. You can either send a bundle key, which will use the Juju Charm Store to fetch the details or a bundle-file which needs to be an HTTP addressed URL to the raw source of the bundle's YAML. Here are some examples:

POST bundle

The second way to generate a bundle is to POST the contents of the bundle to the web service. An example in various languages has been included for your convience.

CURL

curl -X POST --data "$(cat bundle.yaml)" http://svg.juju.solutions

Python Requests

import requests

with open('bundle.yaml') as f:
  bundle = f.read()

r = requests.post('http://svg.juju.solutions', bundle)
# r.content holds SVG, mimetype image/svg+xml

Caveats

This webservice is still under active development. There's bound to be a few issues. I'll document long standing ones here.

Annotations

Support for non-annotated bundles is avaiable. However, it's binary support. Either you have annotations for all services or no services. In the case where no annotations are found, networkx will be used to render the bundle to the best of it's ability (thanks @bcsaller). Initial support is only for the circular plan, but in the future this may become configurable.