Giter Site home page Giter Site logo

settingsservice's Introduction

About

Self-learning Golang project.
Store and managing settings for microservices.

Used packages

backend:

Golang

frontend

Vue

Develop

Recommended IDE - VSCode.
Environment for project in ./.vscode/launch.json.
For another IDE's don't forget set up env variables:

"SettingsServicePort": "9000",
"SettingsServiceDbConnectionString": "postgres://pg:1@localhost:5432/servicesSettings_db",
"SettingsServiceEnv": "dev"

Requiremens

  1. Go
  2. Node

Recommended extentions for VSCode

  1. Docker
  2. Go
  3. npm Intellisense
  4. REST Client
  5. TypeScript Vue Plugin (Volar)
  6. Volar

! disable Vetur

Debug & Test

Debug backend

  1. Install golang swag utility:

    go install github.com/swaggo/swag/cmd/swag@latest
  2. Install dependencies:

    go get .
  3. Run test database docker image:

    docker compose up -d ./.test/database/docker-compose.yml
  4. After changes regenerate swagger files:

    swag init -g ./cmd/SettingsService/main.go -o ./docs
  5. Set breakpoints and press F5

Debug frontend

  1. Install node

  2. Move to ./web/src

  3. Install dependencies npm install

  4. npm run dev

Run in Docker

make front
docker build --tag 'settingsservice' .
docker run -d -p 9000:9000 --name 'SettingsService' 'settingsservice'

or prepare image with tag settingsservice

make image

or run container with tag settingsservice and name SettingsService

make docker

Production

build with remove the symbol and debug info:

go build -o=SettingsService -ldflags "-s -w" ./cmd/SettingsService
(cd ./web/src/ && npm install && npm run build)

where:

  • -w turns off DWARF debugging information
  • -s turns off generation of the Go symbol table

or use Makefile:

make help

For non-docker environment don't forget set up env variables:

"SettingsServicePort": "9000",
"SettingsServiceDbConnectionString": "postgres://pg:1@localhost:5432/servicesSettings_db"

TO DO

  1. healthchecks
  2. Add push mechanism for setting's updates
  3. Add auth
  4. Add unit-tests
  5. Try another DB, for example mongo
  6. fix config. How do it best? Now ENV
  7. Write help instructions

History

  1. Appy project layout
  2. makefile
  3. versioning
  4. SPA
  5. fix results of stat analyst (except swagger comments)
  6. dockerize

settingsservice's People

Contributors

zhivovoleg avatar

Stargazers

Denis Churkin avatar

Watchers

 avatar

Forkers

onemore8762

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.