koding / kite

Micro-service framework in Go

Home Page:https://godoc.org/github.com/koding/kite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

etcd support broken

pdxjohnny opened this issue · comments

So I messed up etcd support the other day with PR #205. The last time etcd support worked was before my PR with git SHA cc90c7b091275e606ad0ca7102a23fb2072f3f5e of coreos/go-etcd (the deprecated lib). I'm working to fix but this is just so all are aware.

This is fixed with #206 right?

@cihangir So I don't know if it worked before either can someone else try? Maybe I'm just doing this wrong. It does this with my version and before my pull requests so I don't know if its my change or my being bad at kontrol.

first.go

package main

import (
	"log"
	"net/url"

	"github.com/koding/kite"
)

func main() {
	k := kite.New("first", "1.0.1")
	k.Config.KontrolURL = "http://127.0.0.1:6000"
	k.Config.Port = 7000
	k.Config.DisableAuthentication = true

	k.HandleFunc("square", func(r *kite.Request) (interface{}, error) {
		a := r.Args.One().MustFloat64()
		return a * a, nil
	})

	_, err := k.Register(&url.URL{Scheme: "http", Host: "localhost:6000/kite"})
	if err != nil {
		log.Fatal(err)
	}

	k.Run()
}

Running

Term 1

$ kontrol                    
2017-09-25 19:40:03 [kontrol] WARNING  Key pair storage is not set. Using in memory cache                 
2017-09-25 19:40:03 [kontrol] INFO     New listening: 0.0.0.0:6000                                        
2017-09-25 19:40:03 [kontrol] INFO     Serving...

Term 2

$ kontrol -initial           
2017-09-26 08:27:15 [kontrol] WARNING  Key pair storage is not set. Using in memory cache                 
2017-09-26 08:27:15 [kontrol] INFO     Registered machine on user: kontrol                                
kite.key is written to ~/.kite/kite.key. You can see it with:                                             
        kitectl showkey
$ go run first.go                                                                 
2017-09-25 20:30:51 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000                        
2017-09-25 20:30:51 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404
2017-09-25 20:30:52 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000                        
2017-09-25 20:30:52 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404
2017-09-25 20:30:53 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000
2017-09-25 20:30:53 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404
2017-09-25 20:30:54 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000
2017-09-25 20:30:54 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404
2017-09-25 20:30:56 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000
2017-09-25 20:30:56 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404
2017-09-25 20:30:58 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000
2017-09-25 20:30:58 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404
2017-09-25 20:31:01 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000
2017-09-25 20:31:01 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404
2017-09-25 20:31:06 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000
2017-09-25 20:31:06 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404
2017-09-25 20:31:14 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000
2017-09-25 20:31:14 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404
2017-09-25 20:31:27 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000
2017-09-25 20:31:27 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404
2017-09-25 20:31:44 [first] INFO     Dialing 'kontrol' kite: http://127.0.0.1:6000
2017-09-25 20:31:44 [first] WARNING  Dialing 'kontrol' kite error: http://127.0.0.1:6000: Starting new session failed. Want: 200 Got: 404

Kontrol environment variables

KONTROL_STORAGE=etcd
KONTROL_PUBLICKEYFILE=/home/pdxjohnny/.kontrol/key_pub.pem
KONTROL_PORT=6000
KONTROL_USERNAME=kontrol
KONTROL_KONTROLURL=http://127.0.0.1:6000/kite
KONTROL_MACHINES=http://127.0.0.1:2379
KONTROL_PRIVATEKEYFILE=/home/pdxjohnny/.kontrol/key.pem

Open Ports

$ sudo ss -tpln
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN     0      128    127.0.0.1:2380                     *:*                   users:(("etcd",pid=392,fd=5))
LISTEN     0      128          *:6000                     *:*                   users:(("kontrol",pid=12653,fd=5))
LISTEN     0      128    127.0.0.1:8080                     *:*                   users:(("kube-apiserver",pid=481,fd=22))
LISTEN     0      128    127.0.0.1:44549                    *:*                   users:(("python",pid=15485,fd=7))
LISTEN     0      128    127.0.0.1:50795                    *:*                   users:(("gocode",pid=15525,fd=0))
LISTEN     0      128    127.0.0.1:2379                     *:*                   users:(("etcd",pid=392,fd=6))
LISTEN     0      128          *:6443                     *:*                   users:(("kube-apiserver",pid=481,fd=24))

@pdxjohnny What does the following output:

kite $ KITE_TRANSPORT="WebSocket"  KONTROL_STORAGE="etcd" make test

This is my current situation:

what

That failed:

pdxjohnny@pdxjohnny:kite$ KITE_TRANSPORT="WebSocket"  KONTROL_STORAGE="etcd" sudo -E make test
\033[0;32m==> Preparing test environment \033[0m
Using WebSocket transport
Cleaning /tmp/test_kite_home directory
Setting ulimit to 9000 for multiple client tests
\033[0;32m==> Using kontrol storage: 'etcd'\033[0m
Killing previous etcd instance
Installing etcd
test -d "_etcd" || git clone -b release-2.2 https://github.com/coreos/etcd _etcd
Creating test key
2017-09-26 13:49:03.907144 I | etcdmain: etcd Version: 2.2.5+git
2017-09-26 13:49:03.907183 I | etcdmain: Git SHA: 9f5189cd0
2017-09-26 13:49:03.907189 I | etcdmain: Go Version: go1.9
2017-09-26 13:49:03.907194 I | etcdmain: Go OS/Arch: linux/amd64
2017-09-26 13:49:03.907197 I | etcdmain: setting maximum number of CPUs to 4, total number of available CPUs is 4
2017-09-26 13:49:03.907201 W | etcdmain: no data-dir provided, using default data-dir ./default.etcd
2017-09-26 13:49:03.907450 I | etcdmain: listening for peers on http://localhost:2380
2017-09-26 13:49:03.907515 I | etcdmain: listening for peers on http://localhost:7001
2017-09-26 13:49:03.907597 I | etcdmain: listening for client requests on http://localhost:2379
2017-09-26 13:49:03.907668 I | etcdmain: listening for client requests on http://localhost:4001
2017-09-26 13:49:03.907896 I | etcdserver: name = default
2017-09-26 13:49:03.907909 I | etcdserver: data dir = default.etcd
2017-09-26 13:49:03.907916 I | etcdserver: member dir = default.etcd/member
2017-09-26 13:49:03.907921 I | etcdserver: heartbeat = 100ms
2017-09-26 13:49:03.907936 I | etcdserver: election = 1000ms
2017-09-26 13:49:03.907942 I | etcdserver: snapshot count = 10000
2017-09-26 13:49:03.907957 I | etcdserver: advertise client URLs = http://localhost:2379,http://localhost:4001
2017-09-26 13:49:03.907963 I | etcdserver: initial advertise peer URLs = http://localhost:2380,http://localhost:7001
2017-09-26 13:49:03.907975 I | etcdserver: initial cluster = default=http://localhost:2380,default=http://localhost:7001
2017-09-26 13:49:03.944313 I | etcdserver: starting member ce2a822cea30bfca in cluster 7e27652122e8b2ae
2017-09-26 13:49:03.944349 I | raft: ce2a822cea30bfca became follower at term 0
2017-09-26 13:49:03.944362 I | raft: newRaft ce2a822cea30bfca [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
2017-09-26 13:49:03.944367 I | raft: ce2a822cea30bfca became follower at term 1
2017-09-26 13:49:03.944540 I | etcdserver: starting server... [version: 2.2.5+git, cluster version: to_be_decided]
2017-09-26 13:49:03.944758 E | etcdmain: failed to notify systemd for readiness: No socket
2017-09-26 13:49:03.944882 E | etcdmain: forgot to set Type=notify in systemd service file?
2017-09-26 13:49:03.945144 N | etcdserver: added local member ce2a822cea30bfca [http://localhost:2380 http://localhost:7001] to cluster 7e27652122e8b2ae
2017-09-26 13:49:04.344681 I | raft: ce2a822cea30bfca is starting a new election at term 1
2017-09-26 13:49:04.344725 I | raft: ce2a822cea30bfca became candidate at term 2
2017-09-26 13:49:04.344771 I | raft: ce2a822cea30bfca received vote from ce2a822cea30bfca at term 2
2017-09-26 13:49:04.344789 I | raft: ce2a822cea30bfca became leader at term 2
2017-09-26 13:49:04.344798 I | raft: raft.node: ce2a822cea30bfca elected leader ce2a822cea30bfca at term 2
2017-09-26 13:49:04.345107 I | etcdserver: published {Name:default ClientURLs:[http://localhost:2379 http://localhost:4001]} to cluster 7e27652122e8b2ae
2017-09-26 13:49:04.345156 I | etcdserver: setting up the initial cluster version to 2.2
2017-09-26 13:49:04.398714 N | etcdserver: set the initial cluster version to 2.2
\033[0;32m==> Downloading dependencies\033[0m
\033[0;32m==> Testing packages \033[0m
ok      github.com/koding/kite  20.079s
ok      github.com/koding/kite/config   1.015s
ok      github.com/koding/kite/dnode    1.008s
?       github.com/koding/kite/examples/exp2    [no test files]
?       github.com/koding/kite/examples/exp2-query      [no test files]
?       github.com/koding/kite/examples/math    [no test files]
?       github.com/koding/kite/examples/math/math-cli   [no test files]
?       github.com/koding/kite/examples/math/math-kite  [no test files]
?       github.com/koding/kite/examples/math-register   [no test files]
?       github.com/koding/kite/kitectl  [no test files]
?       github.com/koding/kite/kitectl/command  [no test files]
?       github.com/koding/kite/kitekey  [no test files]
?       github.com/koding/kite/kitetest [no test files]
exit status 1
FAIL    github.com/koding/kite/kontrol  0.060s
?       github.com/koding/kite/kontrol/kontrol  [no test files]
ok      github.com/koding/kite/kontrol/onceevery        3.005s
?       github.com/koding/kite/kontrol/protocol [no test files]
ok      github.com/koding/kite/protocol 1.005s
====> Starting WebSocket test
Starting kontrol
FAIL    github.com/koding/kite/reverseproxy     0.068s
?       github.com/koding/kite/reverseproxy/reverseproxy        [no test files]
ok      github.com/koding/kite/sockjsclient     1.212s
ok      github.com/koding/kite/systeminfo       1.048s
exit status 1
FAIL    github.com/koding/kite/test     0.052s
?       github.com/koding/kite/testkeys [no test files]
?       github.com/koding/kite/testutil [no test files]
?       github.com/koding/kite/testutil/writekey        [no test files]
Starting kontrol
FAIL    github.com/koding/kite/tunnelproxy      0.037s
?       github.com/koding/kite/tunnelproxy/tunnelproxy  [no test files]
?       github.com/koding/kite/utils    [no test files]
make: *** [Makefile:125: test] Error 1

It worked in travis though: https://travis-ci.org/koding/kite/jobs/279708934