# Set up Dargo on this computer (instructions for an AI agent)

You are an AI agent (Claude Code, Codex or similar) helping a user set up **Dargo** on the computer
you are running on. Dargo turns a Windows PC, Mac or Linux machine the user already owns into a home
server: they install self-hosted apps (WordPress, n8n, Nextcloud, Immich, Ghost and 60+ more) from the
Dargo portal, and each app gets its own web address with HTTPS, reachable from anywhere, with no port
forwarding and no router changes.

What you do: check this computer, run the Dargo installer for its operating system with the user's
install token, and confirm it is running. The user then manages apps at https://my.dargo.net.

## Rules

- Install only on the computer you are running on, and only after the user agrees. Say what you will
  run before you run it. Ask before anything that restarts the computer.
- **The Linux install link works exactly once.** Download it to a file a single time, then run that file.
  Never open it in a browser, never fetch it twice, never pipe a second copy.
- The downloaded Linux script contains this device's credentials. Don't repeat them in chat or
  save them anywhere else, and delete the script file when you are done.
- Don't uninstall, stop or edit Dargo, its `dargo` service, its Docker containers or its VM unless the
  user asks you to.
- If a step needs the user (a password, a setup window, a restart), say exactly what to click or type,
  then wait for them.
- If something fails, show the user the last lines of output and stop. Don't improvise workarounds
  like disabling security software.

## Get an install token first

You need the user's install token (32 letters and digits). If the user hasn't given you one, ask them:

> Sign in at https://my.dargo.net (or create a free account there), go to **Devices → Add device → Bring your own
> device**, give the device a name, open the **AI agent** tab and paste me the prompt it shows.
> (If the device already exists, open it and click **Get install token**.)

The portal's prompt contains a link like `https://install.dargo.net/agent/<TOKEN>`. Fetch that link: it is this
guide with the token filled in. Or, given a bare token, use it as `<TOKEN>` below.

Check a token without using it up:

    curl -s -o /dev/null -w '%{http_code}' https://install.dargo.net/api/install-credentials/<TOKEN>

200 = good. 404 = unknown or expired: ask the user for a new one. Don't print that endpoint's body:
it holds the device's credentials.

## 1. Check this computer

Find the operating system and processor:

- Linux / macOS: `uname -sm`; on macOS also `sw_vers -productVersion`.
- Windows (PowerShell): `[Environment]::OSVersion.Version` and `$env:PROCESSOR_ARCHITECTURE`.

Then follow **one** of the sections below. Requirements:

| System | Needs |
|---|---|
| Linux | x86_64, aarch64 or armv7, systemd, `curl`, `sudo`. Ubuntu 18.04+, Debian 10+, Fedora 30+, CentOS 7+ and similar. 2 GB RAM is a comfortable minimum. Docker is installed for you if missing. |
| Windows | Windows 10 (build 17763 or newer) or 11, 64-bit. Setup turns on WSL 2 and may need a restart. |
| Mac | Apple silicon (M1 or newer) with macOS 13 or newer: the Dargo app. Intel Macs or macOS 12: a Terminal script that runs Dargo in a small Ubuntu VM. |

Already installed? On Linux, `systemctl is-active dargo` prints `active`; on Windows and Mac, a Dargo
app exists. Then ask the user whether to reinstall before going on.

## 2a. Linux

Download the installer **once**, then run it as root:

    curl -fsSL https://install.dargo.net/install/<TOKEN> -o dargo-install.sh
    sudo bash dargo-install.sh
    rm -f dargo-install.sh

- If the download is a short message starting with `# Error`, the token is expired or used: stop and
  ask the user for a new one.
- If `sudo` needs a password you can't type, ask the user to run `sudo bash dargo-install.sh` in a
  terminal in the same folder, then continue with the check below (and delete the file afterwards).
- The script installs Docker if needed and the `dargo` service. It takes a few minutes.

Check:

    systemctl is-active dargo
    sudo journalctl -u dargo -n 30 --no-pager

`active` and no repeating errors = done.

## 2b. Windows

In PowerShell (a normal window, no admin needed):

    irm "https://install.dargo.net/win?token=<TOKEN>" | iex

If you run commands through another shell, wrap it:
`powershell -NoProfile -Command "irm 'https://install.dargo.net/win?token=<TOKEN>' | iex"`.

It downloads the signed Dargo installer, checks its SHA-256, installs it for this Windows user and opens
the **Dargo** setup window with the token already filled in. Then tell the user:

> A Dargo window opened. Follow its steps: it turns on WSL 2 (Windows may ask to restart; after the
> restart Dargo continues by itself) and connects this PC to your account. If it asks for an install
> token, paste: `<TOKEN>`

The window is the user's part; you can't click it. Wait until they say it finished.

## 2c. Mac

**Apple silicon and macOS 13 or newer** (the Dargo app):

    curl -fL -o /tmp/Dargo.dmg https://install.dargo.net/mac/Dargo.dmg
    hdiutil attach -nobrowse -mountpoint /tmp/dargo-dmg /tmp/Dargo.dmg
    cp -R /tmp/dargo-dmg/Dargo.app /Applications/
    hdiutil detach /tmp/dargo-dmg
    rm -f /tmp/Dargo.dmg
    printf '%s' '<TOKEN>' | pbcopy
    open -a Dargo

Then tell the user:

> Dargo is open, and your install token is on the clipboard. In the Dargo window, paste it (⌘V) when it
> asks and follow the steps. Setup takes a few minutes; afterwards Dargo lives in the menu bar. Keep this
> Mac awake while you use your apps: a sleeping Mac takes them offline.

**Intel Mac or macOS 12:** the script asks for the token on its own terminal, so the user runs it. Ask
them to open **Terminal** and run (no `sudo`):

    curl -fsSL https://install.dargo.net/mac | bash

and paste `<TOKEN>` when it asks. It installs Multipass (a free Ubuntu VM app) if needed and creates a VM
called `dargo`. Afterwards `multipass info dargo` shows it running.

## 3. Confirm with the user

Tell them:

> Dargo is installed. Open https://my.dargo.net → **Devices**. Your device shows **Online** within a minute or two
> (click **Done** or **Verify connection** if the setup dialog is still open).

## 4. Next: install apps

Apps are installed from the portal; this guide doesn't install them for you. Tell the user how:

1. https://my.dargo.net → **App Store** → pick the app (WordPress, n8n, Nextcloud, Immich, Ghost, …) → **Install**.
2. Choose this device and a free web address (for example `myblog.dargo.app`), or use your own domain.
3. Wait for **Installed**, then open the app's address and finish the app's own first-run setup.

Short videos with the exact steps: https://dargo.net/tutorials (for example
https://dargo.net/tutorials/self-host-wordpress and https://dargo.net/tutorials/self-host-n8n).
You can help with the app itself afterwards: its settings, workflows or content, through its web page.

Help: https://dargo.net/faqs and https://dargo.net/guides.
