Docs

How to run something on cas.run and what to expect of it.

1. Install the CLI

curl -fsSL https://cas.run/install.sh | sh

Linux and macOS. The script downloads the release tarball for your machine, checks it against the release's checksums and puts cas in ~/.local/bin. CAS_INSTALL_DIR chooses another directory and CAS_VERSION another release. Elsewhere, or with Go installed, go install git.mills.io/cas/cas/cmd/cas@latest builds the same binary, and the releases page has every tarball.

2. Log in

Your identity is your GitHub account. cas login connects to the SSH front door on port 2222 with your GitHub login as the username. The key you connect with is checked against the keys on your profile, and on first contact an account is created. A token for the CLI is written to ~/.config/cas/config.json.

cas login <you>

The front door answers plain ssh too. ssh -p 2222 <you>@cas.run token | sh writes the same file, login prints a one-time link that signs you into this site, whoami says who you are, and help lists them all. CAS_ENDPOINT and CAS_TOKEN override the file.

Host key: SHA256:GkpHA8bl7JNhPCJwLAI54ydzG/N4czDj5efDyuI31gs

3. Run a service

A service is one container that cas.run keeps running. Give it an image, and the port it serves HTTP on if it serves any.

cas run -p 80 nginx:alpine
cas run -n site -p 80 -e TZ=UTC -m 128 caddy:2-alpine
cas run -n job --restart no alpine sh -c 'echo hello'
  • -n namethe service name. Without it the image's name is used (nginx:alpine → nginx)
  • -p portthe container port that serves HTTP. The hostname proxies to it
  • -e K=Van environment variable, repeatable. Values are stored and shown back in clear, on the service page and in the API, so rotate anything that leaks
  • -m MBmemory limit in MB (64 by default, 256 at most). It comes out of your units' pool
  • --restartalways (the default) runs it again when it exits. no leaves it stopped
  • -v name:/patha volume: a directory of the service's own, mounted there. It survives restarts and re-creates, counts against your disk, and goes when the service does. Up to four

4. Reach it

Every service with a port has a hostname, with HTTPS already on it:

https://<name>-<login>.cas.run/

The proxy talks plain HTTP to the container's port inside the host, so your container needs no TLS. Websockets pass through. A service that is not running answers with a 503 page.

Your own domain

With a unit beyond the free one, a service can also answer at a hostname you own. Make the name a CNAME to the service's hostname. A bare domain cannot be a CNAME, so point one at cas.run's addresses with A and AAAA records and add a TXT record at _cas.<domain> whose value is the service's hostname. Either record proves the name is yours, and it is checked again at every renewal. Then attach it on the service's page or from a terminal:

  • cas domain web app.example.comattach the hostname. cas domain web - detaches it
  • cas domain webwhere the certificate is at

The certificate is ordered once the name resolves here and renewed with the rest. Until then the page says where the name points instead.

5. Look after it

  • cas psyour services and their state
  • cas logs -f NAMEfollow the container's output
  • cas show NAMEeverything about it
  • cas update NAMEchange its image, port, memory, environment or command in place; the volumes stay. -image, -p, -m, -e as for run
  • cas stop NAMEstop it, and keep it stopped
  • cas start NAMErun it again
  • cas restart NAMErecreate the container
  • cas rm NAMEremove it
  • cas tokensyour CLI tokens. cas token new LABEL mints one, cas token rm ID revokes one
  • cas whoamiwho you are, your units and what you use of them

A container that exits is removed and run again after a short pause that grows each time. After ten exits in a row it is parked as crashloop until you restart it. A service whose starts keep failing instead, because the registry cannot be reached for instance, is parked the same way but tries again on its own: after fifteen minutes, then thirty, then every hour, for a day. The dashboard shows the same services, with their logs.

Pricing, limits, and what is not here yet

You have units. A service smaller than a unit still takes a whole unit, and its CPU share. One that asks for 128 MB takes two units' memory and one unit's slot. The operator can give an account more by hand.

64 MB runs nginx, Caddy, a Go or Rust binary, or a small Python or Node app. A Java virtual machine does not fit.

  • First container free
    64 MB. Your GitHub login is your account.
  • More units A$1 a month or A$10 a year, each
    A unit is one service with 64 MB of memory and a gigabyte of disk. GST included where it applies. Bought on your settings page; cancel any time, and what you paid for stays to the end of the month or year.
  • Units per account up to 8, one free
    Need more than that? Ask.
  • Memory per service 64 MB unless you ask, 256 MB most (four units)
    A bigger one takes more of your pool.
  • Processes per service 64
  • CPU a fair share of one core, with nothing reserved

Not supported: TCP ports other than the one HTTP port, more than one HTTP port, building images here, and private registries. Everything a container writes outside its volumes is lost when it is recreated, and every restart recreates it. Put what matters in a volume. Every night the site's data and every volume are copied to object storage, but not images or a container's own disk. A database in a volume is copied while it runs, so dump it to a file in the volume if you need it whole. Keep a copy elsewhere all the same. Images come from the Docker Hub and other public OCI registries. Images must be public: there is no way to give cas.run a registry login.

Found a bug, or want one of those? Open an issue.

What to expect

A deploy of cas.run restarts the daemon only, and running containers survive it. A reboot of the host restarts every container, so a service is down for a minute or so, and anything it wrote outside a volume is gone. Every night the site's data and every volume are copied to object storage. A free service may be stopped when its owner has not used the site, the API or the SSH door for sixty days. The dashboard starts it again. The machine's own state is at /api/v1/status, as JSON.

Automate it

The CLI and this site use the same API, with the token cas login wrote.

curl -H "Authorization: Bearer $CAS_TOKEN" https://cas.run/api/v1/services

Every route is in the reference, as Markdown.