Commit graph

69 commits

Author SHA1 Message Date
joeduffy 154db7a0a7 Use the stretchr/testify package for testing
We use the testify package for convenience methods like assert.
2016-11-15 19:18:03 -08:00
joeduffy 38c73b2e6a Add a simple compiler test
This change adds a compiler test that just checks the basic "Mufile is missing"
error checking.  The test itself is mostly uninteresting; what's more interesting
is the addition of some basic helper functionality that can be used for future
compiler tests, like capturing of compiler diagnostics for comparisons.
2016-11-15 19:16:02 -08:00
joeduffy 0ab10dd207 Rename Semver to SemVer
Eric rightly pointed out in a CR that Semver is...different.  Since it
is an abbreviation of the lengthier SemanticVersion name, SemVer seems
more appropriate.  Changed.
2016-11-15 18:34:19 -08:00
joeduffy 79f5f312b8 Support .yml Mufile extensions
This change recognizes .yml in addition to the official .yaml extension,
since .yml is actually very commonly used.  In addition, while in here, I've
centralized more of the extensions logic so that it's more "data-driven"
and easier to manage down the road (one place to change rather than two).
2016-11-15 18:26:21 -08:00
joeduffy ff0059cd7b Print relative filenames in errors
Error messages could get quite lengthy as the code was written previously,
because we always used the complete absolute path for the file in question.
This change "prettifies" this to be relative to whatever contextual path
the user has chosen during compilation.  This shortens messages considerably.
2016-11-15 18:00:43 -08:00
joeduffy c527cedb03 Delete api/types (missing from last commit) 2016-11-15 17:58:48 -08:00
joeduffy 094d3a0817 Perform more real compilation activities
This change includes some progress on actual compilation (albeit with several
TODOs remaining before we can actually spit out a useful artifact).  There are
also some general cleanups sprinkled throughout.  In a nutshell:

* Add a compiler.Context object that will be available during template expansion.

* Introduce a diag.Document abstraction.  This is better than passing raw filenames
  around, and lets us embellish diagnostics as we go.  In particular, we will be
  in a better position to provide line/column error information.

* Move IO out of the Parser and into the Compiler, where it can cache and reuse
  Documents.  This will become important as we start to load up dependencies.

* Rename PosRange to Location.  This reads nicer with the new Document terminology.

* Rename the mu/api package to mu/schema.  It's likely we will need to introduce a
  true AST that is decoupled from the serialization format and contains bound nodes.
  As a result, treating the existing types as "schema" is more honest.

* Add in a big section of TODOs at the end of the compiler.Compiler.Build function.
2016-11-15 17:42:22 -08:00
joeduffy d238ed61da Make a few improvements, mostly readability
* Rename Meta to Metadata.

* Rename Target's CloudOS and CloudScheduler properties to Cloud
  and Scheduler, respectively.  Also rename Target's JSON properties
  to match (they had drifted); they are now "cloud" and "scheduler".

* Rename Diags() to Diag() on the Compiler and Parser interfaces.

* Rename defaultDiags to defaultSink, to match the interface name.

* Add a few useful logging outputs.
2016-11-15 16:30:10 -08:00
joeduffy c928a0f60b Correctly recognize file extensions 2016-11-15 16:15:58 -08:00
joeduffy e75f06bb2b Sketch a mu build command and its scaffolding
This adds a bunch of general scaffolding and the beginning of a `build` command.

The general engineering scaffolding includes:

* Glide for dependency management.
* A Makefile that runs govet and golint during builds.
* Google's Glog library for logging.
* Cobra for command line functionality.

The Mu-specific scaffolding includes some packages:

* mu/pkg/diag: A package for compiler-like diagnostics.  It's fairly barebones
  at the moment, however we can embellish this over time.
* mu/pkg/errors: A package containing Mu's predefined set of errors.
* mu/pkg/workspace: A package containing workspace-related convenience helpers.

in addition to a main entrypoint that simply wires up and invokes the CLI.  From
there, the mu/cmd package takes over, with the Cobra-defined CLI commands.

Finally, the mu/pkg/compiler package actually implements the compiler behavior.
Or, it will.  For now, it simply parses a JSON or YAML Mufile into the core
mu/pkg/api types, and prints out the result.
2016-11-15 14:30:34 -05:00
joeduffy 9c7f774fc6 Project the core Mufile types
This change adds the core Mufile types (Cluster, Stack, and friends), including
mapping them to the relevant JSON names in the serialized form.  Notably absent
are all of the Identity-related types, which will come later on.
2016-11-15 14:28:17 -05:00
joeduffy 19d5fcbd93 Fix a lambda typo in the demo code 2016-11-07 17:03:32 -08:00
joeduffy 8ce0ff95e9 Remove the Dockerfile from demo1/build2
The Mu stack stands alone and hence doesn't require a Dockerfile.
2016-11-07 17:02:36 -08:00
joeduffy 43fe8de15b Add a reminder to decide on "local" flavors 2016-11-07 11:26:07 -08:00
joeduffy d71e7e8315 Describe more of the compilation process 2016-11-07 10:47:15 -08:00
joeduffy c208ab65bb Replace Mu.yaml service description with a "source" directive 2016-11-07 10:16:11 -08:00
joeduffy 7323436760 Rearrange demo directory so the "build" variants stand alone 2016-11-07 10:15:38 -08:00
joeduffy 736008168d Add two variants to the Mu demo
This adds two hypothetical variants to the Mu demo, "building" new capabilities
up from the basic Express and MongoDB app we start with:

1) The first variant is to leverage the Mu SDK for service discovery and
   configuration, eliminating the "loosely typed" approach that is common with
   Docker (e.g., having to fetch connection URLs from arguments, environment
   variables, etc).  This extends the Mu type system "into" the Docker container,
   whereas previously it stopped at the boundary.

2) The second variant really takes this to the next level, embellishing the nice
   DSL-like approach.  In this model, infrastructure is expressed in code.
2016-11-07 09:37:47 -08:00
joeduffy 31717d5f95 Eliminate manual persistence from demo Mufile
Instead of manually creating a volume, we will arrange for the mongodb/mongodb
to auto-mount a mu/x/fs/volume, as per [the cloud-neutral design doc](/docs/xcloud.md).
2016-11-06 12:36:28 -08:00
joeduffy c6cdb9a7ae Add a note on AWS IAM mapping
...plus a handful of random TODOs.
2016-11-06 10:02:06 -08:00
joeduffy a90b16f34d Add a note about Groups being members of other Groups 2016-11-06 09:51:23 -08:00
joeduffy be0097ed85 Add a document on the cloud-neutral Mu abstractions 2016-11-06 09:32:46 -08:00
joeduffy 371429a95a Add a small informative note on security personas 2016-11-04 16:06:53 -07:00
joeduffy ea707cab68 Add a reminder to figure out Security metadata in Mufiles 2016-11-04 15:43:03 -07:00
joeduffy d8ac8efa80 Start a new Security doc
This change refactors the Architecture doc, splitting out Security into its
own design document.
2016-11-04 15:37:12 -07:00
joeduffy d8ea7de341 Add some thoughts on security to the architecture doc 2016-11-04 15:34:50 -07:00
joeduffy 695573d211 Sketch out a few more necessary concepts 2016-11-04 13:50:10 -07:00
joeduffy 216b2867eb Add a reminder to figure out "secret" storage as a service 2016-11-04 13:21:47 -07:00
joeduffy b176a3b314 Reorganize some remaining TODOs 2016-11-04 13:19:24 -07:00
joeduffy 2226584cff Add a note about IAM, credentials, region, etc. flowing from AWS IaaS to CaaS 2016-11-04 13:10:50 -07:00
joeduffy 25e0979da3 Add initial thoughts on EC2 Container Service (ECS) targeting 2016-11-04 12:53:45 -07:00
joeduffy 7bd27e9036 Add a note to consider mu/job and mu/daemon types 2016-11-04 12:43:31 -07:00
joeduffy 7e26ab050d Add the "demo1" example app
This just adds a simple voting app for the demo script.  It leverages
a Node.js Express app for the frontend and a MongoDB database for the backend.
It conditionally provisions and attaches to an AWS Elastic Block Store volume
in the event that it's targeting an AWS cluster, and ephemeral storage otherwise.
2016-11-04 12:17:46 -07:00
joeduffy 9836600e73 Do a bit of random wordsmithing as I proofread 2016-11-04 11:34:30 -07:00
joeduffy 97d251772d Clean up out of date documentation 2016-11-04 11:27:09 -07:00
joeduffy 47d8044e9a Split the metadata spec from the targets doc
This change separates the metadata specification from the targets doc,
since they are both meant to be consumable independent of one another
and will evolve at their own paces.
2016-11-04 11:23:59 -07:00
joeduffy a270a9e0fc Eliminate TODO stacking; it kills MarkDown readability 2016-11-03 18:29:23 -07:00
joeduffy cb2726dfb7 Flesh out more of the AWS CloudFormation transformations 2016-11-03 18:27:21 -07:00
joeduffy 047bc0aae2 Add a few AWS-specific TODOs to the Metadata doc 2016-11-03 16:18:23 -07:00
joeduffy ab35057316 Sketch out the nested Stacks section 2016-11-03 16:11:28 -07:00
joeduffy 792e90fe17 Add a brief note about subclassing 2016-11-03 15:52:03 -07:00
joeduffy 523a55ed1e Articulate the parameters section 2016-11-03 15:47:52 -07:00
joeduffy 1742d0ecf1 Sketch out the Metadata spec; start on the AWS IaaS
This sketches out some more details in the Metadata format, in addition to
starting to articulate what the AWS IaaS provider looks like.  Sadly, more
questions than answers, but it's good to have the placeholders...
2016-11-03 15:12:22 -07:00
joeduffy 969294aad6 Introduce the notion of a Clusters
Simple developer scenarios can be done solely in terms of Stacks.  However, to
support more sophisticated cases -- where multiplexing many Stacks onto a shared
set of resources is preferred (for cost savings, provisioning time savings,
control, etc) -- we need to introduce the concept of a Cluster.  Each Cluster has
a fixed combination of IaaS/CaaS provider, decided at provisioning time.
2016-11-03 12:13:51 -07:00
joeduffy fe2f52c436 Link to prioritized platform list 2016-11-03 12:06:46 -07:00
joeduffy 55ab75b222 Clarify the IaaS/CaaS relationship 2016-11-02 13:33:48 -07:00
joeduffy 0232dd3a08 Refactor the Architecture doc, and start a Metadata specification
This just contains primarily scaffolding, however lays out a general direction
and table of contents for the metadata specification document (marapongo/mu#1).
2016-11-02 13:04:27 -07:00
joeduffy 48e178d0d2 Create the start of an Architecture doc
This doc will describe the overall architecture for the Mu tools, platform,
and related artifacts.  It will be a companion to the more detailed drill-down
into the Mufile format and its specific target transformations (marapongo/mu#1).

There are tons of todos, etc., however this is at least a start, with some
amount of conceptual overview plus scaffolding and structure to fill out.
2016-11-01 17:04:34 -07:00
joeduffy 8f529cb3d8 Add the Nginx hypothetical examples
This was really just a brainstorming exercise that helped get to the final
model we landed on.  I'm archiving it for posterity.  I'll decide whether to
carry it forward or delete it and leave it as an artifact for future reference
as I make more progress on the overall architecture and file format specification.
2016-11-01 11:01:55 -07:00
joeduffy 07444a9612 Add some README scaffolding around the converted examples 2016-11-01 10:39:36 -07:00