Giter Club home page Giter Club logo

shippy's Introduction

shippy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shippy's Issues

Update on tutorial no. 2

Hi, I think there's an error on [this page[(https://ewanvalentine.io/microservices-in-golang-part-2/) the code under point number 12 is the same as on number 11. Commit 3fdf034 is containing changes to consignment-service/main.go that are described by point 12

Wrong Dockerfile for user-service

Apparently,Dockerfile for user-service was copied from the version for vessel-service. The following lines are wrong in user-service/Dockerfile

WORKDIR /go/src/github.com/EwanValentine/shippy/vessel-service

RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo .

COPY --from=builder /go/src/github.com/EwnaValentine/shippy/vessel-service/vessel-service .
CMD ["./vessel-service"]

Primary key of mongodb "_id" in proto file

First of all a big thank you for your great tutorial!

I have a question regarding the primary keys of mongodb. Mongodb creates a unique _id attribute for each document itself. In the.proto file we have also set an "id" attribute, so that there are two id fields in the database after calling the Create function. I tried to use byte as a proto type for the id attribute an renaming it to _id like mongodb has, but it does not work..

Is there a way to specify the"_id" attribute in the.proto file and somehow map it with mongodb? Or is there nothing else left but to work with two ID fields?

I am very happy about feedback

tutorial-1 error

description:
when I run cli.go, the error is like below:

open consignment.json: no such file or directory

the code is downloaded directly from https://github.com/wuYin/shippy, so it shouldnot have problem.
Hope to have your opinion~

Could not connect to DB: dial tcp: lookup database on 127.0.0.11:53: no such host

the tutorial 3 problem:

I start the database,use the command:

docker-compose run database
  • the result is
PostgreSQL init process complete; ready for start up.

LOG:  database system was shut down at 2019-09-22 10:08:20 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections

it is ok

when I start the user-service, the error is coming:

Could not connect to DB: dial tcp: lookup database on 127.0.0.11:53: no such host

how to solve the problem, my operating system is macos

Validate Token Function

i believe there is an error with this function. You need to pass tokenString as the first parameter and not key, to ParseWithClaims.

func (srv *TokenService) Decode(tokenString string) (*CustomClaims, error) {
	// Parse the token
	tokenType, err := jwt.ParseWithClaims(tokenString, &CustomClaims{}, func(token *jwt.Token) (interface{}, error) {
		return key, nil
	})
	// Validate the token and return the custom claims
	if claims, ok := tokenType.Claims.(*CustomClaims); ok && tokenType.Valid {
		return claims, nil
	} else {
		return nil, err
	}
}

However, I received the following when validating

{
  "errors": [
    {
      "message": "token is expired by 438487h43m24s",
      "path": [
        "valid"
      ]
    }
  ],
  "data": null
}

user service bug

  1. uuid gen need 2 resps but one wriiten, and uuid var is corrupted with uuid
uUuid,_ := uuid.NewV4()
  1. in Authable implement method Decode, jwt.ParseWithClaims first param should be token, not key!!
	tokenType, err := jwt.ParseWithClaims(string(token), &CustomClaims{}, func(token *jwt.Token) (interface{}, error) {
		return key, nil
	})

Tutorial 2 Question -> consignment-cli proto: Marshal called with nil

Many thanks for this amazing tutorial! It's been super helpful. I may be missing something simple, but when I run my consignment-cli I get the following error output:

2018/02/23 13:11:51 Couldn't greet: {"id":"go.micro.client.codec","code":500,"detail":"proto: Marshal called with nil","status":"Internal Server Error"}

docker ps:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7fd3d4792ba3 microservices_consignment-service "./consignment-servi…" 5 minutes ago Up 5 minutes 0.0.0.0:50051->50051/tcp microservices_consignment-service_1
4f2eb28a7e0d microservices_vessel-service "./vessel-service" 5 minutes ago Up 5 minutes 0.0.0.0:50052->50051/tcp microservices_vessel-service_1

I feel like I've triple checked our code side-by-side (using plugins in atom). Here's all of my code, thus far:
[https://github.com/giancarlopetrini/microservices]

tutorial-3: question is there a session leak?

file handlers.go:
function:
func (s *service) GetRepo() Repository { return &VesselRepository{s.session.Clone()} }

returns clone of current session.
then later:

func (s *service) Create(ctx context.Context, req *pb.Vessel, res *pb.Response) error {
	defer s.GetRepo().Close()
	if err := s.GetRepo().Create(req); err != nil {
		return err
	}
	res.Vessel = req
	res.Created = true
	return nil
}

at the exitting of the function,
defer s.GetRepo().Close()
will produce clone of session, during s.GetRepo() call and then close it.
Why do we need this?

No more gRPC?

Hey, great posts by the way. Just to be clear, from tutorial-2, gRPC is not longer being used and was replaced fully by go-micro?

Getting error when downloading the dependencies of shippy-cli-consignment

Following the tutorial, i was able to build and run the image for the shippy-service-consignment but i'm having issues with the building of the shippy-cli-consignment image, it gets stuck at the RUN go mod download command.

Error message:
go: github.com/Qalifah/shippy/[email protected]: parsing /shippy-service-consignment/go.mod: open /shippy-service-consignment/go.mod: no such file or directory

what am i doing wrong?

Build failure

Hi, I have just tried to build the consignment-services project from the Makefile:build command, but it is breaking at step 6:

Step 6/12 : RUN CGO_ENABLED=0 GOOS=linux go build  -o consignment-service -a -installsuffix cgo main.go repository.go handler.go datastore.go
 ---> Running in b05fe7bc63da
# command-line-arguments
./main.go:52:2: undefined: go_micro_srv_consignment.RegisterShippingServiceHandler
The command '/bin/sh -c CGO_ENABLED=0 GOOS=linux go build  -o consignment-service -a -installsuffix cgo main.go repository.go handler.go datastore.go' returned a non-zero code: 2
Makefile:2: recipe for target 'build' failed
make: *** [build] Error 2

Seeing how I have just started to follow the articles, I am not sure where that would be breaking.

Tutorial 3 Issue

Hi,

I just want to say first of all this is an awesome series, and really helping me get up to speed with GO and the framework. I've been following along exactly, but seems to have hit a stumbling block in tutorial 3. I am able to get the services and client cli up and running, but I get an error from the consignment-service to the vessel-service, in that the vessel service cannot be found.

I have verified that the vessel service is coming up properly on the correct port and is even writing the initial vessel into MongoDB, but it just cannot be looked up from the consignment service. I have tried running everything in docker-compose, as individual docker containers, and even just starting them directly from the command line after compilation, but still the same issue in all 3 scenarios.

Looking for some pointers as to what you think the cause may be ?

Docker Build Failed Tutorial 2

Hello,

I got the following error when I run docker build

Step 6/6 : RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo .
 ---> Running in 1c22dd374872
# github.com/fdmsantos/microservices-grpc-demo/consignment-service/vendor/github.com/micro/go-micro/registry/gossip/proto
vendor/github.com/micro/go-micro/registry/gossip/proto/gossip.pb.go:21:11: undefined: proto.ProtoPackageIsVersion3
# github.com/fdmsantos/microservices-grpc-demo/consignment-service/vendor/github.com/miekg/dns
vendor/github.com/miekg/dns/dnssec_keyscan.go:295:7: undefined: strings.Builder
vendor/github.com/miekg/dns/msg_helpers.go:270:8: undefined: strings.Builder
vendor/github.com/miekg/dns/serve_mux.go:43:9: undefined: strings.Builder
vendor/github.com/miekg/dns/types.go:432:10: undefined: strings.Builder
vendor/github.com/miekg/dns/types.go:456:10: undefined: strings.Builder
vendor/github.com/miekg/dns/types.go:484:10: undefined: strings.Builder
vendor/github.com/miekg/dns/types.go:505:29: undefined: strings.Builder
vendor/github.com/miekg/dns/types.go:515:28: undefined: strings.Builder
# github.com/fdmsantos/microservices-grpc-demo/consignment-service/proto/consignment
proto/consignment/consignment.pb.go:27:11: undefined: proto.ProtoPackageIsVersion3
The command '/bin/sh -c CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo .' returned a non-zero code: 2

Thanks for any help.

Regards,
Fábio Santos

Dep init on dev environment

Shouldn't we run dep init on dev environment so then we just run dep ensure on the machine?
This is because I like to test things first on my machine and only after dockerize it. But if I do so, then running dep init again complains because Gopkg.toml file already exists. Also I think what gets installed on docker should be exactly the same as dev environment so its predictable - which I believe is assured by Gopkg.lock.

Thoughts?

tutorial - 2: Dockerrfile

In line 18 why vessel-service directory twice ?
COPY --from=builder /go/src/github.com/EwanValentine/shippy/vessel-service/vessel-service .

Broken Article Link

Hi @EwanValentine!

Thank you for the article. I've stumbled upon two issues:

  1. The link to the Github repo is broken:
    image
    It refers to: https://ewanvalentine.io/microservices-in-golang-part-1/github.com/ewanvalentine/shippy/
    Not to (as it should be): https://github.com/EwanValentine/shippy/

  2. Package name in the import statement is case sensitive. Also note shippy vs shipper.
    https://github.com/EwanValentine/shippy/blob/tutorial-1/consignment-service/main.go#L8
    Must be: pb "github.com/EwanValentine/shippy/consignment-service/proto/consignment"
    Your code: pb "github.com/ewanvalentine/shipper/consignment-service/proto/consignment"

  3. The same goes to CLI client: https://github.com/EwanValentine/shippy/blob/tutorial-1/consignment-cli/cli.go

Cheers,
@resurtm

Tutorial 2: undefined: vessel.RegisterVesselServiceHandler

For some reason, following the code on https://ewanvalentine.io/microservices-in-golang-part-2/ and using golang:1.10.3-alpine3.7, I get the following error while compiling vessel-service:

CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo .
# github.com/EwanValentine/shippy/vessel-service
./main.go:65:2: undefined: vessel.RegisterVesselServiceHandler

I've attached the vessel.pb.go.txt file that was generated on my container. I can see that there's a RegisterVesselServiceServer where it looks like the RegisterVesselServiceHandler should be. I do not know why this is the case as there is no code diff between what I have copy and pasted and what's in this repo.

UserService.Get error unexpected EOF

Hi, i am trying to get user by id, but it's always error

{"id":"go.micro.client.transport","code":500,"detail":"unexpected EOF","status":"Internal Server Error"}

using micro call still error

$ micro call go.micro.srv.user UserService.Get '{"id": "3ac5d85a-4770-4147-8ce5-5397619cbee4"}'
error calling go.micro.srv.user.UserService.Get: {"id":"go.micro.client.transport","code":500,"detail":"unexpected EOF","status":"Internal Server Error"}

can you explain me how to get user by id?
thanks!

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.