--- name: ship-setup description: Set up ship for the first time or add a new VPS host. Saves host config to ~/.config/ship/config.json and installs server dependencies. Use when configuring ship for the first time, or adding/changing a host. argument-hint: "[host-nickname]" --- # ship-setup Configure ship and prepare a VPS for deployments. ## Companion Script Server setup is handled by `setup.sh` in this skill's directory. It is idempotent, handles all branching logic, and mirrors the behavior of the original `ship host init` Go CLI command. ``` skills/ship-setup/setup.sh [--default] ``` ## Config File All ship skills read from `~/.config/ship/config.json`. The setup script creates or updates it — never overwrites the whole file. ```json { "default": "prod", "hosts": { "prod": { "host": "ubuntu@1.2.3.4", "domain": "example.com" }, "staging": { "host": "ubuntu@5.6.7.8", "domain": "staging.example.com" } } } ``` ## Steps ### 1. Read existing config Check if `~/.config/ship/config.json` exists: ```bash cat ~/.config/ship/config.json 2>/dev/null ``` If it exists, show the user the current hosts so they know what's already configured. ### 2. Get host details If not already known, ask the user: - **Nickname** — short name for this host (e.g. `prod`, `staging`) - **SSH connection string** — e.g. `ubuntu@1.2.3.4` or an alias from `~/.ssh/config` - **Base domain** — the domain pointing to this server (e.g. `example.com`) - **Default?** — if this is the first host, make it default. Otherwise ask. ### 3. Run the setup script ```bash bash ~/.claude/skills/ship-setup/setup.sh [--default] ``` The script will: 1. Test the SSH connection — stops early if it fails 2. Detect OS (Ubuntu/Debian only) 3. Install Caddy if not present 4. Configure the main Caddyfile if not already set up 5. Create required directories (`/etc/ship/env`, `/etc/ship/ports`, `/etc/caddy/sites-enabled`, `/var/www`) 6. Enable and start Caddy 7. Save the host to `~/.config/ship/config.json` ### 4. Confirm Tell the user: - Host nickname and SSH target saved - Whether it's the default host - That the server is ready for deployments - How to add another host: `/ship-setup` - How to deploy: `/ship-deploy` ## Notes - Safe to run multiple times — all steps are idempotent - The SSH host can be an alias from `~/.ssh/config` - If a nickname already exists in config, the script overwrites it — confirm with the user first - Default host is used by all other ship skills when no host is specified