Deploy an app
This tutorial takes a project from a cloud workspace to a public URL: describe it in izcode.toml, run it in the workspace, make the workspace a host, and serve a release that was built, migrated and health-checked before it took traffic.
Before you start, open your project in a cloud workspace. If it is still on your computer, run Remote: Move Workspace to Remote… and choose Cloud.
The path of a release#
Runtimes, setup, build, release steps and services, in one file at the root of /workspace.
Runtime and setup run, then the services with [env.dev]: your dev server with reload.
A copy of the workspace boots on its own machine: runtime, build, release, then services with [env.prod].
Only when every step succeeded and every service is healthy does the URL switch. Otherwise the previous version keeps serving.
Deploy#
- Create izcode.toml
Run Cloud: Create izcode.toml from the Command Palette. IZ Code looks at your project (language, framework, package manager, versions) and writes a version 2 file. If several apps match, or the folder is a monorepo with
apps/,packages/orservices/, it asks which one. Ifizcode.tomlalready exists, the proposal goes toizcode.proposed.tomlso you can compare. - Read the NOTE lines The top of the file lists what IZ Code could not decide for you, for example "The server must listen on the PORT environment variable and on 0.0.0.0." Fix your app or the file, then delete the note.
- Save and check
When you save, problems appear in the Problems panel. In a terminal of the workspace,
izc validatechecks the file with both[env.dev]and[env.prod]. - Watch it run in the workspace
Open the workspace page ▸ Services, or run
izc services. The runtime and setup steps run first (state Setting up), then your services start. Show logs orizc logs web -fshows their output. - Try the release steps
Run
izc buildandizc logs build -fin the workspace. A build that fails here fails in a release too. Runizc run releaseonly if your release step is safe to repeat, such as migrations. - Make the workspace a host
On the workspace's Overview, choose Make host and pick a name. The URL
https://<name>.t1s.ionow serves the live workspace. See Host your app. - Add production secrets
On Environment secrets, choose prod and add what production needs, such as
DATABASE_URL. Values are encrypted and never shown again. Secrets in dev go to the workspace only. - Release On Releases, choose Release, add optional notes and keep Serve it when ready on. The workspace keeps running; its disk is frozen for a few seconds at the end of the copy.
- Wait for Serving The release goes from Copying… to Ready and Deploying…, then Running. The URL switches to it when it is Serving. You also get a notification.
If the release fails#
flowchart TD
rel["New release"] --> ok{"Steps and health OK?"}
ok -- "Yes" --> serve(["Serving: URL switches"])
ok -- "No" --> failed["Failed, with reason and Log"]
failed --> prev(["Previous version keeps serving"])
failed --> fix["Fix in the workspace, izc build"]
fix --> relA release fails when a step exits with an error, a service crash-loops or fails its health check, or izcode.toml is invalid. The release is marked Failed with the reason and a Log. The previous release, or the live workspace, keeps serving.
A release that failed because of izcode.toml or your code is not retried. Fix it in the workspace, check with izc build and izc logs build, and create a new release.
A minimal file#
If your project is not detected, IZ Code writes a short commented file instead. The smallest useful version 2 file for a Node server looks like this:
version = 2
[runtime]
node = "22"
[setup]
command = "npm ci"
watch = ["package-lock.json"]
[build]
command = "npm run build"
[services.web]
command = "npm start"
port = 3001
public = true
health = { http = "/", grace = "60s" }
[env.dev]
services.web.command = "npm run dev -- --port $PORT"Good to know#
| Topic | Detail |
|---|---|
| Ports | 1024–65535, not 3000. Your app reads the port from PORT. |
| Address | Listen on 0.0.0.0, not localhost. |
| Runtimes | Installed with mise from [runtime]. The first install downloads them, so the first setup takes longer. |
| Build time | [build] may take up to 30 minutes by default; set timeout up to 2 hours for large Rust or Java builds. |
| Every boot | A release machine runs runtime, build and release at every boot, including a rollback to it. Keep the release step safe to run twice. |
| Cron | [cron.*] jobs run only in releases, in UTC. Test them with izc run cron.<name>. |
| Containers | There is no Docker in the workspace. Describe the app with izcode.toml instead of a Dockerfile. |