Skip to content

Commit 14ec629

Browse files
lucacasonatophilhawksworththisisjofrank
authored
Document new predefined env vars in EA (#2401)
Co-authored-by: Phil Hawksworth <phil@deno.com> Co-authored-by: Jo Franchetti <jofranchetti@gmail.com>
1 parent 866cee0 commit 14ec629

File tree

2 files changed

+149
-16
lines changed

2 files changed

+149
-16
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
title: Builds
3+
description: "Detailed explanation of the build process in Deno Deploy Early Access, covering build triggers, stages, configuration options, caching, and the build environment."
4+
---
5+
6+
:::info
7+
8+
You are viewing the documentation for Deno Deploy<sup>EA</sup>. Looking for
9+
Deploy Classic documentation? [View it here](/deploy/).
10+
11+
:::
12+
13+
In Deno Deploy<sup>EA</sup>, each version of your application code is
14+
represented as a revision (or build). When deploying from GitHub, revisions
15+
generally map one-to-one to git commits in your repository.
16+
17+
## Build triggers
18+
19+
Builds can be triggered in two ways:
20+
21+
- **Manually**: Using the "Deploy Default Branch" button on the builds page,
22+
which deploys the default git branch (usually `main`). The dropdown menu lets
23+
you select a different branch.
24+
25+
- **Automatically**: When a new commit is pushed to a GitHub repository linked
26+
to your app.
27+
28+
## Build stages
29+
30+
A revision goes through these stages before becoming available:
31+
32+
1. **Queuing**: The revision waits to be assigned to a builder.
33+
2. **Preparing**: A builder downloads the source code and restores any available
34+
build caches.
35+
3. **Install**: The install command executes (if specified), typically
36+
downloading dependencies.
37+
4. **Build**: The build command executes (if specified), creating a build
38+
artifact that is uploaded to the runtime infrastructure.
39+
5. **Warm up**: The application is booted to check that no errors occur during
40+
startup.
41+
6. **Route**: The global infrastructure is configured to route requests to the
42+
new revision based on its timelines.
43+
44+
If any step fails, the build enters a "Failed" state and does not receive
45+
traffic.
46+
47+
Build logs are streamed live to the dashboard during the build process and
48+
remain available on the build page after completion.
49+
50+
Build caching speeds up builds by reusing files that haven't changed between
51+
builds. This happens automatically for framework presets and the `DENO_DIR`
52+
dependency cache.
53+
54+
You can cancel a running build using the "Cancel" button in the top-right corner
55+
of the build page. Builds automatically cancel after running for 5 minutes.
56+
57+
## Build configuration
58+
59+
Build configuration defines how to convert source code into a deployable
60+
artifact. You can modify build configuration in three places:
61+
62+
- During app creation by clicking "Edit build config"
63+
- In app settings by clicking "Edit" in the build configuration section
64+
- In the retry drawer on a failed build's page
65+
66+
When creating an app, build configuration may be automatically detected from
67+
your repository if you're using a recognized framework or common build setup.
68+
69+
### Configuration options
70+
71+
- **Framework preset**: Optimized configuration for supported frameworks like
72+
Next.js or Fresh. [Learn more about framework integrations](./frameworks/).
73+
74+
- **Install command**: Shell command for installing dependencies, such as
75+
`npm install` or `deno install`.
76+
77+
- **Build command**: Shell command for building the project, often a task from
78+
`package.json` or `deno.json`, such as `deno task build` or `npm run build`.
79+
80+
- **Runtime configuration**: Determines how the application serves traffic:
81+
- **Dynamic**: For applications that respond to requests using a server (API
82+
servers, server-rendered websites, etc.)
83+
- **Entrypoint**: The JavaScript or TypeScript file to execute
84+
- **Arguments** (optional): Command-line arguments to pass to the
85+
application
86+
- **Static**: For static websites serving pre-rendered content
87+
- **Directory**: Folder containing static assets (e.g., `dist`, `.output`)
88+
- **Single page app mode** (optional): Serves `index.html` for paths that
89+
don't match static files instead of returning 404 errors
90+
91+
## Build environment
92+
93+
The build environment runs on Linux using either x64 or ARM64 architecture.
94+
Available tools include:
95+
96+
- `deno` (same version as at runtime)
97+
- `node`
98+
- `npm`
99+
- `npx`
100+
- `yarn` (v1)
101+
- `pnpm`
102+
- `git`
103+
- `tar`
104+
- `gzip`
105+
106+
:::info
107+
108+
All JavaScript inside of the builder is executed using Deno.
109+
110+
The `node` command is actually a shim that translates Node.js invocations to
111+
`deno run`. Similarly, `npm`, `npx`, `yarn`, and `pnpm` run through Deno rather
112+
than Node.js.
113+
114+
:::
115+
116+
Environment variables configured for the "Build" context are available during
117+
builds, but variables from "Production" or "Development" contexts are not.
118+
[Learn more about environment variables](./env-vars-and-contexts/).
119+
120+
The following environment variables are additionally always available during
121+
builds:
122+
123+
- `CI`: `true`
124+
- `DENO_DEPLOY`: `true` - Indicates that the code is running in Deno Deploy.
125+
- `DENO_DEPLOY_ORGANIZATION_ID`: The ID of the organization that owns the
126+
application. This is a UUID.
127+
- `DENO_DEPLOY_ORGANIZATION_SLUG`: The slug of the organization that owns the
128+
application. This is the human-readable identifier used in URLs that was set
129+
when creating the organization.
130+
- `DENO_DEPLOY_APPLICATION_ID`: The ID of the application. This is a UUID.
131+
- `DENO_DEPLOY_APPLICATION_SLUG`: The slug of the application. This is the
132+
human-readable identifier used in URLs that was set when creating the
133+
application, or changed later in the application settings.
134+
- `DENO_DEPLOY_BUILD_ID`: The ID of the currently running build.
135+
136+
Builders have 8 GB of storage available during the build process.

deploy/reference/env_vars_and_contexts.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,24 +140,21 @@ Environment variables have the following limits:
140140

141141
Deno Deploy provides these predefined environment variables in all contexts:
142142

143-
- `DENO_DEPLOY=1`: Indicates that the application is running in the Deno Deploy
144-
environment.
145-
143+
- `DENO_DEPLOY`: `true` - Indicates that the code is running in Deno Deploy.
144+
- `DENO_DEPLOY_ORGANIZATION_ID`: The ID of the organization that owns the
145+
application. This is a UUID.
146+
- `DENO_DEPLOY_ORGANIZATION_SLUG`: The slug of the organization that owns the
147+
application. This is the human-readable identifier used in URLs that was set
148+
when creating the organization.
149+
- `DENO_DEPLOY_APPLICATION_ID`: The ID of the application. This is a UUID.
150+
- `DENO_DEPLOY_APPLICATION_SLUG`: The slug of the application. This is the
151+
human-readable identifier used in URLs that was set when creating the
152+
application, or changed later in the application settings.
153+
- `DENO_DEPLOY_BUILD_ID`: The ID of the currently running build.
146154
- `DENO_DEPLOYMENT_ID`: A unique identifier representing the entire
147-
configuration set (application ID, revision ID, context, and environment
148-
variables). Changes if any of these components change.
149-
150-
- `DENO_DEPLOY_ORG_ID`: The ID of the organization the application belongs to.
151-
152-
- `DENO_DEPLOY_ORG_SLUG`: The slug of the organization the application belongs
153-
to.
154-
155-
- `DENO_DEPLOY_APP_ID`: The ID of the application.
156-
157-
- `DENO_DEPLOY_APP_SLUG`: The slug of the application.
158-
155+
configuration set (application ID, build ID, context, environment variables,
156+
cloud connections, database). Changes if any of these components change.
159157
- `DENO_DEPLOY_BUILD_ID`: The ID of the currently running revision.
160-
161158
- `DENO_TIMELINE`: The timeline the application is currently running in.
162159
Possible values are `production`, `git-branch/<branch-name>`, and
163160
`preview/<revision-id>`. This is not set during builds, as builds are not

0 commit comments

Comments
 (0)