Mesos-Compose Framework for Apache Mesos



With Mesos-Compose I offer an alternative to Mesosphere Marathon. Here the goal is to translate docker-compose files into MesosTasks.

The goal is to adapt the way of working with Mesos closer to the workflow of the developers. It is indisputable that the majority of developers in the microservice environment are familiar with the docker-compose syntax and may test the workload in a local test the workload in a local Docker environment. The same docker-compose.yaml can be used with the help of the Mesos CLI to the mesos-compose framework. The framework then schedules the appropriate containers in Apache Mesos.

Features

The mesos-compose framework provides the following features

  • Long and Shortrunning Jobs
  • Constraints to control which node the job should run on
  • Support for Docker container engine as well as Mesos UCR
  • Bridge, Host and User Network
  • Capabilities
  • CPU and memory resource limits
  • Hashicorb Vault to store passwords and certificates from the secretstore

Compose File

The Docker Compose syntax supported is version 3.9. The following parameters have been implemented so far:

version: '3.9'

services:
  app:
    image: alpine:latest
    command: "sleep"
    arguments: ["1000"]        
    restart: always
    volumes:
      - "12345test:/tmp"
    environment:
      MYSQL_HOST: test
    hostname: test
    container_name: test
    container_type: docker
    shell: true
    mesos:
      task_name: "mc:test:app1" # an alternative taskname      
      executer:
        command: "/mnt/mesos/sandbox/my-custom-executor"
      fetch:
        - value: http://localhost/my-custom-executor
          executable: true
          extract:  false
          cache: false
    labels:
      traefik.enable: "true"
      traefik.http.routers.test.entrypoints: "web"
      traefik.http.routers.test.service: "mc_test_app1_80" # if an alternative taskname is set, we have to use it here to
      traefik.http.routers.test.rule: "HostRegexp(`example.com`, `{subdomain:[a-z]+}.example.com`)"
    network_mode: "BRIDGE"
    ports:
      - "8080:80"
      - "9090"
      - "8081:81/tcp"
      - "8082:82/udp"
      - "8082:82/http"
      - "8082:82/https"  
      - "8082:82/h2c"
      - "8082:82/wss"       
    network: default
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536 
        hard: 65536
    deploy:
      placement:
        constraints:
          - "node.hostname==localhost"
          - "node.platform.os==linux"
          - "node.platform.arch==arm"
          - "unique"
      replicas: 1
      resources:
        limits:
          cpus: 0.01
          memory: 50

networks:
  default:
    external: true
    name: weave
    driver: bridge

volumes:
  12345test:
    driver: local

We use the Docker labels for configuring both Traefik (if available), but also the mesos-compose framework.