• Stars
    star
    189
  • Rank 204,649 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 3 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A blog microservices written in Golang, which can be deployed in an Istio-enabled kubernetes cluster.

blog-microservices

Test Lint Go Report Card Codecov

A blog microservices written in Golang, which can be deployed in an Istio-enabled kubernetes cluster. If you’re using this demo, please ★Star this repository to show your interest!

English | 中文

Architecture

architecture

Kiali Console

kiali-console

Project Layout

This demo refers to the following project layout:

Full list what has been used

  • gRPC Go implementation of gRPC
  • GORM The fantastic ORM library for Go
  • DTM Go implementation of Distributed Transaction Management Framework
  • Jaeger open source, end-to-end distributed tracing
  • Prometheus Monitoring system
  • Grafana Operational dashboards
  • Kiali The Console for Istio Service Mesh
  • Kubernetes Production-Grade Container Orchestration
  • Istio The leading service mesh

Makefile

Command Description
make init go install protoc-gen-*, wire, migrate and mockgen
make protoc generate *pb.go
make wire generate wire_gen.go
make mock generate mock file
make test go test
make migrate-up migrate up databases
make migrate-down migrate down databases
make migrate-refresh migrate down and up databases
make blog-server start blog server in local
make user-server start user server in local
make post-server start post server in local
make comment-server start comment server in local
make auth-server start auth server in local
make dtm-server start dtm server in local,please see the dtm docs
make docker-build build docker images
make kube-deploy deploy blog, user, post, comment, auth and dtm server in kubernetes cluster
make kube-delete delete all servers in kubernetes cluster
make kube-redeploy redeploy all servers in kubernetes cluster (⚠ not including database servers️)

Development Environment in Local

This is a list of development environment in local for macOS:

  • docker-desktop >= 4.13.1
  • kubernetes >= 1.25.2
  • istioctl >= 1.15.3
  • protobuf >= 21.8
  • go >= 1.19
  • mysql >= 8.0

Install the Docker Desktop,and enable Kubernetes cluster, See the docker docs

# install Go
brew install go
# install MySQL without a root password
brew install mysql
# install Protobuf
brew install protobuf
# install istioctl
brew install istioctl
# ensure you change the context so that kubectl is pointing to docker-desktop
kubectl config use-context docker-desktop
# install and enable istio
istioctl install -y
kubectl label namespace default istio-injection=enabled

Deploy the demo in Kubernetes

# build docker images
make docker-build
# deploy all services
make kube-deploy

Get All Pod Resources:

kubectl get pods -A

Returns:

NAMESPACE      NAME                                     READY   STATUS    RESTARTS          AGE
default        auth-server-678f9d4b4-lhkf8              2/2     Running   0                 101s
default        blog-server-6475d7bdd5-6t9jk             2/2     Running   0                 101s
default        comment-db-59665d87f8-plswq              2/2     Running   0                 101s
default        comment-server-857445775b-qkpm5          2/2     Running   3 (74s ago)       100s
default        dtm-db-cb8c45698-qms8q                   2/2     Running   0                 102s
default        dtm-server-c548d67cc-xcv2z               2/2     Running   0                 102s
default        post-db-867f5f85db-zz64g                 2/2     Running   0                 101s
default        post-server-5448dc5b67-mdhcc             2/2     Running   4 (54s ago)       101s
default        user-db-fcfd47bf8-dh9kp                  2/2     Running   0                 101s
default        user-server-78688485b8-zf5tc             2/2     Running   3 (76s ago)       101s
istio-system   grafana-6ccd56f4b6-tp84j                 1/1     Running   0                 100s
istio-system   istio-egressgateway-67dc4b96cd-2gm6s     1/1     Running   5                 13d
istio-system   istio-ingressgateway-68d897fbcd-thvt9    1/1     Running   5                 13d
istio-system   istiod-66dc55cd96-r6cnv                  1/1     Running   5                 13d
istio-system   jaeger-9dd685668-wdzsz                   1/1     Running   0                 100s
istio-system   kiali-79b86ff5bc-jh6v8                   1/1     Running   0                 100s
istio-system   prometheus-64fd8ccd65-4c5nc              2/2     Running   0                 99s
kube-system    coredns-558bd4d5db-5nlbz                 1/1     Running   5                 13d
kube-system    coredns-558bd4d5db-m46lb                 1/1     Running   5                 13d
kube-system    etcd-docker-desktop                      1/1     Running   13                13d
kube-system    kube-apiserver-docker-desktop            1/1     Running   13                13d
kube-system    kube-controller-manager-docker-desktop   1/1     Running   13                13d
kube-system    kube-proxy-mj6x8                         1/1     Running   5                 13d
kube-system    kube-scheduler-docker-desktop            1/1     Running   13                13d
kube-system    storage-provisioner                      1/1     Running   11                13d
kube-system    vpnkit-controller                        1/1     Running   177 (2m56s ago)   13d

Get All Service Resources:

kubectl get services -A

Returns:

NAMESPACE      NAME                   TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                                                                      AGE
default        auth-server            ClusterIP      10.99.64.145     <none>        50054/TCP,8054/TCP,9054/TCP                                                  15m
default        blog-server            ClusterIP      10.96.207.114    <none>        50050/TCP,8050/TCP,9050/TCP                                                  15m
default        comment-db             ClusterIP      10.99.195.67     <none>        3306/TCP                                                                     15m
default        comment-server         ClusterIP      10.96.179.191    <none>        50053/TCP,9053/TCP                                                           15m
default        dtm-db                 ClusterIP      10.106.31.52     <none>        3306/TCP                                                                     15m
default        dtm-server             ClusterIP      10.99.170.244    <none>        36790/TCP,36789/TCP                                                          15m
default        kubernetes             ClusterIP      10.96.0.1        <none>        443/TCP                                                                      13d
default        post-db                ClusterIP      10.103.103.106   <none>        3306/TCP                                                                     15m
default        post-server            ClusterIP      10.96.232.141    <none>        50052/TCP,9052/TCP                                                           15m
default        user-db                ClusterIP      10.99.144.168    <none>        3306/TCP                                                                     15m
default        user-server            ClusterIP      10.100.66.36     <none>        50051/TCP,9051/TCP                                                           15m
istio-system   grafana                ClusterIP      10.105.48.42     <none>        3000/TCP                                                                     15m
istio-system   istio-egressgateway    ClusterIP      10.99.128.200    <none>        80/TCP,443/TCP                                                               13d
istio-system   istio-ingressgateway   LoadBalancer   10.101.116.168   localhost     15021:30898/TCP,80:32417/TCP,443:32343/TCP,31400:32210/TCP,15443:31544/TCP   13d
istio-system   istiod                 ClusterIP      10.108.250.181   <none>        15010/TCP,15012/TCP,443/TCP,15014/TCP                                        13d
istio-system   jaeger-collector       ClusterIP      10.103.107.169   <none>        14268/TCP,14250/TCP,9411/TCP                                                 15m
istio-system   kiali                  ClusterIP      10.111.157.82    <none>        20001/TCP,9090/TCP                                                           15m
istio-system   prometheus             ClusterIP      10.100.104.250   <none>        9090/TCP                                                                     15m
istio-system   tracing                ClusterIP      10.108.139.227   <none>        80/TCP,16685/TCP                                                             15m
istio-system   zipkin                 ClusterIP      10.101.235.179   <none>        9411/TCP                                                                     15m
kube-system    kube-dns               ClusterIP      10.96.0.10       <none>        53/UDP,53/TCP,9153/TCP                                                       13d

Visit the microservice

Install the BloomRPC, select the api/protobuf/blog/v1/blog.proto file and start making requests! No extra steps or configuration needed.

Sign Up:

sign-up

Create a post:

create-post

More Repositories

1

id-validator

中华人民共和国居民身份证、中华人民共和国港澳居民居住证以及中华人民共和国台湾居民居住证号码验证工具(PHP 版)
PHP
673
star
2

id-validator.py

中华人民共和国居民身份证、中华人民共和国港澳居民居住证以及中华人民共和国台湾居民居住证号码验证工具(Python 版)
Python
357
star
3

awesome-laravel-admin

A curated list of Laravel-admin resources
220
star
4

kubernetes-examples

Kubernetes 经典示例
Go
217
star
5

chinese-typesetting

📄 中文排版 Composer 包
PHP
85
star
6

address-code-of-china

中华人民共和国行政区划代码/身份证地址码
36
star
7

php2python

Python alternatives for PHP internal (built-in) functions.
Python
19
star
8

cloud-native-reading-list

精选云原生相关的阅读列表(包含博客、专栏、书籍、视频等)
18
star
9

grpc-lb

Kubernetes 中的 gRPC 负载均衡
Go
14
star
10

installing-solr-and-indexing-mysql-on-macos

在 macOS 上安装 Solr 并索引 MySQL
11
star
11

http-echo

HTTP Echo is a go web server that echos back the arguments given to it. Multi-platform supported.
Go
9
star
12

learn-docker-and-k8s

Docker 与 Kubernetes 学习笔记
JavaScript
6
star
13

percona-toolkit-document

MySQL 管理工具包 Percona Toolkit 中文翻译文档
5
star
14

git-teching

HTML
4
star
15

memcached-operator

memcached operator
Go
4
star
16

english-proper-nouns

English nouns that indicate individual entities, such as names of persons, places or organizations.
Python
4
star
17

yii2-admin

后台内容管理系统
PHP
4
star
18

todo

Todolist microservice with Istio
Go
3
star
19

cnat-operator

Go
3
star
20

visitors-operator

Go
3
star
21

php-dev-on-macos

2
star
22

wordpress-operator

Go
2
star
23

house_price_index

Python
2
star
24

My_Local_PHP_Development_Environment_On_MacOS_Sierra_11.12

1
star
25

guestbook-operator

「Kubernetes 官方示例:使用 Redis 部署 PHP 留言板应用程序」Operator 化。
Go
1
star
26

synonyms-api

Python
1
star
27

Metro-UI-CSS-CN

Metro-UI-CSS 中文版/中文翻译 创建Windows UI的网页
PHP
1
star
28

chainbase-client-go

[WIP]
Go
1
star
29

laravel-7-kubernetes-demo

PHP
1
star
30

go-restful

Go
1
star
31

editor-skill-guide

1
star