Skip to content

davidaparicio/gokvs

Repository files navigation

Go Key-Value Store

GoKVs logo

Docs Go Report Card License FOSSA Status Maintenance Twitter

Table of Contents

Introduction

A simple KV from the O'Reilly, Cloud Native Go book (Matthew A. Titmus)

Usage

make help

To have all make commands

benchmark                      Run benchmark tests 🚄
check-editorconfig             Use to check if the codebase follows editorconfig rules
check-format                   Used by CI to check if code is formatted
clean                          Clean your artifacts 🧼
compile                        Compile for the local architecture ⚙
doc                            Launch the offline Go documentation 📚
docker                         Docker run 🛠
dockerbuild                    Docker build 🛠
dockerfull                     Docker build and run 🛠
format                         Format the code using gofmt
fuzz                           Run fuzzing tests 🌀
goreleaser                     Run goreleaser directly at the pinned version 🛠
help                           Show help messages for make targets
install                        Install the program to /usr/bin 🎉
lint                           Runs the linter
mod                            Go mod things
run                            Run the server
sec                            Go Security checks code for security issues 🔒
test                           🤓 Run go tests

As an example:

❯ make dockerfull
docker build -t gokvs .
[+] Building 5.5s (16/16) FINISHED
[...]
docker run -it --rm -p 8008:8080 gokvs
Server: 	GoKVs - Community
Version: 	v0.0.1-SNAPSHOT
Git commit: 	54a8d74ea3cf6fdcadfac10ee4a4f2553d4562f6q
Built: 		Thu Jan  1 01:00:00 CET 1970

2024/10/26 20:14:31 0 events replayed
2024/10/26 20:14:31 Server running on port 8080
^C2024/10/26 20:14:36
2024/10/26 20:14:36 Caught the following signal: interrupt
2024/10/26 20:14:36 Gracefully shutting down server..
2024/10/26 20:14:36 Server stopping...
2024/10/26 20:14:36 Server stopped
2024/10/26 20:14:36 Gracefully shutting down TransactionLogger...
2024/10/26 20:14:36 FileTransactionLogger closed

Diagram

GoKVs diagram

Building and running your application

When you're ready, start your application by running: docker compose up --build.

Your application will be available at http://localhost:8080.

Deploying your application to the cloud

First, build your image, e.g.: docker build -t myapp .. If your cloud uses a different CPU architecture than your development machine (e.g., you are on a Mac M1 and your cloud provider is amd64), you'll want to build the image for that platform, e.g.: docker build --platform=linux/amd64 -t myapp ..

Then, push it to your registry, e.g. docker push myregistry.com/myapp.

Consult Docker's getting started docs for more detail on building and pushing.

Contribute

Works on my machine - and yours ! Spin up pre-configured, standardized dev environments of this repository, by clicking on the button below.

Open in Gitpod

Limitations

  • Like in the book, currently: Key/Value only text, without spaces

Tests

Improvement list

References

License

Licensed under the MIT License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License here.

If needed some help, there are a "Licenses 101" by FOSSA, a Snyk explanation of MIT license and a French conference talk by Jean-Michael Legait about licenses.

Open source management report powered by FOSSA

Contact

If you have any questions or suggestions regarding the project, feel free to reach out to our team in the GitHub issues.

About

Super Simple KVS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 2

  •  
  •