A simple in memory key value store application.
Migrated from Gitlab -> https://gitlab.com/mfcekirdek/in-memory-store
Note: Gitlab CI/CD automation will be replaced with github actions soon.
- Api doc
- Go doc
- Project setup
- Run lint checks
- Run Tests
- Build project
- Run
- Built With
- CI/CD Processes
- Contributing
- License
- Get Help
To run a go doc server locally: (godoc must be installed)
godoc -http=localhost:6060
Check docs from http://localhost:6060/pkg/gitlab.com/mfcekirdek/in-memory-store/?m=all
go mod download
golangci-lint should be installed before running tests.
https://golangci-lint.run/usage/install/
make lint
Mockgen framework should be installed before running tests. Follow the instructions in this link.
Generate mocks and run tests:
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
make test
make build
You can simply run the app with default configurations:
make run
Or set configs by exporting environment variables.
export IS_DEBUG=true
export APP_NAME=kv-store
export PORT=8080
export STORAGE_DIR_PATH=storage
export SAVE_TO_FILE_INTERVAL=10
make run
-
Go
- Go standard library
- github.com/spf13/viper --> For reading env configs at startup.
- github.com/k0kubun/pp --> For printing app configs in a pretty format.
- github.com/golang/mock --> For mocking components in tests.
-
Other Technologies and Components
- Swagger for API design and documentation.
- Postman
- You can find exported Postman collection file here
- godoc for code documentation.
- pkg/gitlab.com/mfcekirdek/in-memory-store
- Too see documentation of not exported packages, ?m=all parameter to the end of the url.
- Docker
- build and push images to the private gitlab registry.
- tag the image with branch name (main) and pipeline id
- image:
- registry.gitlab.com/mfcekirdek/in-memory-store/main
- image:
- Kubernetes (Created a cluster at Digital Ocean with 2 nodes)
- Namespace: in-memory-store-30556712-test
- Deployment (Pod.container.image: registry.gitlab.com/mfcekirdek/in-memory-store/main)
- Service
- NodePort Service for deployment (Port: 30000)
- Sonarqube for code coverage assessment
- Pipeline fails if the coverage decreases under 80%
- Deployed to kubernetes cluster
- GitLab CI/CD Pipeline for automation
- CI/CD Pipeline steps
- build
- build-job
- test
- unit-test-job
- lint-test-job
- code-analysis
- sonarqube
- dockerize
- dockerize-job
- deploy
- deploy-job
- build
In the case of a bug report, bugfix or a suggestions, please feel very free to open an issue.
Pull requests are always welcome, and I'll do my best to do reviews as fast as I can.
This project is licensed under the MIT License
- Contact me on [email protected]
- If appropriate, open an issue on GitLab