github.com/hhrutter/nomad@v0.6.0-rc2.0.20170723054333-80c4b03f0705/website/source/api/deployments.html.md (about)

     1  ---
     2  layout: api
     3  page_title: Deployments - HTTP API
     4  sidebar_current: api-deployments
     5  description: |-
     6    The /deployment are used to query for and interact with deployments.
     7  ---
     8  
     9  # Deployments HTTP API
    10  
    11  The `/deployment` endpoints are used to query for and interact with deployments.
    12  
    13  ## List Deployments
    14  
    15  This endpoint lists all deployments.
    16  
    17  | Method | Path                     | Produces                   |
    18  | ------ | ------------------------ | -------------------------- |
    19  | `GET`  | `/v1/deployments`        | `application/json`         |
    20  
    21  The table below shows this endpoint's support for
    22  [blocking queries](/api/index.html#blocking-queries) and
    23  [required ACLs](/api/index.html#acls).
    24  
    25  | Blocking Queries | ACL Required |
    26  | ---------------- | ------------ |
    27  | `YES`            | `none`       |
    28  
    29  ### Parameters
    30  
    31  - `prefix` `(string: "")`- Specifies a string to filter deployments on based on
    32    an index prefix. This is specified as a querystring parameter.
    33  
    34  ### Sample Request
    35  
    36  ```text
    37  $ curl \
    38      https://nomad.rocks/v1/deployments
    39  ```
    40  
    41  ```text
    42  $ curl \
    43      https://nomad.rocks/v1/deployments?prefix=25ba81c
    44  ```
    45  
    46  ### Sample Response
    47  
    48  ```json
    49  [
    50    {
    51      "ID": "70638f62-5c19-193e-30d6-f9d6e689ab8e",
    52      "JobID": "example",
    53      "JobVersion": 1,
    54      "JobModifyIndex": 17,
    55      "JobCreateIndex": 7,
    56      "TaskGroups": {
    57        "cache": {
    58          "Promoted": false,
    59          "DesiredCanaries": 1,
    60          "DesiredTotal": 3,
    61          "PlacedAllocs": 1,
    62          "HealthyAllocs": 0,
    63          "UnhealthyAllocs": 0
    64        }
    65      },
    66      "Status": "running",
    67      "StatusDescription": "",
    68      "CreateIndex": 19,
    69      "ModifyIndex": 19
    70    }
    71  ]
    72  ```
    73  
    74  ## Read Deployment
    75  
    76  This endpoint reads information about a specific deployment by ID.
    77  
    78  | Method | Path                             | Produces                   |
    79  | ------ | -------------------------------- | -------------------------- |
    80  | `GET`  | `/v1/deployment/:deployment_id`  | `application/json`         |
    81  
    82  The table below shows this endpoint's support for
    83  [blocking queries](/api/index.html#blocking-queries) and
    84  [required ACLs](/api/index.html#acls).
    85  
    86  | Blocking Queries | ACL Required |
    87  | ---------------- | ------------ |
    88  | `YES`            | `none`       |
    89  
    90  ### Parameters
    91  
    92  - `:deployment_id` `(string: <required>)`- Specifies the UUID of the deployment.
    93    This must be the full UUID, not the short 8-character one. This is specified
    94    as part of the path.
    95  
    96  ### Sample Request
    97  
    98  ```text
    99  $ curl \
   100      https://nomad.rocks/v1/deployment/70638f62-5c19-193e-30d6-f9d6e689ab8e
   101  ```
   102  
   103  ### Sample Response
   104  
   105  ```json
   106  {
   107    "ID": "70638f62-5c19-193e-30d6-f9d6e689ab8e",
   108    "JobID": "example",
   109    "JobVersion": 1,
   110    "JobModifyIndex": 17,
   111    "JobCreateIndex": 7,
   112    "TaskGroups": {
   113      "cache": {
   114        "Promoted": false,
   115        "DesiredCanaries": 1,
   116        "DesiredTotal": 3,
   117        "PlacedAllocs": 1,
   118        "HealthyAllocs": 0,
   119        "UnhealthyAllocs": 0
   120      }
   121    },
   122    "Status": "running",
   123    "StatusDescription": "",
   124    "CreateIndex": 19,
   125    "ModifyIndex": 19
   126  }
   127  ```
   128  
   129  ## List Allocations for Deployment
   130  
   131  This endpoint lists the allocations created or modified for the given
   132  deployment.
   133  
   134  | Method | Path                                        | Produces                   |
   135  | ------ | ------------------------------------------- | -------------------------- |
   136  | `GET`  | `/v1/deployment/allocations/:deployment_id` | `application/json`         |
   137  
   138  The table below shows this endpoint's support for
   139  [blocking queries](/api/index.html#blocking-queries) and
   140  [required ACLs](/api/index.html#acls).
   141  
   142  | Blocking Queries | ACL Required |
   143  | ---------------- | ------------ |
   144  | `YES`            | `none`       |
   145  
   146  ### Parameters
   147  
   148  - `:deployment_id` `(string: <required>)`- Specifies the UUID of the deployment.
   149    This must be the full UUID, not the short 8-character one. This is specified
   150    as part of the path.
   151  
   152  ### Sample Request
   153  
   154  ```text
   155  $ curl \
   156      https://nomad.rocks/v1/deployment/allocations/5456bd7a-9fc0-c0dd-6131-cbee77f57577
   157  ```
   158  
   159  ### Sample Response
   160  
   161  ```json
   162  [
   163    {
   164      "ID": "287b65cc-6c25-cea9-0332-e4a75ca2af98",
   165      "EvalID": "9751cb74-1a0d-190e-d026-ad2bc666ad2c",
   166      "Name": "example.cache[0]",
   167      "NodeID": "cb1f6030-a220-4f92-57dc-7baaabdc3823",
   168      "JobID": "example",
   169      "TaskGroup": "cache",
   170      "DesiredStatus": "run",
   171      "DesiredDescription": "",
   172      "ClientStatus": "running",
   173      "ClientDescription": "",
   174      "TaskStates": {
   175        "redis": {
   176          "State": "running",
   177          "Failed": false,
   178          "StartedAt": "2017-06-29T22:29:41.52000268Z",
   179          "FinishedAt": "0001-01-01T00:00:00Z",
   180          "Events": [
   181            {
   182              "Type": "Received",
   183              "Time": 1498775380693307400,
   184              "FailsTask": false,
   185              "RestartReason": "",
   186              "SetupError": "",
   187              "DriverError": "",
   188              "ExitCode": 0,
   189              "Signal": 0,
   190              "Message": "",
   191              "KillTimeout": 0,
   192              "KillError": "",
   193              "KillReason": "",
   194              "StartDelay": 0,
   195              "DownloadError": "",
   196              "ValidationError": "",
   197              "DiskLimit": 0,
   198              "FailedSibling": "",
   199              "VaultError": "",
   200              "TaskSignalReason": "",
   201              "TaskSignal": "",
   202              "DriverMessage": ""
   203            },
   204            {
   205              "Type": "Task Setup",
   206              "Time": 1498775380693659000,
   207              "FailsTask": false,
   208              "RestartReason": "",
   209              "SetupError": "",
   210              "DriverError": "",
   211              "ExitCode": 0,
   212              "Signal": 0,
   213              "Message": "Building Task Directory",
   214              "KillTimeout": 0,
   215              "KillError": "",
   216              "KillReason": "",
   217              "StartDelay": 0,
   218              "DownloadError": "",
   219              "ValidationError": "",
   220              "DiskLimit": 0,
   221              "FailedSibling": "",
   222              "VaultError": "",
   223              "TaskSignalReason": "",
   224              "TaskSignal": "",
   225              "DriverMessage": ""
   226            },
   227            {
   228              "Type": "Started",
   229              "Time": 1498775381508493800,
   230              "FailsTask": false,
   231              "RestartReason": "",
   232              "SetupError": "",
   233              "DriverError": "",
   234              "ExitCode": 0,
   235              "Signal": 0,
   236              "Message": "",
   237              "KillTimeout": 0,
   238              "KillError": "",
   239              "KillReason": "",
   240              "StartDelay": 0,
   241              "DownloadError": "",
   242              "ValidationError": "",
   243              "DiskLimit": 0,
   244              "FailedSibling": "",
   245              "VaultError": "",
   246              "TaskSignalReason": "",
   247              "TaskSignal": "",
   248              "DriverMessage": ""
   249            }
   250          ]
   251        }
   252      },
   253      "DeploymentStatus": null,
   254      "CreateIndex": 19,
   255      "ModifyIndex": 22,
   256      "CreateTime": 1498775380678486300
   257    }
   258  ]
   259  ```
   260  
   261  ## Fail Deployment
   262  
   263  This endpoint is used to mark a deployment as failed. This should be done to
   264  force the scheduler to stop creating allocations as part of the deployment or to
   265  cause a rollback to a previous job version.
   266  
   267  | Method  | Path                                 | Produces                   |
   268  | ------- | ------------------------------------ | -------------------------- |
   269  | `POST`  | `/v1/deployment/fail/:deployment_id` | `application/json`         |
   270  
   271  The table below shows this endpoint's support for
   272  [blocking queries](/api/index.html#blocking-queries) and
   273  [required ACLs](/api/index.html#acls).
   274  
   275  | Blocking Queries | ACL Required |
   276  | ---------------- | ------------ |
   277  | `NO`             | `none`       |
   278  
   279  ### Parameters
   280  
   281  - `:deployment_id` `(string: <required>)`- Specifies the UUID of the deployment.
   282    This must be the full UUID, not the short 8-character one. This is specified
   283    as part of the path.
   284  
   285  ### Sample Request
   286  
   287  ```text
   288  $ curl \
   289      --request POST \
   290      https://nomad.rocks/v1/deployment/fail/5456bd7a-9fc0-c0dd-6131-cbee77f57577
   291  ```
   292  
   293  ### Sample Response
   294  
   295  ```json
   296  {
   297    "EvalID": "0d834913-58a0-81ac-6e33-e452d83a0c66",
   298    "EvalCreateIndex": 20,
   299    "DeploymentModifyIndex": 20,
   300    "RevertedJobVersion": 1,
   301    "Index": 20
   302  }
   303  ```
   304  
   305  ## Pause Deployment
   306  
   307  This endpoint is used to pause or unpause a deployment. This is done to pause
   308  a rolling upgrade or resume it.
   309  
   310  | Method  | Path                                  | Produces                   |
   311  | ------- | ------------------------------------- | -------------------------- |
   312  | `POST`  | `/v1/deployment/pause/:deployment_id` | `application/json`         |
   313  
   314  The table below shows this endpoint's support for
   315  [blocking queries](/api/index.html#blocking-queries) and
   316  [required ACLs](/api/index.html#acls).
   317  
   318  | Blocking Queries | ACL Required |
   319  | ---------------- | ------------ |
   320  | `NO`             | `none`       |
   321  
   322  ### Parameters
   323  
   324  - `:deployment_id` `(string: <required>)`- Specifies the UUID of the deployment.
   325    This must be the full UUID, not the short 8-character one. This is specified
   326    as part of the path.
   327  
   328  - `Pause` `(bool: false)` - Specifies whether to pause or resume the deployment.
   329  
   330  ### Sample Payload
   331  
   332  ```javascript
   333  {
   334    "Pause": true
   335  }
   336  ```      
   337  
   338  ### Sample Request
   339  
   340  ```text
   341  $ curl \
   342      --request POST \
   343      https://nomad.rocks/v1/deployment/pause/5456bd7a-9fc0-c0dd-6131-cbee77f57577
   344  ```
   345  
   346  ### Sample Response
   347  
   348  ```json
   349  {
   350    "EvalID": "0d834913-58a0-81ac-6e33-e452d83a0c66",
   351    "EvalCreateIndex": 20,
   352    "DeploymentModifyIndex": 20,
   353    "Index": 20
   354  }
   355  ```
   356  
   357  ## Promote Deployment
   358  
   359  This endpoint is used to promote task groups that have canaries for a
   360  deployment. This should be done when the placed canaries are healthy and the
   361  rolling upgrade of the remaining allocations should begin.
   362  
   363  | Method  | Path                                    | Produces                   |
   364  | ------- | -------------------------------------   | -------------------------- |
   365  | `POST`  | `/v1/deployment/promote/:deployment_id` | `application/json`         |
   366  
   367  The table below shows this endpoint's support for
   368  [blocking queries](/api/index.html#blocking-queries) and
   369  [required ACLs](/api/index.html#acls).
   370  
   371  | Blocking Queries | ACL Required |
   372  | ---------------- | ------------ |
   373  | `NO`             | `none`       |
   374  
   375  ### Parameters
   376  
   377  - `:deployment_id` `(string: <required>)`- Specifies the UUID of the deployment.
   378    This must be the full UUID, not the short 8-character one. This is specified
   379    as part of the path.
   380  
   381  - `All` `(bool: false)` - Specifies whether all task groups should be promoted.
   382  
   383  - `Groups` `(array<string>: nil)` - Specifies a particular set of task groups
   384    that should be promoted.
   385  
   386  ### Sample Payload
   387  
   388  ```javascript
   389  {
   390    "All": true
   391  }
   392  ```      
   393  
   394  ```javascript
   395  {
   396    "Groups": ["web", "api-server"]
   397  }
   398  ```      
   399  
   400  ### Sample Request
   401  
   402  ```text
   403  $ curl \
   404      --request POST \
   405      https://nomad.rocks/v1/deployment/promote/5456bd7a-9fc0-c0dd-6131-cbee77f57577
   406  ```
   407  
   408  ### Sample Response
   409  
   410  ```json
   411  {
   412    "EvalID": "0d834913-58a0-81ac-6e33-e452d83a0c66",
   413    "EvalCreateIndex": 20,
   414    "DeploymentModifyIndex": 20,
   415    "Index": 20
   416  }
   417  ```
   418  
   419  ## Set Allocation Health in Deployment
   420  
   421  This endpoint is used to set the health of an allocation that is in the
   422  deployment manually. In some use cases, automatic detection of allocation health
   423  may not be desired. As such those task groups can be marked with an upgrade
   424  policy that uses `health_check = "manual"`. Those allocations must have their
   425  health marked manually using this endpoint. Marking an allocation as healthy
   426  will allow the rolling upgrade to proceed. Marking it as failed will cause the
   427  deployment to fail.
   428  
   429  | Method  | Path                                              | Produces                   |
   430  | ------- | ------------------------------------------------- | -------------------------- |
   431  | `POST`  | `/v1/deployment/allocation-health/:deployment_id` | `application/json`         |
   432  
   433  The table below shows this endpoint's support for
   434  [blocking queries](/api/index.html#blocking-queries) and
   435  [required ACLs](/api/index.html#acls).
   436  
   437  | Blocking Queries | ACL Required |
   438  | ---------------- | ------------ |
   439  | `NO`             | `none`       |
   440  
   441  ### Parameters
   442  
   443  - `:deployment_id` `(string: <required>)`- Specifies the UUID of the deployment.
   444    This must be the full UUID, not the short 8-character one. This is specified
   445    as part of the path.
   446  
   447  - `HealthyAllocationIDs` `(array<string>: nil)` - Specifies the set of
   448    allocation that should be marked as healthy.
   449  
   450  - `UnhealthyAllocationIDs` `(array<string>: nil)` - Specifies the set of
   451    allocation that should be marked as unhealthy.
   452  
   453  ### Sample Payload
   454  
   455  ```javascript
   456  {
   457    "HealthyAllocationIDs": [
   458      "eb13bc8a-7300-56f3-14c0-d4ad115ec3f5",
   459      "6584dad8-7ae3-360f-3069-0b4309711cc1"
   460    ]
   461  }
   462  ```      
   463  
   464  ### Sample Request
   465  
   466  ```text
   467  $ curl \
   468      --request POST \
   469      https://nomad.rocks/v1/deployment/allocation-health/5456bd7a-9fc0-c0dd-6131-cbee77f57577
   470  ```
   471  
   472  ### Sample Response
   473  
   474  ```json
   475  {
   476    "EvalID": "0d834913-58a0-81ac-6e33-e452d83a0c66",
   477    "EvalCreateIndex": 20,
   478    "DeploymentModifyIndex": 20,
   479    "RevertedJobVersion": 1,
   480    "Index": 20
   481  }
   482  ```