Skip to content

Commit

Permalink
Merge pull request #61 from maestro-framework/npm-packaging
Browse files Browse the repository at this point in the history
Merge branch npm-packaging into master
  • Loading branch information
zklamm authored Aug 12, 2020
2 parents 900e7ec + 92ad9db commit 22e88cd
Show file tree
Hide file tree
Showing 45 changed files with 1,219 additions and 115 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ __MACOSX
.env
yarn.*
*.log
doc/man/*.1.gz
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,20 @@ In the `templates` directory lie an assortment of template Maestro projects to h

To use, you must have the [AWS CLI][aws-cli] installed and set up.

1. Clone this repository (`git clone https://github.com/maestro-framework/maestro.git`)
2. Change directory into the newly cloned repo (`cd maestro`)
3. Install npm packages (`npm install`)
4. Place all lambda files (directories not supported yet) into the `lambdas` directory
5. Place state machine definition(s) into the `state-machines` directory
6. Create a file called `aws_account_info.json` under `~/.config/maestro/` that looks like this (change info to your specific needs):
1. Clone this repository (`git clone https://github.com/maestro-framework/maestro.git /path/to/maestro`)
2. Install the npm package globally (`sudo npm -g install /path/to/maestro`)
3. Create a new project with `maestro new [-n|--no-template|-t <template>|--template=<template>|--template <template>] <projectname>`
4. Create a file called `aws_account_info.json` under `~/.maestro/` that looks like this (change info to your specific needs):
```
{
"account_number": "123456789012",
"region": "us-east-1"
"account_number": "XXXXXXXXXXXX",
"region": "XXXXXXXXX"
}
```
7. Run `deploy.js` in the top level directory of your Maestro project to deploy it to AWS
8. To tear down state machine and associated resources, run the teardown script in the top level directory of your Maestro project
5. Run `maestro deploy` in the top level directory of your Maestro project to deploy it to AWS
6. To tear down state machine and associated resources, run `maestro teardown [-f|--force|--roles=<roles>|--roles <roles>]`
- This prompts you for confirmation. If you prefer to run it without a confirmation, provide a `-f` or `--force` flag
- This doesn't automatically tear down the roles that were created by `deploy.js`. To do that, provide a `--roles` flag with a comma-separated-list of role names to tear down (for example, `--roles=roleName1,roleName2` OR `--roles roleName1,roleName2`)
- This doesn't automatically tear down the roles that were created upon deployment. To do that, provide a `--roles` flag with a comma-separated-list of role names to tear down (for example, `--roles=roleName1,roleName2` OR `--roles roleName1,roleName2`)

## Dependencies

Expand All @@ -36,11 +34,12 @@ To use, you must have the [AWS CLI][aws-cli] installed and set up.
- `aws-sdk`
- `zip` command line utility
- [AWS CLI][aws-cli]
- `git` version control system

## Development Assumptions

- The name of the workflow is the project directory
- The project directory has to have a `lambdas` and `state-machines` child directory (to change soon)
- The project directory has to have a `lambdas` subdirectory and a `definition.asl.json` state machine definition template file
- We'll never deploy or teardown from any location that isn't the project root directory (can't deploy from the lambdas directory or any nested)

[aws-cli]: https://aws.amazon.com/cli/
25 changes: 0 additions & 25 deletions bin/deploy.js

This file was deleted.

42 changes: 42 additions & 0 deletions bin/maestro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env node

const deploy = require("../src/commands/deploy");
const teardown = require("../src/commands/teardown");
const newProject = require("../src/commands/newProject");
const getTemplates = require("../src/commands/getTemplates");
const config = require("../src/commands/config");
const minimist = require("minimist");
const argv = minimist(process.argv.slice(2), {
boolean: ["force", "n"],
string: ["roles", "template"],
alias: {
f: "force",
t: "template",
},
default: {
roles: "",
},
});

switch(argv._[0]) {
case "config":
config();
break;
case "deploy":
deploy();
break;
case "teardown":
teardown(argv);
break;
case "new":
newProject(argv);
break;
// TODO: perhaps `maestro get-templates` should be called as part of the `maestro config` command? If so, should we still leave `get-templates` as a top level sub-command?
case "get-templates":
getTemplates();
break;
default:
console.log(
`See man pages for commands (i.e. maestro(1), maestro-deploy(1), maestro-teardown(1), etc.)`
);
}
54 changes: 0 additions & 54 deletions bin/teardown.js

This file was deleted.

12 changes: 12 additions & 0 deletions bin/welcome-message.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

cat <<'EOF'
+--------------------------------------------------------------+
| Welcome to Maestro! |
| Run `maestro config` to configure Maestro for first-time use.|
| Or see the documentation for instructions for use. |
| https://github.com/maestro-framework/maestro |
| Happy coding! |
+--------------------------------------------------------------+
EOF
5 changes: 5 additions & 0 deletions bin/zip-man-pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

for file in "doc/man/*.1"; do
gzip -f -k -n -9 $file
done
33 changes: 33 additions & 0 deletions doc/man/maestro-config.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.TH MAESTRO-CONFIG 1 2020-08-08 "Maestro v1.0.0"

.SH NAME

.PP
maestro-config \- set up or alter your Maestro configuration files

.SH SYNOPSIS

.PP
.B maestro config

.SH DESCRIPTION

.SH BUGS

.PP
Since Maestro is in the prototypal phase, bug reports are welcome and can be submitted at
.UR https://github.com/maestro-framework/maestro/issues
the GitHub Issues page
.UE .

.SH EXAMPLE

.SH SEE ALSO

.PP
.BR maestro (1),
.BR maestro-help (1),
.BR maestro-teardown (1),
.BR maestro-deploy (1),
.BR maestro-new (1),
.BR maestro-get-templates (1)
36 changes: 36 additions & 0 deletions doc/man/maestro-deploy.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.TH MAESTRO-DEPLOY 1 2020-08-08 "Maestro v1.0.0"

.SH NAME

maestro-deploy \- deploy a full AWS Step Functions workflow with AWS
Lambdas

.SH SYNOPSIS

.PP
.B maestro deploy

.SH DESCRIPTION

.SH OPTIONS

.SH NOTES

.SH BUGS

.PP
Since Maestro is in the prototypal phase, bug reports are welcome and can be submitted at
.UR https://github.com/maestro-framework/maestro/issues
the GitHub Issues page
.UE .

.SH EXAMPLE

.SH SEE ALSO

.BR maestro(1),
.BR maestro-help (1),
.BR maestro-config (1),
.BR maestro-new (1),
.BR maestro-get-templates (1),
.BR maestro-teardown (1)
56 changes: 56 additions & 0 deletions doc/man/maestro-get-templates.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.TH MAESTRO-GET-TEMPLATES 1 2020-08-08 "Maestro v1.0.0"

.SH NAME

maestro-get-templates \- fetch and install the default maestro templates

.SH SYNOPSIS

.PP
.B maestro get-templates

.SH DESCRIPTION

.PP
Fetches the
.UR https://github.com/maestro-framework/maestro-templates
Maestro default templates
.UE from git and installs them on the user's local machine.

.PP
If the templates are already installed, this simply notifies the user.

.SH OPTIONS

.SH FILES

.PP
Like
.BR maestro (1),
this uses the special maestro directory located at
.BR ~/.maestro/ .
The templates that
.BR maestro-get-templates (1)
installs are located in the
.BR "~/.maestro/templates/ " directory.

.SH NOTES

.SH BUGS

.PP
Since Maestro is in the prototypal phase, bug reports are welcome and can be submitted at
.UR https://github.com/maestro-framework/maestro/issues
the GitHub Issues page
.UE .

.SH EXAMPLE

.SH SEE ALSO

.BR maestro (1),
.BR maestro-help (1),
.BR maestro-deploy (1),
.BR maestro-new (1),
.BR maestro-config (1),
.BR maestro-teardown (1)
40 changes: 40 additions & 0 deletions doc/man/maestro-help.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.TH MAESTRO-HELP 1 2020-08-08 "Maestro v1.0.0"

.SH NAME

maestro \- display help information about maestro or maestro command

.SH SYNOPSIS

.PP
.B maestro help
[\fIcommand\fR]

.PP
.B maestro
[\fIcommand\fR] \fB\-h\fR|\fB\-\-help\fR

.SH DESCRIPTION

.SH OPTIONS

.SH NOTES

.SH BUGS

.PP
Since Maestro is in the prototypal phase, bug reports are welcome and can be submitted at
.UR https://github.com/maestro-framework/maestro/issues
the GitHub Issues page
.UE .

.SH EXAMPLE

.SH SEE ALSO

.BR maestro (1),
.BR maestro-config (1),
.BR maestro-deploy (1),
.BR maestro-new (1),
.BR maestro-get-templates (1),
.BR maestro-teardown (1)
Loading

0 comments on commit 22e88cd

Please sign in to comment.