Comments (5)
there ins't one currently, gRPC just stops via normal signals. But I'm open to a better running that listens to signal that we can act on. It would be useful for draining subscribers too.
from lile.
I'll put one in with consul in one go. We can discuss from there
from lile.
So here's what I've got so far:
https://github.com/nadilas/lile
The templates are supposed to be updated, although I haven't done a clean install test yet. I will do that later.
first:
consul agent -dev
server:
go run service/main.go up --pubsub --consul --service_port=8555
time="2018-03-18T14:29:49+01:00" level=warning msg="Using noop pubsub provider"
time="2018-03-18T14:29:49+01:00" level=info msg="Regsitered service 'srvsearch-4485272b-a433-49cb-bf43-699369a58a77' at consul."
time="2018-03-18T14:29:49+01:00" level=info msg=Subscribing...
time="2018-03-18T14:29:49+01:00" level=info msg="Serving gRPC on localhost:8555"
time="2018-03-18T14:29:49+01:00" level=info msg="Using Zipkin HTTP tracer: http://localhost:9411/api/v1/spans"
time="2018-03-18T14:29:49+01:00" level=info msg="Prometheus metrics at http://localhost:9555/metrics"
time="2018-03-18T14:29:57+01:00" level=info msg="Captured interrupt. Exiting..."
time="2018-03-18T14:29:57+01:00" level=info msg="Shutting gRPC service 'srvsearch'"
time="2018-03-18T14:29:57+01:00" level=info msg="Deregistered service 'srvsearch-4485272b-a433-49cb-bf43-699369a58a77' at consul."
time="2018-03-18T14:29:57+01:00" level=info msg=Unsubscribing...
Process finished with exit code 0
client:
INFO[0000] Creating srvsearch gRPC client
INFO[0000] read from service: id:"created at server"
from lile.
Looks like a good start! Can you make a pull-request and we'll go through it?
Some first thoughts. I quite like to the move to AppConfig or something similar, but I would like to keep pubsub and consul abstracted away, I moved pubsub to https://github.com/lileio/pubsub and it's been good as internal we not use that without any gRPC logic at all.
So perhaps we should make Registery
an interface? During generation we could allow the passing flags like --pubsub --consul to generate the required parts.
The shutdown hook is great and I definitely get that support into pubsub ASAP, I'm working on a v2 branch here with middleware etc https://github.com/lileio/pubsub/tree/v2
from lile.
Making the registry pluggable is definitely a great idea! I'll leave it for this PR as is, but I'll extract it out later this week. Would you open a lileio/registry
repo? Then I can create a PR against it later this week. I'd even go as far as:
--pubsub=gcloud --registry=consul
having pluggable implementations for registry then: consul,zookeeper, etc...
My problem with AppConfig was that I couldn't get cobra/viper to read the cli arg as an env var at the same time, I'm sure it's possible I just didn't want to spend too much time on it initially. Ideal would be a setup like in this flag implementation: https://github.com/ogier/pflag.
pubsub V2 looks nice! I just moved the pubsub.Subscribe()
to the main Run() in the core, but based on user flags and an interfaced pubsub initialization --pubsub=gcloud
it will even be better.
PR: #32
from lile.
Related Issues (20)
- logger write escape sequence on Windows command prompt HOT 9
- Running tests on windows isn't supported HOT 1
- lile new throws [ERROR]: 1:13: expected ';', found '-' HOT 5
- add a `build` target in the `Makefile` that runs the tests and builds the binary
- Prometheus port is always 9000 in log HOT 2
- Registery ? HOT 1
- vendoring lile HOT 2
- One test stub created when wildcard * used to specify all proto files HOT 1
- Does not support go_package option with semi-colon in proto HOT 1
- make build error HOT 3
- Go modules HOT 2
- Question about import other protos HOT 1
- support grpc-gateway HOT 2
- Cannot compile with lile parameter HOT 1
- Lile bootstrap does not work as in README HOT 4
- Add TODOs Badge to README
- Adding Client-side code generators and Ask Advise for dependent servers HOT 1
- Issue trying to install using go get -u github.com/lileio/lile/... HOT 2
- GO111MODULE=on go get -u github.com/lileio/lile/... fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lile.