> ## Documentation Index
> Fetch the complete documentation index at: https://rakumux.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# A Fly Machine

> An always-on Linux machine on Fly.io for your agents, with your home folder on a volume.

A [Fly Machine](https://fly.io/docs/machines/) is a Linux VM on Fly.io. Here it runs one container
that does nothing but stay up. You connect with `fly ssh console`, and your home folder (Rakumux,
your agents, your code) lives on a volume, so it survives restarts and new deploys.

You need a [Fly.io account](https://fly.io/app/sign-up) and
[`flyctl`](https://fly.io/docs/flyctl/install/), signed in with `fly auth login`.

## Set it up

**1. Write a Dockerfile and fly.toml**

In a new folder, save this as `Dockerfile`:

```dockerfile theme={null}
FROM ubuntu:24.04
RUN apt-get update \
 && apt-get install -y --no-install-recommends ca-certificates curl git less nano openssh-client \
 && rm -rf /var/lib/apt/lists/*
ENV HOME=/root
CMD ["bash", "-c", "if [ -x /root/.local/bin/rakumux ]; then /root/.local/bin/rakumux daemon start; fi; exec sleep infinity"]
```

The last line starts Rakumux's background server whenever the machine starts, so sessions come
back after a restart without you logging in. Then save this as `fly.toml`, with an app name of
your own and the [region](https://fly.io/docs/reference/regions/) nearest you:

```toml theme={null}
app = "rakumux-yourname"
primary_region = "syd"

[build]

[mounts]
  source = "home"
  destination = "/root"

[[vm]]
  size = "shared-cpu-2x"
  memory = "4gb"
```

There's no `[http_service]`: nothing is exposed, and Fly never stops the machine for being idle.

**2. Create the app, its volume and the machine**

```bash theme={null}
fly apps create rakumux-yourname
fly volumes create home --size 20 --region syd
fly deploy --ha=false
```

**3. Install Rakumux**

```bash theme={null}
fly ssh console
```

On the machine:

```bash theme={null}
curl -fsSL https://rakumux.com/install.sh | PREFIX="$HOME/.local" bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
export PATH="$HOME/.local/bin:$PATH"
```

**4. Install your agents and start working**

Install and sign in to your agents as on any Linux machine; whatever goes in your home folder is
kept on the volume. Then run `rakumux` in a project and start sessions as usual. Close the
console whenever you like: the sessions keep running.

## Come back

Run `fly ssh console` from any computer with `flyctl`, then `rakumux`: the same sessions, still
running. Everything in [Your own server](https://rakumux.com/docs/remote/own-server.md) applies, including
[checking on agents from your phone](https://rakumux.com/docs/remote/own-server.md#check-on-agents-from-your-phone).

## Good to know

* **Cost.** About \$25 a month for 2 shared CPUs, 4 GB of memory and a 20 GB volume, running all the
  time. See [Fly's pricing](https://fly.io/docs/about/pricing/).
* **Only your home folder is kept.** Programs installed with `apt` go away on the next deploy; add
  them to the `Dockerfile` instead.
* **The volume lives on one host.** Fly keeps daily snapshots of it, but push your work as you go.
* **Updates.** `U` in Rakumux mode updates Rakumux in your home folder, like anywhere else.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.