deployments
Creates, updates, deletes, gets or lists a deployments resource.
Overview
| Name | deployments |
| Type | Resource |
| Id | deno.deployment.deployments |
Fields
The following fields are returned by SELECT queries:
- list_deployments
- get_deployment
| Name | Datatype | Description |
|---|---|---|
id | string | A deployment ID Note that this is not UUID v4, as opposed to organization ID and project ID. (example: abcde12vwxyz) |
createdAt | string (date-time) | (example: 2021-08-01T00:00:00Z) |
databases | object | The KV databases that this deployment has access to. Currently, only "default" database is supported. |
description | string | The description of this deployment. This is present only when the status is success. (example: My deployment) |
domains | array | |
permissions | object | Permissions to be set for the deployment. Currently only net is supported, where you can specify a list of IP addresses and/or hostnames that the deployment is allowed to make outbound network requests to. |
projectId | string (uuid) | (example: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11) |
requestTimeout | integer (int32) | The wall-clock timeout in milliseconds for requests to the deployment. This becomes null when no timeout is set, or the deployment has not been done successfully yet. |
status | string | The status of a deployment. (example: success) |
updatedAt | string (date-time) | (example: 2021-08-01T00:00:00Z) |
| Name | Datatype | Description |
|---|---|---|
id | string | A deployment ID Note that this is not UUID v4, as opposed to organization ID and project ID. (example: abcde12vwxyz) |
createdAt | string (date-time) | (example: 2021-08-01T00:00:00Z) |
databases | object | The KV databases that this deployment has access to. Currently, only "default" database is supported. |
description | string | The description of this deployment. This is present only when the status is success. (example: My deployment) |
domains | array | |
permissions | object | Permissions to be set for the deployment. Currently only net is supported, where you can specify a list of IP addresses and/or hostnames that the deployment is allowed to make outbound network requests to. |
projectId | string (uuid) | (example: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11) |
requestTimeout | integer (int32) | The wall-clock timeout in milliseconds for requests to the deployment. This becomes null when no timeout is set, or the deployment has not been done successfully yet. |
status | string | The status of a deployment. (example: success) |
updatedAt | string (date-time) | (example: 2021-08-01T00:00:00Z) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_deployments | select | projectId | page, limit, q, sort, order | This API returns a list of deployments belonging to the specified project in a pagenated manner. The URLs for the next, previous, first, and last page are returned in the Link header of the response, if any. |
get_deployment | select | deploymentId | ||
create_deployment | insert | projectId, data__entryPointUrl, data__assets, data__envVars | This API initiates a build process for a new deployment. Note that this process is asynchronous; the completion of this API doesn't mean the deployment is ready. In order to keep track of the progress of the build, call the "Get build logs of a deployment" API or the "Get deployment details" API. | |
delete_deployment | delete | deploymentId | ||
redeploy_deployment | exec | deploymentId |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
deploymentId | string | Deployment ID |
projectId | string (uuid) | Project ID |
limit | integer | The maximum number of items to return per page. |
order | string | Sort order, either asc or desc. Defaults to asc. |
page | integer | The page number to return. |
q | string | Query by deployment ID |
sort | string | The field to sort by, either id or created_at. Defaults to created_at. |
SELECT examples
- list_deployments
- get_deployment
This API returns a list of deployments belonging to the specified project in
a pagenated manner.
The URLs for the next, previous, first, and last page are returned in theLink header of the response, if any.
SELECT
id,
createdAt,
databases,
description,
domains,
permissions,
projectId,
requestTimeout,
status,
updatedAt
FROM deno.deployment.deployments
WHERE projectId = '{{ projectId }}' -- required
AND page = '{{ page }}'
AND limit = '{{ limit }}'
AND q = '{{ q }}'
AND sort = '{{ sort }}'
AND order = '{{ order }}'
;
Success
SELECT
id,
createdAt,
databases,
description,
domains,
permissions,
projectId,
requestTimeout,
status,
updatedAt
FROM deno.deployment.deployments
WHERE deploymentId = '{{ deploymentId }}' -- required
;
INSERT examples
- create_deployment
- Manifest
This API initiates a build process for a new deployment.
Note that this process is asynchronous; the completion of this API doesn't
mean the deployment is ready. In order to keep track of the progress of the
build, call the "Get build logs of a deployment" API or the "Get deployment
details" API.
INSERT INTO deno.deployment.deployments (
data__entryPointUrl,
data__importMapUrl,
data__lockFileUrl,
data__compilerOptions,
data__assets,
data__domains,
data__envVars,
data__databases,
data__requestTimeout,
data__permissions,
data__description,
data__enableCron,
projectId
)
SELECT
'{{ entryPointUrl }}' /* required */,
'{{ importMapUrl }}',
'{{ lockFileUrl }}',
'{{ compilerOptions }}',
'{{ assets }}' /* required */,
'{{ domains }}',
'{{ envVars }}' /* required */,
'{{ databases }}',
{{ requestTimeout }},
'{{ permissions }}',
'{{ description }}',
{{ enableCron }},
'{{ projectId }}'
RETURNING
id,
createdAt,
databases,
description,
domains,
permissions,
projectId,
requestTimeout,
status,
updatedAt
;
# Description fields are for documentation purposes
- name: deployments
props:
- name: projectId
value: string (uuid)
description: Required parameter for the deployments resource.
- name: entryPointUrl
value: string
description: |
An URL of the entry point of the application.
This is the file that will be executed when the deployment is invoked.
- name: importMapUrl
value: string
description: |
An URL of the import map file.
If `null` is given, import map auto-discovery logic will be performed,
where it looks for Deno's config file (i.e. `deno.json` or `deno.jsonc`)
which may contain an embedded import map or a path to an import map file.
If found, that import map will be used.
If an empty string is given, no import map will be used.
- name: lockFileUrl
value: string
description: |
An URL of the lock file.
If `null` is given, lock file auto-discovery logic will be performed,
where it looks for Deno's config file (i.e. `deno.json` or `deno.jsonc`)
which may contain a path to a lock file or boolean value, such as `"lock":
false` or `"lock": "my-lock.lock"`. If a config file is found, the
semantics of the lock field is the same as the Deno CLI, so refer to [the
CLI doc page](https://docs.deno.com/runtime/manual/basics/modules/integrity_checking#auto-generated-lockfile).
If an empty string is given, no lock file will be used.
- name: compilerOptions
value: object
description: |
Compiler options to be used when building the deployment.
If `null` is given, Deno's config file (i.e. `deno.json` or `deno.jsonc`)
will be auto-discovered, which may contain a `compilerOptions` field. If
found, that compiler options will be applied.
If an empty object `{}` is given, [the default compiler options](https://docs.deno.com/runtime/manual/advanced/typescript/configuration#how-deno-uses-a-configuration-file)
will be applied.
- name: assets
value: object
description: |
A map whose key represents a file path, and the value is an asset that
composes the deployment.
Each asset is one of the following three kinds:
1. A file with content data (which is UTF-8 for text, or base64 for binary)
2. A file with a git sha1 hash of the content
3. A symbolic link to another asset
Assets that were uploaded in some of the previous deployments don't need to
be uploaded again. In this case, in order to identify the asset, just provide the
git SHA-1 hash of the content (use `git hash-object -t 'blob' <file>` command to generate).
- name: domains
value: array
description: |
A list of domains that will be attached to the deployment once it's
successfully deployed.
If this field is omitted or `null` is provided, the default domain will be
attached to the deployment, which looks like `projectname-deploymentid.deno.dev`.
If an empty list is provided, no domain will be attached to the deployment.
In this case, the default one will not get attached either.
If a list is provided, only the domains in the list will be attached, but
the default domain will not.
- name: envVars
value: object
description: |
A dictionary of environment variables to be set in the runtime environment
of the deployment.
- name: databases
value: object
description: |
KV database ID mappings to associate with the deployment.
A key represents a KV database name (e.g. `"default"`), and a value is a
KV database ID.
Currently, only `"default"` database is supported. If any other database
name is specified, that will be rejected.
If not provided, the deployment will be created with no KV database
attached.
- name: requestTimeout
value: integer
description: |
The wall-clock timeout in milliseconds for requests to the deployment.
If not provided, the system default value will be used.
- name: permissions
value: object
description: |
Permissions to be set for the deployment.
Currently only `net` is supported, where you can specify a list of IP
addresses and/or hostnames that the deployment is allowed to make outbound
network requests to.
- name: description
value: string
description: |
A description of the created deployment. If not provided, an empty string
will be set.
- name: enableCron
value: boolean
description: |
Enables cron functionality for this deployment. Requires a database to be attached.
When multiple projects share the same database, only the first project to enable crons
will have access to cron management. Other projects sharing the database cannot use crons.
DELETE examples
- delete_deployment
No description available.
DELETE FROM deno.deployment.deployments
WHERE deploymentId = '{{ deploymentId }}' --required
;
Lifecycle Methods
- redeploy_deployment
Success
EXEC deno.deployment.deployments.redeploy_deployment
@deploymentId='{{ deploymentId }}' --required
@@json=
'{
"envVars": "{{ envVars }}",
"databases": "{{ databases }}",
"requestTimeout": {{ requestTimeout }},
"permissions": "{{ permissions }}",
"description": "{{ description }}"
}'
;