Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default defineConfig({
items: [
{ label: "Tailscale Setup", slug: "guides/tailscale" },
{ label: "IAP Setup", slug: "guides/iap" },
{ label: "SSH Provider", slug: "guides/ssh-provider" },
{ label: "Mobile SSH", slug: "guides/mobile-ssh" },
{ label: "Toolchains", slug: "guides/toolchains" },
{ label: "Git & GitHub", slug: "guides/git-github" },
Expand Down
33 changes: 30 additions & 3 deletions docs/src/content/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ vybn uses a modular architecture with swappable provider and network backends.

## Core Concepts

- **Provider** (`VYBN_PROVIDER`): Manages VM lifecycle — create, start, stop, delete. Default: `gcp`
- **Network** (`VYBN_NETWORK`): Manages SSH connectivity and file transfer. Default: `tailscale`
- **Provider** (`VYBN_PROVIDER`): Manages VM lifecycle — create, start, stop, delete. Options: `gcp` (default), `ssh` (bring your own server)
- **Network** (`VYBN_NETWORK`): Manages SSH connectivity and file transfer. Options: `tailscale` (default), `iap` (GCP only)

Provider backends live in `providers/` and network backends in `networks/`. The VM setup script is selected based on the combination: `vm-setup/${VYBN_PROVIDER}-${VYBN_NETWORK}.sh`.

Expand Down Expand Up @@ -72,6 +72,29 @@ SSH connections go through [GCP Identity-Aware Proxy](https://cloud.google.com/i
- Firewall allows IAP SSH range (`35.235.240.0/20`) + deny-all for everything else
- Not available from iOS (no `gcloud`)

## SSH Provider Backend

```
┌─────────┐ bootstrap SSH ┌──────────────────────────┐
│ Laptop │─────────────────►│ Your Server │
│ │ (upload script) │ │
│ vybn │ │ setup script runs: │
│ CLI │ │ ├─ Claude Code │
│ │ Tailscale mesh │ ├─ toolchains │
│ Phone │◄────────────────►│ ├─ Tailscale │
│ Tablet │ (after setup) │ └─ tmux session "claude" │
└─────────┘ └──────────────────────────┘
```

The SSH provider deploys to an existing server you manage. Instead of creating a VM, `vybn deploy` uploads the assembled setup script via SCP and executes it over SSH. Once setup completes and Tailscale enrolls, the server is reachable through the tailnet like any other vybn VM.

**Characteristics:**

- No cloud API required — works with any SSH-accessible server
- The bootstrap SSH connection (used during deploy) is separate from the Tailscale mesh used afterward
- `start`/`stop` are not available — the user manages server lifecycle externally
- `destroy` deregisters from Tailscale and cleans up local state without modifying the remote server

## Project Structure

```
Expand All @@ -97,14 +120,16 @@ vybn/
│ ├── switch_network.sh # switch-network command
│ └── add_key.sh # add-key command
├── providers/ # Cloud provider backends
│ └── gcp.sh # Google Cloud Platform
│ ├── gcp.sh # Google Cloud Platform
│ └── ssh.sh # Bring your own VM (SSH)
├── networks/ # Network connectivity backends
│ ├── iap.sh # Identity-Aware Proxy
│ └── tailscale.sh # Tailscale mesh
├── vm-setup/ # VM startup scripts
│ ├── base.sh # Shared setup functions
│ ├── gcp-iap.sh # GCP + IAP variant
│ ├── gcp-tailscale.sh # GCP + Tailscale variant
│ ├── ssh-tailscale.sh # SSH + Tailscale variant
│ └── toolchains/ # Composable toolchain modules
│ ├── node.sh # nvm + Node.js LTS
│ ├── python.sh # pyenv + Python 3
Expand All @@ -129,3 +154,5 @@ At deploy time, the VM's startup script is assembled by concatenating several la
6. **User script** — contents of `VYBN_SETUP_SCRIPT`, if configured

Configuration is baked directly into the script header rather than read from cloud metadata at runtime. This makes the startup script self-contained and debuggable — you can read the full assembled script in the GCP serial console or setup log.

For the SSH provider, the same assembly process produces the script locally. Instead of being passed as GCP startup metadata, the script is uploaded to the server via SCP and executed over SSH.
45 changes: 33 additions & 12 deletions docs/src/content/docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ vybn init
- `-f, --force` — back up and overwrite existing `~/.vybnrc` without prompting

The wizard prompts for:
- Provider (GCP or SSH)
- Network backend (Tailscale or IAP)
- GCP project and zone
- VM name, machine type, and disk size
- Provider-specific settings (GCP project/zone or SSH server details)
- VM name, machine type, and disk size (GCP) or hostname (SSH)
- Tailscale auth key (if using Tailscale)
- Toolchains, extra packages, and custom setup scripts

Expand All @@ -61,10 +62,13 @@ vybn deploy

- `-y, --yes` — skip the confirmation prompt
- `--connect` — after deploy completes, attach to the tmux session
- `--script-only` — output the assembled setup script to stdout and exit (does not deploy)

Before creating the VM, `deploy` shows a summary with estimated monthly cost (based on the selected machine type and disk size) and asks for confirmation. Use `-y` to skip this.
Before creating the VM, `deploy` shows a summary with estimated monthly cost (GCP) or server details (SSH) and asks for confirmation. Use `-y` to skip this.

This provisions a GCP VM, runs the setup script (installs Claude Code native binary, selected toolchains, extra packages, tmux), and configures the network backend. The VM is ready to use once the command completes.
**GCP provider:** provisions a VM, runs the setup script as startup metadata, and waits for the VM to become reachable.

**SSH provider:** uploads the setup script to the server via SCP and executes it over SSH. The server must already be running and accessible.

## connect

Expand Down Expand Up @@ -123,6 +127,10 @@ Start a stopped VM. Waits until the VM is reachable via SSH before returning.
vybn start
```

:::note
GCP only. The SSH provider does not manage server lifecycle — start your server directly.
:::

## stop

Stop the VM to save on compute costs. Disk is preserved.
Expand All @@ -135,6 +143,10 @@ vybn stop

- `-y, --yes` — skip the confirmation prompt

:::note
GCP only. The SSH provider does not manage server lifecycle — stop your server directly.
:::

:::note
tmux sessions run in memory and don't survive a stop/start cycle. Your repos and files on disk persist. Create new sessions with `vybn connect` or `vybn session` after restarting.
:::
Expand All @@ -151,9 +163,9 @@ vybn destroy

- `-y, --yes` — skip the confirmation prompt (which normally requires typing the VM name)

:::caution
This deletes the VM's boot disk and all data on it. This action is not reversible.
:::
**GCP provider:** deletes the VM, its boot disk, and all associated network infrastructure. This action is not reversible.

**SSH provider:** deregisters from Tailscale and cleans up local state files. The remote server itself is not modified or deleted.

## status

Expand All @@ -171,13 +183,22 @@ Validate that all prerequisites are met before deploying.
vybn check
```

Runs all checks and reports pass/fail for each:
- gcloud CLI installed
- gcloud authenticated (prints account)
- GCP project configured (prints project ID)
Runs provider-specific checks and reports pass/fail for each.

**GCP provider:**
- gcloud CLI installed and authenticated
- GCP project configured
- Compute Engine API enabled
- Network-specific checks (Tailscale CLI, auth key, etc.)
- VM setup script exists for the provider/network combination

**SSH provider:**
- SSH client installed
- `VYBN_SSH_HOST` configured
- SSH key readable (if set)
- SSH connectivity to the server
- Tailscale CLI and auth key

Both providers also verify the VM setup script exists for the provider/network combination.

Exits 0 if all checks pass, 1 if any fail. Run this before `vybn deploy` to catch configuration issues early.

Expand Down
46 changes: 38 additions & 8 deletions docs/src/content/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The easiest way to configure vybn is with the init wizard:
vybn init
```

This walks you through network backend, GCP project, machine type, Tailscale auth key, and other settings, then writes `~/.vybnrc` for you.
This walks you through provider, network backend, GCP project (or SSH server details), machine type, Tailscale auth key, and other settings, then writes `~/.vybnrc` for you.

You can also create the file manually from the included template:

Expand All @@ -23,26 +23,39 @@ All settings can also be set as environment variables.

| Variable | Default | Description |
|----------|---------|-------------|
| `VYBN_PROVIDER` | `gcp` | Cloud provider backend |
| `VYBN_PROVIDER` | `gcp` | Cloud provider backend (`gcp` or `ssh`) |
| `VYBN_NETWORK` | `tailscale` | Network backend (`tailscale` or `iap`) |
| `VYBN_VM_NAME` | *(auto-generated petname)* | VM instance name (`claude-<adj>-<animal>`) |
| `VYBN_ZONE` | `us-west1-a` | GCP zone |
| `VYBN_MACHINE_TYPE` | `e2-standard-2` | Machine type (CPU/RAM) |
| `VYBN_DISK_SIZE` | `30` | Boot disk size in GB |
| `VYBN_USER` | `claude` | VM user account |
| `VYBN_PROJECT` | *(auto-detected)* | GCP project ID |
| `VYBN_TMUX_SESSION` | `claude` | tmux session name |
| `VYBN_TERM` | `xterm-256color` | Terminal type for tmux sessions |
| `VYBN_EXTERNAL_IP` | `false` | Assign public IP to VM (forced `true` for Tailscale) |
| `VYBN_QUIET` | `false` | Suppress info/success output (`--quiet` flag) |
| `VYBN_VERBOSE` | `false` | Enable trace output (`--verbose` flag) |

## GCP Settings
## GCP Provider Settings

These apply when using `VYBN_PROVIDER=gcp` (the default).

| Variable | Default | Description |
|----------|---------|-------------|
| `VYBN_ZONE` | `us-west1-a` | GCP zone |
| `VYBN_MACHINE_TYPE` | `e2-standard-2` | Machine type (CPU/RAM) |
| `VYBN_DISK_SIZE` | `30` | Boot disk size in GB |
| `VYBN_PROJECT` | *(auto-detected)* | GCP project ID |
| `VYBN_EXTERNAL_IP` | `false` | Assign public IP to VM (forced `true` for Tailscale) |
| `VYBN_GCP_SCOPES` | `compute-ro,logging-write,storage-ro` | GCP API scopes assigned to the VM |

## SSH Provider Settings

These apply when using `VYBN_PROVIDER=ssh`.

| Variable | Default | Description |
|----------|---------|-------------|
| `VYBN_SSH_HOST` | *(none, required)* | Remote hostname or IP address |
| `VYBN_SSH_USER` | *(current user)* | SSH user for the bootstrap connection |
| `VYBN_SSH_KEY` | *(none)* | Path to SSH private key (uses SSH agent if unset) |
| `VYBN_SSH_PORT` | `22` | SSH port for the bootstrap connection |

## Claude Code

| Variable | Default | Description |
Expand Down Expand Up @@ -146,6 +159,23 @@ VYBN_ZONE="europe-west1-b"
VYBN_VM_NAME="claude-work"
```

### SSH Provider

```bash
# ~/.vybnrc

# Use an existing server
VYBN_PROVIDER="ssh"

# Server connection details
VYBN_SSH_HOST="dev.example.com"
VYBN_SSH_USER="ubuntu"
VYBN_SSH_KEY="$HOME/.ssh/id_ed25519"

# Tailscale auth key (required for deploy)
VYBN_TAILSCALE_AUTHKEY="tskey-auth-..."
```

### Custom Setup Script

For project-specific configuration beyond packages and toolchains, point `VYBN_SETUP_SCRIPT` to a local shell script:
Expand Down
40 changes: 37 additions & 3 deletions docs/src/content/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ description: Install vybn and deploy your first cloud VM with Claude Code.

Need help setting these up? See the [Prerequisites guide](/guides/prerequisites/) for a full walkthrough.

**GCP provider** (default):

- [Google Cloud SDK](https://cloud.google.com/sdk/docs/install) (`gcloud`) — authenticated with a project
- SSH client — comes with macOS/Linux
- A GCP project with billing enabled
- [Tailscale](https://tailscale.com/download) — installed and logged in on your local machine
- A Tailscale auth key — generate at the [admin console](https://login.tailscale.com/admin/settings/keys)

**SSH provider** (bring your own server):

- SSH client — comes with macOS/Linux
- An accessible server (Ubuntu 22.04+/Debian 12+) with root or sudo
- [Tailscale](https://tailscale.com/download) — installed and logged in on your local machine
- A Tailscale auth key — generate at the [admin console](https://login.tailscale.com/admin/settings/keys)

:::note[Using IAP instead of Tailscale?]
For IAP networking (alternative to Tailscale): no additional prerequisites beyond `gcloud`. See the [IAP Setup guide](/guides/iap/).
For IAP networking (GCP only, alternative to Tailscale): no additional prerequisites beyond `gcloud`. See the [IAP Setup guide](/guides/iap/).
:::

## Installation
Expand Down Expand Up @@ -79,7 +87,7 @@ vybn deploy
vybn connect
```

The wizard asks for your Tailscale auth key, GCP project, machine type, and other settings. It writes a validated `~/.vybnrc` for you.
The wizard asks for your provider, network backend, Tailscale auth key, GCP project (or SSH server details), machine type, and other settings. It writes a validated `~/.vybnrc` for you.

After deploy, the VM is reachable from any device on your tailnet — including iOS via [Termius](https://termius.com/) or any SSH client.

Expand All @@ -104,16 +112,42 @@ vybn connect

`vybn init` handles the network choice — select `iap` when prompted for the network backend.

## Quick Start (SSH Provider)

Use an existing server instead of provisioning a GCP VM.

```bash
# 1. Run the setup wizard — select "ssh" as the provider
vybn init

# 2. Deploy Claude Code to your server
vybn deploy

# 3. Connect
vybn connect
```

The wizard asks for your server's hostname, SSH user, and Tailscale auth key. vybn uploads and runs the setup script over SSH. See the [SSH Provider guide](/guides/ssh-provider/) for details.

## What happens on deploy

When you run `vybn deploy`, the following happens:

**GCP provider:**

1. A GCP VM is created running Ubuntu 24.04
2. A startup script installs Claude Code CLI (native binary with checksum verification), selected toolchains (Node.js by default), and tmux
3. Any extra apt/npm packages from your config are installed
4. Network infrastructure is configured (Tailscale enrollment or IAP firewall rules)
5. The VM becomes reachable via the selected network backend

**SSH provider:**

1. The setup script is assembled locally and uploaded to your server via SCP
2. The script runs over SSH, installing Claude Code, toolchains, and tmux
3. Tailscale is installed and enrolled on your tailnet
4. The server becomes reachable via Tailscale

After deploy completes, run `vybn connect` to drop into a tmux session. Claude Code will prompt you to log in on first launch.

## Sessions persist across disconnects
Expand Down
Loading