arkenio / gogeta Goto Github PK
View Code? Open in Web Editor NEWReverse proxy based on etcd hierarchy
License: GNU Lesser General Public License v2.1
Reverse proxy based on etcd hierarchy
License: GNU Lesser General Public License v2.1
@dmetzler
Can you put a bit more clarity to:
if type is io service we look for /services/{value}/1/location which value is in the form
{"host":"172.13.4.3","port":42567}
What is exactly the format of mycustomdomain.com/[type,value]
?
How the services
get linked to the mycustomdomain.com
?
Thanks
It looks like there are a lot of env values to handle (STARTING_STATUS, STARTED_STATUS, ...). I was wondering if there is an example of the data I'd have to post to etcd in order to make this work?
It would be great to see an actual example for domains & env.
I really like gogeta, as it exactly suits our needs. But we get some strange behavior when removing an instance of a ha-service which I can't explain to myself:
Here's our unit-file:
[Unit]
Description=Account
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill account-%i
[...]
ExecStart=/usr/bin/docker run --name account-%i [...]
ExecStartPost=/usr/bin/etcdctl set /services/AccountService/%i/location '{\"host\": "%H", \"port\": 3000}'
ExecStop=/usr/bin/docker stop account-%i
ExecStopPost=/usr/bin/etcdctl rm --recursive /services/AccountService/%i
User=core
[Install]
WantedBy=multi-user.target
[X-Fleet]
Conflicts=account@*.service
When I start both services with fleetctl start account@{1..2}.service
everything runs as expected. I get the following structure in ectd:
/services
/services/AccountService
/services/AccountService/1
/services/AccountService/1/location #=> pointing to right location
/services/AccountService/1/lastAccess
/services/AccountService/2
/services/AccountService/2/location #=> pointing to right location
/services/AccountService/2/lastAccess
/domains
/domains/ourDomain.com
/domains/ourDomain.com/type #=> is manually set to "service"
/domains/ourDomain.com/value #=> is manually set to "AccountService"
When I now stop one service fleetctl stop [email protected]
I get the following error in the logs:
Removing service AccountService
ioetcdresolver.go:108 The services map doesn't contain service with the domain value: AccountService
At that point the remaining instance of the service isn't reachable anymore just giving an Unable to serve page :
etcd says:
/services/AccountService/2/lastAccess
/services/AccountService/2/location #=> {"host": "some-ip", "port": 3000} (unchanged: it's the right location)
So there definetly is a service under AccountService
...
Did we oversee anything? Thanks in advance
How do you handle ssl traffic? Do you put stunnel in front of gogeta or are you going to implement ssl support as well?
Tried /usr/bin/docker run --rm --name gogeta -p 7777:7777 arken/gogeta -etcdAddress=https://discovery.etcd.io/...
Here's a stacktrace:
runtime.chanrecv(0x6427e0, 0xc21006fa50, 0x7fccece25f78, 0x0, 0x0)
/usr/local/go/src/pkg/runtime/chan.c:308 +0x59 fp=0x7fccece25f38
runtime.chanrecv1(0x6427e0, 0xc21006fa50, 0x0)
/usr/local/go/src/pkg/runtime/chan.c:446 +0x38 fp=0x7fccece25f68
main.(*watcher).watch(0xc2100faf60, 0xc21006fa50, 0xc2100f6da0)
/usr/local/go/src/github.com/arkenio/gogeta/etcdwatcher.go:59 +0x30 fp=0x7fccece25f88
runtime.goexit()
/usr/local/go/src/pkg/runtime/proc.c:1394 fp=0x7fccece25f90
created by main.(*watcher).loadAndWatch
/usr/local/go/src/github.com/arkenio/gogeta/etcdwatcher.go:43 +0x89
goroutine 1 [IO wait]:
net.runtime_pollWait(0x7fccf0354658, 0x72, 0x0)
/usr/local/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(*pollDesc).Wait(0xc210065220, 0x72, 0x7fccf03530c0, 0xb)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(*pollDesc).WaitRead(0xc210065220, 0xb, 0x7fccf03530c0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:86 +0x30
net.(*netFD).accept(0xc2100651c0, 0x7dcaf0, 0x0, 0x7fccf03530c0, 0xb)
/usr/local/go/src/pkg/net/fd_unix.go:382 +0x2c2
net.(*TCPListener).AcceptTCP(0xc210000ee8, 0x18, 0xc210044010, 0x45bb83)
/usr/local/go/src/pkg/net/tcpsock_posix.go:233 +0x47
net.(*TCPListener).Accept(0xc210000ee8, 0x7fccf03536e0, 0xc2100ace70, 0x0, 0x0)
/usr/local/go/src/pkg/net/tcpsock_posix.go:243 +0x27
net/http.(*Server).Serve(0xc2100f9780, 0x7fccf0354ee0, 0xc210000ee8, 0x0, 0x0)
/usr/local/go/src/pkg/net/http/server.go:1622 +0x91
net/http.(*Server).ListenAndServe(0xc2100f9780, 0xc2100f9780, 0x5)
/usr/local/go/src/pkg/net/http/server.go:1612 +0xa0
net/http.ListenAndServe(0xc210000ec0, 0x5, 0x0, 0x0, 0x1, ...)
/usr/local/go/src/pkg/net/http/server.go:1677 +0x6d
main.(*proxy).start(0xc2100faf80)
/usr/local/go/src/github.com/arkenio/gogeta/proxy.go:58 +0x281
main.main()
/usr/local/go/src/github.com/arkenio/gogeta/main.go:40 +0x19a
goroutine 3 [chan receive]:
github.com/golang/glog.(*loggingT).flushDaemon(0xa97120)
/usr/local/go/src/github.com/golang/glog/glog.go:839 +0x50
created by github.com/golang/glog.init·1
/usr/local/go/src/github.com/golang/glog/glog.go:406 +0x276
goroutine 4 [syscall]:
runtime.goexit()
/usr/local/go/src/pkg/runtime/proc.c:1394
goroutine 13 [runnable]:
main.(*watcher).watch(0xc2100faf60, 0xc21006fc60, 0xc2100f6db0)
/usr/local/go/src/github.com/arkenio/gogeta/etcdwatcher.go:59 +0x30
created by main.(*watcher).loadAndWatch
/usr/local/go/src/github.com/arkenio/gogeta/etcdwatcher.go:43 +0x89
goroutine 8 [IO wait]:
net.runtime_pollWait(0x7fccf0354700, 0x72, 0x0)
/usr/local/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(*pollDesc).Wait(0xc2100465a0, 0x72, 0x7fccf03530c0, 0xb)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(*pollDesc).WaitRead(0xc2100465a0, 0xb, 0x7fccf03530c0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:86 +0x30
net.(*netFD).Read(0xc210046540, 0xc2100f0000, 0x1000, 0x1000, 0x0, ...)
/usr/local/go/src/pkg/net/fd_unix.go:204 +0x2a0
net.(*conn).Read(0xc210000290, 0xc2100f0000, 0x1000, 0x1000, 0x0, ...)
/usr/local/go/src/pkg/net/net.go:122 +0xc5
crypto/tls.(*block).readFromUntil(0xc2100ac270, 0x7fccf0354858, 0xc210000290, 0x5, 0xc210000290, ...)
/usr/local/go/src/pkg/crypto/tls/conn.go:459 +0xb6
crypto/tls.(*Conn).readRecord(0xc210050780, 0x17, 0x0, 0x8)
/usr/local/go/src/pkg/crypto/tls/conn.go:539 +0x107
crypto/tls.(*Conn).Read(0xc210050780, 0xc21005e000, 0x1000, 0x1000, 0x0, ...)
/usr/local/go/src/pkg/crypto/tls/conn.go:897 +0x135
bufio.(*Reader).fill(0xc21005d180)
/usr/local/go/src/pkg/bufio/bufio.go:91 +0x110
bufio.(*Reader).Peek(0xc21005d180, 0x1, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/pkg/bufio/bufio.go:119 +0xcb
net/http.(*persistConn).readLoop(0xc210093680)
/usr/local/go/src/pkg/net/http/transport.go:687 +0xb7
created by net/http.(*Transport).dialConn
/usr/local/go/src/pkg/net/http/transport.go:528 +0x607
goroutine 9 [select]:
net/http.(*persistConn).writeLoop(0xc210093680)
/usr/local/go/src/pkg/net/http/transport.go:791 +0x271
created by net/http.(*Transport).dialConn
/usr/local/go/src/pkg/net/http/transport.go:529 +0x61e
Hi, I am getting an error when trying to run gogeta.
I ran the etcd image in a container and then ran the following commands
core@core ~/gogeta $ etcdctl mkdir /domains
core@core ~/gogeta $ etcdctl mkdir /services
core@core ~/gogeta $ etcdctl mkdir /domains/test.com
core@core ~/gogeta $ etcdctl set /domains/test.com/type uri
core@core ~/gogeta $ etcdctl set /domains/test.com/value 172.17.0.29:80
my etcd image was running on 172.17.0.48:4001
So used the following command:
root@8f732eed0887:/usr/local/go/src/github.com/arkenio/gogeta# gogeta -etcdAddress="http://172.17.0.48:4001" \
> -domainDir="/domains" \
> -serviceDir="/services" \
> -templateDir="/usr/local/go/src/github.com/nuxeo/gogeta/templates"
This is the error and it repeats again and again.
E0610 10:30:13.230260 26 etcdwatcher.go:54] Error when watching /domains : 501: All the given peers are not reachable (failed to propose on members [http://127.0.0.1:4001] twice [last error: Get http://127.0.0.1:4001/v2/keys/domains?recursive=true&wait=true: dial tcp 127.0.0.1:4001: connection refused]) [0]
E0610 10:30:13.231045 26 etcdwatcher.go:55] Waiting 1 second and relaunch watch
E0610 10:30:13.231924 26 etcdwatcher.go:54] Error when watching /services : 501: All the given peers are not reachable (failed to propose on members [http://127.0.0.1:4001] twice [last error: Get http://127.0.0.1:4001/v2/keys/services?recursive=true&wait=true: dial tcp 127.0.0.1:4001: connection refused]) [0]
E0610 10:30:13.232254 26 etcdwatcher.go:55] Waiting 1 second and relaunch watch
I am a complete beginner here so I have no idea where I am wrong, but gogeta is the exact thing that I want.
Thanks for the awesome project.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.