--- name: setting-up-devbox description: Starts, connects to, and troubleshoots a PostHog devbox, a remote Coder workspace for PostHog development that can also run the full stack, through `hogli devbox:*` commands. Use when asked to spin up or resume a devbox, open a shell or editor on it, run a command on it, mirror a local checkout to it (devbox:sync), run the PostHog app on it and share a link, clone, update, share, or free disk on a devbox, store gh or Claude Code tokens for it, or diagnose a failing devbox command (tailnet, DNS, Coder CLI version, SSH). Not for running the stack on the local machine or for changing the Coder template in posthog-cloud-infra. --- # Setting up a PostHog devbox A devbox is a Coder workspace on EC2 for PostHog development. Drive it through `hogli devbox:*` and don't reimplement what those commands do. A new box has the repo at `~/posthog` on `master`, prewarmed dependencies, and Claude Code installed. `hogli devbox: --help` has the current flags. This skill covers the order of operations and what the help text leaves out. People use a box in different ways: a shell or editor for general development, a remote target for a local checkout, or a host for the running PostHog app. Work out which one the user wants, and don't start the PostHog stack unless they ask for the app. ## Get a box Copy this checklist and track it: ```text - [ ] 1. hogli devbox:doctor: the tailnet and control plane checks are ok - [ ] 2. hogli devbox:setup has run on this machine - [ ] 3. hogli devbox:start: the box is running - [ ] 4. The user is connected the way they asked for - [ ] 5. hogli devbox:stop when the user is done ``` ### 1. Check access `hogli devbox:doctor` is read-only: it never prompts or changes host config. Commands that reach a box run the same reachability check first, so fix a failure here before anything else. - The active tailnet must be `posthog.com`. Doctor prints it and names a wrong tailnet as the cause. - Every PostHog employee has the route to the Coder control plane through `group:employees` in the tailnet policy. Nobody needs a PR to get access. - If doctor reports the control plane unreachable, read [references/access-troubleshooting.md](references/access-troubleshooting.md) before changing anything. - `[missing] Commit signing agent` does not block starting or using a box. It matters only for signed commits made on the box. ### 2. Set up this machine once `hogli devbox:setup` is interactive, so ask the user to run it in their own terminal. It installs the Coder CLI at the server's version into `~/.hogli/bin`, logs in, installs the pinned mutagen binary for `devbox:sync`, and writes the `coder.*` SSH host entries that `devbox:ssh` and `devbox:exec` use. `~/.hogli/bin` is not on `PATH`, so call that CLI as `~/.hogli/bin/coder` when a step needs `coder` directly. Each optional step has a `--configure-` and `--skip-configure-` flag: `ssh`, `git-identity`, `git-signing`, `region`, `dotfiles`, `claude`. Run it again when a command prints `Coder CLI vX does not match server vY`, because it reinstalls the matching CLI. On Linux, the reachability check can run `sudo tailscale set --accept-routes` and prompt for a password. Run setup interactively once before an agent drives devbox commands unattended. ### 3. Start the box ```bash hogli devbox:start ``` This creates the box on first use and resumes it after a stop. It brings up the PostHog stack only when the workspace has `--start-app` set, which is covered in [Run the PostHog app](#run-the-posthog-app). `--disk` (`100` or `200` GiB) applies only when the box is created. `--region` (`us-east-1` or `eu-central-1`) starts that region's default box and creates it if it doesn't exist, so leave it off when resuming an existing box. A box's region can't change. The default box is `devbox-`, and a labeled box is `devbox--