-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a CLI, kvetchctl, to interact with the Kvetch API (#8)
* (+semver: feature) Added ketchctl CLI - Build and documentation still in progress * (+semver: feature) Refactored to use viper for flags/env variable input * (+semver: feature) Update build scripts * (+semver: feature) Added documentation for kvetchctl * (+semver: patch) Update for image build optimization * (+semver: fix) Fixed version flag config to use viper * (+semver: patch) Update Makefile to remove temporary containers * (+semver: feature) Add DX docs * (+semver: patch) Added link to build status
- Loading branch information
Showing
27 changed files
with
1,235 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.* | ||
[Dd]ockerfile | ||
[Mm]akefile | ||
artifacts/ | ||
data/ |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths. | ||
# See https://help.github.com/articles/about-code-owners/ | ||
|
||
* @syncromatics/engineers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Describe the bug | ||
A clear and concise description of what the bug is. | ||
|
||
## To Reproduce | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
## Expected behavior | ||
A clear and concise description of what you expected to happen. | ||
|
||
## Screenshots (if appropriate) | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
## Additional context | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Is your feature request related to a problem? Please describe. | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
## Describe the solution you'd like | ||
A clear and concise description of what you want to happen. | ||
|
||
## Describe alternatives you've considered | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
## Additional context | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,32 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Build the Docker image | ||
- name: Prepare repository | ||
run: git checkout "${GITHUB_REF:11}" | ||
|
||
- uses: syncromatics/[email protected] | ||
id: gogitver | ||
|
||
- name: test | ||
run: make test | ||
env: | ||
IMAGE: ${{github.repository}} | ||
VERSION: ${{ steps.gogitver.outputs.version }} | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: github.ref == 'refs/heads/master' | ||
steps: | ||
- uses: syncromatics/[email protected] | ||
- uses: actions/checkout@v1 | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
- name: Prepare repository | ||
run: git checkout "${GITHUB_REF:11}" | ||
|
||
- uses: syncromatics/[email protected] | ||
id: gogitver | ||
|
||
- name: Create Release | ||
|
@@ -33,9 +48,46 @@ jobs: | |
|
||
- uses: actions/checkout@v1 | ||
|
||
- name: Ship the Docker image | ||
run: make ship | ||
- name: Build release artifacts and ship Docker image | ||
run: make package ship | ||
env: | ||
IMAGE: ${{github.repository}} | ||
VERSION: ${{ steps.gogitver.outputs.version }} | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/linux.tar.gz | ||
asset_name: linux.tar.gz | ||
asset_content_type: application/gzip | ||
|
||
- uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/windows.zip | ||
asset_name: windows.zip | ||
asset_content_type: application/zip | ||
|
||
- uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/arm.tar.gz | ||
asset_name: arm.tar.gz | ||
asset_content_type: application/gzip | ||
|
||
- uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/darwin.tar.gz | ||
asset_name: darwin.tar.gz | ||
asset_content_type: application/gzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
artifacts/ | ||
data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected]. 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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Contributing | ||
|
||
We are committed to fostering an open and welcoming environment. Please read our [code of conduct](CODE_OF_CONDUCT.md) before participating in or contributing to this project. | ||
|
||
When contributing to this repository, we recommend discussing your feature, bug fix, or other contribution via an issue in this repository. If the change requires direct communication with the maintainers, send an email to [email protected]. | ||
|
||
## Pull Request Process | ||
|
||
1. Fork this repository | ||
2. Make the changes as you wish | ||
3. Submit a pull request back to this repository with a reference to the issue | ||
|
||
### Process for Maintainers | ||
|
||
1. Ensure that at least two maintainer reviewers have reviewed and approved the pull request | ||
2. Ensure that pull requests pass all applicable tests and successfully build the project | ||
3. Merge the pull request, and if applicable, clean up any merged branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,46 @@ | ||
FROM golang:1.14 as build | ||
|
||
WORKDIR /build | ||
|
||
COPY go.mod ./ | ||
COPY go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN go vet ./... | ||
|
||
RUN go get -u golang.org/x/lint/golint | ||
|
||
COPY . ./ | ||
RUN go vet ./... | ||
RUN golint -set_exit_status ./... | ||
|
||
# Build kvetch | ||
RUN go build -o kvetch ./cmd/kvetch | ||
|
||
#testing | ||
# Build kvetchctl | ||
RUN mkdir -p \ | ||
/artifacts/linux \ | ||
/artifacts/arm \ | ||
/artifacts/windows \ | ||
/artifacts/darwin | ||
ARG BUILD_FLAGS | ||
RUN GOOS=linux GOARCH=amd64 go build -ldflags "$BUILD_FLAGS" -o /artifacts/linux/kvetchctl ./cmd/kvetchctl | ||
RUN GOOS=linux GOARCH=arm go build -ldflags "$BUILD_FLAGS" -o /artifacts/arm/kvetchctl ./cmd/kvetchctl | ||
RUN GOOS=darwin GOARCH=amd64 go build -ldflags "$BUILD_FLAGS" -o /artifacts/darwin/kvetchctl ./cmd/kvetchctl | ||
RUN GOOS=windows GOARCH=amd64 go build -ldflags "$BUILD_FLAGS" -o /artifacts/windows/kvetchctl.exe ./cmd/kvetchctl | ||
|
||
# Test repo | ||
FROM build as test | ||
|
||
CMD go test -race -coverprofile=/artifacts/coverage.txt -covermode=atomic ./... | ||
|
||
# final image | ||
# Package binaries for release | ||
FROM build AS package | ||
RUN apt-get -y update && apt-get -y install zip | ||
WORKDIR /artifacts | ||
RUN cd linux && tar zcf /artifacts/linux.tar.gz kvetchctl | ||
RUN cd arm && tar zcf /artifacts/arm.tar.gz kvetchctl | ||
RUN cd darwin && tar zcf /artifacts/darwin.tar.gz kvetchctl | ||
RUN cd windows && zip -r /artifacts/windows.zip kvetchctl.exe | ||
WORKDIR /artifacts | ||
|
||
# Final configuration for running kvetch | ||
FROM ubuntu:18.04 as final | ||
|
||
ENV GOMAXPROCS 128 | ||
|
||
EXPOSE 7777 | ||
WORKDIR /app | ||
|
||
COPY --from=0 /build/kvetch /app/ | ||
|
||
CMD ["/app/kvetch"] | ||
CMD ["/app/kvetch"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!--- 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. --> | ||
|
||
## How Has This Been Tested? | ||
<!--- Please describe in detail how you tested your changes. --> | ||
<!--- Include details of your testing environment, tests ran to see how --> | ||
<!--- your change affects other areas of the code, etc. --> | ||
|
||
## Screenshots (if appropriate) | ||
|
||
## 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 not work as expected) | ||
|
||
## 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,68 @@ | ||
# key-value-service | ||
# Kvetch | ||
|
||
Kvetch is a small gRPC wrapper around the [Badger](https://github.com/dgraph-io/badger) key-value datastore | ||
|
||
## Quickstart | ||
|
||
Run the Kvetch container in Docker: | ||
|
||
```bash | ||
docker run --rm -v $PWD/data:/data -e DATASTORE=/data -p 7777:7777 syncromatics/kvetch:0.4.0 | ||
``` | ||
|
||
Interact with Kvetch using `kvetchctl`: | ||
|
||
```bash | ||
export KVETCHCTL_ENDPOINT=localhost:7777 # host:port of Kvetch instance | ||
kvetchctl set example/1 "first value" | ||
kvetchctl set example/2 "second value" | ||
kvetchctl set example/3 "third value" | ||
kvetchctl get --prefix example/ | ||
``` | ||
|
||
More `kvetchctl` documentation is available in [docs/kvetchctl](docs/kvetchctl/kvetchctl.md) | ||
|
||
## Building | ||
|
||
[![build](https://github.com/syncromatics/kvetch/workflows/build/badge.svg)](https://github.com/syncromatics/kvetch/actions?query=workflow%3Abuild) | ||
[![Docker Build Status](https://img.shields.io/docker/build/syncromatics/kvetch.svg)](https://hub.docker.com/r/syncromatics/kvetch/) | ||
|
||
Building Kvetch requires the following: | ||
|
||
- Docker | ||
- [gogitver](https://github.com/syncromatics/gogitver) | ||
|
||
To build and test the Kvetch Docker image alone: | ||
|
||
```bash | ||
make test | ||
``` | ||
|
||
To build and package `kvetchctl`: | ||
|
||
```bash | ||
make package | ||
``` | ||
|
||
To update generated code and documentation: | ||
|
||
```bash | ||
make generate | ||
``` | ||
|
||
## Code of Conduct | ||
|
||
We are committed to fostering an open and welcoming environment. Please read our [code of conduct](CODE_OF_CONDUCT.md) before participating in or contributing to this project. | ||
|
||
## Contributing | ||
|
||
We welcome contributions and collaboration on this project. Please read our [contributor's guide](CONTRIBUTING.md) to understand how best to work with us. | ||
|
||
## License and Authors | ||
|
||
[![GMV Syncromatics Engineering logo](https://secure.gravatar.com/avatar/645145afc5c0bc24ba24c3d86228ad39?size=16) GMV Syncromatics Engineering](https://github.com/syncromatics) | ||
|
||
[![license](https://img.shields.io/github/license/syncromatics/kvetch.svg)](https://github.com/syncromatics/kvetch/blob/master/LICENSE) | ||
[![GitHub contributors](https://img.shields.io/github/contributors/syncromatics/kvetch.svg)](https://github.com/syncromatics/kvetch/graphs/contributors) | ||
|
||
This software is made available by GMV Syncromatics Engineering under the MIT license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "github.com/syncromatics/kvetch/internal/cmd/kvetchctl" | ||
|
||
func main() { | ||
kvetchctl.Execute() | ||
} |
Oops, something went wrong.