Skip to content

Commit 236e068

Browse files
committed
Merge branch 'release/v0.3.4'
2 parents 6e4d718 + 3b2b9e8 commit 236e068

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+921
-825
lines changed

CHANGELOG.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
## [Unreleased]
1010

1111

12+
<a name="v0.3.4"></a>
13+
## [v0.3.4] - 2020-06-14
14+
### Docs
15+
- **docker:** updated docker docs
16+
17+
### Feat
18+
- **grpclog:** adding zerolog to grpclog adoptor
19+
20+
### Refactor
21+
- **config:** support dns based load balancing
22+
- **config:** support dns based load balancing
23+
- **core:** order go-micro bootstraping
24+
25+
### Revert
26+
- **listener:** going back to go-micro managed listener
27+
28+
29+
<a name="v0.3.3"></a>
30+
## [v0.3.3] - 2020-06-11
31+
### Feat
32+
- **client:** updated cmd/account CLI client
33+
- **micro:** testing cmux with greeter project
34+
35+
### Fix
36+
- **cmd:** using flags with Account Client CLI
37+
- **transation:** updated transation logger to use built-in Micro-Trace-Id
38+
39+
### Refactor
40+
- **config:** mived certs to config/certs location
41+
- **config:** mived certs to config/certs location
42+
- **config:** mived certs to config/certs location
43+
44+
1245
<a name="v0.3.2"></a>
1346
## [v0.3.2] - 2020-06-09
1447
### Build
@@ -36,6 +69,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3669
- **refactor:** micro.Publisher -> micro.Event
3770

3871
### Ci
72+
- **changelog:** updated changelog
3973
- **gitflow:** upgrading golang to 1.14
4074
- **gomod_lint:** adding gomod_lint task
4175

@@ -459,7 +493,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
459493
- added steps when behind VPN
460494

461495

462-
[Unreleased]: https://github.com/xmlking/micro-starter-kit/compare/v0.3.2...HEAD
496+
[Unreleased]: https://github.com/xmlking/micro-starter-kit/compare/v0.3.4...HEAD
497+
[v0.3.4]: https://github.com/xmlking/micro-starter-kit/compare/v0.3.3...v0.3.4
498+
[v0.3.3]: https://github.com/xmlking/micro-starter-kit/compare/v0.3.2...v0.3.3
463499
[v0.3.2]: https://github.com/xmlking/micro-starter-kit/compare/v0.3.1...v0.3.2
464500
[v0.3.1]: https://github.com/xmlking/micro-starter-kit/compare/v0.3.0...v0.3.1
465501
[v0.3.0]: https://github.com/xmlking/micro-starter-kit/compare/v0.2.9...v0.3.0

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ARG VERSION=0.0.1
2929
ARG TYPE=service
3030
ARG TARGET=account
3131

32-
RUN pkger -o $TYPE/$TARGET -include /config
32+
RUN pkger -o $TYPE/$TARGET -include /config/config.yaml -include /config/config.prod.yaml -include /config/certs
3333
RUN go build -a \
3434
-ldflags="-w -s -linkmode external -extldflags '-static' $(govvv -flags -version ${VERSION} -pkg $(go list ./shared/config) )" \
3535
-o /app ./$TYPE/$TARGET/main.go ./$TYPE/$TARGET/plugin.go

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ endif
160160
for _target in $${type}/*/; do \
161161
temp=$${_target%%/}; target=$${temp#*/}; \
162162
echo "\tPackaging config for $${target}-$${type}"; \
163-
${GOPATH}/bin/pkger -o $${type}/$${target} -include /config; \
163+
${GOPATH}/bin/pkger -o $${type}/$${target} -include /config/config.yaml -include /config/config.prod.yaml -include /config/certs; \
164164
done \
165165
done \
166166
else \
167167
echo "Packaging config for ${TARGET}-${TYPE}..."; \
168-
${GOPATH}/bin/pkger -o ${TYPE}/${TARGET} -include /config ; \
168+
${GOPATH}/bin/pkger -o ${TYPE}/${TARGET} -include /config/config.yaml -include /config/config.prod.yaml -include /config/certs ; \
169169
fi
170170

171171
build build-%: pkger-%
@@ -289,13 +289,13 @@ docker_push:
289289
docker push $$image; \
290290
done;
291291

292-
kustomize: OVERLAY := e2e
292+
kustomize: OVERLAY := local
293293
kustomize: NS := default
294294
kustomize:
295-
# @kustomize build deploy/overlays/${OVERLAY}/ | sed -e "s|\$$(NS)|${NS}|g" -e "s|\$$(IMAGE_VERSION)|${VERSION}|g" | kubectl apply -f -
296-
@kustomize build deploy/overlays/${OVERLAY}/ | sed -e "s|\$$(NS)|${NS}|g" -e "s|\$$(IMAGE_VERSION)|${VERSION}|g" > build/deploy.yaml
295+
# @kustomize build --load_restrictor none config/envs/${OVERLAY}/ | sed -e "s|\$$(NS)|${NS}|g" -e "s|\$$(IMAGE_VERSION)|${VERSION}|g" | kubectl apply -f -
296+
@kustomize build --load_restrictor none config/envs/${OVERLAY}/ | sed -e "s|\$$(NS)|${NS}|g" -e "s|\$$(IMAGE_VERSION)|${VERSION}|g" > build/kubernetes.yaml
297297

298298
build/kustomize: check_dirty
299-
@kustomize build deploy/overlays/e2e/ | sed -e "s|\$$(NS)|default|g" -e "s|\$$(IMAGE_VERSION)|${VERSION}|g" > build/deploy.e2e.yaml
300-
@kustomize build deploy/overlays/production/ | sed -e "s|\$$(NS)|default|g" -e "s|\$$(IMAGE_VERSION)|${VERSION}|g" > build/deploy.production.yaml
301-
@kustomize build deploy/overlays/production/ | sed -e "s|\$$(NS)|mynamespace|g" -e "s|\$$(IMAGE_VERSION)|${VERSION}|g" > build/deploy.production.mynamespace.yaml
299+
@kustomize build --load_restrictor none config/envs/local | sed -e "s|\$$(NS)|default|g" -e "s|\$$(IMAGE_VERSION)|${VERSION}|g" > build/kubernetes.local.yaml
300+
@kustomize build --load_restrictor none config/envs/production/ | sed -e "s|\$$(NS)|default|g" -e "s|\$$(IMAGE_VERSION)|${VERSION}|g" > build/kubernetes.production.yaml
301+
@kustomize build --load_restrictor none config/envs/production/ | sed -e "s|\$$(NS)|mynamespace|g" -e "s|\$$(IMAGE_VERSION)|${VERSION}|g" > build/kubernetes.production.mynamespace.yaml

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,14 @@ kubectl delete -f build/deploy.yaml
154154

155155
### Project Docs
156156

157-
1. [prerequisites](docs/prerequisites.md)
158-
2. [scaffolding](docs/scaffolding.md)
159-
3. [makefile](docs/makefile.md)
160-
4. [testing](docs/testing.md)
161-
5. [docker](docs/docker.md)
162-
6. [gitops](docs/gitops.md)
163-
7. [releasing](docs/releasing.md)
164-
8. [Protobuf Style Guide](https://buf.build/docs/style-guide)
165-
9. [Google Protobuf Style Guide](https://github.com/uber-go/guide/blob/master/style.md)
157+
1. [prerequisites](docs/introduction/prerequisites.md)
158+
2. [scaffolding](docs/introduction/scaffolding.md)
159+
3. [makefile](docs/introduction/makefile.md)
160+
4. [testing](docs/testing/testing.md)
161+
5. [docker](docs/devops/docker.md)
162+
6. [gitops](docs/advanced/gitops.md)
163+
7. [Protobuf Style Guide](https://buf.build/docs/style-guide)
164+
8. [Google Protobuf Style Guide](https://github.com/uber-go/guide/blob/master/style.md)
166165

167166
### External Docs
168167

cmd/account/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Account CLI
2+
3+
This is a demo Account CLI
4+
5+
6+
## Run
7+
8+
Make sure `account` , `emailer`, `greeter` services are **UP** before running `Account CLI`
9+
10+
Check services are **UP** with `micro list services` command
11+
12+
1. Start Services
13+
```bash
14+
make run-emailer
15+
make run-greeter
16+
make run-account
17+
```
18+
19+
2. Run Account CLI
20+
```bash
21+
go run cmd/account/main.go
22+
go run cmd/account/main.go -username=crazy [email protected] -limit=7
23+
```

cmd/account/main.go

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package main
2+
3+
import (
4+
"context"
5+
"flag"
6+
7+
"github.com/micro/go-micro/v2"
8+
"github.com/micro/go-micro/v2/client"
9+
"github.com/micro/go-micro/v2/metadata"
10+
"github.com/rs/zerolog/log"
11+
12+
"github.com/golang/protobuf/ptypes/wrappers"
13+
14+
userPB "github.com/xmlking/micro-starter-kit/service/account/proto/user"
15+
"github.com/xmlking/micro-starter-kit/shared/config"
16+
"github.com/xmlking/micro-starter-kit/shared/constants"
17+
_ "github.com/xmlking/micro-starter-kit/shared/logger"
18+
logWrapper "github.com/xmlking/micro-starter-kit/shared/wrapper/log"
19+
)
20+
21+
var (
22+
cfg = config.GetConfig()
23+
)
24+
25+
func main() {
26+
log.Debug().Msgf("IsProduction? %v", config.IsProduction())
27+
//log.Debug().Interface("Dialect", cfg.Database.Dialect).Send()
28+
//log.Debug().Msg(cfg.Database.Host)
29+
//log.Debug().Uint32("Port", cfg.Database.Port).Send()
30+
//log.Debug().Uint64("FlushInterval", cfg.Features.Tracing.FlushInterval).Send()
31+
//log.Debug().Msgf("cfg is %v", cfg)
32+
33+
username := flag.String("username", "sumo", "username of user to be create")
34+
email := flag.String("email", "[email protected]", "email of user to be create")
35+
limit := flag.Uint64("limit", 10, "Limit number of results")
36+
flag.Parse()
37+
38+
log.Debug().Str("username", *username).Str("email", *email).Uint64("limit", *limit).Msg("Flags Using:")
39+
40+
userService := userPB.NewUserService(constants.ACCOUNT_SERVICE, client.DefaultClient)
41+
42+
if _, err := userService.Create(context.TODO(), &userPB.CreateRequest{
43+
Username: &wrappers.StringValue{Value: *username},
44+
FirstName: &wrappers.StringValue{Value: "sumo"},
45+
LastName: &wrappers.StringValue{Value: "demo"},
46+
Email: &wrappers.StringValue{Value: *email},
47+
}); err != nil {
48+
log.Fatal().Err(err).Msg("Unable to create User")
49+
}
50+
51+
getUserList(userService, uint32(*limit))
52+
getUserList2(uint32(*limit))
53+
}
54+
55+
func getUserList(us userPB.UserService, limit uint32) {
56+
if rsp, err := us.List(context.Background(), &userPB.ListRequest{Limit: &wrappers.UInt32Value{Value: limit}}); err != nil {
57+
log.Fatal().Err(err).Msg("Unable to List Users")
58+
} else {
59+
log.Info().Interface("listRsp", rsp).Send()
60+
}
61+
}
62+
63+
// Just to showcase usage of generic micro client
64+
func getUserList2(limit uint32) {
65+
66+
// New Service
67+
service := micro.NewService(
68+
micro.Name(constants.ACCOUNT_CLIENT),
69+
micro.Version(config.Version),
70+
micro.WrapClient(logWrapper.NewClientWrapper()), // Showcase ClientWrapper usage
71+
)
72+
73+
cl := service.Client()
74+
75+
// Create new request to service mkit.service.account, method UserService.List
76+
listReq := cl.NewRequest(constants.ACCOUNT_SERVICE, "UserService.List", &userPB.ListRequest{
77+
Limit: &wrappers.UInt32Value{Value: limit},
78+
})
79+
listRsp := &userPB.ListResponse{}
80+
81+
// Create context with metadata - (Optional) Just for demonstration
82+
ctx := metadata.NewContext(context.Background(), map[string]string{
83+
"X-User-Id": "john",
84+
"X-From-Id": "script",
85+
})
86+
87+
if err := cl.Call(ctx, listReq, listRsp); err != nil {
88+
log.Fatal().Err(err).Msg("Unable to List Users")
89+
} else {
90+
log.Info().Interface("listRsp", listRsp).Send()
91+
}
92+
}

cmd/demo/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

cmd/demo/main.go

Lines changed: 0 additions & 51 deletions
This file was deleted.

config/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ git push
7575
# dry run to see what you will create
7676
# kubectl apply -k config/envs/development --dry-run=client -o yaml
7777
mkdir -p {./build/kubernetes/development,./build/kubernetes/production,./build/kubernetes/staging}
78-
kustomize build config/envs/development --output ./build/kubernetes/development
79-
kustomize build config/envs/production --output ./build/kubernetes/production
80-
kustomize build config/envs/staging --output ./build/kubernetes/staging
78+
kustomize build config/envs/development --output ./build/kubernetes/development --load_restrictor none
79+
kustomize build config/envs/production --output ./build/kubernetes/production --load_restrictor none
80+
kustomize build config/envs/staging --output ./build/kubernetes/staging --load_restrictor none
8181
# tag changes
8282
git tag v0.1.3
8383
git push origin v0.1.3

config/base/secrets/kustomization.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ secretGenerator:
1313
# type: kubernetes.io/dockerconfigjson
1414
- name: certs
1515
files:
16-
- certs/ca-cert.pem
17-
- certs/proxy-cert.pem
18-
- certs/proxy-key.pem
19-
- certs/upstream-ca-cert.pem
20-
- certs/upstream-cert.pem
21-
- certs/upstream-key.pem
16+
- ../../certs/ca-cert.pem
17+
- ../../certs/proxy-cert.pem
18+
- ../../certs/proxy-key.pem
19+
- ../../certs/upstream-ca-cert.pem
20+
- ../../certs/upstream-cert.pem
21+
- ../../certs/upstream-key.pem
22+
2223
type: Opaque

0 commit comments

Comments
 (0)