Skip to content
This repository has been archived by the owner on Dec 8, 2019. It is now read-only.

Vamp Router does not start #22

Closed
zutherb opened this issue Aug 7, 2015 · 23 comments
Closed

Vamp Router does not start #22

zutherb opened this issue Aug 7, 2015 · 23 comments

Comments

@zutherb
Copy link

zutherb commented Aug 7, 2015

I try out vamp 0.7.9 and installed vamp like you have defined it in the guide (http://vamp.io/installation/ubuntu/). But the Vamp Router does not start, i got an endless loop in the log file (/var/log/vamp-router/vamp-router.log ) of the following message.
I could not find a log file of the haproxy to see what is wrong.

██╗   ██╗ █████╗ ███╗   ███╗██████╗
██║   ██║██╔══██╗████╗ ████║██╔══██╗
██║   ██║███████║██╔████╔██║██████╔╝
╚██╗ ██╔╝██╔══██║██║╚██╔╝██║██╔═══╝
 ╚████╔╝ ██║  ██║██║ ╚═╝ ██║██║
  ╚═══╝  ╚═╝  ╚═╝╚═╝     ╚═╝╚═╝
                       router
                       version 0.7.9
                       by magnetic.io

08:13:53.615 main NOTI ==>  Attempting to load config at /usr/share/vamp-router/configuration
08:13:53.615 main NOTI ==>  Did not find a config...initializing empty config
08:13:53.616 main CRIT ==>  Could not render initial config, exiting...
08:13:53.649 main INFO ==>  
██╗   ██╗ █████╗ ███╗   ███╗██████╗
██║   ██║██╔══██╗████╗ ████║██╔══██╗
██║   ██║███████║██╔████╔██║██████╔╝
╚██╗ ██╔╝██╔══██║██║╚██╔╝██║██╔═══╝
 ╚████╔╝ ██║  ██║██║ ╚═╝ ██║██║
  ╚═══╝  ╚═╝  ╚═╝╚═╝     ╚═╝╚═╝
                       router
                       version 0.7.9
                       by magnetic.io

08:13:53.650 main NOTI ==>  Attempting to load config at /usr/share/vamp-router/configuration
08:13:53.650 main NOTI ==>  Did not find a config...initializing empty config
08:13:53.651 main CRIT ==>  Could not render initial config, exiting...
08:13:53.670 main INFO ==>  
@plamola
Copy link
Contributor

plamola commented Aug 10, 2015

@zutherb Which version of Ubuntu are you using?

Did you notice the issue reported in the documentation regarding vamp-router?
http://vamp.io/installation/ubuntu/#install-router

@plamola plamola self-assigned this Aug 10, 2015
@zutherb
Copy link
Author

zutherb commented Aug 10, 2015

@plamola

I'm using:
Linux master1 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Yes notice the issue.

@plamola
Copy link
Contributor

plamola commented Aug 10, 2015

I'm able to reproduce this issue, when I install an old version of haproxy.

The haproxy version in the default Ubuntu repo is 1.4.x; vamp-router required haproxy 1.5+

Could you check which version of haproxy you got installed?

haproxy -v

See the instructions for adding the haproxy repo in our docs:
http://vamp.io/installation/ubuntu/#haproxy-1-5-x

@zutherb
Copy link
Author

zutherb commented Aug 10, 2015

Hi @plamola,
i'm using HA-Proxy version 1.5.14

vagrant@master1:~$ haproxy -v
HA-Proxy version 1.5.14 2015/07/02
Copyright 2000-2015 Willy Tarreau <willy@haproxy.org>

@plamola
Copy link
Contributor

plamola commented Aug 10, 2015

Can you check the privileges on the /usr/share/vamp-router/data & /usr/share/vamp-router/configuration directories?

The vamp-router user needs read/write access on both directories.

I've done a clean install on an Ubuntu 14.04 machine and this is what is been setup:

$ ls -al /usr/share/vamp-router
total 10168
drwxr-xr-x   6 root        root            4096 Aug 10 09:54 .
drwxr-xr-x 105 root        root            4096 Aug 10 09:54 ..
drwxrwxr-x   2 root        root            4096 Aug 10 09:54 bin
drwxr-xr-x   4 vamp-router vamp-router     4096 Aug 10 09:54 configuration
drwxr-xr-x   2 vamp-router vamp-router     4096 Aug 10 11:02 data
drwxrwxr-x   2 root        root            4096 Aug 10 09:54 examples
lrwxrwxrwx   1 root        root              20 Aug  3 09:12 logs -> /var/log/vamp-router
-rwxr-xr-x   1 root        root        10383392 Jul 31 14:14 vamp-router

@zutherb
Copy link
Author

zutherb commented Aug 10, 2015

Looks good

vagrant@master1:~$ ls -al /usr/share/vamp-router
total 10168
drwxr-xr-x   6 root        root            4096 Aug  7 06:04 .
drwxr-xr-x 118 root        root            4096 Aug  7 06:06 ..
drwxrwxr-x   2 root        root            4096 Aug  7 06:04 bin
drwxr-xr-x   2 vamp-router vamp-router     4096 Aug  7 07:27 configuration
drwxr-xr-x   2 vamp-router vamp-router     4096 Aug  7 07:27 data
drwxrwxr-x   2 root        root            4096 Aug  7 06:04 examples
lrwxrwxrwx   1 root        root              20 Aug  3 02:12 logs -> /var/log/vamp-router
-rwxr-xr-x   1 root        root        10383392 Jul 31 07:14 vamp-router

I will try a clean installation of ubuntu as well.

@zutherb
Copy link
Author

zutherb commented Aug 11, 2015

Hi @plamola,

the fresh installation doesn't work. Here is what i did:

#!/usr/bin/env bash
sudo apt-get install -y openjdk-8

sudo add-apt-repository -y ppa:vbernat/haproxy-1.5
sudo apt-get update
sudo apt-get install -y haproxy

echo "deb https://dl.bintray.com/magnetic-io/upstart trusty main" | sudo tee -a /etc/apt/sources.list
curl https://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
sudo apt-get update

sudo apt-get install -y vamp-core
cp -vf /vagrant/scripts/vamp/core-application.conf /usr/share/vamp-core/conf/application.conf
sudo service vamp-core restart

sudo apt-get install -y vamp-pulse
cp -vf /vagrant/scripts/vamp/pulse-application.conf /usr/share/vamp-pulse/conf/application.conf
sudo service vamp-pulse restart

sudo apt-get install -y vamp-router
/usr/share/vamp-router/vamp-router --binary=/usr/sbin/haproxy

sudo apt-get install -y vamp-cli

@tnolet
Copy link

tnolet commented Aug 11, 2015

@zutherb Hi Bernd, we're checking this right now in a fresh Ubuntu 14.04 instance. We noticed a couple of things:

  1. Openjdk 1.8 is not available on this version. We used the Oracle JDK. This is beside this issue of course.
  2. When installing vamp-router, it should automatically start correctly. A ps tells me the following:
root     32259     1  0 09:27 ?        00:00:00 sudo -u vamp-router bin/vamp-router
vamp-ro+ 32261 32259  0 09:27 ?        00:00:00 bash bin/vamp-router
vamp-ro+ 32263 32261  0 09:27 ?        00:00:00 ./vamp-router
vamp-ro+ 32268     1  0 09:27 ?        00:00:00 /usr/sbin/haproxy -f /usr/share/vamp-router/configuration/haproxy_new.cfg -p /usr/share/vamp-router/data/haproxy-private.pid -D

a => root does a sudo -u preserving the user and starting our little bash script to kick off router.
b => vamp-router user runs bin/vamp-router bash script.
c => vamp-router user runs the actual vamp-router binary.
d => vamp-router user runs haproxy with the correct initialisation parameters.

For now, all is fine...a simple curl confirms its running:

tim@ubuntu-14-4-real:~$ curl localhost:10001/v1/info
{"Message":"Hi, I'm Vamp Router! How are you?","Version":"0.7.9","Status":{"Name":"HAProxy","Version":"1.5.14","Release_date":"2015/07/02","Nbproc":"1","Process_num":"1","Pid":"32268","Uptime":"0d 0h04m29s","Uptime_sec":"269","Memmax_MB":"0","Ulimit-n":"8223","Maxsock":"8223","Maxconn":"4096","Hard_maxconn":"4096","CurrConns":"0","CumConns":"92","CumReq":"92","MaxSslConns":"0","CurrSslConns":"0","CumSslConns":"0","Maxpipes":"0","PipesUsed":"0","PipesFree":"0","ConnRate":"0","ConnRateLimit":"0","MaxConnRate":"0","SessRate":"0","SessRateLimit":"0","MaxSessRate":"0","SslRate":"0","SslRateLimit":"0","MaxSslRate":"0","SslFrontendKeyRate":"0","SslFrontendMaxKeyRate":"0","SslFrontendSessionReuse_pct":"0","SslBackendKeyRate":"0","SslBackendMaxKeyRate":"0","SslCacheLookups":"0","SslCacheMisses":"0","CompressBpsIn":"0","CompressBpsOut":"0","CompressBpsRateLim":"0","ZlibMemUsage":"0","MaxZlibMemUsage":"0","Tasks":"5","Run_queue":"1","Idle_pct":"100"}}

Things start going wrong once we start/stop the processes directly using root or sudo. This will work once...but then all pid files, logs, haproxy socket files etc. are written under root. From that moment on, everything should be started under root, otherwise vamp-router cannot communicate with haproxy.

@zutherb
Copy link
Author

zutherb commented Aug 11, 2015

Hi Tim,
thx for your quick help.

  1. i am using the Oracle JDK.
vagrant@master1:~$ java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
  1. The ps tells me. And i can't see a running haproxy-
root      1035  0.0  0.4  62108  3172 ?        Ss   09:51   0:00 sudo -u vamp-core bin/vamp-core
vamp-co+  1040 20.0 22.7 2150740 172460 ?      Sl   09:51   1:24 java -Dlogback.configurationFile=/usr/share/vamp-core/bin/../conf/logback.xml -Dconfig.file=/usr/share/vamp-core/bin/../conf/application.conf -cp /usr/share/vamp-core/lib/vamp-core.jar Main
root      1045  0.0  0.4  62108  3116 ?        Ss   09:51   0:00 sudo -u vamp-pulse bin/vamp-pulse
vamp-pu+  1052  5.8 23.7 2189576 180060 ?      Sl   09:51   0:24 java -Dlogback.configurationFile=/usr/share/vamp-pulse/bin/../conf/logback.xml -Dconfig.file=/usr/share/vamp-pulse/bin/../conf/application.conf -cp /usr/share/vamp-pulse/lib/vamp-pulse.jar Boot
root     12647  0.0  0.4  62108  3512 ?        Ss   09:58   0:00 sudo -u vamp-router bin/vamp-router
vamp-ro+ 12649  0.0  0.2   9520  2204 ?        S    09:58   0:00 bash bin/vamp-router
vamp-ro+ 12650  0.0  0.8  11300  6668 ?        Sl   09:58   0:00 ./vamp-router
vagrant  12653  0.0  0.2  11728  1944 pts/3    S+   09:58   0:00 grep --color=auto vamp

The curl doesn't work as well.

vagrant@master1:~$ curl localhost:10001/v1/info
curl: (7) Failed to connect to localhost port 10001: Connection refused

The vamp-core logfile (/var/log/vamp-core/application.log) show that it can connect to the proxy.

09:55:30.467 | ERROR | io.vamp.common.notification.Notification |                                          | Router response error.
09:55:30.467 | ERROR | io.vamp.common.notification.Notification |                                          | java.net.ConnectException: Connection refused: localhost/127.0.0.1:10001 to http://localhost:10001/v1/routes
java.util.concurrent.ExecutionException: java.net.ConnectException: Connection refused: localhost/127.0.0.1:10001 to http://localhost:10001/v1/routes
    at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:342) ~[vamp-core.jar:0.7.9.1]
    at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:107) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:431) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:422) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:384) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:109) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) ~[vamp-core.jar:0.7.9.1]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_51]
    at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_51]
Caused by: java.net.ConnectException: Connection refused: localhost/127.0.0.1:10001 to http://localhost:10001/v1/routes
    at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:103) ~[vamp-core.jar:0.7.9.1]
    ... 12 common frames omitted
Caused by: java.net.ConnectException: Connection refused: localhost/127.0.0.1:10001
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_51]
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_51]
    at org.jboss.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105) ~[vamp-core.jar:0.7.9.1]
    ... 8 common frames omitted
09:55:30.470 | ERROR | akka.actor.OneForOneStrategy             | e/user/deployment-synchronization-actor$ | io.vamp.common.notification.NotificationErrorException cannot be cast to io.vamp.core.router_driver.DeploymentRoutes
java.lang.ClassCastException: io.vamp.common.notification.NotificationErrorException cannot be cast to io.vamp.core.router_driver.DeploymentRoutes
    at io.vamp.core.operation.deployment.DeploymentSynchronizationActor.io$vamp$core$operation$deployment$DeploymentSynchronizationActor$$synchronize(DeploymentSynchronizationActor.scala:84) ~[vamp-core.jar:0.7.9.1]
    at io.vamp.core.operation.deployment.DeploymentSynchronizationActor$$anonfun$receive$1.applyOrElse(DeploymentSynchronizationActor.scala:72) ~[vamp-core.jar:0.7.9.1]
    at akka.actor.Actor$class.aroundReceive(Actor.scala:467) ~[vamp-core.jar:0.7.9.1]
    at io.vamp.core.operation.deployment.DeploymentSynchronizationActor.aroundReceive(DeploymentSynchronizationActor.scala:43) ~[vamp-core.jar:0.7.9.1]
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) [vamp-core.jar:0.7.9.1]
    at akka.actor.ActorCell.invoke(ActorCell.scala:487) [vamp-core.jar:0.7.9.1]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238) [vamp-core.jar:0.7.9.1]
    at akka.dispatch.Mailbox.run(Mailbox.scala:220) [vamp-core.jar:0.7.9.1]
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) [vamp-core.jar:0.7.9.1]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [vamp-core.jar:0.7.9.1]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [vamp-core.jar:0.7.9.1]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [vamp-core.jar:0.7.9.1]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [vamp-core.jar:0.7.9.1]
09:55:30.562 | ERROR | io.vamp.common.notification.Notification |                                          | Router response error.
09:55:30.563 | ERROR | io.vamp.common.notification.Notification |                                          | java.net.ConnectException: Connection refused: localhost/127.0.0.1:10001 to http://localhost:10001/v1/info
java.util.concurrent.ExecutionException: java.net.ConnectException: Connection refused: localhost/127.0.0.1:10001 to http://localhost:10001/v1/info
    at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:342) ~[vamp-core.jar:0.7.9.1]
    at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:107) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:431) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.DefaultChannelFuture.addListener(DefaultChannelFuture.java:145) ~[vamp-core.jar:0.7.9.1]
    at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:1138) ~[vamp-core.jar:0.7.9.1]
    at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:935) ~[vamp-core.jar:0.7.9.1]
    at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:499) ~[vamp-core.jar:0.7.9.1]
    at dispatch.HttpExecutor$class.apply(execution.scala:47) ~[vamp-core.jar:0.7.9.1]
    at dispatch.Http.apply(execution.scala:12) ~[vamp-core.jar:0.7.9.1]
    at dispatch.HttpExecutor$class.apply(execution.scala:42) ~[vamp-core.jar:0.7.9.1]
    at dispatch.Http.apply(execution.scala:12) ~[vamp-core.jar:0.7.9.1]
    at io.vamp.common.http.RestClient$.http(RestClient.scala:69) ~[vamp-core.jar:0.7.9.1]
    at io.vamp.common.http.RestClient$.get(RestClient.scala:27) ~[vamp-core.jar:0.7.9.1]
    at io.vamp.core.router_driver.DefaultRouterDriver.info(DefaultRouterDriver.scala:20) ~[vamp-core.jar:0.7.9.1]
    at io.vamp.core.router_driver.RouterDriverActor.reply(RouterDriverActor.scala:45) [vamp-core.jar:0.7.9.1]
    at io.vamp.common.akka.ReplyActor$$anonfun$receive$1.applyOrElse(ReplyActor.scala:19) [vamp-core.jar:0.7.9.1]
    at akka.actor.Actor$class.aroundReceive(Actor.scala:467) [vamp-core.jar:0.7.9.1]
    at io.vamp.core.router_driver.RouterDriverActor.aroundReceive(RouterDriverActor.scala:33) [vamp-core.jar:0.7.9.1]
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) [vamp-core.jar:0.7.9.1]
    at akka.actor.ActorCell.invoke(ActorCell.scala:487) [vamp-core.jar:0.7.9.1]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238) [vamp-core.jar:0.7.9.1]
    at akka.dispatch.Mailbox.run(Mailbox.scala:220) [vamp-core.jar:0.7.9.1]
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) [vamp-core.jar:0.7.9.1]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [vamp-core.jar:0.7.9.1]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [vamp-core.jar:0.7.9.1]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [vamp-core.jar:0.7.9.1]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [vamp-core.jar:0.7.9.1]
Caused by: java.net.ConnectException: Connection refused: localhost/127.0.0.1:10001 to http://localhost:10001/v1/info
    at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:103) ~[vamp-core.jar:0.7.9.1]
    ... 25 common frames omitted
Caused by: java.net.ConnectException: Connection refused: localhost/127.0.0.1:10001
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_51]
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_51]
    at org.jboss.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) ~[vamp-core.jar:0.7.9.1]
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) ~[vamp-core.jar:0.7.9.1]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_51]
    at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_51]

The vamp-router logfile (/var/log/vamp-router/vamp-router.log) show that vamp-router starts again and again.

10:05:41.922 main INFO ==>  
██╗   ██╗ █████╗ ███╗   ███╗██████╗
██║   ██║██╔══██╗████╗ ████║██╔══██╗
██║   ██║███████║██╔████╔██║██████╔╝
╚██╗ ██╔╝██╔══██║██║╚██╔╝██║██╔═══╝
 ╚████╔╝ ██║  ██║██║ ╚═╝ ██║██║
  ╚═══╝  ╚═╝  ╚═╝╚═╝     ╚═╝╚═╝
                       router
                       version 0.7.9
                       by magnetic.io

10:05:41.923 main NOTI ==>  Attempting to load config at /usr/share/vamp-router/configuration
10:05:41.925 main NOTI ==>  Pidfile exists at /usr/share/vamp-router/data/haproxy-private.pid, proceeding...
10:05:41.928 main CRIT ==>  Error while reloading haproxy: exit status 1
10:05:41.948 main INFO ==>  
██╗   ██╗ █████╗ ███╗   ███╗██████╗
██║   ██║██╔══██╗████╗ ████║██╔══██╗
██║   ██║███████║██╔████╔██║██████╔╝
╚██╗ ██╔╝██╔══██║██║╚██╔╝██║██╔═══╝
 ╚████╔╝ ██║  ██║██║ ╚═╝ ██║██║
  ╚═══╝  ╚═╝  ╚═╝╚═╝     ╚═╝╚═╝
                       router
                       version 0.7.9
                       by magnetic.io

10:05:41.949 main NOTI ==>  Attempting to load config at /usr/share/vamp-router/configuration
10:05:41.953 main NOTI ==>  Pidfile exists at /usr/share/vamp-router/data/h

@tnolet
Copy link

tnolet commented Aug 12, 2015

@zutherb

The problem of the constant restarting is due to the service scripts that continuously tries to start Vamp Router after it fails. I think Vamp Router fails because either Router or Haproxy cannot write the necessary files to disk.

What we can do to pinpoint the problem is the following:

  1. Stop the vamp router service script: sudo service vamp-router stop
  2. Now start it by hand and see what happens
sudo /usr/share/vamp-router/vamp-router
  1. If that doesn't help, remove these files:
rm /usr/share/vamp-router/configuration/haproxy_new.cfg
rm /usr/share/vamp-router/data/haproxy.stats.sock
rm /usr/share/vamp-router/data/haproxy-private.pid

and try again with the manual start.

@zutherb
Copy link
Author

zutherb commented Aug 12, 2015

thx @tnolet that works, but when i'm using sudo service vamp-router stop to start the vamp-router again i have the same behaviour again.

@tnolet
Copy link

tnolet commented Aug 12, 2015

@zutherb this is due to the fact that now some files are owned by root and the 'service' command tries to use the vamp-router user. This user cannot read/write the files owned by root so it fails. I'm not sure how we can dodge this in an elegant manner. Once files are owned by root it is hard to switch back.

@tnolet
Copy link

tnolet commented Sep 8, 2015

Hi @zutherb I heard this was still an issue.
1 .You can easily configure logging for Haproxy by just putting an extra line in the Haproxy template Vamp Router uses. Haproxy uses syslog or rsyslog for logging. Just put this in the global section of the haproxy_config.template file that ships with Vamp Router. The file should be at /usr/share/vamp-router/configuration/templates/. You should have a syslog or rsyslog daemon on port 514 on 127.0.0.1

 log 127.0.0.1 local0
  1. I have a hard time debugging it from here. Is there a way you can snaphot your VM and upload somewhere so I can see what's happening?

@zutherb
Copy link
Author

zutherb commented Sep 8, 2015

Hi @tnolet,

I try to upload the vm to google drive. I will send you an invention when the upload is done.

I did the following steps to active the logging:
https://www.percona.com/blog/2014/10/03/haproxy-give-me-some-logs-on-centos-6-5/

The Log is then avaible under /var/log/haproxy.log

I got the following output:

Sep  8 09:52:13 localhost haproxy[31106]: { "timestamp" : 08/Sep/2015:09:52:13.033, "frontend" : "b017c339-9406-48aa-ac90-4307e7f6343a_mongodb_27017", "method" : "", "captured_request_headers" : "", "captures_response_headers" : "" }
Sep  8 09:52:13 localhost haproxy[31106]: { "timestamp" : 08/Sep/2015:09:52:13.034, "frontend" : "cebe1679-e15d-41d7-a29f-c03bbcfd33ee_mongodb_27017", "method" : "", "captured_request_headers" : "", "captures_response_headers" : "" }
Sep  8 09:52:13 localhost haproxy[31106]: { "timestamp" : 08/Sep/2015:09:52:13.034, "frontend" : "b017c339-9406-48aa-ac90-4307e7f6343a_mongodb_27017::mongodb", "method" : "", "captured_request_headers" : "", "captures_response_headers" : "" }
Sep  8 09:52:14 localhost haproxy[31106]: { "timestamp" : 08/Sep/2015:09:52:14.540, "frontend" : "b4d4a437-2a0f-4489-be9e-7118ec3237c1_mongodb_27017", "method" : "", "captured_request_headers" : "", "captures_response_headers" : "" }
Sep  8 09:52:16 localhost haproxy[31106]: { "timestamp" : 08/Sep/2015:09:52:16.425, "frontend" : "b4d4a437-2a0f-4489-be9e-7118ec3237c1_mongodb_27017", "method" : "", "captured_request_headers" : "", "captures_response_headers" : "" }

While trying to connect the mongodb:

berndzuther@cc ~/development/appstash/vamp/vagrant (master●)$ mongo 172.31.1.11:33006
MongoDB shell version: 3.0.6
connecting to: 172.31.1.11:33006/test
Server has startup warnings: 
2015-09-08T16:18:36.719+0000 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-09-08T16:18:36.719+0000 I CONTROL  [initandlisten] 
2015-09-08T16:18:36.719+0000 I CONTROL  [initandlisten] 
2015-09-08T16:18:36.719+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-09-08T16:18:36.719+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-09-08T16:18:36.719+0000 I CONTROL  [initandlisten] 
2015-09-08T16:18:36.720+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-09-08T16:18:36.720+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-09-08T16:18:36.720+0000 I CONTROL  [initandlisten] 
> ^C
bye
berndzuther@cc ~/development/appstash/vamp/vagrant (master●)$ mongo 172.31.1.11:33006
MongoDB shell version: 3.0.6
connecting to: 172.31.1.11:33006/test
2015-09-08T18:49:24.715+0200 I NETWORK  DBClientCursor::init call() failed
2015-09-08T18:49:24.720+0200 E QUERY    Error: DBClientBase::findN: transport error: 172.31.1.11:33006 ns: admin.$cmd query: { whatsmyuri: 1 }
    at connect (src/mongo/shell/mongo.js:181:14)
    at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed
berndzuther@cc ~/development/appstash/vamp/vagrant (master●)$ mongo 172.31.1.11:33006
MongoDB shell version: 3.0.6
connecting to: 172.31.1.11:33006/test
2015-09-08T18:50:00.926+0200 I NETWORK  DBClientCursor::init call() failed
2015-09-08T18:50:00.928+0200 E QUERY    Error: DBClientBase::findN: transport error: 172.31.1.11:33006 ns: admin.$cmd query: { whatsmyuri: 1 }
    at connect (src/mongo/shell/mongo.js:181:14)
    at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed

When i looked to the haproxy log i notice that haproxy try to connected multiple mongodb instances. So i checked the routes with the rest api http://172.31.1.11:10001/v1/routes

[

{

    "name": "cebe1679-e15d-41d7-a29f-c03bbcfd33ee_9050",
    "port": 9050,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "catalog.ports.port",
    "weight": 100,
    "servers": 

[

                {
                    "name": "cebe1679-e15d-41d7-a29f-c03bbcfd33ee_9050",
                    "host": "localhost",
                    "port": 33000
                }
            ]
        }
    ]

},
{

    "name": "cebe1679-e15d-41d7-a29f-c03bbcfd33ee_catalog_80",
    "port": 33000,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "catalog",
    "weight": 100,
    "servers": 

[

                {
                    "name": "a7ca3d5b6ae0f571519c46e90ff04e728ebe4788",
                    "host": "172.31.2.12",
                    "port": 31199
                }
            ]
        }
    ]

},
{

    "name": "cebe1679-e15d-41d7-a29f-c03bbcfd33ee_checkout_8080",
    "port": 33001,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "checkout",
    "weight": 100,
    "servers": 

[

                {
                    "name": "3a7a866906fcc8d57e570529a8322b3a310daf3c",
                    "host": "172.31.2.13",
                    "port": 31009
                }
            ]
        }
    ]

},
{

    "name": "cebe1679-e15d-41d7-a29f-c03bbcfd33ee_navigation_18090",
    "port": 33003,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "navigation",
    "weight": 100,
    "servers": 

[

                {
                    "name": "9d383f9c62101eaad169a606f6b7df6f633689ef",
                    "host": "172.31.2.13",
                    "port": 31053
                }
            ]
        }
    ]

},
{

    "name": "cebe1679-e15d-41d7-a29f-c03bbcfd33ee_redis_6379",
    "port": 33005,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "redis",
    "weight": 100,
    "servers": 

[

                {
                    "name": "ae455150a13722cfe13a6c7a937f1335ae83190d",
                    "host": "172.31.2.12",
                    "port": 31435
                }
            ]
        }
    ]

},
{

    "name": "cebe1679-e15d-41d7-a29f-c03bbcfd33ee_product_18080",
    "port": 33002,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "product",
    "weight": 100,
    "servers": 

[

                {
                    "name": "d7101f706052c48fd5ea07711437c501c7b48a3e",
                    "host": "172.31.2.13",
                    "port": 31656
                }
            ]
        }
    ]

},
{

    "name": "cebe1679-e15d-41d7-a29f-c03bbcfd33ee_cart_18100",
    "port": 33004,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "cart",
    "weight": 100,
    "servers": 

[

                {
                    "name": "8ce645fcd48685809cb5f71b96f275a12f42b005",
                    "host": "172.31.2.11",
                    "port": 31491
                }
            ]
        }
    ]

},
{

    "name": "cebe1679-e15d-41d7-a29f-c03bbcfd33ee_mongodb_27017",
    "port": 33006,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "mongodb",
    "weight": 100,
    "servers": 

[

                {
                    "name": "54406b9ac88840ea9ff9988604f9ffa7792bd34f",
                    "host": "172.31.2.12",
                    "port": 31375
                }
            ]
        }
    ]

},
{

    "name": "9b766960-3680-49c5-8395-5c05e4ac5e6d_9050",
    "port": 9050,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "catalog.ports.port",
    "weight": 100,
    "servers": 

[

                {
                    "name": "9b766960-3680-49c5-8395-5c05e4ac5e6d_9050",
                    "host": "172.31.1.11",
                    "port": 33000
                }
            ]
        }
    ]

},
{

    "name": "9b766960-3680-49c5-8395-5c05e4ac5e6d_navigation_18090",
    "port": 33003,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "navigation",
    "weight": 100,
    "servers": 

[

                {
                    "name": "2c3468acb8f4c1d90d6b0df20e077815537a9a09",
                    "host": "172.31.2.11",
                    "port": 31650
                }
            ]
        }
    ]

},
{

    "name": "9b766960-3680-49c5-8395-5c05e4ac5e6d_checkout_8080",
    "port": 33001,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "checkout",
    "weight": 100,
    "servers": 

[

                {
                    "name": "a2d6cef22c51c85d9d78cf6da04d019623dccff9",
                    "host": "172.31.2.11",
                    "port": 31338
                }
            ]
        }
    ]

},
{

    "name": "9b766960-3680-49c5-8395-5c05e4ac5e6d_catalog_80",
    "port": 33000,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "catalog",
    "weight": 100,
    "servers": 

[

                {
                    "name": "433750cd0a85c8ea01fab15292259b046265f931",
                    "host": "172.31.2.11",
                    "port": 31652
                }
            ]
        }
    ]

},
{

    "name": "9b766960-3680-49c5-8395-5c05e4ac5e6d_cart_18100",
    "port": 33004,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "cart",
    "weight": 100,
    "servers": 

[

                {
                    "name": "932ba659b6df8522e92656874b8c3177e428fed8",
                    "host": "172.31.2.11",
                    "port": 31598
                }
            ]
        }
    ]

},
{

    "name": "9b766960-3680-49c5-8395-5c05e4ac5e6d_mongodb_27017",
    "port": 33006,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "mongodb",
    "weight": 100,
    "servers": 

[

                {
                    "name": "30ffce15d779dc85b16e7e16cae6637b5b6dfe83",
                    "host": "172.31.2.11",
                    "port": 31031
                }
            ]
        }
    ]

},
{

    "name": "9b766960-3680-49c5-8395-5c05e4ac5e6d_product_18080",
    "port": 33002,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "product",
    "weight": 100,
    "servers": 

[

                {
                    "name": "7e326e5166c9bc6f81ab893f8d57ebc77189e219",
                    "host": "172.31.2.11",
                    "port": 31622
                }
            ]
        }
    ]

},
{

    "name": "9b766960-3680-49c5-8395-5c05e4ac5e6d_redis_6379",
    "port": 33005,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "redis",
    "weight": 100,
    "servers": 

[

                {
                    "name": "a48675044bfd9eccb572633bc7db0d9dc19e4bc8",
                    "host": "172.31.2.12",
                    "port": 31305
                }
            ]
        }
    ]

},
{

    "name": "cdee9d2d-8856-4144-811a-e0731056255b_mongodb_27017",
    "port": 33006,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "mongodb",
    "weight": 100,
    "servers": 

[

                {
                    "name": "a50c9b0aec6eb14969127a89fe65d4ff7c65841b",
                    "host": "172.31.2.11",
                    "port": 31208
                }
            ]
        }
    ]

},
{

    "name": "cdee9d2d-8856-4144-811a-e0731056255b_cart_18100",
    "port": 33004,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "cart",
    "weight": 100,
    "servers": 

[

                {
                    "name": "cafff5b83ba6efe05a6c27ea0f0b42746068384e",
                    "host": "172.31.2.13",
                    "port": 31304
                }
            ]
        }
    ]

},
{

    "name": "cdee9d2d-8856-4144-811a-e0731056255b_product_18080",
    "port": 33002,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "product",
    "weight": 100,
    "servers": 

[

                {
                    "name": "60a47e9baa75c60376613a69864a103553d383f1",
                    "host": "172.31.2.11",
                    "port": 31466
                }
            ]
        }
    ]

},
{

    "name": "cdee9d2d-8856-4144-811a-e0731056255b_checkout_8080",
    "port": 33001,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "checkout",
    "weight": 100,
    "servers": 

[

                {
                    "name": "db1763d79983efadefc4cbc82ed97b35c5dfe69",
                    "host": "172.31.2.11",
                    "port": 31852
                }
            ]
        }
    ]

},
{

    "name": "cdee9d2d-8856-4144-811a-e0731056255b_9050",
    "port": 9050,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "catalog.ports.port",
    "weight": 100,
    "servers": 

[

                {
                    "name": "cdee9d2d-8856-4144-811a-e0731056255b_9050",
                    "host": "172.31.1.11",
                    "port": 33000
                }
            ]
        }
    ]

},
{

    "name": "cdee9d2d-8856-4144-811a-e0731056255b_redis_6379",
    "port": 33005,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "redis",
    "weight": 100,
    "servers": 

[

                {
                    "name": "b47078fc6733e11c600eaa563692f7094fee1d16",
                    "host": "172.31.2.12",
                    "port": 31765
                }
            ]
        }
    ]

},
{

    "name": "cdee9d2d-8856-4144-811a-e0731056255b_navigation_18090",
    "port": 33003,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "navigation",
    "weight": 100,
    "servers": 

[

                {
                    "name": "b90c7e73e6d9537d984e43af8212c26cab01d62c",
                    "host": "172.31.2.11",
                    "port": 31077
                }
            ]
        }
    ]

},
{

    "name": "cdee9d2d-8856-4144-811a-e0731056255b_catalog_80",
    "port": 33000,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "catalog",
    "weight": 100,
    "servers": 

[

                {
                    "name": "a9dd24652f4a25ed1c980ee8ffbe5b7a172d397",
                    "host": "172.31.2.12",
                    "port": 31186
                }
            ]
        }
    ]

},
{

    "name": "b4d4a437-2a0f-4489-be9e-7118ec3237c1_redis_6379",
    "port": 33005,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "redis",
    "weight": 100,
    "servers": 

[

                {
                    "name": "c33e8a1cc12f259e26f8839b7771d9caa3c49661",
                    "host": "172.31.2.11",
                    "port": 31609
                }
            ]
        }
    ]

},
{

    "name": "b4d4a437-2a0f-4489-be9e-7118ec3237c1_mongodb_27017",
    "port": 33006,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "mongodb",
    "weight": 100,
    "servers": 

[

                {
                    "name": "90dcd245565752c85712c84a2bdcaa5c5f4f5813",
                    "host": "172.31.2.12",
                    "port": 31910
                }
            ]
        }
    ]

},
{

    "name": "b4d4a437-2a0f-4489-be9e-7118ec3237c1_cart_18100",
    "port": 33004,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "cart",
    "weight": 100,
    "servers": 

[

                {
                    "name": "d96571279bfd13d7aae6b82d91812a0bb1bfda64",
                    "host": "172.31.2.11",
                    "port": 31527
                }
            ]
        }
    ]

},
{

    "name": "b4d4a437-2a0f-4489-be9e-7118ec3237c1_checkout_8080",
    "port": 33001,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "checkout",
    "weight": 100,
    "servers": 

[

                {
                    "name": "5940db53b7e336cedcf30b36971771bff0500bc2",
                    "host": "172.31.2.13",
                    "port": 31448
                }
            ]
        }
    ]

},
{

    "name": "b4d4a437-2a0f-4489-be9e-7118ec3237c1_product_18080",
    "port": 33002,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "product",
    "weight": 100,
    "servers": 

[

                {
                    "name": "fcccda9d9a78f8fcd8e1af994526002c57ecd9f1",
                    "host": "172.31.2.12",
                    "port": 31102
                }
            ]
        }
    ]

},
{

    "name": "b4d4a437-2a0f-4489-be9e-7118ec3237c1_navigation_18090",
    "port": 33003,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "navigation",
    "weight": 100,
    "servers": 

[

                {
                    "name": "178df2e513f49e942a3e1a29180a8f457f8e8aac",
                    "host": "172.31.2.11",
                    "port": 31676
                }
            ]
        }
    ]

},
{

    "name": "b4d4a437-2a0f-4489-be9e-7118ec3237c1_9050",
    "port": 9050,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "catalog.ports.port",
    "weight": 100,
    "servers": 

[

                {
                    "name": "b4d4a437-2a0f-4489-be9e-7118ec3237c1_9050",
                    "host": "172.31.1.11",
                    "port": 33000
                }
            ]
        }
    ]

},
{

    "name": "b4d4a437-2a0f-4489-be9e-7118ec3237c1_catalog_80",
    "port": 33000,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "catalog",
    "weight": 100,
    "servers": 

[

                {
                    "name": "389f8ed829e54a6ca41279663e126cc0fba99e5",
                    "host": "172.31.2.13",
                    "port": 31458
                }
            ]
        }
    ]

},
{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_9050",
    "port": 9050,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "catalog.port",
    "weight": 100,
    "servers": 

[

                {
                    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_9050",
                    "host": "172.31.1.11",
                    "port": 33000
                }
            ]
        }
    ]

},
{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_catalog_80",
    "port": 33000,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "catalog",
    "weight": 100,
    "servers": 

[

                {
                    "name": "888fac5307018583257f83b97a8324cf4f63279a",
                    "host": "172.31.2.12",
                    "port": 31305
                }
            ]
        }
    ]

},
{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_product_18080",
    "port": 33002,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "product",
    "weight": 100,
    "servers": 

[

                {
                    "name": "6f0c1359cff78fd679427a9e3a05ef78e74ae8fe",
                    "host": "172.31.2.12",
                    "port": 31188
                }
            ]
        }
    ]

},
{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_navigation_18090",
    "port": 33003,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "navigation",
    "weight": 100,
    "servers": 

[

                {
                    "name": "443c24f1197b8a5caf0a73a96b2f6e5285f7f8af",
                    "host": "172.31.2.11",
                    "port": 31799
                }
            ]
        }
    ]

},
{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_cart_18100",
    "port": 33004,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "cart",
    "weight": 100,
    "servers": 

[

                {
                    "name": "1174248e3ab5b52a9f3d3332eeff8e112d140518",
                    "host": "172.31.2.11",
                    "port": 31312
                }
            ]
        }
    ]

},
{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_redis_6379",
    "port": 33005,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "redis",
    "weight": 100,
    "servers": 

[

                {
                    "name": "7ff24e9ba4cafa7598f581e1c013e627b43640ec",
                    "host": "172.31.2.11",
                    "port": 31289
                }
            ]
        }
    ]

},
{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_mongodb_27017",
    "port": 33006,
    "protocol": "tcp",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "mongodb",
    "weight": 100,
    "servers": 

[

                {
                    "name": "1d249a608eb7de5ec0a26179bd666fcd71f1a308",
                    "host": "172.31.2.14",
                    "port": 31575
                }
            ]
        }
    ]

},
{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_checkout_8080",
    "port": 33001,
    "protocol": "http",
    "httpQuota": { },
    "tcpQuota": { },
    "filters": [ ],
    "services": 

[

{

    "name": "checkout",
    "weight": 100,
    "servers": 

[

                    {
                        "name": "87e1e0f376ff3ebb04b294901749bb6967459442",
                        "host": "172.31.2.11",
                        "port": 31324
                    }
                ]
            }
        ]
    }

]

As you can see there are multiple routes for the port 30006:

  • cebe1679-e15d-41d7-a29f-c03bbcfd33ee_mongodb_27017
  • 9b766960-3680-49c5-8395-5c05e4ac5e6d_mongodb_27017
  • cdee9d2d-8856-4144-811a-e0731056255b_mongodb_27017
  • b4d4a437-2a0f-4489-be9e-7118ec3237c1_mongodb_27017
  • b017c339-9406-48aa-ac90-4307e7f6343a_mongodb_27017

It seems the the router does not delete the old configuration of an old deployment When looking to the deployments call http://172.31.1.11:8081/api/v1/deployments only b017c339-9406-48aa-ac90-4307e7f6343a should deployed.

[

{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a",
    "endpoints": 

{

    "catalog.port": "9050"

},
"clusters": 
{

    "cart": 

{

    "services": 

[

{

    "state": 

{

    "name": "Deployed",
    "started_at": "2015-09-08T09:20:47.312-07:00"

},
"breed": 
{

    "name": "cart",
    "deployable": "docker://zutherb/cart-service:latest",
    "ports": 

{

    "port": "18100/http"

},
"environment_variables": 
{

    "REDIS_PORT_6379_TCP_ADDR": "$redis.host",
    "REDIS_PORT_6379_TCP_PORT": "$redis.ports.port"

},
"constants": { },
"dependencies": 

    {
        "redis": "redis"
    }

},
"environment_variables": 
{

    "REDIS_PORT_6379_TCP_ADDR": "172.31.1.11",
    "REDIS_PORT_6379_TCP_PORT": "33005"

},
"scale": 
{

    "cpu": 0.1,
    "memory": 128,
    "instances": 1

},
"routing": 
{

    "weight": 100,
    "filters": [ ]

},
"servers": 
[

{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_cart.3d680f6c-5645-11e5-884c-56847afe9799",
    "host": "172.31.2.11",
    "ports": 

        {
            "18100": 31312
        },
        "deployed": true
    }

],
"dependencies": 

        {
            "redis": "redis"
        },
        "dialects": { }
    }

],
"routes": 

    {
        "18100": 33004
    },
    "dialects": { }

},
"catalog": 
{

    "services": 

[

{

    "state": 

{

    "name": "Deployed",
    "started_at": "2015-09-08T09:20:47.307-07:00"

},
"breed": 
{

    "name": "catalog",
    "deployable": "docker://zutherb/catalog-frontend:latest",
    "ports": 

{

    "port": "80/http"

},
"environment_variables": 
{

    "CHECKOUT_DESIGN": "standard",
    "NAVIGATION_PORT_18090_TCP_PORT": "$navigation.ports.port",
    "PRODUCT_PORT_18080_TCP_ADDR": "$product.host",
    "PRODUCT_PORT_18080_TCP_PORT": "$product.ports.port",
    "CART_PORT_18100_TCP_ADDR": "$cart.host",
    "CART_PORT_18100_TCP_PORT": "$cart.ports.port",
    "SHOP_PORT_8080_TCP_ADDR": "$checkout.host",
    "NAVIGATION_PORT_18090_TCP_ADDR": "$navigation.host",
    "SHOP_PORT_8080_TCP_PORT": "$checkout.ports.port"

},
"constants": { },
"dependencies": 

    {
        "product": "product",
        "navigation": "navigation",
        "cart": "cart",
        "checkout": "checkout"
    }

},
"environment_variables": 
{

    "CHECKOUT_DESIGN": "standard",
    "NAVIGATION_PORT_18090_TCP_PORT": "33003",
    "PRODUCT_PORT_18080_TCP_ADDR": "172.31.1.11",
    "PRODUCT_PORT_18080_TCP_PORT": "33002",
    "CART_PORT_18100_TCP_ADDR": "172.31.1.11",
    "CART_PORT_18100_TCP_PORT": "33004",
    "SHOP_PORT_8080_TCP_ADDR": "172.31.1.11",
    "NAVIGATION_PORT_18090_TCP_ADDR": "172.31.1.11",
    "SHOP_PORT_8080_TCP_PORT": "33001"

},
"scale": 
{

    "cpu": 0.1,
    "memory": 128,
    "instances": 1

},
"routing": 
{

    "weight": 100,
    "filters": [ ]

},
"servers": 
[

{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_catalog.47d288a0-5645-11e5-884c-56847afe9799",
    "host": "172.31.2.12",
    "ports": 

        {
            "80": 31305
        },
        "deployed": true
    }

],
"dependencies": 

        {
            "product": "product",
            "navigation": "navigation",
            "cart": "cart",
            "checkout": "checkout"
        },
        "dialects": { }
    }

],
"routes": 

    {
        "80": 33000
    },
    "dialects": { }

},
"checkout": 
{

    "services": 

[

{

    "state": 

{

    "name": "Deployed",
    "started_at": "2015-09-08T09:50:51.512-07:00"

},
"breed": 
{

    "name": "checkout",
    "deployable": "docker://zutherb/monolithic-shop:latest",
    "ports": 

{

    "port": "8080/http"

},
"environment_variables": 
{

    "CART_PORT_18100_TCP_ADDR": "$cart.host",
    "CART_PORT_18100_TCP_PORT": "$cart.ports.port",
    "MONGODB_PORT_27017_TCP_ADDR": "$mongodb.host",
    "MONGODB_PORT_27017_TCP_PORT": "$mongodb.ports.port"

},
"constants": { },
"dependencies": 

    {
        "mongodb": "mongodb",
        "cart": "cart"
    }

},
"environment_variables": 
{

    "CART_PORT_18100_TCP_ADDR": "172.31.1.11",
    "CART_PORT_18100_TCP_PORT": "33004",
    "MONGODB_PORT_27017_TCP_ADDR": "172.31.1.11",
    "MONGODB_PORT_27017_TCP_PORT": "33006"

},
"scale": 
{

    "cpu": 0.3,
    "memory": 256,
    "instances": 1

},
"routing": 
{

    "weight": 100,
    "filters": [ ]

},
"servers": 
[

{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_checkout.bf6e0d95-5649-11e5-884c-56847afe9799",
    "host": "172.31.2.11",
    "ports": 

        {
            "8080": 31324
        },
        "deployed": true
    }

],
"dependencies": 

        {
            "mongodb": "mongodb",
            "cart": "cart"
        },
        "dialects": { }
    }

],
"routes": 

    {
        "8080": 33001
    },
    "dialects": { }

},
"navigation": 
{

    "services": 

[

{

    "state": 

{

    "name": "Deployed",
    "started_at": "2015-09-08T09:20:47.307-07:00"

},
"breed": 
{

    "name": "navigation",
    "deployable": "docker://magneticio/navigation-service:latest",
    "ports": 

{

    "port": "18090/http"

},
"environment_variables": 
{

    "MONGODB_PORT_27017_TCP_ADDR": "$mongodb.host",
    "MONGODB_PORT_27017_TCP_PORT": "$mongodb.ports.port"

},
"constants": { },
"dependencies": 

    {
        "mongodb": "mongodb"
    }

},
"environment_variables": 
{

    "MONGODB_PORT_27017_TCP_ADDR": "172.31.1.11",
    "MONGODB_PORT_27017_TCP_PORT": "33006"

},
"scale": 
{

    "cpu": 0.1,
    "memory": 128,
    "instances": 1

},
"routing": 
{

    "weight": 100,
    "filters": [ ]

},
"servers": 
[

{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_navigation.49084982-5645-11e5-884c-56847afe9799",
    "host": "172.31.2.11",
    "ports": 

        {
            "18090": 31799
        },
        "deployed": true
    }

],
"dependencies": 
{

    "mongodb": "mongodb"

},
"dialects": 
{

    "marathon": 

            {
                "cmd": "export PORT=18090 && /navigation-0.6/bin/navigation"
            }
        }
    }

],
"routes": 

    {
        "18090": 33003
    },
    "dialects": { }

},
"redis": 
{

    "services": 

[

{

    "state": 

{

    "name": "Deployed",
    "started_at": "2015-09-08T09:20:47.312-07:00"

},
"breed": 
{

    "name": "redis",
    "deployable": "docker://redis:latest",
    "ports": 

    {
        "port": "6379/tcp"
    },
    "environment_variables": { },
    "constants": { },
    "dependencies": { }

},
"environment_variables": { },
"scale": 
{

    "cpu": 0.1,
    "memory": 128,
    "instances": 1

},
"routing": 
{

    "weight": 100,
    "filters": [ ]

},
"servers": 
[

{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_redis.44d5000f-5645-11e5-884c-56847afe9799",
    "host": "172.31.2.11",
    "ports": 

                {
                    "6379": 31289
                },
                "deployed": true
            }
        ],
        "dependencies": { },
        "dialects": { }
    }

],
"routes": 

    {
        "6379": 33005
    },
    "dialects": { }

},
"mongodb": 
{

    "services": 

[

{

    "state": 

{

    "name": "Deployed",
    "started_at": "2015-09-08T09:50:41.556-07:00"

},
"breed": 
{

    "name": "mongodb",
    "deployable": "docker://mongo:latest",
    "ports": 

    {
        "port": "27017/tcp"
    },
    "environment_variables": { },
    "constants": { },
    "dependencies": { }

},
"environment_variables": { },
"scale": 
{

    "cpu": 0.1,
    "memory": 128,
    "instances": 1

},
"routing": 
{

    "weight": 100,
    "filters": [ ]

},
"servers": 
[

{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_mongodb.ba0ec744-5649-11e5-884c-56847afe9799",
    "host": "172.31.2.14",
    "ports": 

        {
            "27017": 31575
        },
        "deployed": true
    }

],
"dependencies": { },
"dialects": 
{

    "marathon": 

            {
                "cmd": "mongod --smallfiles"
            }
        }
    }

],
"routes": 

    {
        "27017": 33006
    },
    "dialects": { }

},
"product": 
{

    "services": 

[

{

    "state": 

{

    "name": "Deployed",
    "started_at": "2015-09-08T09:20:47.307-07:00"

},
"breed": 
{

    "name": "product",
    "deployable": "docker://zutherb/product-service",
    "ports": 

{

    "port": "18080/http"

},
"environment_variables": 
{

    "MONGODB_PORT_27017_TCP_ADDR": "$mongodb.host",
    "MONGODB_PORT_27017_TCP_PORT": "$mongodb.ports.port"

},
"constants": { },
"dependencies": 

    {
        "mongodb": "mongodb"
    }

},
"environment_variables": 
{

    "MONGODB_PORT_27017_TCP_ADDR": "172.31.1.11",
    "MONGODB_PORT_27017_TCP_PORT": "33006"

},
"scale": 
{

    "cpu": 0.1,
    "memory": 128,
    "instances": 1

},
"routing": 
{

    "weight": 100,
    "filters": [ ]

},
"servers": 
[

{

    "name": "b017c339-9406-48aa-ac90-4307e7f6343a_product.44a4a13e-5645-11e5-884c-56847afe9799",
    "host": "172.31.2.12",
    "ports": 

        {
            "18080": 31188
        },
        "deployed": true
    }

],
"dependencies": 

        {
            "mongodb": "mongodb"
        },
        "dialects": { }
    }

],
"routes": 

        {
            "18080": 33002
        },
        "dialects": { }
    }

},
"ports": 
{

    "navigation.port": "33003",
    "cart.port": "33004",
    "checkout.port": "33001",
    "catalog.port": "33000",
    "mongodb.port": "33006",
    "redis.port": "33005",
    "product.port": "33002"

},
"environment_variables": { },
"hosts": 

        {
            "checkout": "172.31.1.11",
            "catalog": "172.31.1.11",
            "cart": "172.31.1.11",
            "navigation": "172.31.1.11",
            "product": "172.31.1.11",
            "mongodb": "172.31.1.11",
            "redis": "172.31.1.11"
        }
    }

]

Is there a way to reset the router?

@zutherb
Copy link
Author

zutherb commented Sep 8, 2015

@tnolet

I unlock you for the vm.

My Assumption seems to be correct. After i deleted the following to files in /usr/share/vamp-router/configuration the haproxy works as excepted even that the external port 9050 is not started:

  • haproxy_new.cfg
  • vamp_router.json

@tnolet
Copy link

tnolet commented Sep 9, 2015

@zutherb

  1. It seems like indeed Vamp Core and Router were out of sync. You can always reset Vamp completely by using the /api/v1/reset command on the Vamp Core API. See http://vamp.io/documentation/api-reference/debug/
    Or you can just reset Vamp Router by posting an empty config to the /v1/config endpoint of Vamp Router API, i.e.:
POST /v1/config
{
  "frontends" : [],
  "backends": [],
  "routes" : []
}
  1. I got the VM downloaded and started. I just need a username + password now.

@zutherb
Copy link
Author

zutherb commented Sep 9, 2015

@tnolet thx, username + password is vagrant + vagrant

@tnolet
Copy link

tnolet commented Sep 9, 2015

@zutherb I can see the machine booting, but I guess its missing some Puppet files as it throws errors about missing those files. When trying to log in it seems the user is either incorrect or not setup:

Tims-MacBook-Pro:VirtualBox VMs tim$ ssh -p 2222 vagrant@127.0.0.1
The authenticity of host '[127.0.0.1]:2222 ([127.0.0.1]:2222)' can't be established.
RSA key fingerprint is 95:88:a8:f9:8f:a1:d1:b6:9b:a6:a3:76:d9:06:9b:68.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts.
vagrant@127.0.0.1's password: 
Permission denied, please try again.

@zutherb
Copy link
Author

zutherb commented Sep 9, 2015

@tnolet hmm ... normally puppet is only need for provisioning the vm.
Can you try to login with the vagrant inscure key?
https://github.com/mitchellh/vagrant/blob/master/keys/vagrant

@tnolet
Copy link

tnolet commented Sep 9, 2015

@zutherb That works! Great!

@tnolet
Copy link

tnolet commented Sep 9, 2015

@zutherb

There are a couple of issues with the way this particular setup. Luckily, they are all pretty easy to fix:

  1. You are running HAProxy as root or Haproxy was at some point in the past started as root.Vamp Router (when started with 'service vamp-router start') runs under the 'vamp-router' user. You can see this in /etc/init/vamp-router.conf
exec sudo -u vamp-router bin/vamp-router

This means all .sock files and .pid files that Haproxy writes are not accessible to Vamp Router and therefore it cannot start. I fixed this in your VMBox image by first killing haproxy and then chowning all files to vamp-router:

cd /usr/share/vamp-router/
sudo chown -R vamp-router:vamp-router *

I also removed the config files as you did mentioned earlier. We now have a clean start.
I then startup Vamp Router and all is well:

sudo service vamp-router start

with the result of haproxy AND vamp-router running as the same user.

vagrant@master1:/usr/share/vamp-router$ ps -ef | grep vamp-router
root      9856     1  0 05:49 ?        00:00:00 sudo -u vamp-router bin/vamp-router
vamp-ro+  9858  9856  0 05:49 ?        00:00:00 bash bin/vamp-router
vamp-ro+  9859  9858 61 05:49 ?        00:00:01 ./vamp-router
vamp-ro+  9864     1  0 05:49 ?        00:00:00 /usr/sbin/haproxy -f /usr/share/vamp-router/configuration/haproxy_new.cfg -p /usr/share/vamp-router/data/haproxy-privat

You can of course ignore this and just start Vamp Router as root. This also allows you to run HAproxy as root and bind to port 80 for instance. This is done by either editing the /etc/init/vamp-router.conf file or just using something like the following command to start vamp-router and push it to the background.

sudo /usr/share/vamp-router/vamp-router > /dev/null 2>&1 &

@zutherb
Copy link
Author

zutherb commented Sep 9, 2015

@tnolet thx a lot it works.

@tnolet tnolet closed this as completed Sep 10, 2015
@tnolet
Copy link

tnolet commented Sep 10, 2015

added to the FAQ.

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

No branches or pull requests

3 participants