Deploying to RTEdge.net

Deploying publishes the page you are editing, its exported files and its worker to RTEdge.net, at every route you chose. You deploy from the playground with one keystroke, or from code with edge.save.limit(). This guide covers choosing routes, deploying, adding a message, opening a deployment and deleting it. You sign in to RTCode.io first, with GitHub, Google, Microsoft or Apple.

Choose routes

A route says where a deployment lives. Open the Code dialog with Set Routes… (Alt+R / ⌥+R), Set Title… (Alt+T / ⌥+T), a click on the title or route chip in the toolbar, or the Routes item of the Edge menu (File ▸ Edge). The dialog has three fields: Title, Routes and Editors.

Route syntax

A route is a host plus an optional path. Enter demo/docs for https://demo.rt.ht/docs/, or example.com/docs for https://example.com/docs/. The Routes reference explains the grammar, normalization and invalid entries.

Press Space to commit the chip you are typing and start the next one. Enter moves to the Set button, which reads Deploy when a deploy opened the dialog. Ctrl+Backspace removes a committed chip, and Esc restores the previous values. The first route is the one that Open, Revert and the defaults of edge.size() and edge.versions() use. After a reload, or when code assigns Code.D, the routes are sorted alphabetically, so the first route is then the alphabetically first one. From code, Code.D holds the routes; see Code.

Title

The title becomes the default og:description and <meta name=description> of the deployed page. See Social previews and screenshots. An empty title shows "Untitled", and a title that equals the first route is cleared.

Editors

Use the Editors field to grant other accounts permission to view, edit and redeploy this deployment. See Editors for entry syntax, permissions, and how to add or remove collaborators. The owner publishes changes to this list by deploying.

Deploy

Deploy with a keystroke

Press Ctrl+S / ⌘+S in the editor, or choose File ▸ Edge ▸ Deploy. The playground sends its whole state to every route in the Routes field. If you are not signed in, the user menu opens with "Sign in to deploy." and nothing is sent. If there are no routes, a toast says "No routes to deploy." and the Code dialog opens on Routes with a Deploy button.

While the deploy runs, the favicon turns into a cloud icon, a "Deploying…" toast shows, and closing the tab asks for confirmation. A worker with static URL imports is bundled first, within 60 seconds. The request itself times out after 60 seconds. On success you get one toast for each route, linking to the deployed URL, and a second toast linking route/: for a route whose worker was uploaded. Worker upload errors appear as toasts of their own, with the platform's message. When an editor deploys, the toast reads "<owner> allowed you as editor."

Your first deploy to a name

When you deploy to a name.rt.ht route that you have not claimed yet, the playground claims the name for you if it is free, shows "You have reserved this domain! 🎉" with a Domains button, and deploys. A name that is taken, reserved or too short fails with an error toast, and the Routes dialog opens again so that you can choose another. See Domains and subdomains.

Deploy with a message

Press Ctrl+Alt+S / ⌘+⌥+S, or Alt+click or Alt+Enter on File ▸ Edge ▸ Deploy. A prompt titled "Commit message" appears. Cancel aborts the deploy, and an empty message deploys without one.

The message is stored with the version, not with the route. It becomes one line, because every run of whitespace is collapsed to a single space. Its length is not enforced, but keep it short, about 200 characters. It shows in the version viewer, in Code Size and in edge.versions(). See Versions and Smart Undo.

Deploy to several routes

One deploy publishes the same state to every route. Ownership is checked for all routes before anything is written, and so are the quota and the domain claims. Publishing then runs for each route on its own, so a route can still fail while the others succeed. All routes of one deploy must have the same owner. Each route is charged its full size and its own worker; see Limits and quotas.

Deploy from code

edge.save.limit() deploys from io.eval.js, the console or an agent, with the same checks as the keystroke. It resolves to an object and does not reject for platform errors, so read it:

ok

true when the platform accepted the request. This does not mean that every route was published.

action

'deploy' or 'delete'.

reason

'success', 'error', 'busy' when another deploy or delete is still running, 'cancelled' when you cancelled a dialog, 'missing-user' when you are not signed in, or 'no-routes' for a delete with no routes.

response

The platform's answer. The outcome of each route is in response.D[route], as success or error.

js
const r = await edge.save.limit({ message: 'Tighten hero spacing' })
r.ok ? Object.entries(r.response.D).map(([route, v]) => [route, v.error ?? (v.success ? 'deployed' : 'not deployed')]) : r

Check every route in response.D before you assume that the deploy worked, and open the route to see the result. When there are no routes, or a route fails, the playground opens the Code dialog and waits for you.

When a deploy fails

A failure for a route shows an error toast with a table of details, such as the route, the domain and the account, and the Routes dialog opens again with a Deploy button. Deploy tries once more, and Cancel ends the call with reason: 'error'.

MessageMeaningWhat to do
"Sign in to deploy."You are not signed in. Nothing was sent.Sign in from the user menu.
"Route is not yours."Another account owns the route, or you are an editor whose Editors list differs from the deployed one.Choose another route, or ask the owner.
"Route domain is not yours."The owner of the route has not claimed its domain.Claim the domain, or use another route.
The domain quota is used upYour account cannot claim another domain, or a custom domain.Release a domain you no longer use, or use a name you already hold. See Limits and quotas.
"Your session has expired. Sign in again to deploy!"The signed-in session does not match the playground account. The playground signs you out.Sign in again.
storage quota exhaustedYour deployments are over the size quota or the worker quota. The message does not say which.Delete deployments you no longer need, or shrink the deploy.
invalid old sizeAnother deploy changed the route in the meantime.Deploy again.
common owner requiredThe routes of one deploy have different owners.Deploy them separately.
save failedThe compiler could not be reached or refused the request.Try again.
"Rate limit hit. Try again later!"Deploy requests were sent too quickly.Wait, then deploy again.
"Edge network is not available for public."The platform answered with something other than a result.Try again.

A page to deploy

This page has a worker. Open it in the playground, set a route in the Routes field, and press Ctrl+S / ⌘+S. The link then reaches the deployed worker.

html
<title>Hello</title>
<h1>Hello from the edge</h1>
<a href=:>Ask the worker</a>
<script type=worker edge>
  export default { fetch: () => new Response('Hello from the worker') }
</script>

Open a deployment

Edge: Open… (Ctrl+E / ⌘+E, or File ▸ Edge ▸ Open) opens the first route in a new tab. Edge: Open All Routes… (Ctrl+Shift+E / ⌘+⇧+E) opens every route. From code, edge.open() and edge.open({ all: true }) do the same. With no routes, a toast says "No routes to open." File ▸ Edge ▸ Network opens the network map at rtedge.net.

Right after a deploy, the new tab can still show the previous version for a moment. Reload it. See Freshness after a deploy.

Any deployed URL answers a few suffixes that lead back to the playground and its history:

plain
https://name.rt.ht/     the page
https://name.rt.ht/?    its source, in RTCode.io
https://name.rt.ht/??   its versions
https://name.rt.ht/*    the deployments you can edit

Recent deployments

Edge: Recent Deployments… (Alt+. / ⌥+., or User menu ▸ Routes) opens a drawer with the routes you own, newest first, in pages of 1 to 20 entries (5 by default). Each entry shows the local deploy time and age, a Copy button for the URL, the route, Edit to open its source in a new tab, Versions, and the screenshot of the deploy. Deploys by your editors update your list. Routes you only edit do not appear in it. You must be signed in.

Delete a deployment

Edge: Delete… (Shift+Delete / ⇧+⌦ in the editor, or File ▸ Edge ▸ Delete) asks "Delete this deployment permanently?" and lists the routes. It deletes the deployment of every route in the Routes field. Shift+Enter on the menu item skips the confirmation, and so does Ctrl+Shift+Delete outside the editor, though a browser may take that key for itself. From code, edge.save.limit() deletes too. See its page for the option.

Warning: A delete removes the deployment. Keep a copy of the source you still need.

Owners, editors and savers

The first account to deploy a route is its owner. Each route's owner must hold the domain claim of its host. The owner can change the editor list or delete the deployment; the Editors reference describes the permissions granted to collaborators.

An editor's deploy keeps the owner and the saved editor list, records the editor as the saver, and counts against the owner's quota and domain claim. When the owner deploys again, the saver disappears. Versions and Smart Undo explains deployment history.

See also