Skip to content

mF2C/LifecycleManagement

Repository files navigation

LifecycleManagement

Platform Controller - Lifecycle Management module

License version

© Atos Spain S.A. 2017

The Lifecycle Management module is a component of the European Project mF2C.


Description

Component architecture

Installation Guide

Usage Guide

Relation to other mF2C components

Resources managed by this component

LICENSE


Description

The Lifecycle Management component is responsible for managing the lifecycle of the applications to be executed by the mF2C infrastructure. This includes the initialization, the submission and the termination of these applications, among other operations.

The Lifecycle Manager can deploy services in agents with Docker, Docker Swarm and Kubernetes. Services deployed in Docker engines can be normal docker images or docker-compose files.


Component architecture

This component is part of the Platform Manager's Service Orchestration module:

Platform Manager


Installation Guide

1. Requirements

  1. Install Docker

2. Install and Run

This component can be installed as a standalone component, or as part of mF2C. To install it as a standalone component you just need the following:

  • Clone repository
      git clone https://github.com/mF2C/LifecycleManagement.git
      cd LifecycleManagement
  • Select the Dockerfile from docker folder. There are three different Dockerfiles:

    • One Dockerfile used to generate images for ARM devices. This version only includes the Lifecycle component and needs to be used with the arm branch.
    • A "light" Docker image which includes all functionalitites except the deployment of docker-compose in Swarm
    • And one Docker image, based on ubuntu, which supports the deployment of docker-compose in Swarm
  • Build the docker image:

      sudo docker build -t lifecycle .

The docker image can also be downloaded from docker hub (this image includes the User Management module):

      sudo docker pull mf2c lifecycle-usermngt:latest

To install it as part of mF2C see mF2C/mF2C repository

  ########## Lifecycle Manager + User Manager ##########
  lm-um:
    image: mf2c/lifecycle-usermngt:1.3.13
    restart: on-failure
    depends_on:
      - cimi
      - resource-categorization
      - analytics-engine
      - landscaper
    expose:
      - "46300"
      - "46000"
    ports:
      - "46000:46000"
      - "46300:46300"
    environment:
      - WORKING_DIR_VOLUME=/tmp/mf2c/lm/compose_files
      - UM_WORKING_DIR_VOLUME=/tmp/mf2c/um/
      - LM_WORKING_DIR_VOLUME=/tmp/mf2c/lm/
      - SERVICE_CONSUMER=true
      - RESOURCE_CONTRIBUTOR=true
      - MAX_APPS=100
    volumes:
      - /tmp/mf2c/lm/compose_files:/tmp/mf2c/lm/compose_files
      - /tmp/mf2c/um:/tmp/mf2c/um
      - /tmp/mf2c/lm:/tmp/mf2c/lm
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker
    labels:
      - "traefik.enable=true"
      - "traefik.lm.frontend.rule=PathPrefixStrip:/lm"
      - "traefik.lm.port=46000"
      - "traefik.um.frontend.rule=PathPrefixStrip:/um"
      - "traefik.um.port=46300"
    healthcheck:
      start_period: 60s
      retries: 5
      test: ["CMD", "wget", "--spider", "http://localhost:46000/api/v2/lm/isumalive"]
    logging: *logging_params

Finally, to run the component without Docker, you will need Python 3.4.

2.1. Launch the Lifecycle

Run application and expose port 46000:

sudo docker run -p 46000:46000 lifecycle

To start the Lifecycle Management module with access to the docker socket ('-v /var/run/docker.sock:/var/run/docker.sock') run the following:

sudo docker run -v /var/run/docker.sock:/var/run/docker.sock -p 46000:46000 lifecycle
sudo docker run -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v /tmp/mf2c/lm:/tmp/mf2c/lm -v /tmp/mf2c/lm/compose_files:/tmp/mf2c/lm/compose_files -p 46000:46000 lifecycle

Available environment variables:

  • STANDALONE_MODE False if working in an agent with other mF2C components; True if working without external dependencies (except docker)
  • CIMI_URL
  • HOST_IP Machine's IP address: needed by the lifecycle when deploying services in a set of agents (to see if an agent is in local host or if it is in another machine)
  • WORKING_DIR_VOLUME docker-compose.yml folder
  • URL_PM_SLA_MANAGER URL of the Platform Manager - SLA Manager; e.g. https://192.168.192.192:46030
  • URL_AC_SERVICE_MNGMT URL of the Agent Controller - QoS Providing; e.g. https://192.168.192.192:46200/api/service-management
  • URL_AC_USER_MANAGEMENT URL of the Agent Controller - User Management; e.g. https://192.168.192.192:46300/api/v1/user-management
  • URL_PM_RECOM_LANDSCAPER URL of the Platform Manager - Landscaper/Recommender; e.g. http://192.168.252.41:46020/mf2c
  • DOCKER_SOCKET

Example:

sudo docker run -v /var/run/docker.sock:/var/run/docker.sock --env HOST_IP=192.192.192.192 -p 46000:46000 mf2c/lifecycle

After launching the Lifecycle Management module, the REST API services can be accessed at port 46000:


Usage Guide

The following methods are exposed by the Lifeycle REST API:

  • /api/v2

    • GET get rest api service status
  • /api/v2/lm

    • POST SLA / User Management / QoS notifications
  • /api/v2/lm/agent-config

    • GET get agent's lifecycle configuration: docker, docker-swarm, kubernetes, ...
  • /api/v2/lm/check-agent-um

    • GET checks if device can run more apps - UP & SM policies (from 'local' User Management module)
  • /api/v2/lm/check-agent-swarm

    • GET checks if device can run warm apps (from 'local' User Management module)
  • /api/v2/lm/agent-um

  • /api/v2/lm/service-instance/string:service_instance_id

    • GET get service instance / all service instances (from cimi)
    • PUT Starts / stops / restarts a service instance
    • DELETE terminates a service instance; deletes service instance (from cimi)
  • /api/v2/lm/service-instance/string:service_instance_id/compss

    • PUT starts a job in COMPSs
  • /api/v2/lm/service-instances/string:service_instance_id/report

    • GET get service instance report
  • /api/v2/lm/service

    • POST Submits a service and gets a service instance
  • /api/v2/lm/service-instance-int (internal calls between LMs from different agents)

    • POST Submits a service in a mF2C agent
    • PUT starts / stops ... a service in a mF2C agent; start-job

View the following examples:

See also the user guide that can be found in https://github.com/mF2C/Documentation/blob/master/documentation/user_guide/api.rst


Relation to other mF2C components

The Lifecycle Management module is connected with the following mF2C components:

  • Is called by the following modules / components:

    • User Management: Lifecycle receives warnings from the User Management when the mF2C applications use more resources than allowed by the users
    • QoS Enforcement: The Lifecycles process the QoS Enforcement notifications to increase the number of agents executing a COMPSs job.
  • Makes calls to the following modules / components:

    • Analytics Engine: The Lifecycle gets from this component the list of all available agents and resources where a service can be deployed
    • Service Management: The Lifecycle calls the Service Management module to know which of the agents from a list can be used to deploy a service
    • User Management: Lifecycle interacts with the User Management module to get the profile and sharing resources defined by the user in a device
    • Distributed Execution Runtime / COMPSs: The Lifecycle can launch COMPSs jobs
    • SLA Manager: Lifecycle calls the SLA Manager to start, stop and terminate the SLA agreement monitoring process

Resources managed by this component

The Lifecycle creates and manages the service instances resource. These are the instances of the services that are deployed and launched in one or more mF2C agents. Each of the Service Instance resource contains the following properties:

  • user : user that launches the service
  • device_id : device that launches the service
  • device_ip : device's IP address
  • parent_device_id : leader / parent device
  • parent_device_ip : parent's IP address
  • service : service identifier (service running in the agents)
  • agreement : agreement identifier
  • status : status of the service
  • service_type : type of service: docker, docker-compose, docker-swarm, kubernetes
  • agents: (mF2C agents that are running this service)
    • url : agent IP address
    • status : status of the container or docker swarm service
    • ports : ports used / exposed by the container or docker swarm service
    • container_id : id from docker container or docker swarm service
    • allow : agent is allowed to deploy the container / service (set by the service manager component)
    • master_compss : true if this agent is master (COMPSs)
    • app_type : type of service: docker, docker-compose, docker-swarm, kubernetes
    • device_id : device identifier
    • compss_app_id : COMPSs job id

LICENSE

The Lifecycle application is licensed under Apache License, version 2.

About

Platform Controller - Lifecycle Management module

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages