Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation on Kontrol or basic explanations ? #141

Open
depado opened this issue Oct 28, 2015 · 7 comments
Open

Documentation on Kontrol or basic explanations ? #141

depado opened this issue Oct 28, 2015 · 7 comments

Comments

@depado
Copy link

depado commented Oct 28, 2015

Hello,

I'm trying to use Kontrol. First of all there a things I don't understand :

  • Do I need to install Kontrol on each node that has a kite ?
  • Is there another way of generating a key ?
  • Is a key needed for each different kite or can I use the same key for, say, two kites on the same host ?
  • What if I want to test Kontrol in local ? Would it be ok (for testing purpose) to use the same key for Kontrol, the server kite and the client kite ?

Currently I'm having a single error when I try to connect my client kite to the server kite going through Kontrol. I generated the keys with the commands given in your README.md file, started etcd and then started kontrol with the -initial argument. It generated the key without a problem and then started kontrol like that :

kontrol -port=6000 -publickeyfile="certs/key_pub.pem" -privatekeyfile="certs/key.pem" -ip="127.0.0.1"

(I hope so far everything is fine)

Here is my server kite (I stripped down everything that wasn't needed) :

func main() {
    k := kite.New("bus", "1.0.0")
    c := config.MustGet()
    k.Config = c
    k.Config.Port = 6001
    k.Config.Username = "test"
    k.Config.Environment = "dev"
    k.Config.KontrolURL = "http://127.0.0.1:6000/kite"

    k.HandleFunc("square", func(r *kite.Request) (interface{}, error) {
        return "Ok", nil
    })

    k.RegisterForever(&url.URL{Scheme: "http", Host: "127.0.0.1:6001"})
    k.Run()
}

When I start this server, there is no problem, the kite registers itself with Kontrol. (Note that I ignored the error returned k.RegisterForever to simplify the snippet, but I do check it otherwise)

First thing I don't understand :

[bus] Kite Stdout :
2015-10-28 18:09:18 [bus] INFO     Registered to kontrol with URL: http://127.0.0.1:6001 and Kite query: /test/dev/bus/1.0.0/unknown/silence/0888388b-e4a3-4918-4115-82f6c98b0432

[kontrol] Kite Stdout :
2015-10-28 18:11:53 [kontrol] INFO     Register request from: /kontrol/dev/bus/1.0.0/unknown/silence/0888388b-e4a3-4918-4115-82f6c98b0432
2015-10-28 18:11:53 [kontrol] INFO     Kite registered: /kontrol/dev/bus/1.0.0/unknown/silence/0888388b-e4a3-4918-4115-82f6c98b0432

So the [bus] Kite tells me that it has registered with Kontrol, and that the query to reach him is /test/dev/bus/... but Kontrol tells me it registered to /kontrol/dev/bus/.... What am I missing here ?

And then with my client I'm getting a websocket: bad handshake but I guess my misunderstanding in the way Kontrol works caused this issue.

Also, sorry for the long post, I understand that you're busy and that you may have not the time to answer me. (And thanks for updating the example with a struct, it was helpful 😄 )

I intend to write a tutorial on Kite once I make it work fine if you don't mind 😄

@depado
Copy link
Author

depado commented Nov 10, 2015

Any chance someone using Kontrol could answer me ?

@bhalle
Copy link

bhalle commented Jan 27, 2016

@depado did you ever get your issue resolved? I'm currently running into a similar issue with "websocket: bad handshake" when trying to get simple example running.

@depado
Copy link
Author

depado commented Jan 27, 2016

No, I dropped it for now. I'm running things without Kontrol.

@bhalle
Copy link

bhalle commented Jan 27, 2016

@depado ... ok thx

@depado
Copy link
Author

depado commented Jan 27, 2016

@bhalle if you happen to make things work, would you mind writing down a small tutorial on how you managed to do it ? I'm still quite interested in that.

@bhalle
Copy link

bhalle commented Jan 30, 2016

@depado ... here ya go ... https://github.com/bhalle/api.kite

@depado
Copy link
Author

depado commented Jan 30, 2016

Thanks @bhalle I'll give that a try 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants