Skip to content

cloudfoundry-attic/narc

Repository files navigation


                  88
              .d888888b
              d8P 88 "8b
              Y8b.88        88888b.   8888b.  888d888 .d8888b
              "Y88888b.     888 "88b     "88b 888P"  d88P"
                  88 "8b    888  888 .d888888 888    888
              Y8b 88 .8P    888  888 888  888 888    Y88b.
               "Y8888P"     888  888 "Y888888 888     "Y8888P
                  88


                       $ nearly a real console


= About

Provides interactive console access to fresh new throwaway containers. As soon
as the task is complete (whether it's an interactive bash session or a one-off
command), the container is destroyed and the task goes away.

Containers are spun up and torn down over NATS, and connected to via a
lightweight SSH server.

= Running tests

librarian-chef install
vagrant up
vagrant ssh
gvm install go1.1.2 (one-time thing)
gvm use go1.1.2
cd /workspace
export GOPATH=$PWD
cd src/github.com/cloudfoundry/narc
go test -gocheck.v

= Usage

  PUB task.start

    Provisions a task on the given narc server.

    Payload: {"task":"(task id)","secure_token":"(secure token)"}

      `task id` is a unique identifier for the session.
      `secure token` is the token to authorize access to the task.

    Optional toplevel attributes:

      {"memory_limit":(memory limit)}
      {"disk_limit":(memory limit)}

      `memory limit` is the memory limit for the container, in megabytes.
      `disk limit` is the disk quota for the container, in megabytes.

      If either are omitted, there is no limit. For example, if memory is
      limited but not disk, there will be no disk limit, and vice versa.

  --------------------------------------------------

  PUB task.stop

    Terminate a task. This destroys the container and kicking everyone off.

    Payload: {"task":"(task id)"}

      `task id` is a unique identifier for the task.

  --------------------------------------------------

  SUB task.advertise

    Sent periodically to allow other components to discover the narc server.

    Payload: {
      "id": "(agent id)",
      "available_memory": (avail. memory),
      "available_disk": (avail. disk)
    }

      `agent id` is the unique identifier for the narc server.
      `available memory` is the remaining reservable memory for the server.
      `available disk` is the remaining reservable disk space for the server.