izc command
izc is the command-line tool inside every cloud workspace. Use it in a terminal of the workspace to check izcode.toml, see the state of your services, follow their logs and run build steps by hand.
izc exists only inside a cloud workspace. On your own computer or an SSH server it reports that it cannot reach the service supervisor. The same information is in the app on the workspace's Services page; see Cloud workspaces.
Commands#
| Command | What it does |
|---|---|
izc services | Lists the services of izcode.toml and their state. izc status is the same. |
izc services --json | The same, as raw JSON. |
izc logs <name> | Prints the recent output of a service or a step. |
izc logs <name> -f | Prints it and keeps following new output. Stop with Ctrl+C. |
izc start <name> | Starts a stopped service. |
izc stop <name> | Stops a service. |
izc restart <name> | Restarts a service. izc restart setup runs the setup steps again. |
izc run <step> | Runs build, release, runtime or cron.<job> once, next to the running services. |
izc build | The same as izc run build. |
izc keepalive --for <duration> | Keeps the workspace awake, for example 2h; at most 24h; 0 clears it. |
izc validate [file] | Checks izcode.toml (or another file) and prints every problem. |
izc serve-static --port <p> --dir <d> [--spa] | Serves a built folder. This is what a kind = "static" service runs. |
izc help | Prints the usage. |
izc services#
The output starts with any problem in izcode.toml, then the state of the setup steps, a release and cron jobs, then one row per service:
izcode.toml: services.bad: `port` must be an integer, found string
setup: ok
NAME STATE PID PORT RESTARTS HEALTH
web running 42 3001 (public) 0 ok
worker crashloop - - 7 -
bad invalid (`port` must be an integer) - - 0 -| State | Meaning |
|---|---|
starting | Started, waiting for its first passing health check |
running | Running (and healthy, if it has a health check) |
unhealthy | The health check failed threshold times in a row; the service is restarted |
stopped | Stopped by you, or exited with code 0 and is not restarted by its restart policy |
crashloop | Exited five times in ten minutes; tried again five minutes later |
failed | Exited with an error and is not restarted by its restart policy |
setup | Waiting for the runtime and setup steps to finish |
setup-failed | A setup step failed, so the service was not started |
invalid | Its section in izcode.toml has an error |
The HEALTH column shows ok, pending, failing: <reason> or - when the service has no check. Cron jobs appear as job cron.<name> [<schedule>]: <state>, exit <code>.
izc logs#
Each service and each step keeps its recent output. Names are service names and these steps:
| Name | Output of |
|---|---|
setup | [setup] |
runtime | Installing [runtime] tools and packages |
build | [build] |
release | [release] |
cron.<job> | A cron job |
Older output is dropped when the buffer is full. With -f, a gap is marked as [izc] … output was lost while catching up ….
izc run and izc build#
Run a release step in the workspace to test it before you release:
izc build
izc logs build -fizc run starts the step and returns right away with build: started (follow it with izc logs build -f). It runs beside the services and does not stop them. A cron job runs in the workspace only this way; on its schedule it runs only in a release.
izc validate#
izc validate
izc validate ./izcode.proposed.tomlizc validate reads the file without changing anything. It checks the file as written and, when that is clean, again with [env.dev] and with [env.prod] applied, so a broken override shows up too:
/workspace/izcode.toml: with [env.prod]: services.web: `port` 80 is out of range (1024-65535: services do not run as root)| Exit code | Meaning |
|---|---|
| 0 | Valid. Prints <file>: ok (N services). |
| 1 | Problems found (one line each), or the file could not be read or is larger than 256 KiB |
| 2 | Unknown command or wrong arguments |
Use it in a script or a Git hook inside the workspace before you release. All messages are listed in the izcode.toml reference.
izc keepalive#
A cloud workspace with nothing going on is suspended after its idle timeout. A long job that runs without a connected app (a training run, a big download) does not count as activity, so keep the workspace awake while it runs:
izc keepalive --for 3h
izc keepalive --for 0The longest is 24 hours. The workspace's details show "kept awake until …". Hosts are always on and need no keepalive.
izc serve-static#
A small web server for a built site: GET and HEAD, index.html for a folder, page.html for a clean URL /page, and 404.html (when present) with status 404 for anything else. With --spa, unknown paths get index.html instead. It never serves files outside the folder. Without --port, it uses the PORT environment variable. You normally do not call it yourself: declare a kind = "static" service.
Related#
- izcode.toml: every key and its limits.
- Deploy an app: from an empty file to a public URL.
- Troubleshooting: what each state and failure means.