From f182e398e83056c6b3df5591f30806dac061d04f Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Sun, 20 Sep 2015 15:31:33 -0700 Subject: [PATCH 01/17] website: skeleton drivers --- website/source/docs/drivers/custom.html.md | 15 +- website/source/docs/drivers/docker.html.md | 14 + .../source/docs/drivers/docker/index.html.md | 358 ------------------ website/source/docs/drivers/exec.html.md | 14 + website/source/docs/drivers/index.html.md | 79 +--- website/source/docs/drivers/java.html.md | 14 + website/source/docs/drivers/qemu.html.md | 14 + website/source/layouts/docs.erb | 10 +- 8 files changed, 81 insertions(+), 437 deletions(-) create mode 100644 website/source/docs/drivers/docker.html.md delete mode 100644 website/source/docs/drivers/docker/index.html.md create mode 100644 website/source/docs/drivers/exec.html.md create mode 100644 website/source/docs/drivers/java.html.md create mode 100644 website/source/docs/drivers/qemu.html.md diff --git a/website/source/docs/drivers/custom.html.md b/website/source/docs/drivers/custom.html.md index 53f30939e..7f2bde558 100644 --- a/website/source/docs/drivers/custom.html.md +++ b/website/source/docs/drivers/custom.html.md @@ -3,17 +3,14 @@ layout: "docs" page_title: "Drivers: Custom" sidebar_current: "docs-drivers-custom" description: |- - Create custom secret backends for Nomad. + Create custom task drivers for Nomad. --- # Custom Drivers -Nomad does not currently support the creation of custom secret backends. -The primary reason is because we want to ensure the core of Nomad is -secure before attempting any sort of plug-in system. We're interested -in supporting custom secret backends, but do not yet have a clear strategy -or timeline to do. +Nomad does not currently support pluggable task drivers, however the +interface that a task driver must implement is minimal. In the short term, +custom drivers can be implemented in Go and compiled into the binary, +however in the long term we plan to expose a plugin interface such that +task drivers can be dynamically registered without recompiling the Nomad binary. -In the mean time, you can use the -[generic backend](/docs/secrets/generic/index.html) to support custom -data with custom leases. diff --git a/website/source/docs/drivers/docker.html.md b/website/source/docs/drivers/docker.html.md new file mode 100644 index 000000000..d9bb939c1 --- /dev/null +++ b/website/source/docs/drivers/docker.html.md @@ -0,0 +1,14 @@ +--- +layout: "docs" +page_title: "Drivers: Docker" +sidebar_current: "docs-drivers-docker" +description: |- + The Docker task driver is used to run Docker based tasks. +--- + +# Docker Driver + +Name: `docker` + +TODO + diff --git a/website/source/docs/drivers/docker/index.html.md b/website/source/docs/drivers/docker/index.html.md deleted file mode 100644 index ee88d0a96..000000000 --- a/website/source/docs/drivers/docker/index.html.md +++ /dev/null @@ -1,358 +0,0 @@ ---- -layout: "docs" -page_title: "Drivers: Docker" -sidebar_current: "docs-drivers-docker" -description: |- - The AWS secret backend for Nomad generates access keys dynamically based on IAM policies. ---- - -# Docker Driver - -Name: `aws` - -The AWS secret backend for Nomad generates AWS access credentials dynamically -based on IAM policies. This makes IAM much easier to use: credentials could -be generated on the fly, and are automatically revoked when the Nomad -lease is expired. - -This page will show a quick start for this backend. For detailed documentation -on every path, use `vault path-help` after mounting the backend. - -## Quick Start - -The first step to using the aws backend is to mount it. -Unlike the `generic` backend, the `aws` backend is not mounted by default. - -```text -$ vault mount aws -Successfully mounted 'aws' at 'aws'! -``` - -Next, we must configure the root credentials that are used to manage IAM credentials: - -```text -$ vault write aws/config/root \ - access_key=AKIAJWVN5Z4FOFT7NLNA \ - secret_key=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 \ - region=us-east-1 -``` - -The following parameters are required: - -- `access_key` - the AWS access key that has permission to manage IAM - credentials. -- `secret_key` - the AWS secret key that has permission to manage IAM - credentials. -- `region` the AWS region for API calls. - -The next step is to configure a role. A role is a logical name that maps -to a policy used to generated those credentials. For example, lets create -a "deploy" role: - -```text -$ vault write aws/roles/deploy \ - name=deploy \ - policy=@policy.json -``` - -This path will create a named role along with the IAM policy used -to restrict permissions for it. This is used to dynamically create -a new pair of IAM credentials when needed. - -The `@` tells Nomad to load the policy from the file named `policy.json`. Here -is an example IAM policy to get started: - -```javascript -{ - "Version": "2012-10-17", - "Statement": { - "Effect": "Allow", - "Action": "iam:*", - "Resource": "*" - } -} -``` - -For more information on IAM policies, please see the -[AWS IAM policy documentation](http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html). - -To generate a new set of IAM credentials, we simply read from that role: - -```text -$ vault read aws/creds/deploy -Key Value -lease_id aws/creds/deploy/7cb8df71-782f-3de1-79dd-251778e49f58 -lease_duration 3600 -access_key AKIAIOMYUTSLGJOGLHTQ -secret_key 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 -``` - -If you run the command again, you will get a new set of credentials: - -```text -$ vault read aws/creds/deploy -Key Value -lease_id aws/creds/deploy/82d89562-ff19-382e-6be9-cb45c8f6a42d -lease_duration 3600 -access_key AKIAJZ5YRPHFH3QHRRRQ -secret_key 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 -``` - -If you get an error message similar to either of the following, the root credentials that you wrote to `aws/config/root` have insufficient privilege: - -```text -$ vault read aws/creds/deploy -* Error creating IAM user: User: arn:aws:iam::000000000000:user/hashicorp is not authorized to perform: iam:CreateUser on resource: arn:aws:iam::000000000000:user/vault-root-1432735386-4059 - -$ vault revoke aws/creds/deploy/774cfb27-c22d-6e78-0077-254879d1af3c -Revoke error: Error making API request. - -URL: PUT http://127.0.0.1:8200/v1/sys/revoke/aws/creds/deploy/774cfb27-c22d-6e78-0077-254879d1af3c -Code: 400. Errors: - -* invalid request -``` - -The root credentials need permission to perform various IAM actions. These are the actions that the AWS secret backend uses to manage IAM credentials. Here is an example IAM policy that would grant these permissions: - -```javascript -{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "iam:CreateAccessKey", - "iam:CreateUser", - "iam:PutUserPolicy", - "iam:ListGroupsForUser", - "iam:ListUserPolicies", - "iam:ListAccessKeys", - "iam:DeleteAccessKey", - "iam:DeleteUserPolicy", - "iam:RemoveUserFromGroup", - "iam:DeleteUser" - ], - "Resource": [ - "arn:aws:iam::ACCOUNT-ID-WITHOUT-HYPHENS:user/vault-*" - ] - } - ] -} -``` - -Note that this policy example is unrelated to the policy you wrote to `aws/roles/deploy`. This policy example should be applied to the IAM user (or role) associated with the root credentials that you wrote to `aws/config/root`. You have to apply it yourself in IAM. The policy you wrote to `aws/roles/deploy` is the policy you want the AWS secret backend to apply to the temporary credentials it returns from `aws/creds/deploy`. - -If you get stuck at any time, simply run `vault path-help aws` or with a subpath for -interactive help output. - -## API - -### /aws/config/root -#### POST - -
-
Description
-
- Configures the root IAM credentials used. - This is a root protected endpoint. -
- -
Method
-
POST
- -
URL
-
`/aws/config/root`
- -
Parameters
-
-
    -
  • - access_key - required - The AWS Access Key -
  • -
  • - secret_key - required - The AWS Secret Key -
  • -
  • - region - required - The AWS region for API calls -
  • -
-
- -
Returns
-
- A `204` response code. -
-
- -### /aws/config/lease -#### POST - -
-
Description
-
- Configures the lease settings for generated credentials. - This is a root protected endpoint. -
- -
Method
-
POST
- -
URL
-
`/aws/config/lease`
- -
Parameters
-
-
    -
  • - lease - required - The lease value provided as a string duration - with time suffix. Hour is the largest suffix. -
  • -
  • - lease_max - required - The maximum lease value provided as a string duration - with time suffix. Hour is the largest suffix. -
  • -
-
- -
Returns
-
- A `204` response code. -
-
- -### /aws/roles/ -#### POST - -
-
Description
-
- Creates or updates a named role. -
- -
Method
-
POST
- -
URL
-
`/aws/roles/`
- -
Parameters
-
-
    -
  • - policy - required - The IAM policy in JSON format. -
  • -
-
- -
Returns
-
- A `204` response code. -
-
- -#### GET - -
-
Description
-
- Queries a named role. -
- -
Method
-
GET
- -
URL
-
`/aws/roles/`
- -
Parameters
-
- None -
- -
Returns
-
- - ```javascript - { - "data": { - "policy": "..." - } - } - ``` - -
-
- -#### DELETE - -
-
Description
-
- Deletes a named role. -
- -
Method
-
DELETE
- -
URL
-
`/aws/roles/`
- -
Parameters
-
- None -
- -
Returns
-
- A `204` response code. -
-
- - -### /aws/creds/ -#### GET - -
-
Description
-
- Generates a dynamic IAM credential based on the named role. -
- -
Method
-
GET
- -
URL
-
`/aws/creds/`
- -
Parameters
-
- None -
- -
Returns
-
- - ```javascript - { - "data": { - "access_key": "...", - "secret_key": "..." - } - } - ``` - -
-
diff --git a/website/source/docs/drivers/exec.html.md b/website/source/docs/drivers/exec.html.md new file mode 100644 index 000000000..03286208e --- /dev/null +++ b/website/source/docs/drivers/exec.html.md @@ -0,0 +1,14 @@ +--- +layout: "docs" +page_title: "Drivers: Exec" +sidebar_current: "docs-drivers-exec" +description: |- + The Exec task driver is used to run binaries using OS isolation primitives. +--- + +# Fork/Exec Driver + +Name: `exec` + +TODO + diff --git a/website/source/docs/drivers/index.html.md b/website/source/docs/drivers/index.html.md index 4175c7e8e..e5a950392 100644 --- a/website/source/docs/drivers/index.html.md +++ b/website/source/docs/drivers/index.html.md @@ -1,75 +1,24 @@ --- layout: "docs" -page_title: "Drivers" +page_title: "Task Drivers" sidebar_current: "docs-drivers" description: |- - Secret backends are mountable backends that store or generate secrets in Nomad. + Task Drivers are used to integrate with the host OS to run tasks in Nomad. --- -# Drivers +# Task Drivers -Secret backends are the components in Nomad which store and generate -secrets. +Task drivers are used by Nomad clients to execute a task and provide resource +isolation. By having extensible task drivers, Nomad has the flexibility to +support a broad set of workloads across all major operating systems. -Some secret backends, such as "generic", simply store and read -secrets verbatim. Other secret backends, such as "aws", create _dynamic -secrets_: secrets that are made on demand. +The list of supported task is on the left. Each task driver documents the +configuration available in a job specification, the environments it can be +used in, and the resource isolation mechanisms available. -Secret backends are part of the -[mount system](#) -in Nomad. They behave very similarly to a virtual filesystem: -any read/write/delete is sent to the secret backend, and the secret -backend can choose to react to that operation however it sees fit. +Nomad strives to mask the details of running a task from users and instead +provides a clean abstraction. It is possible for the same task to be executed +with different isolation levels depending on the client running the task. +The goal is to use the strictest isolation available and gracefully degrade +protections where necessary. -For example, the "generic" backend passes through any operation back -to the configured storage backend for Nomad. A "read" turns into a -"read" of the storage backend at the same path, a "write" turns into -a write, etc. This is a lot like a normal filesystem. - -The "aws" backend, on the other hand, behaves differently. When you -write to `aws/config/root`, it expects a certain format and stores that -information as configuration. You cannot read from this path. When you -read from `aws/`, it looks up an IAM policy named `` and -generates AWS access credentials on demand and returns them. It does not -behave at all like a typical filesystem: you are not simply storing and -retrieving values, you are interacting with an API. - -## Mounting/Unmounting Secret Backends - -Secret backends can be mounted/unmounted using the CLI or the API. -There are three operations that can be performed with a secret backend -with regards to mounting: - - * **Mount** - This mounts a new secret backend. Multiple secret - backends of the same type can be mounted at the same time by - specifying different mount points. By default, secret backends are - mounted to the same path as their name. This is what you want most - of the time. - - * **Unmount** - This unmounts an existing secret backend. When a secret - backend is unmounted, all of its secrets are revoked (if they support - it), and all of the data stored for that backend in the physical storage - layer is deleted. - - * **Remount** - This moves the mount point for an existing secret backend. - This revokes all secrets, since secret leases are tied to the path they - were created at. The data stored for the backend will not be deleted. - -Once a secret backend is mounted, you can interact with it directly -at its mount point according to its own API. You can use the `vault path-help` -system to determine the paths it responds to. - -## Barrier View - -An important concept around secret backends is that they receive a -_barrier view_ to the configured Nomad physical storage. This is a lot -like a [chroot](http://en.wikipedia.org/wiki/Chroot). - -Whenever a secret backend is mounted, a random UUID is generated. This -becomes the data root for that backend. Whenever that backend writes to -the physical storage layer, it is prefixed with that UUID folder. Since -the Nomad storage layer does not support relative access (such as `..`), -this makes it impossible for a mounted backend to access any other data. - -This is an important security feature in Nomad: even a malicious backend -cannot access the data from any other backend. diff --git a/website/source/docs/drivers/java.html.md b/website/source/docs/drivers/java.html.md new file mode 100644 index 000000000..130fc999b --- /dev/null +++ b/website/source/docs/drivers/java.html.md @@ -0,0 +1,14 @@ +--- +layout: "docs" +page_title: "Drivers: Java" +sidebar_current: "docs-drivers-java" +description: |- + The Java task driver is used to run Jars using the JVM. +--- + +# Java Driver + +Name: `java` + +TODO + diff --git a/website/source/docs/drivers/qemu.html.md b/website/source/docs/drivers/qemu.html.md new file mode 100644 index 000000000..f617179f5 --- /dev/null +++ b/website/source/docs/drivers/qemu.html.md @@ -0,0 +1,14 @@ +--- +layout: "docs" +page_title: "Drivers: Qemu" +sidebar_current: "docs-drivers-qemu" +description: |- + The Qemu task driver is used to run virtual machines using Qemu/KVM. +--- + +# Qemu Driver + +Name: `qemu` + +TODO + diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index a0af2ed94..6a0ec604e 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -94,22 +94,22 @@
> - Drivers + Task Drivers <% end %> From e8fabad2679529b561c885eade74f874f13f7a76 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Sun, 20 Sep 2015 16:12:52 -0700 Subject: [PATCH 05/17] website: initial http layout --- website/source/docs/http/index.html.md | 30 ++++++++++-- website/source/layouts/http.erb | 63 +++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 6 deletions(-) diff --git a/website/source/docs/http/index.html.md b/website/source/docs/http/index.html.md index 16145bce1..422a015cc 100644 --- a/website/source/docs/http/index.html.md +++ b/website/source/docs/http/index.html.md @@ -3,13 +3,33 @@ layout: "http" page_title: "HTTP API" sidebar_current: "docs-http-overview" description: |- - Nomad has an HTTP API that can be used to control every aspect of Nomad. + Nomad has an HTTP API that can be used to programmatically use Nomad. --- # HTTP API -The Nomad HTTP API gives you full access to Nomad via HTTP. Every -aspect of Nomad can be controlled via this API. The Nomad CLI uses -the HTTP API to access Nomad. +The Nomad HTTP API is the primary interface to using Nomad, and is used +to query the current state of the system as well as to modify it. +The Nomad CLI makes use of the Go HTTP client and invokes the HTTP API. + +All API routes are prefixed with `/v1/`. This documentation is only for the v1 API. + +## Data Model + +There are four primary "nouns" in Nomad, these are jobs, nodes, allocations, and evaluations: + +[![Nomad Data Model](/assets/images/nomad-data-model.png)](/assets/images/nomad-data-model.png) + +Jobs are submitted by users and represent a _desired state_. A job is a declarative description +of tasks to run which are bounded by constraints and require resources. Nodes are the servers +in the clusters that tasks can be scheduled on. The mapping of tasks in a job to nodes is done +using allocations. An allocation is used to declare that a set of tasks in a job should be run +on a particular node. Scheduling is the process of determining the appropriate allocations and +is done as part of an evaluation. + +The API is modeled closely on the underlying data model. Use the links to the left for +documentation about specific endpoints. + +There are a set of "Agent" APIs which are used to interact with a specific agent and not the +broader cluster. -TODO: Document Nomand API diff --git a/website/source/layouts/http.erb b/website/source/layouts/http.erb index 038bc1f3b..8e8881306 100644 --- a/website/source/layouts/http.erb +++ b/website/source/layouts/http.erb @@ -10,7 +10,68 @@ > Overview - + + + > + Jobs + + + + > + Nodes + + + + > + Allocations + + + + > + Evaluations + + + + > + Agent + + <% end %> From 14241ab3e55740203dabf0c6a20ac8dd572c5513 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Sun, 20 Sep 2015 16:52:08 -0700 Subject: [PATCH 06/17] website: HTTP docs --- website/source/docs/http/index.html.md | 68 ++++++++++++++++++-- website/source/docs/http/jobs.html.md | 88 ++++++++++++++++++++++++++ website/source/layouts/http.erb | 4 +- 3 files changed, 154 insertions(+), 6 deletions(-) create mode 100644 website/source/docs/http/jobs.html.md diff --git a/website/source/docs/http/index.html.md b/website/source/docs/http/index.html.md index 422a015cc..671d19fa5 100644 --- a/website/source/docs/http/index.html.md +++ b/website/source/docs/http/index.html.md @@ -14,7 +14,7 @@ The Nomad CLI makes use of the Go HTTP client and invokes the HTTP API. All API routes are prefixed with `/v1/`. This documentation is only for the v1 API. -## Data Model +## Data Model and API Layout There are four primary "nouns" in Nomad, these are jobs, nodes, allocations, and evaluations: @@ -28,8 +28,68 @@ on a particular node. Scheduling is the process of determining the appropriate a is done as part of an evaluation. The API is modeled closely on the underlying data model. Use the links to the left for -documentation about specific endpoints. +documentation about specific endpoints. There are also "Agent" APIs which interact with +a specific agent and not the broader cluster used for administration. + +## Blocking Queries + +Certain endpoints support a feature called a "blocking query." A blocking query +is used to wait for a potential change using long polling. + +Not all endpoints support blocking, but those that do are clearly designated in the +documentation. Any endpoint that supports blocking will also set the HTTP header +`X-Nomad-Index`, a unique identifier representing the current state of the +requested resource. On subsequent requests for this resource, the client can set the `index` +query string parameter to the value of `X-Nomad-Index`, indicating that the client wishes +to wait for any changes subsequent to that index. + +In addition to `index`, endpoints that support blocking will also honor a `wait` +parameter specifying a maximum duration for the blocking request. This is limited to +10 minutes. If not set, the wait time defaults to 5 minutes. This value can be specified +in the form of "10s" or "5m" (i.e., 10 seconds or 5 minutes, respectively). + +A critical note is that the return of a blocking request is **no guarantee** of a change. It +is possible that the timeout was reached or that there was an idempotent write that does +not affect the result of the query. + +## Consistency Modes + +Most of the read query endpoints support multiple levels of consistency. Since no policy will +suit all clients' needs, these consistency modes allow the user to have the ultimate say in +how to balance the trade-offs inherent in a distributed system. + +The two read modes are: + +* default - If not specified, the default is strongly consistent in almost all cases. However, + there is a small window in which a new leader may be elected during which the old leader may + service stale values. The trade-off is fast reads but potentially stale values. The condition + resulting in stale reads is hard to trigger, and most clients should not need to worry about + this case. Also, note that this race condition only applies to reads, not writes. + +* stale - This mode allows any server to service the read regardless of whether + it is the leader. This means reads can be arbitrarily stale; however, results are generally + consistent to within 50 milliseconds of the leader. The trade-off is very fast and + scalable reads with a higher likelihood of stale values. Since this mode allows reads without + a leader, a cluster that is unavailable will still be able to respond to queries. + +To switch these modes, use the `stale` query parameter on request. + +To support bounding the acceptable staleness of data, responses provide the `X-Nomad-LastContact` +header containing the time in milliseconds that a server was last contacted by the leader node. +The `X-Nomad-KnownLeader` header also indicates if there is a known leader. These can be used +by clients to gauge the staleness of a result and take appropriate action. + +## Cross-Region Requests + +By default any request to the HTTP API is assumed to pertain to the region of the machine +servicing the request. A target region can be explicitly specified with the `region` query +parameter. The request will be transparently forwarded and serviced by a server in the +appropriate region. + +## Formatted JSON Output + +By default, the output of all HTTP API requests is minimized JSON. If the client passes `pretty` +on the query string, formatted JSON will be returned. + -There are a set of "Agent" APIs which are used to interact with a specific agent and not the -broader cluster. diff --git a/website/source/docs/http/jobs.html.md b/website/source/docs/http/jobs.html.md new file mode 100644 index 000000000..f9a78a089 --- /dev/null +++ b/website/source/docs/http/jobs.html.md @@ -0,0 +1,88 @@ +--- +layout: "http" +page_title: "HTTP API: /v1/jobs" +sidebar_current: "docs-http-jobs" +description: |- + The '/1/jobs' endpoint is used list jobs and register new ones. +--- + +# /v1/jobs + +The `jobs` endpoint is used to query the status of existing jobs in Nomad +and to to register new jobs. By default, the agent's local region is used; +another region can be specified using the `?region=` query parameter. + +## GET + +
+
Description
+
+ Lists all the jobs registered with Nomad. +
+ +
Method
+
GET
+ +
URL
+
`/v1/jobs`
+ +
Parameters
+
+ None +
+ +
Returns
+
+ + ```javascript + { + "aws": { + "type": "aws", + "description": "AWS keys" + }, + + "sys": { + "type": "system", + "description": "system endpoint" + } + } + ``` + +
+
+ +## PUT / POST + +
+
Description
+
+ Registers a new job +
+ +
Method
+
PUT or POST
+ +
URL
+
`/v1/jobs`
+ +
Parameters
+
+
    +
  • + type + required + The name of the backend type, such as "aws" +
  • +
  • + description + optional + A human-friendly description of the mount. +
  • +
+
+ +
Returns
+
`204` response code. +
+
+ diff --git a/website/source/layouts/http.erb b/website/source/layouts/http.erb index 8e8881306..a2d7dae31 100644 --- a/website/source/layouts/http.erb +++ b/website/source/layouts/http.erb @@ -15,8 +15,8 @@ > Jobs - > + > Nodes - > + > Allocations - > + > Evaluations - > + > Agent + > + Status + + + > Agent From 71817ffbbaef38cbac21682077a9c9b9123e2a15 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Sun, 20 Sep 2015 19:18:37 -0700 Subject: [PATCH 16/17] website: agent API docs --- .../docs/http/agent-force-leave.html.md | 47 +++++++++++++ website/source/docs/http/agent-join.html.md | 53 +++++++++++++++ .../source/docs/http/agent-members.html.md | 67 +++++++++++++++++++ website/source/docs/http/agent-self.html.md | 4 +- 4 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 website/source/docs/http/agent-force-leave.html.md create mode 100644 website/source/docs/http/agent-join.html.md create mode 100644 website/source/docs/http/agent-members.html.md diff --git a/website/source/docs/http/agent-force-leave.html.md b/website/source/docs/http/agent-force-leave.html.md new file mode 100644 index 000000000..8fcd62e27 --- /dev/null +++ b/website/source/docs/http/agent-force-leave.html.md @@ -0,0 +1,47 @@ +--- +layout: "http" +page_title: "HTTP API: /v1/agent/force-leave" +sidebar_current: "docs-http-agent-force-leave" +description: |- + The '/1/agent/force-leave' endpoint is force a gossip member to leave. +--- + +# /v1/agent/force-leave + +The `foce-leave` endpoint is used to force a member of the gossip pool from +the "failed" state into the "left" state. This allows the consensus protocol to +remove the peer and stop attempting replication. This is only applicable for +servers. + +## PUT / POST + +
+
Description
+
+ Force a failed gossip member into the left state. +
+ +
Method
+
PUT or POST
+ +
URL
+
`/v1/agent/force-leave`
+ +
Parameters
+
+
    +
  • + node + required + The name of the node to force leave. +
  • +
+
+ +
Returns
+
+ + A `200` status code on success. +
+
+ diff --git a/website/source/docs/http/agent-join.html.md b/website/source/docs/http/agent-join.html.md new file mode 100644 index 000000000..c2ead7df3 --- /dev/null +++ b/website/source/docs/http/agent-join.html.md @@ -0,0 +1,53 @@ +--- +layout: "http" +page_title: "HTTP API: /v1/agent/join" +sidebar_current: "docs-http-agent-join" +description: |- + The '/1/agent/join' endpoint is used to cluster the Nomad servers. +--- + +# /v1/agent/join + +The `join` endpoint is used to cluster the Nomad servers using a gossip pool. +The servers participate in a peer-to-peer gossip, and `join` is used to introduce +a member to the pool. This is only applicable for servers. + +## PUT / POST + +
+
Description
+
+ Initiate a join between the agent and target peers. +
+ +
Method
+
PUT or POST
+ +
URL
+
`/v1/agent/join`
+ +
Parameters
+
+
    +
  • + address + required + The address to join. Can be provided multiple times + to attempt joining multiple peers. +
  • +
+
+ +
Returns
+
+ + ```javascript + { + "num_joined": 1, + "error": "" + } + ``` + +
+
+ diff --git a/website/source/docs/http/agent-members.html.md b/website/source/docs/http/agent-members.html.md new file mode 100644 index 000000000..f56b5f922 --- /dev/null +++ b/website/source/docs/http/agent-members.html.md @@ -0,0 +1,67 @@ +--- +layout: "http" +page_title: "HTTP API: /v1/agent/members" +sidebar_current: "docs-http-agent-members" +description: |- + The '/1/agent/members' endpoint is used to query the gossip peers. +--- + +# /v1/agent/members + +The `members` endpoint is used to query the agent for the known peers in +the gossip pool. This is only applicable to servers. + +## GET + +
+
Description
+
+ Lists the known members of the gossip pool. +
+ +
Method
+
GET
+ +
URL
+
`/v1/agent/members`
+ +
Parameters
+
+ None +
+ +
Returns
+
+ + ```javascript + [ + { + "Name": "Armons-MacBook-Air.local.global", + "Addr": "127.0.0.1", + "Port": 4648, + "Tags": { + "bootstrap": "1", + "build": "0.1.0dev", + "dc": "dc1", + "port": "4647", + "region": "global", + "role": "nomad", + "vsn": "1", + "vsn_max": "1", + "vsn_min": "1" + }, + "Status": "alive", + "ProtocolMin": 1, + "ProtocolMax": 3, + "ProtocolCur": 2, + "DelegateMin": 2, + "DelegateMax": 4, + "DelegateCur": 4 + }, + ... + ] + ``` + +
+
+ diff --git a/website/source/docs/http/agent-self.html.md b/website/source/docs/http/agent-self.html.md index db280b293..a7a03debc 100644 --- a/website/source/docs/http/agent-self.html.md +++ b/website/source/docs/http/agent-self.html.md @@ -15,14 +15,14 @@ The `self` endpoint is used to query the state of the target agent.
Description
- Lists all the evaluations. + Query the state of the target agent.
Method
GET
URL
-
`/v1/evaluations`
+
`/v1/agent/self`
Parameters
From a06dce3dbaa43146cc28da90b8813d9adf6ae8d1 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Sun, 20 Sep 2015 19:23:58 -0700 Subject: [PATCH 17/17] website: adding status API endpoints --- website/source/docs/http/status.html.md | 77 +++++++++++++++++++++++++ website/source/layouts/http.erb | 18 ++---- 2 files changed, 82 insertions(+), 13 deletions(-) create mode 100644 website/source/docs/http/status.html.md diff --git a/website/source/docs/http/status.html.md b/website/source/docs/http/status.html.md new file mode 100644 index 000000000..797d8875a --- /dev/null +++ b/website/source/docs/http/status.html.md @@ -0,0 +1,77 @@ +--- +layout: "http" +page_title: "HTTP API: /v1/status/" +sidebar_current: "docs-http-status" +description: |- + The '/1/status/' endpoints are used to query the system status. +--- + +# /v1/status/leader + +By default, the agent's local region is used; another region can +be specified using the `?region=` query parameter. + +## GET + +
+
Description
+
+ Returns the address of the current leader in the region. +
+ +
Method
+
GET
+ +
URL
+
`/v1/status/leader`
+ +
Parameters
+
+ None +
+ +
Returns
+
+ + ```javascript + "127.0.0.1:4647" + ``` + +
+
+ +# /v1/status/peers + +## GET + +
+
Description
+
+ Returns the set of raft peers in the region. +
+ +
Method
+
GET
+ +
URL
+
`/v1/status/peers`
+ +
Parameters
+
+ None +
+ +
Returns
+
+ + ```javascript + [ + "127.0.0.1:4647", + ... + ] + ``` + +
+
+ + diff --git a/website/source/layouts/http.erb b/website/source/layouts/http.erb index ebe451935..957b571f1 100644 --- a/website/source/layouts/http.erb +++ b/website/source/layouts/http.erb @@ -64,19 +64,6 @@ - > - Status - - - > Agent + + > + Status + + <% end %>