FlabbergastMaking configuration less o_0

Try on Fiddle Read the Docs Download Ubuntu Package Download on Maven Download on NuGet Discuss Connect on Twitter Connect on Google+

Getting Flabbergast

Packages are available for Ubuntu, Maven, NuGet, and MacOS. Installation instructions are available.

Once installed, running flabbergast-repl will bring up an interactive command promp. An online fiddle is also available to try without installing.

Aurora Example

Here's a small example for generating an Apache Aurora configuration.

aurora_lib : From lib:apache/aurora # Import the Aurora library.
cluster : "cluster1"
role : "jrhacker" 
resources : {
  cpu : 0.1
  ram : 16Mi
  disk : 16Mi
}
hw_file : aurora_lib.aurora_file {  # Create an Aurora configuration file
  jobs : [
    job { # Create a job. This could also be aurora_lib.job, but we have nothing else named job.
      instances : 1 # One replica of this job should run.
      job_name : "hello_world" # Provide a friendly job name. 
      task : aurora_lib.task {
        processes : { # Define the processes ⋯
          hw : process { # ⋯ using process template 
            process_name : "hw" # The name of this process will be hw 
            command_line : [ "echo hello world" ] # The command line we want to run. 
          }
        }
      }
    }
  ]
}
value : hw_file.value # Flabbergast is going to dump this string to the output.

One of the things that makes Flabbergast special is it uses contextual lookup, that allows you to define thing where they make sense for your needs, rather than what the original author imagined. So, you can write the above config as:

aurora_lib : From lib:apache/aurora
cluster : "cluster1" 
role : "jrhacker" 
resources : {
  cpu : 0.1
  ram : 16Mi
  disk : 8Mi
}
hw_file : aurora_lib.aurora_file {
  jobs : [
    job {
      resources : {
        disk : 16Mi This disk resource will be used since it is “closer”.
      }
      instances : 1
      job_name : "hello_world" 
      task : aurora_lib.task {
        processes : {
          hw : process {
            process_name : "hw" 
            command_line : [ "echo hello world" ]
          }
        }
      }
    }
  ]
}
value : hw_file.value

and get the same result. Flabbbergast's contextual lookup will find the “closest” match, so you can shuffle your definitions to share things that should be shared without having to copy variables around.

Have a look at a sophisticated Flabbergast+Aurora example that makes use of Flabbergast's lookup to provide multiple geographic configurations, repeated server configuration, service discovery, and testing configurations.

Where to Go Next

For a quick introduction, have a look at the primer slide deck. To really get started, take a look at the manual. There are some serious examples and some fun Rosetta Code examples.