Skip to content

Instantly share code, notes, and snippets.

@jozko
Last active September 14, 2017 16:53
Show Gist options
  • Save jozko/91befa894ec144a6edee372ef064de77 to your computer and use it in GitHub Desktop.
Save jozko/91befa894ec144a6edee372ef064de77 to your computer and use it in GitHub Desktop.
Minimesos with Traefik

Minimesos with Traefik

Setup

  • One Hetzner dedicated box
  • Minimesos info
# minimesos version
0.13.0

# minimesos info
Minimesos cluster is running: 2754929888
Mesos version: 1.0.0
...
  • Traefik info (Traefik running directly on host)
 # traefik version
Version:      v1.4.0-rc1
Codename:     roquefort
Go version:   go1.9
Built:        2017-08-29_08:16:35AM
OS/Arch:      linux/amd6
  • Nginx 'app' JSON
{
  "id": "nginx",
  "cmd": null,
  "cpus": 0.1,
  "mem": 32,
  "disk": 0,
  "instances": 1,
  "ipAddress": {},
  "container": {
    "docker": {
      "image": "tomcat",
      "network": "BRIDGE"
    },
    "type": "DOCKER"
  },
  "labels": {
    "traefik.backend": "nginx",
    "traefik.port": "80"
  }
}
  • Tomcat 'app' JSON
{
  "id": "tomcat-1",
  "cmd": null,
  "cpus": 0.5,
  "mem": 128,
  "disk": 0,
  "instances": 1,
  "ipAddress": {},
  "container": {
    "docker": {
      "image": "tomcat",
      "network": "BRIDGE"
    },
    "type": "DOCKER"
  },
  "labels": {
    "traefik.backend": "tomcat",
    "traefik.port": "8080",
    "traefik.frontend.rule": "Host:tomcat.marathon.zomg.si"
  }
}

Gotchas

  • Since Minimesos is messing about with containers IPs and ports you'll get Minimesos master IP address with mapped port in the Traefik backend... and 502 on the frontend. See Traefik issue 1243 and related for long explanation.
  • To work around that you need to use two additions to the default JSON:
    • "ipAddress": {} will expose IP address of the actual container.
    • "traefik.port": "8080" will tell Traefik which port to use on the backend.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment