Deployments
A deployment is a snapshot of all code and environment variables required to run an application. Deployments are immutable after they have been created. To deploy a new version of the code for an application, a new deployment must be created.
All deployments have a preview URL that can be used to view this specific
deployment. Preview URLs have the format
{project_name}-{deployment_id}.deno.dev
. There can also be other URLs that can
point to a deployment, like custom domains or a project URL. These are explained
in the Projects chapter.
Creating Deployments
There are multiple ways to create a deployment: through the GitHub integration, through deployctl command (or GitHub Action), or through a playground. In all cases the environment variables are copied from the project at the time of creation. Changing environment variables in a project will not have any impact on the environment variables of previously created deployments.
Playgrounds
The easiest way to deploy some code, is via a Deno Deploy playground. You can learn more about the playgrounds here.
Git Integration
The simplest way to create deployments for more complex projects is to link a project to a GitHub repository (more about this projects chapter). In this case, whenever a new commit is pushed to the linked repository, we will automatically pull the application code from the repository and create a new deployment. The status of this process is reported via status check on the commit. This status check can be viewed in the GitHub UI, and it contains a link to the preview URL for that deployment. If a deployment fails (for example, Deno Deploy could not download a dependency), we will show the error in the GitHub status check of the commit and add a comment to the relevant commit in GitHub.
For pushes to the production branch of your repository (usually main
or the
one chosen by you during the link process), we will create a Production
Deployment. Pushes to any other branch will create a Preview Deployment.
deployctl
deployctl
is a command line tool for deploying your code to Deno Deploy, and
it's also a GitHub Action
for the same purpose. You can control more details
of your deployment than the above automatic GitHub integration by using
deployctl
. See the deployctl
page for more
details.
Production vs Preview Deployments
A deployment can either be a production or a preview deployment. These
deployments do not have any differences in runtime functionality. The only
distinguishing factor is that a project's production deployment will receive
traffic from the project URL (e.g. myproject.deno.dev
), and from custom
domains in addition to traffic to the deployment's preview URL.
Logs
Applications can generate logs at runtime using the console API. These logs can
be viewed in real time by navigating to the Logs
panel of a project or
deployment. Logs will be streamed directly from an application to the log panel.
These logs are not persisted. Only logs that are generated after the logs page is opened can be viewed. After closing the logs page, all streamed logs are discarded.
Log messages have a maximum size of 2kb. Messages larger than this are trimmed to 2kb.
Crash Reports
When a deployment crashes (you get a 502 status code as a response) due to an uncaught exception or uncaught rejection in your code, or we terminate the deployment due to overconsumption of resources, we generate a crash report containing the last 100 logs from your deployment.
We generate new crash reports for a deployment if we see errors different from the previously generated crash reports. If same crash report is generated in different regions, we show you the crash report of the first region. We retain the latest hundred crash reports per deployment. Old crash reports are deleted in order of age when you reach the limit of 100 crash reports for a deployment.