audiobook

command module
v0.0.0-...-3852566 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2020 License: MIT Imports: 0 Imported by: 0

README

micro-starter-kit

Microservices starter kit for Golang, aims to be developer friendly.

GoDoc Go Renovate dependency Status MIT license

Build Status

Build Status

Quality

Go Report Card Total alerts codecov fuzzit

Overview

Image of Deployment

What you get

Getting Started

Prerequisite

Refer prerequisites docs

Initial Setup

Also Refer scaffolding docs

clone the repo

git clone https://github.com/seidu626/audiobook ~/Developer/Work/go/micro-starter-kit
# pull dependencies (when every time `go.mod` changed)
go mod download
Run
Database

By default this project use embedded sqlite3 database. if you want to use postgreSQL,

  • start postgres via docker-compose command provided below
  • uncommend postgres import statement and comment sqlite in plugin.go
  • start micro server with --configFile=config.dev.postgres.yaml flag
    i.e., go run srv/account/main.go srv/account/plugin.go --configFile=config.dev.postgres.yaml
# to start postgres in foreground
docker-compose up postgres
# to stop postgres
docker-compose down
# if needed, remove `postgres_data` volume to recreate database next time, when you start.
docker system prune --volumes
Services

Node: --server_address=localhost:5501x --broker_address=localhost:5502x required only when you are behind VPN a.k.a Work From Home

# dev mode
make run-account
# or
make run-account ARGS="--server_address=localhost:55011 --broker_address=localhost:55021"
# or
go run srv/account/main.go srv/account/plugin.go \
--configDir deploy/bases/account-srv/config \
--server_address=localhost:55011 --broker_address=localhost:55021

make run-greeter
# or
make run-emailer ARGS="--server_address=localhost:55012 --broker_address=localhost:55022"

make run-emailer
# or
make run-emailer ARGS="--server_address=localhost:55013 --broker_address=localhost:55023"


# integration tests for config module via CMD
make run TARGET=demo TYPE=cmd
go run cmd/demo/main.go --help
go run cmd/demo/main.go --database_host=1.1.1.1 --database_port=7777

export APP_ENV=production
go run cmd/demo/main.go
Test

Refer testing docs

GitOps

Make

Refer makefile docs

Docker

Refer docker docs

Release

Refer releasing docs

Deploy
make docker DOCKER_REGISTRY=docker.pkg.github.com DOCKER_CONTEXT_PATH=seidu626/audiobook
docker rmi $(docker images -f "dangling=true" -q)

# make kustomize OVERLAY=e2e NS=default VERSION=v0.1.0-440-g6c7fb7a
make kustomize
kubectl apply -f build/deploy.yaml

POD_NAME=$(kubectl get pods  -lapp.kubernetes.io/name=account-srv -o jsonpath='{.items[0].metadata.name}')
kubectl logs -f -c srv $POD_NAME

kubectl delete -f build/deploy.yaml

Reference

Project Docs
  1. prerequisites
  2. scaffolding
  3. makefile
  4. testing
  5. docker
  6. gitops
  7. releasing
  8. Protobuf Style Guide
  9. Google Protobuf Style Guide
External Docs
  1. Go-Micro Getting Started
  2. examples - example usage code for micro
  3. microhq - a place for prebuilt microservices
  4. explorer - which aggregates micro based open source projects
  5. micro-plugins extensible micro plugins
  6. step-by-step-guide-micro
  7. micro-in-cn
  8. Platform Web
  9. grpc template
  10. Simple API backed by PostgresQL, Golang and gRPC

Directories

Path Synopsis
cmd
service
language/proto/entities
Package entities is a generated protocol buffer package.
Package entities is a generated protocol buffer package.
language/proto/skill
Package skill is a generated protocol buffer package.
Package skill is a generated protocol buffer package.
shared
config
config package from micro-strter-kit import myConfig "github.com/seidu626/audiobook/shared/config" to `main.go` and all test files.
config package from micro-strter-kit import myConfig "github.com/seidu626/audiobook/shared/config" to `main.go` and all test files.
constants
constants package is where you keep shared constants between packages Inspired by https://github.com/kubernetes/minikube/blob/master/pkg/minikube/constants/constants.go
constants package is where you keep shared constants between packages Inspired by https://github.com/kubernetes/minikube/blob/master/pkg/minikube/constants/constants.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL