Skip to content
Permalink
Browse files

Initial commit

  • Loading branch information...
tj committed Mar 15, 2018
0 parents commit 6d27f34c95c7eeba660d54a8ff7c6e48c69f6769
Showing with 25,126 additions and 0 deletions.
  1. +1 −0 .gitattributes
  2. +22 −0 .github/ISSUE_TEMPLATE.md
  3. +14 −0 .github/PULL_REQUEST_TEMPLATE.md
  4. +14 −0 .gitignore
  5. +19 −0 .goreleaser.yml
  6. +10 −0 .travis.yml
  7. +46 −0 CODE_OF_CONDUCT.md
  8. +84 −0 CONTRIBUTING.md
  9. +374 −0 Gopkg.lock
  10. +114 −0 Gopkg.toml
  11. +664 −0 History.md
  12. +5 −0 LICENSE
  13. +65 −0 Makefile
  14. +83 −0 Readme.md
  15. BIN assets/features-community.png
  16. BIN assets/features-pro.png
  17. BIN assets/pricing.png
  18. BIN assets/screen2.png
  19. BIN assets/title.png
  20. +71 −0 cmd/up-proxy/main.go
  21. +74 −0 cmd/up/main.go
  22. +56 −0 config/backoff.go
  23. +31 −0 config/backoff_test.go
  24. +270 −0 config/config.go
  25. +301 −0 config/config_test.go
  26. +37 −0 config/cors.go
  27. +133 −0 config/dns.go
  28. +174 −0 config/dns_test.go
  29. +3 −0 config/doc.go
  30. +37 −0 config/duration.go
  31. +41 −0 config/duration_test.go
  32. +4 −0 config/environment.go
  33. +22 −0 config/errorpages.go
  34. +13 −0 config/errorpages_test.go
  35. +88 −0 config/hooks.go
  36. +78 −0 config/hooks_test.go
  37. +48 −0 config/lambda.go
  38. +14 −0 config/lambda_test.go
  39. +26 −0 config/logs.go
  40. +108 −0 config/relay.go
  41. +224 −0 config/runtimes.go
  42. +151 −0 config/stages.go
  43. +139 −0 config/stages_test.go
  44. +41 −0 config/static.go
  45. +28 −0 config/static_test.go
  46. +9 −0 docs/00-introduction.md
  47. +35 −0 docs/01-installation.md
  48. +95 −0 docs/02-aws-credentials.md
  49. +114 −0 docs/03-getting-started.md
  50. +780 −0 docs/04-configuration.md
  51. +83 −0 docs/05-runtimes.md
  52. +812 −0 docs/06-commands.md
  53. +701 −0 docs/07-guides.md
  54. +34 −0 docs/08-troubleshooting.md
  55. +82 −0 docs/09-faq.md
  56. +13 −0 docs/10-links.md
  57. +70 −0 handler/handler.go
  58. +255 −0 handler/handler_test.go
  59. +6 −0 handler/testdata/node-pkg-start/index.js
  60. +6 −0 handler/testdata/node-pkg-start/package.json
  61. +6 −0 handler/testdata/node-pkg-start/up.json
  62. +6 −0 handler/testdata/node-pkg/app.js
  63. +3 −0 handler/testdata/node-pkg/package.json
  64. +6 −0 handler/testdata/node-pkg/up.json
  65. +10 −0 handler/testdata/node/app.js
  66. +6 −0 handler/testdata/node/up.json
  67. +1 −0 handler/testdata/spa/app.js
  68. +1 −0 handler/testdata/spa/css/bar.css
  69. +1 −0 handler/testdata/spa/css/foo.css
  70. +1 −0 handler/testdata/spa/index.html
  71. +13 −0 handler/testdata/spa/up.json
  72. +1 −0 handler/testdata/static-redirects/help/ping/alerts/index.html
  73. +1 −0 handler/testdata/static-redirects/index.html
  74. +13 −0 handler/testdata/static-redirects/up.json
  75. +1 −0 handler/testdata/static-rewrites/help/ping/alerts.html
  76. +1 −0 handler/testdata/static-rewrites/index.html
  77. +13 −0 handler/testdata/static-rewrites/up.json
  78. +1 −0 handler/testdata/static/index.html
  79. +1 −0 handler/testdata/static/style.css
  80. +7 −0 handler/testdata/static/up.json
  81. +33 −0 http/cors/cors.go
  82. +144 −0 http/cors/cors_test.go
  83. +110 −0 http/errorpages/errorpages.go
  84. +227 −0 http/errorpages/errorpages_test.go
  85. +1 −0 http/errorpages/testdata/defaults/index.html
  86. +3 −0 http/errorpages/testdata/defaults/up.json
  87. +1 −0 http/errorpages/testdata/templates/404.html
  88. +1 −0 http/errorpages/testdata/templates/5xx.html
  89. +1 −0 http/errorpages/testdata/templates/index.html
  90. +3 −0 http/errorpages/testdata/templates/up.json
  91. +15 −0 http/gzip/gzip.go
  92. +68 −0 http/gzip/gzip_test.go
  93. +79 −0 http/headers/headers.go
  94. +54 −0 http/headers/headers_test.go
  95. +2 −0 http/headers/testdata/_headers
  96. +1 −0 http/headers/testdata/index.html
  97. +1 −0 http/headers/testdata/style.css
  98. +3 −0 http/headers/testdata/up.json
  99. +72 −0 http/inject/inject.go
  100. +110 −0 http/inject/inject_test.go
  101. +1 −0 http/inject/testdata/404.html
  102. +9 −0 http/inject/testdata/index.html
  103. +1 −0 http/inject/testdata/style.css
  104. +3 −0 http/inject/testdata/up.json
  105. +102 −0 http/logs/logs.go
  106. +51 −0 http/logs/logs_test.go
  107. +1 −0 http/logs/testdata/index.html
  108. +3 −0 http/logs/testdata/up.json
  109. +14 −0 http/poweredby/poweredby.go
  110. +32 −0 http/poweredby/poweredby_test.go
  111. +1 −0 http/poweredby/testdata/index.html
  112. +3 −0 http/poweredby/testdata/up.json
  113. +117 −0 http/redirects/redirects.go
  114. +199 −0 http/redirects/redirects_test.go
  115. +334 −0 http/relay/relay.go
  116. +320 −0 http/relay/relay_test.go
  117. +103 −0 http/relay/testdata/basic/app.js
  118. +3 −0 http/relay/testdata/basic/up.json
  119. +5 −0 http/relay/testdata/node/package.json
  120. +6 −0 http/relay/testdata/node/server.js
  121. +3 −0 http/relay/testdata/node/up.json
  122. +13 −0 http/static/static.go
  123. +81 −0 http/static/static_test.go
  124. +1 −0 http/static/testdata/index.html
  125. +1 −0 http/static/testdata/style.css
  126. +3 −0 http/static/testdata/up.json
  127. +315 −0 install.sh
  128. +474 −0 internal/account/account.go
  129. +66 −0 internal/account/cards.go
  130. +18 −0 internal/cli/app/app.go
  131. +92 −0 internal/cli/build/build.go
  132. +31 −0 internal/cli/config/config.go
  133. +147 −0 internal/cli/deploy/deploy.go
  134. +21 −0 internal/cli/docs/docs.go
  135. +244 −0 internal/cli/domains/domains.go
  136. +88 −0 internal/cli/logs/logs.go
  137. +43 −0 internal/cli/metrics/metrics.go
  138. +77 −0 internal/cli/root/root.go
  139. +32 −0 internal/cli/run/run.go
  140. +132 −0 internal/cli/stack/stack.go
  141. +83 −0 internal/cli/start/start.go
  142. +703 −0 internal/cli/team/team.go
  143. +168 −0 internal/cli/upgrade/upgrade.go
  144. +67 −0 internal/cli/url/url.go
  145. +19 −0 internal/cli/version/version.go
  146. +53 −0 internal/colors/colors.go
  147. +163 −0 internal/errorpage/errorpage.go
  148. +75 −0 internal/errorpage/errorpage_test.go
  149. +94 −0 internal/errorpage/template.go
  150. +1 −0 internal/errorpage/testdata/200.html
  151. +1 −0 internal/errorpage/testdata/404.html
  152. +1 −0 internal/errorpage/testdata/4xx.html
  153. +1 −0 internal/errorpage/testdata/500.html
  154. +1 −0 internal/errorpage/testdata/error.html
  155. 0 internal/errorpage/testdata/other.html
  156. 0 internal/errorpage/testdata/somedir/test.html
  157. +60 −0 internal/header/header.go
  158. +71 −0 internal/header/header_test.go
  159. +227 −0 internal/inject/inject.go
  160. +173 −0 internal/inject/inject_test.go
  161. +31 −0 internal/logs/logs.go
  162. +203 −0 internal/logs/parser/ast/ast.go
  163. +292 −0 internal/logs/parser/grammar.peg
  164. +3,500 −0 internal/logs/parser/grammar.peg.go
  165. +150 −0 internal/logs/parser/parser.go
  166. +115 −0 internal/logs/parser/parser_test.go
  167. +206 −0 internal/logs/text/text.go
  168. +29 −0 internal/logs/text/text_test.go
  169. +92 −0 internal/logs/writer/writer.go
  170. +69 −0 internal/logs/writer/writer_test.go
  171. +71 −0 internal/metrics/metrics.go
  172. +39 −0 internal/progressreader/progressreader.go
  173. +4 −0 internal/proxy/bin/bin.go
  174. +52 −0 internal/proxy/event.go
  175. +359 −0 internal/proxy/event_test.go
  176. +31 −0 internal/proxy/lambda.go
  177. +66 −0 internal/proxy/request.go
  178. +81 −0 internal/proxy/request_test.go
  179. +116 −0 internal/proxy/response.go
  180. +93 −0 internal/proxy/response_test.go
  181. +148 −0 internal/redirect/redirect.go
  182. +141 −0 internal/redirect/redirect_test.go
  183. +165 −0 internal/setup/setup.go
  184. +152 −0 internal/shim/byline.js
  185. +103 −0 internal/shim/index.js
  186. +4 −0 internal/shim/shim.go
  187. +38 −0 internal/signal/signal.go
  188. +44 −0 internal/stats/stats.go
  189. +194 −0 internal/userconfig/userconfig.go
  190. +48 −0 internal/userconfig/userconfig_test.go
  191. +485 −0 internal/util/util.go
  192. +125 −0 internal/util/util_test.go
  193. +88 −0 internal/validate/validate.go
  194. +1 −0 internal/zip/testdata/.file
  195. +1 −0 internal/zip/testdata/.upignore
  196. +1 −0 internal/zip/testdata/Readme.md
  197. +1 −0 internal/zip/testdata/bar.js
  198. +1 −0 internal/zip/testdata/foo.js
  199. +1 −0 internal/zip/testdata/index.js
  200. +80 −0 internal/zip/zip.go
  201. +50 −0 internal/zip/zip_test.go
  202. +120 −0 platform.go
  203. +58 −0 platform/aws/cost/cost.go
  204. +69 −0 platform/aws/cost/cost_test.go
  205. +354 −0 platform/aws/cost/domains.go
  206. +118 −0 platform/aws/domains/domains.go
  207. +132 −0 platform/aws/logs/logs.go
  208. +73 −0 platform/aws/regions/regions.go
  209. +25 −0 platform/aws/regions/regions_test.go
  210. +46 −0 platform/aws/runtime/runtime.go
  211. +106 −0 platform/event/event.go
  212. +947 −0 platform/lambda/lambda.go
  213. +57 −0 platform/lambda/lambda_test.go
  214. +112 −0 platform/lambda/metrics.go
  215. +29 −0 platform/lambda/reporter/reporter.go
  216. +380 −0 platform/lambda/stack/resources/resources.go
  217. +571 −0 platform/lambda/stack/resources/resources_test.go
  218. +651 −0 platform/lambda/stack/stack.go
  219. +46 −0 platform/lambda/stack/stack_test.go
  220. +118 −0 platform/lambda/stack/status.go
  221. +30 −0 platform/lambda/stack/status_test.go
  222. +11 −0 reporter/discard/discard.go
  223. +66 −0 reporter/plain/plain.go
  224. +18 −0 reporter/reporter.go
  225. +300 −0 reporter/text/text.go
  226. +224 −0 up.go
@@ -0,0 +1 @@
internal/proxy/bin/bin_assets.go filter=lfs diff=lfs merge=lfs -text
@@ -0,0 +1,22 @@
## Prerequisites

* [ ] I am running the latest version. (`up upgrade`)
* [ ] I searched to see if the issue already exists.
* [ ] I inspected the verbose debug output with the `-v, --verbose` flag.
* [ ] Are you an Up Pro subscriber?

## Description

Describe the bug or feature.

## Steps to Reproduce

Describe the steps required to reproduce the issue if applicable.

## Love Up?

Please consider signing up for Up Pro (https://up.docs.apex.sh/#guides.subscribing_to_up_pro) or donating via https://opencollective.com/apex-up/donate.

## Slack

Join us on Slack https://chat.apex.sh/
@@ -0,0 +1,14 @@
Open an issue and discuss changes before spending time on them, unless the change is trivial or an issue already exists.

Use "VERB some thing here. Closes #n" to close the relevant issue, where VERB is one of:

- add
- remove
- change
- refactor

If the change is documentation related prefix with "docs: ", as these are filtered from the changelog.

docs: add ~/.aws/config

Run `dep ensure` if you introduce any new `import`'s so they're included in the ./vendor dir.
@@ -0,0 +1,14 @@
.envrc
node_modules/
.shards/
lib
vendor/
testing
up-proxy
!cmd/up-proxy
dist
.idea
.vscode
.DS_Store
internal/proxy/bin/bin_assets.go
internal/shim/bindata.go
@@ -0,0 +1,19 @@
build:
main: cmd/up/main.go
binary: up
goos:
- darwin
- linux
- windows
- freebsd
- netbsd
- openbsd
goarch:
- amd64
- 386
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^refactor'
@@ -0,0 +1,10 @@
language: go
go:
- 1.9

script:
- curl -sL https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 > dep
- chmod +x ./dep
- ./dep ensure
- make install.deps
- make test.ci
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at tj@apex.sh. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,84 @@
# Contributing

Before contributing to Up you'll need a few things:

- Install [Golang 1.9](https://golang.org/dl/) for that Go thing if you don't have it
- Install [golang/dep](https://github.com/golang/dep) for dependency management

The following are optional:

- Install [pointlander/peg](https://github.com/pointlander/peg) if you're working on the log grammar
- Install [jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata) if you need to bake `up-proxy` into `up`
- Or run `make install.deps` to grab these tools

## Setup

Grab Up:

```
$ go get github.com/apex/up
```

Change into the project:

```
$ cd $GOPATH/src/github.com/apex/up
```

Grab the dependencies:

```
$ dep ensure
```

Grab the dev dependencies:

```
make install.deps
```

## Testing

```
$ make test
```

## Layout

Although Up is not provided as a library it is structured as if it was, for organizational purposes. The project layout is loosely:

- *.go – Primary API
- [reporter](reporter) – Event based CLI reporting
- [platform](platform) – Platform specifics (AWS Lambda, Azure, Google, etc)
- [internal](internal) – Internal utilities and lower level tooling
- [http](http) – HTTP middleware for up-proxy
- [handler](handler) – HTTP middleware aggregate, effectively the entire proxy
- [docs](docs) – Documentation used to generate the static site
- [config](config) – Configuration structures and validation for `up.json`
- [cmd](cmd) – Commands, where `up` is the CLI and `up-proxy` is serving requests in production
Note that this is just a first past, and the code / layout will be refactored. View [Godoc](http://godoc.org/github.com/apex/up) for more details of the internals.
## Proxy
One oddity is that the `up-proxy` is baked into `up`. Yes there's a binary within the binary :) – this is so `up` can inject the proxy before deploying your function to Lambda.
The proxy accepts AWS Lambda events from API Gateway, translates them to HTTP, and sends a request to your application, then translates it back to an event that API Gateway understands.
Reverse proxy features such as URL rewriting, gzip compression, script injection, error pages and others are also provided in `up-proxy`.
## Roadmap
Up uses GitHub issue tracking and milestones for its loose roadmap. I highly recommend installing Zenhub (https://www.zenhub.com/) as well, however I primarily organize by milestones and labels for now.
## Releases
Notes for myself:
- Run `make build` if necessary to re-build the proxy
- Run `git changelog`
- Run `git release`
- Run `make release`
- Re-build documentation
- Notes about any backwards compat issues, migration, IAM policy changes
- Adjust schemastore JSON schema if necessary
Oops, something went wrong.

0 comments on commit 6d27f34

Please sign in to comment.
You can’t perform that action at this time.