zitadel-bootstrap
Use when setting up Zitadel for a new plan.ai-style deployment (a cloud console, a chat/agent and optionally a Harbor on their own domains, like webapp.agency) or re-running it — asks for the domains, org and login names, social-login credentials and shared keys, writes ansible/zitadel/deployments/<name>.yml, runs setup.yml (Zitadel orgs, login policy, IdPs, projects, clients, service users) and secrets.yml (the rest of the secrets, private/<name>-{cloud,chat,harbor}.nix).
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- zitadel-bootstrap
- author
- plan.ai
- license
- MIT
- version
- 1.0.0
- metadata
- { "tags": [ "nixos", "zitadel", "ansible", "secrets", "bootstrap" ], "related_skills": [ "update-nixos" ] }
- description
- Use when setting up Zitadel for a new plan.ai-style deployment (a cloud console, a chat/agent and optionally a Harbor on their own domains, like webapp.agency) or re-running it — asks for the domains, org and login names, social-login credentials and shared keys, writes ansible/zitadel/deployments/<name>.yml, runs setup.yml (Zitadel orgs, login policy, IdPs, projects, clients, service users) and secrets.yml (the rest of the secrets, private/<name>-{cloud,chat,harbor}.nix).
- user_invocable
- true
03 SKILL.md 正文
Zitadel bootstrap for a console + chat deployment
ansible/zitadel/ does what was done by hand for webapp.agency: everything a
console (plan-ai-cloud), a chat (plan-ai-chat) and a Harbor need from their
Zitadel, and the private NixOS files that carry the secrets. It is idempotent
and its state, private/<deployment>-zitadel.json, is the source of truth:
delete a secret from it to rotate it. deployments/webapp.yml is a worked
example; the VM test (nix build .#checks.x86_64-linux.zitadel-ansible -L)
shows a full run.
Run everything from the nixos-infra root. Never print the state file or the
rendered files: they are secrets.
1. Ask
Ask the user, with the defaults in brackets (webapp.agency's values as the example). Don't guess domains or names: they become clients, orgs and what people see on the login page.
| Variable | Question | Example |
|---|---|---|
deployment |
Short name for files and the console's service user | webapp |
zitadel_url |
Zitadel's URL (the instance must exist, first-run setup done) | https://id.webapp.agency |
zitadel_pat_command |
How to read an IAM_OWNER PAT (the first instance's bootstrap machine user writes one with FirstInstance.PatPath) |
ssh root@<host> cat /var/lib/zitadel/bootstrap.pat |
partner_org_name |
The org partners sign in through | webapp-agency |
partner_login_name |
What the services call that sign-in | the.webapp.agency Partner |
apps_project_name |
Project holding the services' clients | webapp.agency apps |
console_domain |
The console's domain | cms.webapp.agency |
agent_domain |
The chat's domain | agent.webapp.agency |
harbor_domain |
Harbor's domain, or empty for none | harbor.webapp.agency |
admin_emails |
Who administers console, chat and Harbor | [maciej@plan.ai] |
internal_login_name, internal_allowed_domains |
Name and allowed email domains of the services' own Google sign-in (optional) | the.webapp.agency Internal, [plan.ai, webapp.agency] |
legal_tos_link, legal_privacy_link |
URL of the AGB & Datenschutz the login makes users accept (privacy defaults to the tos link; pkgs/zitadel-login) | https://plan.ai/legal-de.md |
litellm_url, litellm_key_alias |
LiteLLM for the chat's agents, and the key's alias | https://codex.plan.ai, webapp-chat |
harbor_ssh, harbor_database |
Where to insert the console's Harbor admin token (empty: skip) | root@<harbor host>, harbor |
Then the secrets, as environment variables (only on the first run; the state remembers them):
GITHUB_CLIENT_ID/_SECRET,GOOGLE_CLIENT_ID/_SECRET: the partner org's social logins. Give the user the callback to register:<zitadel_url>/ui/login/login/externalidp/callback.INTERNAL_GOOGLE_CLIENT_ID/_SECRET: the services' own Google client; redirect URIshttps://<console_domain>/auth/google/callbackandhttps://<harbor_domain>/auth/google/callback.LITELLM_MASTER_KEY,REGISTRY_ADMIN_TOKEN: shared with cloud.plan.ai, inprivate/logos-cloud.nix(inference.master_key,registry.admin_token).CONTEXT7_API_KEY,FIRECRAWL_API_KEY: the agents' MCP servers (plan.ai's are inprivate/logos-chat.nix), optional.
Read shared values from the private files into the environment yourself; don't ask the user to paste what the repo already has.
2. Run
cd ansible/zitadel
$EDITOR deployments/<deployment>.yml # from the answers
GITHUB_CLIENT_ID=… GITHUB_CLIENT_SECRET=… GOOGLE_CLIENT_ID=… GOOGLE_CLIENT_SECRET=… \
ansible-playbook setup.yml -e @deployments/<deployment>.yml
LITELLM_MASTER_KEY=… REGISTRY_ADMIN_TOKEN=… INTERNAL_GOOGLE_CLIENT_ID=… … \
ansible-playbook secrets.yml -e @deployments/<deployment>.yml
setup.yml writes the state after every step that produced a secret, so a
failed run loses nothing; run it again. A second run of either playbook
reports changed=0.
3. Wire up
- The host's config imports
private/<deployment>-cloud.nixand-chat.nix(webapp/cloud.nix and webapp/chat.nix show how), Harbor'sprivate/<deployment>-harbor.nix. - Public ids the configs need: the chat's
connector.console.audience_project_idisconsole_api.project_idand the Harbor app'smcp.audience_project_idisharbor_api.project_id(read withjqfrom the state; ids aren't secret). - Commit the private repo (state and rendered files), then nixos-infra's
privatepointer; deploy.
Notes
- An existing social login is left as it is; to change its secret, delete it
in Zitadel and run
setup.ymlagain with the new credentials. - The bootstrap PAT is IAM_OWNER: once the deployment is up, remove the
bootstrap user's PAT in Zitadel and delete the PatPath file, and point
zitadel_pat_commandat the console's own IAM_OWNER PAT in the state (jq -r .console_pat …/private/<deployment>-zitadel.json), asdeployments/webapp.ymldoes.
04 同仓库更多 Skills
fix-codex-litellm
Use when the codex.plan.ai litellm plugin (Codex OAuth custom provider) is throwing errors — HTTP 400/4xx/5xx from the Codex /responses endpoint, request/response translation failures, model-name or auth errors — to diagnose, fix the provider fork, and redeploy codex.plan.ai.
update-nixos
Use when updating NixOS flake inputs and deploying nixos-infra to all plan.ai servers, including fixing build errors and pushing resulting commits.
fix-codex-litellm
Use when the codex.plan.ai litellm plugin (Codex OAuth custom provider) is throwing errors — HTTP 400/4xx/5xx from the Codex /responses endpoint, request/response translation failures, model-name or auth errors — to diagnose, fix the provider fork, and redeploy codex.plan.ai.
codex-healthcheck
Use when checking whether the codex.plan.ai litellm proxy works (scheduled health check) or when it is reported broken — probe /v1/models + a tiny chat completion, classify the failure against the known layers, then fix it (container/config, fork+repin+deploy, auth) and verify.