Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: document for developers #7

Merged
merged 2 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build test clean changelog tools help
.PHONY: build test clean changelog tools help docker generate

S3HUB = s3hub
VERSION = $(shell git describe --tags --abbrev=0)
Expand All @@ -20,7 +20,7 @@ build: ## Build binary
clean: ## Clean project
-rm -rf $(S3HUB) cover.out cover.html

test: ## Start test
test: ## Start unit test
env GOOS=$(GOOS) $(GO_TEST) -cover $(GO_PKGROOT) -coverprofile=cover.out
$(GO_TOOL) cover -html=cover.out -o cover.html

Expand All @@ -32,6 +32,12 @@ tools: ## Install dependency tools
$(GO_INSTALL) github.com/nao1215/hottest@latest
$(GO_INSTALL) github.com/google/wire/cmd/wire@latest

generate: ## Generate code from templates
$(GO) generate ./...

docker: ## Start docker (localstack)
docker compose up -d

.DEFAULT_GOAL := help
help:
@grep -E '^[0-9a-zA-Z_-]+[[:blank:]]*:.*?## .*$$' $(MAKEFILE_LIST) | sort \
Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,24 @@ The rainbow project is a toolset for managing AWS resources. This project consis
This project is licensed under the terms of the MIT license. See the [LICENSE](./LICENSE) file.

## Contributing
Contributions are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md), [Code of Conduct](./CODE_OF_CONDUCT.md), [Principle](./doc/common/principle.md) for more information. This project incurs costs on AWS, and financial support from you would make it easier to maintain the project. If you wish to provide financial support, please do so through [GitHub Sponsors](https://github.com/sponsors/nao1215)
Contributions are welcome! Please see the following documents for details:
- [CONTRIBUTING.md](./CONTRIBUTING.md)
- [Code of Conduct](./CODE_OF_CONDUCT.md)
- [Principle](./doc/common/principle.md)
- [Development Eviorment Setup](./doc/common/developers.md)

This project incurs costs on AWS, and financial support from you would make it easier to maintain the project. If you wish to provide financial support, please do so through [GitHub Sponsors](https://github.com/sponsors/nao1215)

## GitHub Star History
Stars from you motivate me to keep going.
GitHub Star is motivation for me. If you like this project, please star it.
[![Star History Chart](https://api.star-history.com/svg?repos=nao1215/rainbow&type=Date)](https://star-history.com/#nao1215/rainbow&Date)

## Special Thanks
![localstack](./doc/img/localstack-readme-banner.svg)
[LocalStack](https://www.localstack.cloud/) is a service that mocks AWS, covering a wide range of AWS services. It is not easy to set up an AWS infrastructure for personal development, but LocalStack has lowered the barrier for server application development.

It has been incredibly helpful for my technical learning, and among the open-source software (OSS) I encountered in 2023, LocalStack is undoubtedly the best tool. I would like to take this opportunity to express my gratitude.

## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

Expand Down
49 changes: 49 additions & 0 deletions doc/common/developers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## Development Eviorment Setup
### Install Prerequisites
- [Install Golang](https://go.dev/doc/install)
- [Install make](https://www.gnu.org/software/make/)
- [Install Docker](https://docs.docker.com/get-docker/)
- [Install Docker Compose](https://docs.docker.com/compose/install/)
- Install development tools by running the following command:
```shell
make tools
```

### Makefile Usage
If you want to print help information, you can run the following command:
```shell
$ make
build Build binary
changelog Generate changelog
clean Clean project
docker Start docker (localstack)
generate Generate code from templates
test Start unit test
tools Install dependency tools
```

### localstack Setup
The localstack is used to simulate the AWS environment. First, you configure a custom profile to use with LocalStack. Add the following profile to your AWS configuration file (by default, this file is at ~/.aws/config):

```shell
[profile localstack]
region=us-east-1
output=json
endpoint_url = http://localhost:4566
```

Add the following profile to your AWS credentials file (by default, this file is at ~/.aws/credentials):
```shell
[localstack]
aws_access_key_id=test
aws_secret_access_key=test
```

> [!NOTE]
> Alternatively, you can also set the AWS_PROFILE=localstack environment variable, in which case the --profile localstack parameter can be omitted in the commands above.

### Run localstack
```shell
make docker
```

Loading