Commit graph

91 commits

Author SHA1 Message Date
joeduffy 7d249894ee Freshen up the description of dependency management 2017-01-01 16:02:18 -08:00
joeduffy 1895753f53 Goodbye Mull
A Death blow is a Life blow to Some
Who till they died, did not alive become--
Who had they lived, had died but when
They died, Vitality begun.
2017-01-01 15:24:25 -08:00
joeduffy 1bd1aaf968 Reorganize documents a bit and add an index 2017-01-01 15:18:36 -08:00
joeduffy 8f820ce11f Rename languages.md to formats.md
And also wordsmith a bunch of the front matter.
2017-01-01 15:12:51 -08:00
joeduffy f42e2579f4 Bring the concepts section up to date 2017-01-01 14:39:26 -08:00
joeduffy d4d6f3e018 Update the targets table 2017-01-01 14:24:08 -08:00
joeduffy a1d21b0d73 Move most docs into a design subdirectory 2017-01-01 14:18:00 -08:00
joeduffy 1ffb120bb3 Add a placeholder for competetive landscape in overview doc 2017-01-01 14:17:36 -08:00
joeduffy 82135ab219 Add a paragraph about interpretation 2017-01-01 14:17:08 -08:00
joeduffy 36534145a5 Rename architecture.md to overview.md
...and also add some front matter about the Mu problem and solution statements.
2017-01-01 14:13:25 -08:00
joeduffy ca7023602a Make a few nit/todo/wordsmithing edits 2017-01-01 12:58:40 -08:00
joeduffy 88b06e0816 Add a note on exceptions 2016-12-30 11:04:23 -08:00
joeduffy 55a2a2abce Articulate accessibility 2016-12-30 10:34:55 -08:00
joeduffy 5de6b89562 Give in to classical classes
This change adopts some standard aspects of classes, like statics, abstract,
and virtuals (sealing).  It also recognizes records and interfaces as explicit
annotations on classes (both of which can be called "conjurable"); they were
already being treated specially with respect to structural/duck conversions,
and I always hate inferring defining properties of types like this, since simple
edits can completely change the type's semantics and break consumers of it.
2016-12-30 09:48:32 -08:00
joeduffy 88a550f420 Make a statement about async/await 2016-12-29 21:07:48 -08:00
joeduffy b88ed913cc Whittle away at the open issues list 2016-12-29 18:19:38 -08:00
joeduffy cf432e2a8a Add overview of function types and conversions 2016-12-29 18:08:19 -08:00
joeduffy 056ba1acf9 Move away from records, embrace classes
Also add a section on primary properties and initialization.
2016-12-29 16:25:26 -08:00
joeduffy e130b157aa Add details on variables and functions 2016-12-29 15:27:52 -08:00
joeduffy 742e44ae47 Merge branch 'master' of github.com:marapongo/mu 2016-12-29 13:04:32 -08:00
joeduffy 21a23b86f9 Introducing MuPack and MuIL
This change articulates Mu's packaging format, MuPack, along with its
corresponding intermediate language and type system, MuIL.  This is very
much a work in progress.
2016-12-29 13:03:45 -08:00
Joe Duffy 22223db29b Add an "out of date" caution to the old language docs 2016-12-22 18:22:47 -08:00
joeduffy eb20e5fefd Add a work item to figure out MuGL graph queries
This tags the relevant TODO with the work item marapongo/mu#30.
2016-12-22 17:16:02 -08:00
joeduffy 4c39f44095 Add a section on resource providers 2016-12-22 17:12:19 -08:00
joeduffy 27529d5be5 Fix a few typos; clarify a few things 2016-12-22 16:31:25 -08:00
joeduffy d890d43663 Wordsmith the languages doc a bit more
This fixes up some grammar and readability things I noticed as reading.
2016-12-22 16:18:52 -08:00
joeduffy 8f351cddf5 Add references to other deterministic JS projects
...and wordsmith a few minor things I noticed.
2016-12-22 16:11:13 -08:00
joeduffy e864aa302f Mu languages, take three
This documents our latest thinking on Mu languages.  At a high level,
there are three classes of language at play:

1. Mu Metadata Languages (MuML): these are the high-level language
   subsets that a programmer uses to specify Mu modules, etc.  Examples
   include MuJS, MuPy, MuRu, and MyGo, each representing a deterministic
   subset of JavaScript, Python, Ruby, and Go, respectively.

2. Mu Intermediate Language (MuIL): this is the intermediate form that
   all of the above compile down to.  It is capable of representing
   computations like functions, conditionals, and basic expressions like
   string concatenation, etc.  This is fully statically analyzable and
   can be used to create deterministic plans and topology graphs.

3. Mu Graph Language (MuGL): this is the "final" form in which any Mu
   service topology is represented.  It never contains computations and
   is merely a metadata description of services-as-nodes, dependencies-as-
   edges, and all known properties.  In the planning form, it may contain
   "holes" because output properties aren't known until execution has
   occurred, while in the actual applied form, those holes have been
   plugged.  MuGLs can be diffed, and a MuGL can be generated from an
   existing live environment (for bootstrapping and/or drift analysis).

There are several TODOs in here, but this is braindump of where we're at.
2016-12-22 15:40:35 -08:00
joeduffy 271d30e895 Flesh out details on basic stuff 2016-12-16 13:35:59 -08:00
joeduffy 95534eb911 Rename "ctor()" to "new()"
And also eliminate funcs {} block in favor of simply func definitions.
2016-12-16 11:16:26 -08:00
joeduffy 5549d3a2e8 Make a few minor language doc edits 2016-12-15 16:40:19 -08:00
joeduffy d972ab9b6b Talk a little about runtime bindings 2016-12-14 16:55:24 -08:00
joeduffy 9d9c57335f Rename macro to func; rename mu/func to mu/lambda 2016-12-14 16:44:31 -08:00
joeduffy 646bb624db Rename rpcs to interface 2016-12-14 15:11:57 -08:00
joeduffy 8ba1bf6f22 Commit more progress on the metadata language design
Mostly a bunch of TODOs, however, a bit more about RPCs, services, streams,
and the output graph state.
2016-12-14 15:04:27 -08:00
joeduffy 87d2a6e06e Create a new design doc for the metadata language
This checkin includes a new design doc for the Mull metadata language.

This is very much a work-in-progress.

This will eventually supersede the language.md document.
2016-12-14 13:08:08 -08:00
joeduffy 4195c5be9b Add two follow-ups we need to think about, typing-wise 2016-12-12 09:26:06 -08:00
joeduffy d12f249248 Fix references to each
In an older version of this doc, `if` was called `when`, and `for`
was called `each`, to encourage a more declarative feel.  I renamed
them back to their familiar forms.  I missed a few spots.  But I also
thought at least documenting this heritage would be useful, hence
this descriptive checkin comment.
2016-12-12 09:21:30 -08:00
joeduffy dc76cbb989 Add thoughts on a little language
This change includes a miniature spec for what we'd want out of a little
markup language that extends YAML/JSON with typing and minimal templating.

We've begun to reach the limits of what Go's templates give us; the usability
is quite poor: the order of template expansion is "confused" (as it must
happen before verification of stack properties); it is dumb textual copy-and-
paste, and thus knows nothing about the lexical and semantic rules; evaluation
of expressions that should produce actual objects inserted into the metadata
stream as-is must actually be serialized into text (problematic for the above
reasons); and, finally, as a result of all of this, failure modes are terrible.

But worse than this, we simply can't do what we need in many places.  For
instance, mapping a stack's properties onto the services that it creates works
in simple cases -- like strings, booleans, and ints -- but quickly breaks down
when referencing complex objects (for the same above reasons).  This is why
we've needed to special case property mapping in the aws/x/cf provider, but
clearly this won't generalize to all the compositional situations that arise.

It's worth nothing Hashicorp's HCL/HIL is closest to what we want.  (The
language used for Terraform.)  It isn't exactly what we want, however, for two
reasons.  First, it lacks conditionals and iteration.  This is likely to appear
at some point (see https://github.com/hashicorp/terraform/issues/1604), and
indeed in this past week alone, a new C-like conditional operator (which I
actually don't love) got added to HIL:
5fe4b10b43.
Second, and perhaps more importantly, its approach is to create a new language.
The design I list here is a natural extension that adds typechecking and
minimal templating to the existing YAML/JSON formats.  As a stand-alone
project, this whould have a much broader appeal.  And whether or not we use it
for Mu depends on whether we really want an entirely new markup language or not.

To cut to the chase, I'm shelving this for now.  I'm going to keep hacking my
way through the current Go templates plus special-casing for now.  My eye is
on the initial end-to-end prototype.  But, no doubt, we'll need to revisit this
immediately afterwards, make a decision, and make it happen.
2016-12-12 09:11:27 -08:00
joeduffy f88997cc03 Specify more about extensible schema types
As part of marapongo/mu#9, we want to enable extensible schema types
for stronger typechecking at compile-time.  JSON Schema seems like a
decent starting place (http://json-schema.org/), although it's not yet
clear whether we want to use its module/naming schema or our own.  I
suspect we want to use our own so that stack schemas can be managed
using the same discipline as stack management generally.
2016-12-05 18:11:56 -08:00
joeduffy 5b791aab77 Introduce intrinsic types
This change eliminates the special type mu/extension in favor of extensible
intrinsic types.  This subsumes the previous functionality while also fixing
a number of warts with the old model.

In particular, the old mu/extension approach deferred property binding until
very late in the compiler.  In fact, too late.  The backend provider for an
extension simply received an untyped bag of stuff, which it then had to
deal with.  Unfortunately, some operations in the binder are inaccessible
at this point because doing so would cause a cycle.  Furthermore, some
pertinent information is gone at this point, like the scopes and symtables.

The canonical example where we need this is binding services names to the
services themselves; e.g., the AWS CloudFormation "DependsOn" property should
resolve to the actual service names, not the string values.  In the limit,
this requires full binding information.

There were a few solutions I considered, including ones that've required
less code motion, however this one feels the most elegant.

Now we permit types to be marked as "intrinsic."  Binding to these names
is done exactly as ordinary name binding, unlike the special mu/extension
provider name.  In fact, just about everything except code-generation for
these types is the same as ordinary types.  This is perfect for the use case
at hand, which is binding properties.

After this change, for example, "DependsOn" is expanded to real service
names precisely as we need.

As part of this change, I added support for three new basic schema types:

* ast.StringList ("string[]"): a list of strings.
* ast.StringMap ("map[string]any"): a map of strings to anys.
* ast.ServiceList ("service[]"): a list of service references.

Obviously we need to revisit this and add a more complete set.  This work
is already tracked by marapongo/mu#9.

At the end of the day, it's likely I will replace all hard-coded predefined
types with intrinsic types, for similar reasons to the above.
2016-12-05 13:46:18 -08:00
joeduffy 9f2b737715 Clean up workspace file naming
This change makes workspace file naming a little more consistent with respect
to Mufile naming.  Instead of having a .mu/ directory, under which a workspace.yaml
and/or a stacks directory might exist, we now have a Muspace.yaml (or .json) file,
and a .Mudeps/ directory.  This has nicer symmetric with respect to Mu.yaml files.
2016-11-29 20:07:27 -08:00
joeduffy 2238a95502 Add the notion of "perturbing" properties
This change introduces the notion of "perturbing" properties.  Changing
one of these impacts the live service, possibly leading to downtime.  As
such, we will likely encourage blue/green deployments of them just to be
safe.  Note that this is really just a placeholder so I can keep track of
metadata as we go, since AWS CF has a similar notion to this.

I'm not in love with the name.  I considered `interrupts`, however,
I must admit I liked that `readonly` and `perturbs` are symmetric in
the number of characters (meaning stuff lines up nicely...)
2016-11-29 14:29:34 -08:00
joeduffy 9326607c46 Add the notion of readonly properties
This change adds the notion of readonly properties to stacks.  Although these
*can* be "changed", doing so implies recreation of the resources all over again.
As a result, all dependents must be recreated, in a cascading manner.
2016-11-29 12:36:02 -08:00
joeduffy 6e77e0f462 Sketch out some cross-cloud abstraction thinking 2016-11-23 16:20:40 -08:00
joeduffy 0d6208bb00 Simplify cf/template extension provider
For now, we can simply auto-map the Mu properties to CF properties,
eliminating the need to manually map them in the templates.  Eventually
we'll want more sophistication here to control various aspects of the CF
templates, but this eliminates a lot of tedious manual work in the meantime.
2016-11-23 14:16:35 -08:00
joeduffy 83030685c3 Articulate how dependency versioning works
I've gone backwards and forwards on the design for dependency version
management.  However, I think what's written in this commit represents
a pretty sane "sweet spot" between all available options.

In a nutshell, anytime reference to a stack type in your Mufile is a
full-blown StackRef; in other words, it has a protocol (e.g., "https://"),
a base URL (e.g., "hub.mu.com/"), a name (e.g., "aws/s3/bucket"), and a
version ("@^1.0.6").  Each reference carries all of these components.

For convenience, you may omit the components.  In that case, Mu chooses
reasonable defaults:

* "https://" as the default protocol (or "git://"; this is TBD).
* "hub.mu.com/" as the default base URL.
* "@latest" as the default version number.

Note that a version can be "latest" to mean "tip", a specific SHA hash
to pin to a precise version, or a semantic version number/range.

I had originally shied away from specifying versions inline as you reference
stacks in your Mufile, and was leaning towards an explicit dependencies
section, however I was swayed for two reasons:

1. It's very common to only consume a given stack once in a file.  Needing
   to specify it in two places each time is verbose and violates DRY.

2. We have decided that each Mufile stands on its own and forms the unit
   of distribution.  I had previously thought we might move dependencies
   out of Mufiles into a "package manager" specification.  Lacking that,
   there is even less reason to call them out in a dedicated section.

Now, managing all these embedded version numbers across multiple stacks in
a single workspace would have been annoying.  (Many edits for a single
version bump.)  Instead, I've added provisions for storing this in your
workspace.yaml file.  The way it works is if any StackRef lacks a version
number, before defaulting to "@latest" we check the workspace.yaml file and,
if a default is found in there, we will use it.  For example:

        dependencies:
                aws/s3/bucket: ^1.0.6

The provision for pinning an entire namespace is also preserved.  E.g.:

        dependencies:
                aws/...: ^1.0.6
2016-11-22 13:22:29 -08:00
joeduffy 4df1ec8c35 Support baseless and baseful package paths
This changes the probing logic for dependency resolution.  The old logic was
inconsistent between the various roots.  The new approach simply prefers locations
with a base URL component -- since they are more specific -- but will allow for
locations missing a base URL component.  This is convenient for developers managing
a workspace where needing to specify the base URL in the path is annoying and
slightly too "opinionated" for my taste (especially for migrating existing services).
2016-11-22 09:28:25 -08:00
joeduffy 62d1f5c4c1 Add a note about MUROOT in the dependency probe sequence
We will use the $MUROOT envvar to determine where Mu has been installed,
which will by default be /usr/local/mu.  From there, we can access the
predefined library of stacks (underneath $MUROOT/bin/stacks).
2016-11-21 08:39:28 -08:00
joeduffy 58fa832b98 Describe more about "capabilities" as properties 2016-11-21 08:16:19 -08:00