Copy this snippet and write it to a file:
{
"id": "/repoxy",
"cpus": 1,
"acceptedResourceRoles": [
"slave_public"
],
"instances": 1,
"mem": 512,
"container": {
"type": "DOCKER",
"docker": {
"image": "mesosphere/repoxy:2.0.0"
},
"volumes": [
{
"containerPath": "/opt/mesosphere",
"hostPath": "/opt/mesosphere",
"mode": "RO"
}
]
},
"cmd": "/proxyfiles/bin/start myframework $PORT0",
"portDefinitions": [
{
"port": 0,
"protocol": "tcp"
},
{
"port": 0,
"protocol": "tcp"
}
],
"env": {
"PROXY_ENDPOINT_0": "My Cool Dashboard,http,repoxy-0-server,mesos,8080,/dashboard,/ui"
}
}
Change the cmd
. Replace myframework
with your framework name.
"cmd": "/proxyfiles/bin/start framework $PORT0",
Set up the environment variables. It starts at PROXY_ENDPOINT_0
and counts up.
"env": {
"PROXY_ENDPOINT_0": "My Cool Dashboard,http,repoxy-0-server,mesos,8080,/dashboard,/ui"
"PROXY_ENDPOINT_1": "My Cool Dashboard 2,http,repoxy-1-server,mesos,8081,/dashboard2,/ui"
}
The format of the environment variable is a comma separated list:
- Display name: Just for display purposes
- Backend Protocol: The protocol with which to access the backend
- Task name: Used to find the backend
- TLD: Used to find the backend
- Backend Port: The port that your Task is listening on
- Frontend Path: The path that the proxy will serve and redirect from
- Backend Path: The path the the proxy will redirect to on the backend
Now launch this app.
Then navigate to the files
of the proxy app in the DC/OS Services UI, and
click on the invisible magnifying glass to view the contents of the file
called endpoints
. This should give you your links.
If you have a framework called myframework
, and set this environment variable
"PROXY_ENDPOINT_0": "My Cool Dashboard,http,repoxy-0-server,mesos,8080,/dashboard,/ui"
which makes this link
My Cool Dashboard: <PUBLIC_IP>:$PORT0/dashboard
which will redirect to this backend
http://repoxy-0-server.myframework.mesos:8080/ui
Every time you relaunch your framework(s) that are exposed by repoxy, you must also reload repoxy. This is because as with all load balancing software, once it starts up, it resolves all DNS only once and holds onto the IP addresses until the end of time.
This will keep crashing if the backends can not be resolved. The logs are also pretty detailed.
If you relaunched the framework(s) behind repoxy, then you also need to reload repoxy.
The ports are assigned to endpoints in the same order that they are defined. The endpoints are also placed into the proxy config in the order that they are defined. And the proxy will use the value that matches first.
The ports in the example are set to 0
. This is to prevent any collisions.
However, you can actually set these to any value that you want. Also remember to set requirePorts
to true
!
It's possible to skip endpoints by setting the value to the exact string false
"epoxy" is the name of a glue that sounds like "proxy". However "eproxy", or "epRoxy" as it would have been spelled, is already a pretty common name. So the "r" was moved elsewhere.