Skill instructions
ci5.33 KB
View saved version →
---
name: ci
description: Wire a repository's CI pipeline to deploy to Gagarin Cloud on push — mint a scoped deploy credential, store it as a secret, and write the workflow. Use when the user asks to set up continuous deployment, automate deploys, or deploy from GitHub Actions or another CI system to Gagarin.
---
You wire this repository's CI to deploy to Gagarin Cloud on push.
Read the `gagarin` skill of this plugin before anything else: its **"Setting up
CI"** section is the recipe. What follows is the order of work and the rules
you must not break. If your host offers subagents, run the rest of this in one:
it is a long procedure, and the main conversation only needs its report.
Everything here runs on the machine that holds the repository. If you cannot
run commands where you are (ChatGPT on the web, for instance), hand the user
the recipe instead — the `gg creds create` line and the workflow — and say
which secret to set where. Do not try to do it over the MCP tools: no tool
there hands out a secret, by design.
## The order
1. **`gg whoami`** — you need a working credential to mint one from. If there is
none, stop and tell the user to run this plugin's `setup` skill
(`/gagarin:setup` in Claude Code).
2. **Find out what CI they use.** Look for `.github/workflows/`, `.gitlab-ci.yml`,
`.buildkite/`, `cloudbuild.yaml`. Ask if it is ambiguous. Do not assume GitHub.
`git remote get-url origin` says where the repository lives.
3. **Check the forge CLI.** On GitHub that is `gh auth status`; on GitLab,
`glab auth status`. If it is missing or not signed in, say so before minting
anything: ask the user to install it and run `gh auth login` / `glab auth
login` themselves, or to set the secret by hand (see below). Do not sign in
for them.
4. **Confirm the project and service names** and which branch should deploy.
Read `.gagarin.json` at the repository root first — the note of which
project this is, if a deploy left one — then `gg status` or `gg projects`
rather than guessing. If the two disagree, the API is right. Do not write
the note here if it is absent: that is the deploy's job, and there may be
no project yet.
5. **Mint a credential straight into the secret store**, named for where it
will live (`"github actions: <owner>/<repo>"`) — the one-line pipe in the
rule below, never `gg creds create` on its own, which prints it.
6. **Write the workflow.** Install gg, `gg registry login`, build and push
tagged with the commit, deploy, then `gg status`.
7. **Tell them what to check** on the first run — and, once they have pushed,
watch it with the forge CLI (the skill's "Watch the first run").
## Rules that are not negotiable
- **Never run `gg login` in CI, and never copy this machine's credential into
it.** A pipeline gets one of its own.
- **The minted secret must never reach the transcript, a file, or your output.**
`gg creds create` prints it to stdout alone on its line, everything else to
stderr, precisely so it can be piped without touching disk:
```sh
gh secret set GAGARIN_TOKEN --body "$(gg creds create --name "github actions: acme/web" 2>/dev/null)"
```
On GitLab, the same shape:
```sh
glab variable set GAGARIN_TOKEN --masked --value "$(gg creds create --name "gitlab ci: acme/web" 2>/dev/null)"
```
Run it as one command. Do not capture it into a shell variable you later echo,
do not print it "to confirm", and do not write it into a file — not even a
temporary one. It is shown once; Gagarin keeps only a hash. If the user needs
it again they revoke and mint another.
- **No signed-in forge CLI means you do not mint it.** There is no route from
here to the secret store that skips your output. Hand the user the
`gg creds create --name "…"` command to run in their own terminal and say
where in the CI settings to paste it.
- **`gg registry login` is not optional** before any `gg build --push`,
`gg push` or `gg registry copy`. Docker has no
Preview of the first 4,000 characters. Read full instructions →
gagarin145 KB
View saved version →
---
name: gagarin
description: Deploy and operate applications on Gagarin with the gg CLI — ship a service from a Dockerfile, provision postgres, qdrant, valkey, iggy, rabbitmq, s3 or external-credential resources, wire what may reach what, put a service on the internet, give CI its own credential, start jobs from an application's own code with the Go, Node or Python SDK, read status and logs, roll back, tear things down, and keep what a session learned in the project's memory. Use whenever the user asks to deploy, host, run or operate an application, or mentions Gagarin or gg. Gagarin runs container images on managed infrastructure; the user never needs to know about Kubernetes, ingress, TLS, or the underlying cloud.
---
# Deploying with Gagarin
Gagarin runs your services. You drive it with the `gg` CLI, a thin wrapper over
the Gagarin API. There is exactly one way to change anything: call the API.
There is no manifest file and no config file. The one file you will commit is
a note of which project the repository is, and it changes nothing — see "Which
project this repository is".
Everything below is the whole product. Read "The ten rules" and the command map
first; they are the parts that stop you getting it wrong.
## The ten rules
1. **Everything is named for its project.** `shop` is a project; `shop/web` is a
service or a resource inside it. Nothing is inferred from the directory you
stand in. There is no default project to configure — a command that does not
name one is refused with the shape it should have had.
2. **Every write is asynchronous, except `gg run`.** A command that exits zero
recorded a demand; it did not watch it come true. `gg status <project>` reads
the cluster and is the only thing that can answer "is it up". The one
exception is `gg run`, and it is an exception because a run *ends*: it waits,
prints what the run wrote, and exits with the script's own code. Nothing else
here has an end to wait for.
3. **Gagarin runs images from its own registry only.** `gg ship` is build, push
and deploy fused; the three exist separately for CI. Somebody else's image
comes in with `gg registry copy`.
4. **A service is private until `gg domain add`**, and a deploy can neither give
an address nor take one away.
5. **A private service is default-denied.** Until the *caller* declares
`gg deps add`, its calls are dropped — which hangs, rather than failing fast.
6. **`gg deps add <service> <resource>` opens the route *and* hands over the
credentials.** Connecting a database is that one call, not a call plus a
deploy.
7. **A deploy replaces the environment and nothing else.** Dependencies, the
domain, the volume, the size and the replica count all survive a deploy that
forgets to mention them. Env is the one thing you must restate every time.
**A credential never goes in a deploy env.** Env is for plain, single-service
config: a port, a log level, a sibling's URL. A database password arrives
with `gg deps add`; a third-party key is an `external` resource. See "What
does not go in env" below.
**And no secret value ever passes through your output** — not the
terminal, not this chat, not a summary or a commit. A command that takes one
reads it from a file (`--env-file`, `--input NAME=FILE`, `"$(cat FILE)"`),
never `K=value` typed on a command line; a command that produces one writes
it to a file or pipes it into the store it is for (`> .env.db`,
`| gh secret set`). Reach for `--names` before values. Never ask your human
to paste a secret into the chat.
8. **If a resource type exists, use it** (`postgres`, `qdrant`, `valkey`,
`iggy`, `rabbitmq`, `s3`, `external`). If one does not, an ordinary service with a volume is the normal
path, not a workaround.
9. **You can deploy; you cannot destroy.** Deleting anything, taking an address
away, withdrawing a dependency with `gg deps rm`, and handing a project over
with `gg transfer` all answer
Preview of the first 4,000 characters. Read full instructions →
setup6.46 KB
View saved version →
---
name: setup
description: Get this machine ready to deploy on Gagarin Cloud — install the gg CLI if it is missing, sign in, and check the rest of the toolchain (docker, git, gh or glab). Use when the user asks to set up, install or configure Gagarin, or when gg is not found.
---
Get the user ready to use Gagarin Cloud. Work through this in order and stop at
the first step that needs them.
If you cannot run commands where you are (ChatGPT on the web, for instance),
none of this is yours to do: tell the user that `gg` is installed on the machine
that holds their source, with the one-liner on https://gagarin.cloud or a
package manager, and that from here the Gagarin MCP tools cover everything
except building and pushing an image. Stop there.
## 1. Is `gg` already here?
Run `command -v gg`. If it finds nothing, look where the installer puts it:
`~/.local/bin/gg` (Windows: `%LOCALAPPDATA%\Programs\gg\gg.exe`). If either is
there, run `gg version` (by its full path if it is not on `PATH`) and skip to
step 3. If it is installed but not on `PATH`, give the user the same `PATH`
advice as step 2 does.
## 2. Install it
Use a package manager the machine already has. `command -v brew scoop go`
says which. You may run these yourself:
- macOS: `brew install --cask gagarin-cloud/tap/gg` (macOS only — casks do not
work on Linux)
- Windows: `scoop bucket add gagarin
https://github.com/gagarin-cloud/scoop-bucket` then `scoop install gagarin/gg`
- any platform with a Go toolchain: `go install github.com/gagarin-cloud/gg@latest`
Homebrew installs it as a **cask**, not a formula. If they already have a formula
`gg` (`brew list gg` finds it and `brew list --cask gg` does not), tell them to
`brew uninstall gg` once and then install the cask.
If `go install` succeeds but the shell still cannot find `gg`, its bin directory
(`go env GOPATH`/bin) is not on `PATH`. Say so and let them fix their profile.
With none of those, the install is the user's to run, not yours. **Do not download
a script or a binary and run it**, from gagarin.cloud or anywhere else. Point them
at the one-line installer on https://gagarin.cloud — a shell one-liner on macOS
and Linux, a PowerShell one on Windows — and tell them what it does: it checks the
download against the release's `checksums.txt`, installs to `~/.local/bin`
(Windows: `%LOCALAPPDATA%\Programs\gg`, added to their `PATH`) without `sudo`,
and never edits a shell profile. On Linux a `.deb`, `.rpm` or `.apk` from
https://github.com/gagarin-cloud/gg/releases also works; it needs `sudo`, so
that too is theirs to run. Wait until they say it is done, then go back to step 1.
If `~/.local/bin` is not on `PATH`, the installer prints the `export` line to add.
Call `gg` by its full path (`~/.local/bin/gg`) for the rest of this session and
tell the user the line; do not edit their shell configuration yourself.
## 3. Sign in
Run `gg whoami` first. If it names an account, they are already signed in — say
so and go on to step 4.
Otherwise run `gg login`. It prints a link and a code and exits. **Relay both to
the user exactly as printed** — you never handle a secret here. They open the
link, sign in with GitHub or Google, check the page shows the same code, and
approve. A new account starts with $5 on it.
Once they say they have approved, run `gg login` again to collect it.
## 4. Check the skill is not ahead of the binary
The skill ships in this plugin, not in `gg`, so the two update separately and it
can describe a `gg` newer than theirs. Run `gg version`. If it prints "gg vX is
available (you have vY)" on stderr, theirs is behind (`GAGARIN_NO_UPDATE_CHECK=1`
silences that check). Say so and run `gg upgrade`: it upgrades the way `gg` was
installed — brew, scoop and `go install` are handed to that tool, a
script or archive install replaces itself after checking the checksum, and a
`.deb`/`.rpm`/`.apk` install prints a `sudo` command for the human to run.
`gg upgrade --dry-run` previews it first.
`gg upgrade`
Preview of the first 4,000 characters. Read full instructions →
ship6.89 KB
View saved version →
---
name: ship
description: Take the current repository to production on Gagarin Cloud end to end — Dockerising if needed, creating the project, provisioning databases, wiring dependencies, building and shipping the image and giving it an address. Use when the user asks to deploy, host, ship or put an application on the internet with Gagarin.
---
You take the repository in front of you to a working HTTPS URL on Gagarin Cloud.
Read the `gagarin` skill of this plugin before anything else. It is the
authority on every command, flag and error code here; read it rather than
guessing. What follows is only the order of work and the mistakes that matter.
If your host offers subagents, run everything after "Before anything" in one:
it is a long procedure, and the main conversation only needs its report.
The user may have named a target — `project/service:port`. If they did not,
work out a sensible one from the repository and **confirm it with the user
before creating anything**. `.gagarin.json` at the repository root, if it
exists, names the project a previous session used and is the default when no
target names one; still confirm.
## Before anything
Two things are faster to catch here than three steps in:
- `gg` is on the PATH. If it is not, stop and tell the user to run this
plugin's `setup` skill (`/gagarin:setup` in Claude Code). The MCP tools
cannot substitute: they deliberately cannot build or push an image, and that
is most of this procedure. The same applies if you cannot run commands where
you are (ChatGPT on the web, for instance): say that building happens with
`gg ship` on the machine that holds the source, and that from here you can
deploy an image already in the registry, wire dependencies, add an address
and read status over the MCP tools — and stop.
- `docker` is running (`docker info`). `gg build` and `gg push` shell out to
it. If it is not, ask the user to start or install it and stop there.
Then `gg whoami`. If it reports no credentials, stop and tell them to run
`gg login`; relay the link and code exactly as printed and never handle a
secret yourself.
`git` is not required. If the directory is not a repository, or `git` is
missing, say once that `.gagarin.json` will not be committed and carry on. If
it is a repository with uncommitted changes, tell the user the image will be
tagged from the clock rather than the commit, and let them commit first if they
want the hash — do not commit for them.
Then read `.gagarin.json`, if there is one, and `gg projects`, before assuming
a project exists or that you may write to it. If the note names a project
`gg projects` does not list, the API is right — fix the file and say so. A
`viewer` role means every deploy will be refused.
If the project already exists and the Gagarin MCP tools are connected, call
`memory_briefing` for it before reading any code, with a `focus` that says what
you are about to do ("deploy the web service"): a previous session may already
have found the port, the Dockerfile quirk and the variables the app needs.
Without the MCP tools, skip this — memory is unavailable there, and nothing
else waits on it.
## The order
1. **Understand the repo.** What does it run, what port does it listen on, what
does it need? A Dockerfile that already exists is the answer; if there is
none, write one and say you did.
2. **Agree the names.** Everything is named for its project — `shop` is a
project, `shop/web` a service inside it. Nothing is inferred from the
directory. Confirm `project/service:port` with the user before creating
anything.
3. **`gg init <project>`** if it does not exist yet. Either way, once the
project is settled, write `.gagarin.json` — `{ "project": { "id": "…",
"name": "…" } }`, with the id `gg init` printed or the one `gg projects`
shows — and commit it if this is a git repository (if it is not, say so;
do not `git init` on your own). Identity only: no ports, no services, no env.
Nothing reads it; Preview of the first 4,000 characters. Read full instructions →
status1.92 KB
View saved version →
---
name: status
description: Show what is actually running in a Gagarin Cloud project — desired vs actual state, addresses, sizes and today's cost. Use when the user asks whether a service is up, what is deployed, what an address is, or what a project costs.
---
Report the state of the user's Gagarin Cloud project — the one they named, if
they named one.
If no project was named, read `.gagarin.json` at the repository root: it is the
note a previous session left of which project this repository is, and its `id`
is the project to use. If there is no such file, run `gg projects` and ask
which one they mean — do not guess, and do not infer a project from the
working directory. Gagarin names nothing after the directory you stand in, and
it does not read that file either; you do.
Then run `gg status <project>`.
Two things about reading the result:
- **`gg status` is the only thing that reads the cluster.** Every other write
records a demand without watching it come true, so this is the only answer to
"is it up".
- Every row already carries a sentence written by the engine, so that a terminal
and a dashboard cannot describe the same row differently. **Relay those
sentences rather than rewriting them into your own words.** Summarise what
needs attention; do not re-render the table.
If a service is waiting on DNS or a certificate, `gg status` says which side it
is waiting on — theirs or Gagarin's. Say which.
If the Gagarin MCP tools are connected and `gg` is not installed — or you
cannot run commands where you are — use the `status` tool instead; it reads the
same thing. `projects` lists what there is when no project was named.
For "why is it slow", "is it running out of memory", "is the disk filling":
`gg status` says what is running, not how hard. Run `gg metrics <project>`, or
`gg metrics <project>/<service> --window 24h` for one service over time; the
`metrics` tool is the same. Answer from those numbers.