Commit graph

52 commits

Author SHA1 Message Date
joeduffy
acd52778b7 Eliminate the expandTags functionality
This change eliminates the AWS package's cloudformation.expandTags
functionality.  The primary reason is that we haven't yet implemented
string/array intrinsics (see marapongo/mu#80), and so the presence of
this routine was preventing verification of the AWS library.  But, it
turns out, the expandTags routine was violating our "zero artistic
license" principle for the foundational cloud packages.  Namely, it
was auto-adding the Name=<name> tag, when the name property was set,
capturing an idiomatic AWS resource pattern.  Instead of doing that,
we will just project tags in their raw form, and add such conveniences
(possibly) add a higher level in the layer cake.
2017-02-10 15:10:30 -08:00
joeduffy
11b7880547 Further reshuffle Protobufs; generate JavaScript code
After a bit more thinking, we will create new SDK packages for each
of the languages we wish to support writing resource providers in.
This is where the RPC goo will live, so I have created a new sdk/
directory, moved the Protobuf/gRPC definitions underneath sdk/proto/,
and put the generated code into sdk/go/ and sdk/js/.
2017-02-10 09:28:46 -08:00
joeduffy
d67de40cf6 Move Mu library source files underneath src/ directory 2017-02-10 09:10:36 -08:00
joeduffy
432b9666fe Add an install script for the AWS library
Eventually this won't be required, but for now, it will simplify
bringing up our first end-to-end working example.
2017-02-09 16:36:53 -08:00
joeduffy
a3e18fb79a Add a basic Mu standard library install script 2017-02-09 11:18:08 -08:00
joeduffy
37f262e046 Prepare the Mu standard library package
This change:

* Renames the Mu standard library NPM package from "mu" to "@mu/mu".
  This reflects the convention that MuPackages published on NPM will,
  at least initially, be published under the "@mu" scope.  This
  indicates that a package is intended to be consumed by Mu programs.

* Adds an NPM peerDependency on the Mu package from the AWS package.

* Adds a Mu dependency on the Mu package from the AWS MuPackage.
2017-02-09 09:43:18 -08:00
joeduffy
aaefbae956 Eliminate json.ts from the Mu standard library
This is a leftover bit of code from a long time ago, and is no longer needed.
2017-02-09 08:44:39 -08:00
Joe Duffy
382de02bc6 Minor comment update 2017-02-03 05:40:22 -08:00
Luke Hoban
464bd4fe28 Simple EC2 instance example 2017-02-02 22:03:12 -08:00
joeduffy
b9dea700f1 Eliminate some cruft
This nixes the old *.mu files from the AWS MuPackage (when Mull was a thing),
and the nasty YAML files (when Go templates in YAML was a thing...(?!)).  The
TypeScript variants remain, however, which is what we'll use going forward.
2017-02-02 12:48:55 -08:00
joeduffy
b1d371a10e Fix a minor typo with library scope name 2017-02-02 11:13:40 -08:00
joeduffy
6065d2dc26 Update some READMEs from last night
This change updates the READMEs based on some difficulties we had
getting Kurt and Luke's enlistments up and running last night.
2017-02-02 11:09:33 -08:00
joeduffy
8c9c481048 Check in the Mu standard library 2017-02-01 21:06:34 -08:00
joeduffy
bf33605195 Rearrange the library code
This rearranges the library code:

* sdk/... goes away.

* What used to be sdk/javascript/ is now lib/mu/, an actual MuPackage
  that provides the base abstractions for all other MuPackages to use.

* lib/aws is the @mu/aws MuPackage that exposes all AWS resources.

* lib/mux is the @mu/x MuPackage that provides cross-cloud abstractions.
  A lot of what used to be in lib/mu goes here.  In particular, autoscaler,
  func, ..., all the "general purpose" abstractions, really.
2017-01-20 10:30:43 -08:00
joeduffy
729af81e44 Move all cloud switching to mu/x MuPackage
In the old system, the core runtime/toolset understood that we are targeting
specific cloud providers at a very deep level.  In fact, the whole code-generation
phase of the compiler was based on it.

In the new system, this difference is less of a "special" concern, and more of
a general one of mapping MuIL objects to resource providers, and letting *them*
gather up any configuration they need in a more general purpose way.

Therefore, most of this stuff can go.  I've merged in a small amount of it to
the mu/x MuPackage, since that has to switch on cloud IaaS and CaaS providers in
order to decide what kind of resources to provision.  For example, it has a
mu.x.Cluster stack type that itself provisions a lot of the barebone essential
resources, like a virtual private cloud and its associated networking components.

I suspect *some* knowledge of this will surface again as we implement more
runtime presence (discovery, etc).  But for the time being, it's a distraction
getting the core model running.  I've retained some of the old AWS code in the
new pkg/resource/providers/aws package, in case I want to reuse some of it when
implementing our first AWS resource providers.  (Although we won't be using
CloudFormation, some of the name generation code might be useful.)  So, the
ships aren't completely burned to the ground, but they are certainly on 🔥.
2017-01-20 09:46:59 -08:00
joeduffy
33f67f16ae Remove the index entrypoint
For now, an index entrypoint in the MuPackage metadata isn't
required (and in fact, gets rejected as an unrecognized field).
2017-01-17 15:07:11 -08:00
joeduffy
97f5f54fd0 Update the library mu examples to the latest 2016-12-16 11:23:37 -08:00
joeduffy
540d058cf2 Use a separate service for AWS cluster
This change encapsulates what's required for an AWS cluster in new service,
mu/clouds/aws/Cluster, so that mu/Cluster can remain fairly simplistic (it
just switches on the names and dispatches to the appropriate sub-modules).
2016-12-14 15:15:29 -08:00
joeduffy
4bc7737545 Eliminate quotes from module/import statements
There's no need for quotes here and having them makes it feel somehow
"dynamically typed" (I was subconsciously influenced by Go, I think).
Removing them...
2016-12-13 16:47:27 -08:00
joeduffy
468d7f8f3e A few renames
This change renames a few things; more to come, but this is at least
a self-consistent checkpoint:

* Use the "new" keyword to create service objects and not "resource".

* Use the "func" keyword to indicate functions and not "macro".

* Use "bool" instead of "boolean" for boolean types (more Go-like).
2016-12-13 16:39:37 -08:00
joeduffy
e1c3494ba3 Fix two minor issues in the *.mu files
First, I meant to rename "func" to "macro".  This is perhaps contentious,
however my thinking was to differentiate between functions which have runtime
representations -- like lambdas, API gateway handlers, and the like -- and
macros which are purely a metadata/compile-time construct.

Second, there was a resource naming typo.
2016-12-13 15:44:12 -08:00
joeduffy
2d003a2df3 Sketching out a minimal configuration language
This sketches out a minimal configuration language, inspired by a combination
of the Mull document, Hashicorp's various language efforts, Protobufs, and a
mixture of TypeScript.  I'm attempting to whittle down the concepts to the bare
minimum necessary for a universal "intermediate language" for our runtime that
is (a) complete enough to serve our needs, (b) advanced enough to deliver some
of the improvements in componentization and reuse that we desire, (c) appealing
enough that humans are able to write code in the language while possibly even
enjoying it, and, yet, (d) sufficient for machine interoperability needs.

Of course, I will capture all of this in a proper specification (overwriting
the existing Mull one), however I wanted to land these as a proof of concept and
for feedback purposes.  Obviously, none of this code actually compiles or works!
2016-12-13 15:33:13 -08:00
joeduffy
1a3bfc182c Use strongly typed mu.Stacks, not strings, for CloudFormation's dependsOn 2016-12-12 18:56:37 -08:00
joeduffy
832bb80b47 Checkin an initial Mu container that targets AWS ECS
This is a work-in-progress.  In fact, it's going to radically change
given the new approach to representing resource construction, however
I wanted the snapshot in source control as we evolve things.
2016-12-12 17:56:54 -08:00
joeduffy
e731229901 Make the Mu library a Node package; get it compiling
This change morphs the Mu library into a Node package and gets it
compiling against the latest AWS library and SDK changes.
2016-12-12 17:56:13 -08:00
joeduffy
47c67e7d5c Turn the AWS library into a Node package 2016-12-12 17:55:30 -08:00
joeduffy
c7f0465c41 Make an aws/cloudformation module
This includes the original CloudFormation resource type in addition
to the various tag helpers.
2016-12-12 17:54:50 -08:00
joeduffy
d10f2e6bff Get the AWS stacks compiling
This actually compiles... and does absolutely nothing (yet).
2016-12-12 17:25:27 -08:00
joeduffy
3c082ce20e Modularize the AWS proof of concept stacks
And get them building.  Mostly.
2016-12-12 15:35:56 -08:00
joeduffy
5f647b6cc0 Create proof of concept TypeScript resources
This demonstrates what infra-as-code might look like.  Given the difficulties
in expressing everything purely as metadata, I've decided to embark upon a little
spike to see what this would look like.  At first glance, I like it.

To see the difference, compare these to the Mu.yaml files alongside them.
2016-12-12 14:35:00 -08:00
joeduffy
af059c8121 Require cloud=="aws" for aws/x/cf 2016-12-09 13:22:35 -08:00
joeduffy
20e584122a Update aws/ecs/task schema to new format 2016-12-05 18:33:26 -08:00
joeduffy
a9fa42a60c Project ECS task resource stack
This projects the basic AWS::ECS::TaskDefinition CloudFormation template
type as a stack.  It also maps a bunch of schema types using fictitious
syntax, since we don't yet support this (see marapongo/mu#9).  On to that next...
2016-12-05 17:14:22 -08:00
joeduffy
a28f02ce68 Use intrinsics in place of predefineds
This change leverages intrinsics in place of the predefined types.
It remains to be seen if we can reach 100% on this, however I am hopeful.
It's also nice that the system will be built "out of itself" with this
approach; in other words, each of the types is simply a Mufile that can
use conditional targeting as appropriate for the given cloud providers.
If we find that this isn't enough, we can always bring back the concept.
2016-12-05 16:13:49 -08:00
joeduffy
690ee352df Map Route's internet gateway as GatewayId
The route resource is a bit funny, in that it lets you jam in either
an internet gateway ID or a VPC ID as the GatewayId property, whereas
all of the other target kinds get their own property.  Our stack type
offers stronger typing than this (using service references), but we
need to map the resulting ref strings correctly.
2016-12-05 15:37:16 -08:00
joeduffy
069342fef6 Issue an error for missing property names 2016-12-05 15:18:04 -08:00
joeduffy
a82a49291b Simplify mu/x/cf property mapping
I think things have gotten a little out of hand with the way mu/x/cf
auto-maps properties.  In the beginning, it looked like everything could
be trivially auto-mapped, and I wanted to avoid the verbosity of mapping
each property by hand (since you can easily fat finger a name, mess up
capitalization, forget one, etc).  But then we began mapping service
references using proper CloudFormation !Refs, which meant suppressing
some of the auto-mappings, etc., etc.  This led to properties, extraProperties,
skipProperties, renamedProperties, and so on... Pretty confusing IMHO.

I just took a step back and decided to eliminate auto-mapping.  Instead,
you get two options: properties just lists a set of property name mappings,
and extraProperties lets you do template magic to map thing instead if you
wish to take matters into your own hands.  The result isn't too verbose
and has a lot less magic going on so it's easier to understand.
2016-12-05 15:04:33 -08:00
joeduffy
73a3699ea0 Add a renamedProperties section to aws/x/cf
This enables properties to be mapped to arbitrary names, as is needed
to translate strongly typed capability references into string CF IDs.
2016-12-05 14:25:23 -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
5591103218 Fix a few minor metadata mistakes
As of this, the full cluster Mufile, and its dependencies, typechecks
and produces a valid CloudFormation template!
2016-12-03 15:26:12 -08:00
joeduffy
895f39155e Comment out unmapped AWS types
Now that we're actually type-checking property types, a number of the
AWS stacks began failing, because we haven't yet mapped the full set of
resource types.  I began doing that for the missing ones, but pulling on
that thread just leads to an even larger set ... (possibly all of them!)
due to extra dependencies.  For now, since they aren't required for the
basic scenario, I'll just comment these out; I've logged marapongo/mu#27
to track mapping the full set of resource types.
2016-12-03 11:44:18 -08:00
joeduffy
85b1b5fe0a Fix a YAML problem 2016-12-01 09:13:00 -08:00
joeduffy
68181fd0fd Eliminate <>s in cap names
I wasn't sure at first how we'd distinguish between strings and cap names.
At first, I thought we'd need special syntax, e.g. `<vpn>`; however, now I
am leaning towards a "type inference" approach, where we will interpret the
string as a cap name rather than string if that's what the target property
expects.  Although this isn't quite as explicitly typed, that's probably a
good thing in this case, as it eliminates verbosity and weird characters.
2016-11-29 14:48:55 -08:00
joeduffy
b7b1c5a715 Add readonly annotations on relevant AWS properties 2016-11-29 14:36:07 -08:00
joeduffy
182ae190f1 Use Go template whitespace trimming on AWS templates
To avoid injecting needless whitespace -- which is unfortunately meaningful
in YAML -- we need to use the new "-" trimming operators, available in Go 1.6.
2016-11-29 14:22:09 -08:00
joeduffy
e68ee3523d Project more EC2 Mu Stacks
This change projects several EC2 Mu stacks that are required for Mu cluster
bootstrapping.  This includes:

        - aws/ec2/internetGateway
        - aws/ec2/route
        - aws/ec2/routeTable
        - aws/ec2/securityGroup
        - aws/ec2/subnet
        - aws/ec2/vpc
        - aws/ec2/vpcGatewayAttachment

This is still not complete, and in fact some of these reference other EC2
Stacks that do not yet exist.  But we're getting a bit closer...
2016-11-29 12:37:52 -08:00
joeduffy
d722cc284f Inject the availability zone from cluster settings 2016-11-28 16:30:32 -08:00
joeduffy
f511d30a37 Project the AWS::EC2::VPC resource type into Mu 2016-11-28 16:28:23 -08:00
joeduffy
6f572a6a5b Add an initial whack at a cluster Mufile
This change adds a super simple initial whack at a basic cluster topology
comprised of VPC, subnet, internet gateway, attachments, and route tables.
This is actually written in Mu itself, and I am committing this early, since
there are quite a few features required before we can actually make progress
getting this up and running.
2016-11-28 16:18:38 -08:00
joeduffy
6e77e0f462 Sketch out some cross-cloud abstraction thinking 2016-11-23 16:20:40 -08:00