QubitProducts / bamboo

HAProxy auto configuration and auto service discovery for Mesos Marathon
Apache License 2.0
794 stars 214 forks source link

How can I access my app #121

Closed wiselyman closed 9 years ago

wiselyman commented 9 years ago

I lanch docker image in one of my mesos slave

docker run -t -i -d -p 8000:8000 -p 80:80 \
    -e MARATHON_ENDPOINT=http://192.168.1.110:8080,http://192.168.1.111:8080,http://192.168.1.112:8080 \
    -e BAMBOO_ENDPOINT=http://192.168.1.113:8000 \
    -e BAMBOO_ZK_HOST=192.168.1.110:2181,192.168.1.111:2181,192.168.1.112:2181 \
    -e CONFIG_PATH="config/production.example.json" \
    -e BAMBOO_DOCKER_AUTO_HOST=true \
     gregory90/bamboo:0.2.11

And I add a id: "test" with cmd python -m SimpleHTTPServer $PORT with scale of 4.

And then I change the acl to path_beg -i /app-group/test

belove is http://192.168.1.113:8000/api/state

{
"Apps": [
{
"Id": "/test",
"EscapedId": "::test",
"HealthCheckPath": "",
"Tasks": [
{
"Host": "192.168.1.113",
"Port": 31400
},
{
"Host": "192.168.1.114",
"Port": 31950
},
{
"Host": "192.168.1.113",
"Port": 31077
},
{
"Host": "192.168.1.115",
"Port": 31540
}
],
"ServicePort": 10000,
"Env": {}
}
],
"Services": {
"/test": {
"Id": "/test",
"Acl": "path_beg -i /app-group/test"
}
}
}

and I open http://192.168.1.113:8000/api/services//app-group/test shows 404 page not found

How can i access my app?

timoreimann commented 9 years ago

Unless you added some custom logic to the HAProxy template file, the prefix given by the ACL rule defines the route your web service must adhere to. In your case, your service must be able to process requests to /app-group/test, and I think you would then call the service as in

http://192.168.1.113:8000/app-group/test

wiselyman commented 9 years ago

@timoreimann

http://192.168.1.113:8000/app-group/test also shows 404 page not found

my app is only cmd python -m SimpleHTTPServer $PORT

j1n6 commented 9 years ago

The default template using port 80. so it's likely to be at http://192.168.1.113/app-group/test

timoreimann commented 9 years ago

IIRC, Python's SimpleHTTPServer just serves files off of the disk, so you might need to create /app-group/test/some_file.html relative to where you start the HTTP server for it to return anything.

wiselyman commented 9 years ago

thanks @timoreimann I will try your opinion!

wiselyman commented 9 years ago

@timoreimann

I use an accessible empty tomcat using marathon with instance of 3,and everything are ok in marathon!

belove is api/state

{
"Apps": [
{
"Id": "/tomcat",
"EscapedId": "::tomcat",
"HealthCheckPath": "",
"Tasks": [
{
"Host": "192.168.1.113",
"Port": 31000
},
{
"Host": "192.168.1.115",
"Port": 31000
},
{
"Host": "192.168.1.114",
"Port": 31000
}
],
"ServicePort": 10000,
"Env": {}
}
],
"Services": {
"/tomcat": {
"Id": "/tomcat",
"Acl": "path_beg -i /app-group/tomcat"
}
}
}

And http://192.168.1.113:8000/app-group/tomcat still shows 404 page not found And http://192.168.1.113/app-group/tomcat shows tomcat's 404,It may mean that tomcat can access,but can't show pages

timoreimann commented 9 years ago

Does your Tomcat instance actually serve something under the /app-group/tomcat prefix? Can you hit it directly under the exposed IP address and port?

wiselyman commented 9 years ago

@timoreimann Thank you very much!I worked

stevenlee87 commented 7 years ago

at last ,How can you access your app?