Skip to content

mfcekirdek/in-memory-store

Repository files navigation

in-memory-store Tweet

Github License Go Version

Description

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.

Table of content

Go doc

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

Project setup

go mod download

Run lint checks

golangci-lint should be installed before running tests.

https://golangci-lint.run/usage/install/

make lint

Run tests

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

Build project

make build

Run

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

Built With

  1. 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.
  2. Other Technologies and Components

    • Swagger for API design and documentation.
    • Postman
      • You can find exported Postman collection file here
    • godoc for code documentation.
    • 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
    • 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 Processes

example

  • CI/CD Pipeline steps
    • build
      • build-job
    • test
      • unit-test-job
      • lint-test-job
    • code-analysis
      • sonarqube
    • dockerize
      • dockerize-job
    • deploy
      • deploy-job

Contributing

Issues

In the case of a bug report, bugfix or a suggestions, please feel very free to open an issue.

Pull request

Pull requests are always welcome, and I'll do my best to do reviews as fast as I can.

License

This project is licensed under the MIT License

Get Help

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published