eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.99k stars 1.19k forks source link

Agents installation specification #4096

Closed skabashnyuk closed 7 years ago

skabashnyuk commented 7 years ago
garagatyi commented 7 years ago

Glossary:

WS - workspace

Master - Bootstrapper workflow

  1. Master starts WS.
  2. Master starts Machine and passes needed environment configuration and an object that contains full definition of agents (including install scripts and dependent agents) in order they are supposed to be started. It is up to implementation to decide how binaries of Bootstrapper should be delivered into machine. Agents config file format:
    [
    {
      "id":"exec",      
      "description":"Agent for command execution",
      "version":"1.0",
      "script":"$HOME/che/exec-agent -addr :4412",
      "servers":{
         "execAgent":{
            "port":"4412/tcp",
            "protocol":"http",
            "path":"/exec"
         }
      }
    }
    ]
  3. Master adds Machine into lists of machines waiting for status confirmation.
  4. If Machine doesn’t update status that moves it to the next step of booting until timeout expires Master stops machine forcefully and declares that it failed booting. WS start fails too.
  5. Machine starts.
  6. Machine gets Bootstrapper binaries and starts it.
  7. Machine starts Bootstrapper and passes path to agents definition file.
  8. Machine adds Bootstrapper logs into machine logs. It is supposed that logs of this agent should have appropriate prefix, e.g. [Bootstrapper].
  9. Bootstrapper opens WebSocket connection to master and notifies master that it was started.
  10. Bootstrapper starts agents defined by file one-by-one.
  11. Bootstrapper notifies master about states of agents.
  12. Master waits for successful state of all agents in all machines and performs check of ws-agent that its API is responding. If it is not true and ws-agent start timeout expires WS is treated as failed booting and should be forcefully stopped.

Bootstrapper - agents workflow:

  1. Bootstrapper notifies Master that it started
  2. Bootstrapper notifies Master that particular agent starts
  3. Bootstrapper executes agent installation script
  4. Bootstrapper streams agent logs and states to interested sides
  5. Bootstrapper checks agent for installation state:
    1. If Agent contains server
      1. Bootstrapper checks connection to socket on local port of machine
      2. If it is successful agent is treated as started
      3. Otherwise check is repeated with some delay.
      4. If agent boot time expires and last check failed agent is treated as failed
    2. If Agent contains multiple servers
      1. The same, but Bootstrapper checks all ports
    3. If Agent doesn’t contain server
      1. IA waits until installation ends.
      2. If installation script exit code 0 agent is treated as booted.
      3. If installation script exit code differs from 0 agent is treated as failed
      4. If installation doesn’t end when installation time expires agent is treated as failed.
  6. Bootstrapper notifies Master about state of agent

Note:

it is supposed that Bootstrapper will communicate with Master and clients using JSONRPC protocol we started using recently for communication between ws-agent and IDE client.

Bootstrapper events

Installer events

akorneta commented 7 years ago

Added specification for installer config into 2nd item.

voievodin commented 7 years ago

Changed name Installer to Bootstrapper

TylerJewell commented 7 years ago

Bootstrapper

On June 12, 2017 at 10:52 GMT, Yevhenii Voevodin notifications@github.com wrote:

Changed name Installer to Bootstraper

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

voievodin commented 7 years ago

Defined bootstrapper events.

voievodin commented 7 years ago

Changed bootstrapper/statusChanged status from READY to STARTING

voievodin commented 7 years ago

Runtime ID format updated from

{
      "workspace": "workspace123",
      "environment": "default",
      "owner": "user123"
}

to

{
      "workspaceId": "workspace123",
      "envName": "default",
      "owner": "user123"
}