Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Wilde <[email protected]>
  • Loading branch information
ewilde committed Jul 8, 2018
0 parents commit 2256f3b
Show file tree
Hide file tree
Showing 507 changed files with 292,901 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
root = true

; Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8

; Golang
[*.go]
indent_style = tab
indent_size = 4

; YAML
[*.{yaml,yml}]
indent_style = space
indent_size = 2

[{Makefile,GNUmakefile}]
indent_style = tab
indent_size = 4
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--- Provide a general summary of the issue in the Title above -->

## Expected Behaviour
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Current Behaviour
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.

## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* OpenFaaS version information run `faas-cli version` to get relevant information
34 changes: 34 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
- [ ] I have raised an issue to propose this change ([required](https://github.com/ewilde/faas-ecs/blob/master/CONTRIBUTING.md))


## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- Please show output from tests if possible -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I've read the [CONTRIBUTION](https://github.com/ewilde/faas-ecs/blob/master/CONTRIBUTING.md) guide
- [ ] I have signed-off my commits with `git commit -s`
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] Below is the relevant test output.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
examples/hellogoworld2/
dist
16 changes: 16 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
builds:
- binary: faas-ecs
goos:
- linux
goarch:
- amd64
archive:
format: zip
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- Merge pull request
- Merge branch
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
sudo: required

language: go

go:
- 1.10.x

install:
- echo "Please don't go get"

services:
- docker

before_script:
- bash scripts/set_travis_experimental_mode.sh
- curl -sSL get.docker.com | sudo -E sh

after_success:
- if [ ! -z "$TRAVIS_TAG" ] ; then
docker tag ewilde/faas-ecs:latest ewilde/faas-ecs:$TRAVIS_TAG;
echo $DOCKER_PASSWORD | docker login -u=$DOCKER_USERNAME --password-stdin;
docker push $DOCKER_NS/faas-ecs:$TRAVIS_TAG;
docker push $DOCKER_NS/faas-ecs:latest;
fi
script:
- make build

deploy:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_OS_NAME = linux
167 changes: 167 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Contributing

## Guidelines

Guidelines for contributing.

### How can I get involved?

We have a number of areas where we can accept contributions:

* Work on [missing features and bugs](https://github.com/ewilde/faas-ecs/issues)


### I've found a typo

* A Pull Request is not necessary. Raise an [Issue](https://github.com/ewilde/faas-ecs/issues) and we'll fix it as soon as we can.

### I have a (great) idea

The maintainers would like to make faas-ecs the best it can be and welcome new contributions that align with the project's goals.
Our time is limited so we'd like to make sure we agree on the proposed work before you spend time doing it.
Saying "no" is hard which is why we'd rather say "yes" ahead of time. You need to raise a proposal.

**Please do not raise a proposal after doing the work - this is counter to the spirit of the project. It is hard to be objective about something which has already been done**

What makes a good proposal?

* Brief summary including motivation/context
* Any design changes
* Pros + Cons
* Effort required up front
* Effort required for CI/CD, release, ongoing maintenance
* Migration strategy / backwards-compatibility
* Mock-up screenshots or examples of how the CLI would work

If you are proposing a new tool or service please do due diligence.
Does this tool already exist? Can we reuse it? For example: a timer / CRON-type scheduler for invoking functions.

### Paperwork for Pull Requests

Please read this whole guide and make sure you agree to our DCO agreement (included below):

* See guidelines on commit messages (below)
* Sign-off your commits
* Complete the whole template for issues and pull requests
* [Reference addressed issues](https://help.github.com/articles/closing-issues-using-keywords/) in the PR description & commit messages - use 'Fixes #IssueNo'
* Always give instructions for testing
* Provide us CLI commands and output or screenshots where you can

### Commit messages

The first line of the commit message is the *subject*, this should be followed by a blank line and then a message describing the intent and purpose of the commit. These guidelines are based upon a [post by Chris Beams](https://chris.beams.io/posts/git-commit/).

* When you run `git commit` make sure you sign-off the commit by typing `git commit -s`.
* The commit subject-line should start with an uppercase letter
* The commit subject-line should not exceed 72 characters in length
* The commit subject-line should not end with punctuation (., etc)

When giving a commit body:
* Leave a blank line after the subject-line
* Make sure all lines are wrapped to 72 characters

Here's an example:

```
Add secrets to provider
We need to have the ability to pass secrets to faas-ecs securely.
This commits adds secrets support using AWS Secrets Manager API.
Resolves #1
Signed-off-by: Edward Wilde <[email protected]>
```

If you would like to ammend your commit follow this guide: [Git: Rewriting History](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History)

**Unit testing with Golang**

Please follow style guide on [this blog post](https://blog.alexellis.io/golang-writing-unit-tests/) from [The Go Programming Language](https://www.amazon.co.uk/Programming-Language-Addison-Wesley-Professional-Computing/dp/0134190440)

**I have a question, a suggestion or need help**

Please raise an Issue.

**I need to add a dependency**

We use vendoring for projects written in Go.
This means that we will maintain a copy of the source-code of dependencies within Git.
It allows a repeatable build and isolates change.

We use Golang's `dep` tool to manage dependencies for Golang projects - https://github.com/golang/dep

## License

This project is licensed under the MIT License.

### Copyright notice

Please add a Copyright notice to new files you add where this is not already present:

```
// Copyright (c) Edward Wilde 2018. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
```

### Sign your work

> Note: all of the commits in your PR/Patch must be signed-off.
The sign-off is a simple line at the end of the explanation for a patch. Your
signature certifies that you wrote the patch or otherwise have the right to pass
it on as an open-source patch. The rules are pretty simple: if you can certify
the below (from [developercertificate.org](http://developercertificate.org/)):

```
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```

Then you just add a line to every git commit message:

Signed-off-by: Joe Smith <[email protected]>

Use your real name (sorry, no pseudonyms or anonymous contributions.)

If you set your `user.name` and `user.email` git configs, you can sign your
commit automatically with `git commit -s`.

* Please sign your commits with `git commit -s` so that commits are traceable.

If you forgot to sign your work and want to fix that, see the following guide:
[Git: Rewriting History](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History)
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM golang:1.10.2-alpine3.7

RUN apk --no-cache add git curl
RUN go get golang.org/x/tools/cmd/goimports

RUN mkdir -p /go/src/github.com/ewilde/faas-ecs/

WORKDIR /go/src/github.com/ewilde/faas-ecs

COPY . .

RUN curl -sL https://github.com/alexellis/license-check/releases/download/0.2.2/license-check > /usr/bin/license-check \
&& chmod +x /usr/bin/license-check
RUN license-check -path ./ --verbose=false "Edward Wilde" "OpenFaaS Project"
RUN goimports -l -d $(find . -type f -name '*.go' -not -path "./vendor/*") \
&& VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') \
&& GIT_COMMIT_SHA=$(git rev-list -1 HEAD) \
&& GIT_COMMIT_MESSAGE=$(git log -1 --pretty=%B 2>&1 | head -n 1) \
&& CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w \
-X github.com/ewilde/faas-ecs/version.GitCommitSHA=${GIT_COMMIT_SHA}\
-X \"github.com/ewilde/faas-ecs/version.GitCommitMessage=${GIT_COMMIT_MESSAGE}\"\
-X github.com/ewilde/faas-ecs/version.Version=${VERSION}" \
-a -installsuffix cgo -o faas-ecs .

FROM alpine:3.7

RUN addgroup -S app \
&& adduser -S -g app app \
&& apk --no-cache add \
ca-certificates
WORKDIR /home/app

EXPOSE 8080

ENV http_proxy ""
ENV https_proxy ""

COPY --from=0 /go/src/github.com/ewilde/faas-ecs/faas-ecs .
RUN chown -R app:app ./

USER app

CMD ["./faas-ecs"]
Loading

0 comments on commit 2256f3b

Please sign in to comment.