floci
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFloci
Floci
Floci is a family of local cloud emulators that speak the real cloud wire protocols.
The command (floci-cli) manages their lifecycle; the native tools (, ,
, , SDKs, Terraform) do the resource work against the emulator. floci-cli never
creates cloud resources itself.
flociawsgcloudazoci| Cloud | Emulator | CLI tree | Port | Default container | Reference |
|---|---|---|---|---|---|
| AWS | floci | | 4566 | | references/aws.md |
| GCP | floci-gcp | | 4588 | | references/gcp.md |
| Azure | floci-az | | 4577 | | references/azure.md |
| OCI | floci-oci | | 4599 | | references/oci.md |
All paths in this skill (, , ) are relative to the directory
that holds this file, not to the user's working directory.
references/scripts/assets/When to read what:
- The cloud's reference, before the first resource command for that cloud.
- references/docs.md, before writing code against a service you have not used in this session, and whenever an operation looks unsupported. It tells you how to fetch the right page of the published documentation.
- references/docker.md, when the user wants , a
docker run, or an app container that talks to the emulator.docker-compose.yml - references/namespaces.md, when running more than one instance, sharing a Docker host, or cleaning up containers.
- references/ci.md for pipelines and Testcontainers.
- references/troubleshooting.md when anything fails.
Floci 是一组使用真实云端 wire protocol 的本地云模拟器。
命令(floci-cli)负责管理其生命周期;原生工具(、、、、SDK、Terraform)通过模拟器执行资源操作。floci-cli 本身绝不创建云资源。
flociawsgcloudazoci| 云端 | 模拟器 | CLI 产品树 | 端口 | 默认容器 | 参考 |
|---|---|---|---|---|---|
| AWS | floci | | 4566 | | references/aws.md |
| GCP | floci-gcp | | 4588 | | references/gcp.md |
| Azure | floci-az | | 4577 | | references/azure.md |
| OCI | floci-oci | | 4599 | | references/oci.md |
此 skill 中的所有路径(、、)均相对于存放此文件的目录,而不是用户当前的工作目录。
references/scripts/assets/何时阅读哪些内容:
- 在为某个云端首次执行资源命令前,阅读该云端的参考文档。
- references/docs.md:在针对本次会话中尚未使用过的服务编写代码前,以及每当某项操作看起来不受支持时阅读。其中说明了如何获取已发布文档中的正确页面。
- references/docker.md:当用户需要 、
docker run,或需要与模拟器通信的应用容器时阅读。docker-compose.yml - references/namespaces.md:当需要运行多个实例、共享 Docker 主机或清理容器时阅读。
- references/ci.md:用于流水线和 Testcontainers。
- references/troubleshooting.md:当出现任何故障时阅读。
Prerequisites (check first)
先决条件(首先检查)
sh
command -v floci && floci version # floci-cli present?
docker info >/dev/null && echo ok # Docker (or Podman via DOCKER_HOST) reachable?If is missing, ask the user before installing software, then run:
flocish
scripts/install-floci.sh # brew if available, else official script into ~/.local/bin
scripts/install-floci.sh --version 0.4.0 # pin a version (uses the install script)- Windows: (per-user, no admin). The helper scripts here are bash; on Windows run the
iwr https://floci.io/install.ps1 | iexcommands they wrap directly.floci - No native binary for the platform: download from the latest release and run
floci.jar(needs Java 25+).java -jar floci.jar - Do not use or edit shell profiles (
sudo,~/.bashrc) without asking; if the install dir is not on~/.zshrc, export it for the current session only.PATH - Updates: exits 0 when up to date, 1 when an update exists and 2 when the check itself failed. Run
floci update --checkonly on exit 1 (Homebrew installs:floci update).brew upgrade floci - The user does not want the CLI at all: the emulators are plain container images, see references/docker.md.
floci-cli does not install Docker. If the daemon is missing, tell the user; do not install
Docker yourself. The native cloud CLIs (, , , ) are only needed for the
clouds the user works with; suggest installing them, do not install them unasked.
awsgcloudazocish
command -v floci && floci version # floci-cli present?
docker info >/dev/null && echo ok # Docker (or Podman via DOCKER_HOST) reachable?如果缺少 ,安装软件前先询问用户,然后运行:
flocish
scripts/install-floci.sh # brew if available, else official script into ~/.local/bin
scripts/install-floci.sh --version 0.4.0 # pin a version (uses the install script)- Windows:(按用户安装,无需管理员权限)。此处的辅助脚本是 bash;在 Windows 上应直接运行它们所封装的
iwr https://floci.io/install.ps1 | iex命令。floci - 平台没有原生二进制文件:从最新发行版下载 并运行
floci.jar(需要 Java 25+)。java -jar floci.jar - 未经询问,不要使用 或编辑 shell 配置文件(
sudo、~/.bashrc);如果安装目录不在~/.zshrc上,仅为当前会话导出该路径。PATH - 更新:在已是最新时退出码为 0,有可用更新时为 1,检查本身失败时为 2。仅当退出码为 1 时运行
floci update --check(Homebrew 安装:floci update)。brew upgrade floci - 用户完全不需要 CLI:模拟器就是普通容器镜像,请参阅 references/docker.md。
floci-cli 不会安装 Docker。如果 Docker 守护进程缺失,告知用户;不要自行安装 Docker。只有用户使用的云端才需要原生云 CLI(、、、);可以建议安装,但未经用户同意不要安装。
awsgcloudazociHard rules
硬性规则
- Never touch real cloud. Use only the fake credentials the emulators accept
(/
testfor AWS, the dev identitiestestandfloci az setupcreate). Never read, export or reuse the user's real cloud credentials or profiles.floci oci setup - Verify the endpoint before every mutating command. It must point at the emulator
(,
localhost,127.0.0.1, or a Compose service name). If a command might reach public cloud (see each reference's "leaks" section), stop and fix the wiring.localhost.floci.io - Always name the tree explicitly: , not
floci aws start. Bare commands followfloci start, which the user may have changed.floci config default-product - Parse with , never scrape text output. Use
-o jsonto silence noise in scripts.-q - Do not remove containers, volumes or snapshots you did not create in this session. Scope any cleanup to a namespace (see namespaces.md) and confirm with the user first.
- State is ephemeral unless the instance was started with or a profile with
--persist <dir>. BothpersistDiron a stopped container andstartremove the container and create a new one:restartkeeps the settings (port, image, services, persist dir, namespace) but not in-memory state, and on Azure the new container has a new certificate, sorestartmust be run again.floci az setupon a running container fails. Say so before recreating anything.start - Never add to
-q: it suppresses the exports themselves.env - Do not guess what an emulator supports. Check and the published docs (references/docs.md) instead of answering from memory.
floci <tree> services -o json - With a profile, start and wait before . Until the profile's container is running,
envandenvfall back to the default port and describe the default instance. Truststatusin"state": "running", notstatus -o json.reachable
- 绝不访问真实云端。 只能使用模拟器接受的虚假凭据(AWS 使用 /
test,开发身份由test和floci az setup创建)。绝不读取、导出或复用用户的真实云凭据或 profile。floci oci setup - 每次执行变更类命令前都要验证 endpoint。 endpoint 必须指向模拟器(、
localhost、127.0.0.1或 Compose 服务名称)。如果某条命令可能会访问公有云(参见各参考文档中的 “leaks” 一节),请停止操作并修复连接配置。localhost.floci.io - 始终明确指定产品树:使用 ,而不是
floci aws start。裸命令会遵循floci start,而用户可能已更改该值。floci config default-product - 使用 解析,绝不抓取文本输出。在脚本中使用
-o json静默噪声。-q - 不要删除本次会话中未创建的容器、卷或快照。 将任何清理操作限定在特定 namespace 内(见 namespaces.md),并事先向用户确认。
- 实例状态是临时的,除非实例启动时使用了 ,或使用了带有
--persist <dir>的 profile。对已停止容器执行persistDir和执行start都会移除容器并新建容器:restart保留设置(端口、镜像、服务、持久化目录、namespace),但不保留内存中的状态;在 Azure 上,新容器会拥有新的证书,因此必须再次运行restart。对正在运行的容器执行floci az setup会失败。重新创建任何内容之前,先说明这一点。start - 绝不要给 添加
env:这会连导出的变量本身也一并抑制。-q - 不要猜测模拟器支持哪些功能。 应检查 和已发布文档(references/docs.md),而不是凭记忆回答。
floci <tree> services -o json - 使用 profile 时,先启动并等待,再执行 。 在 profile 的容器运行之前,
env和env会回退到默认端口,并描述默认实例。应以status中的status -o json为准,而不是"state": "running"。reachable
Lifecycle (same for every tree)
生命周期(每个产品树均相同)
sh
floci <tree> start --detach # pull if needed, start, return immediately
floci <tree> wait --timeout 2m # block until healthy (exit 0 = ready)
eval "$(floci <tree> env -o text)" # export SDK/CLI wiring into this shellsh
floci <tree> start --detach # pull if needed, start, return immediately
floci <tree> wait --timeout 2m # block until healthy (exit 0 = ready)
eval "$(floci <tree> env -o text)" # export SDK/CLI wiring into this shell... run aws / gcloud / az / oci / tests ...
... run aws / gcloud / az / oci / tests ...
floci <tree> stop --remove # when done, only if you started it
`-o text` keeps the exports correct even when a profile sets `output: json`. In other shells:
`floci <tree> env --shell fish | source`, or
`floci <tree> env --shell powershell | Invoke-Expression`.
Or use the helper, which starts the container only when none exists, then waits and prints
the exports:
```sh
exports="$(scripts/ensure-running.sh <aws|gcp|az|oci> [profile])" && eval "$exports"Keep the two steps: in one go succeeds even when the helper fails, and the
commands after it would run with missing or stale wiring. The helper exits 3 without
touching anything when the container exists but is stopped, because starting it replaces
it (rule 6). Tell the user, and re-run with once they agree.
eval "$(...)"FLOCI_REPLACE_STOPPED=1One-time per instance, before using the native CLI:
- Azure: (trusts the emulator cert, registers an az cloud, logs in).
floci az setup - OCI: (writes a throwaway key and a
floci oci setupprofile in[FLOCI]).~/.oci/config
evaleval "$(floci aws env -o text)" && aws s3 lsThe examples are written for bash. In zsh (the macOS default) an unquoted variable is not
split into words, so passes one argument
and fails. Write the flags out, or use an array: and
.
flags="--profile aws-b"; floci aws status $flagsflags=(--profile aws-b)"${flags[@]}"floci <tree> stop --remove # when done, only if you started it
`-o text` 即使在 profile 设置了 `output: json` 时,也能保持导出项正确。在其他 shell 中:
`floci <tree> env --shell fish | source`,或
`floci <tree> env --shell powershell | Invoke-Expression`。
也可以使用辅助脚本;它仅在容器不存在时启动容器,然后等待并打印导出项:
```sh
exports="$(scripts/ensure-running.sh <aws|gcp|az|oci> [profile])" && eval "$exports"务必保留这两个步骤:一次性执行 即使辅助脚本失败也会成功,后续命令将在连接配置缺失或陈旧的情况下运行。辅助脚本在容器存在但已停止时,会在不进行任何操作的情况下以状态码 3 退出,因为启动它会替换该容器(规则 6)。请告知用户,并在用户同意后使用 重新运行。
eval "$(...)"FLOCI_REPLACE_STOPPED=1每个实例在首次使用原生 CLI 前只需执行一次以下操作:
- Azure:(信任模拟器证书、注册 az cloud 并登录)。
floci az setup - OCI:(在
floci oci setup中写入一次性密钥和~/.oci/configprofile)。[FLOCI]
evalsh
eval "$(floci aws env -o text)" && aws s3 ls示例以 bash 编写。在 zsh(macOS 默认 shell)中,未加引号的变量不会按单词拆分,因此 会将参数作为一个整体传入并失败。请直接写出 flags,或使用数组: 和 。
flags="--profile aws-b"; floci aws status $flagsflags=(--profile aws-b)"${flags[@]}"Inspecting state
检查状态
| Need | Command |
|---|---|
| Is it running and healthy? | |
| Which services are enabled? | |
| CLI and server versions | |
| Recent server logs | |
| Environment problems | |
| Effective config | |
| All instances | |
| Any command's flags | |
| 需求 | 命令 |
|---|---|
| 是否正在运行且健康? | |
| 哪些服务已启用? | |
| CLI 和服务器版本 | |
| 最近的服务器日志 | |
| 环境问题 | |
| 生效配置 | |
| 所有实例 | |
| 任意命令的参数 | |
Several instances
多个实例
An instance is a profile: its container name is its identity, its port must be unique, and
its Docker resource namespace keeps the containers it launches apart from other instances.
Pass the same to every command for that instance. Details and the
namespace derivation rules are in references/namespaces.md.
--profile <name>sh
floci aws config profile create aws-b --container floci-b --port 14566 --persist ~/.floci/data/aws-b
floci aws start --profile aws-b # waits up to 30s; or --detach, then wait
eval "$(floci aws env -o text --profile aws-b)"floci-cli keeps its own files under (profiles in , per-instance
state in ), so instance data goes there too, as
.
~/.floci~/.floci/profiles/~/.floci/<product>/<container>/~/.floci/data/<name>实例即一个 profile:其容器名称就是身份标识,端口必须唯一,Docker 资源 namespace 会将其启动的容器与其他实例隔离开来。
对实例的每条命令都传入相同的 。详细信息和 namespace 派生规则见 references/namespaces.md。
--profile <name>sh
floci aws config profile create aws-b --container floci-b --port 14566 --persist ~/.floci/data/aws-b
floci aws start --profile aws-b # waits up to 30s; or --detach, then wait
eval "$(floci aws env -o text --profile aws-b)"floci-cli 将自己的文件保存在 下(profiles 位于 ,各实例状态位于 ),因此实例数据也保存在那里,即 。
~/.floci~/.floci/profiles/~/.floci/<product>/<container>/~/.floci/data/<name>Choosing the right integration
选择合适的集成方式
- Ad-hoc commands or a dev server: the CLI lifecycle above.
- The user asks for or a Compose file, or the app itself runs in a container: references/docker.md. Start from the templates in
docker runinstead of writing YAML from memory.assets/compose/ - Integration tests in code: a Testcontainers module where one exists (AWS in Java, Node, Python, Go and .NET; Azure in Java only; none for GCP or OCI, see ci.md). Otherwise start the emulator with the CLI or Compose before the tests.
- 临时命令或开发服务器:使用上述 CLI 生命周期。
- 用户要求 或 Compose 文件,或者应用本身在容器中运行:参阅 references/docker.md。从
docker run中的模板开始,不要凭记忆编写 YAML。assets/compose/ - 代码中的集成测试:如果存在相应的 Testcontainers 模块,则使用它(AWS 支持 Java、Node、Python、Go 和 .NET;Azure 仅支持 Java;GCP 和 OCI 不支持,详见 ci.md)。否则,在测试前使用 CLI 或 Compose 启动模拟器。
When something is not supported
不支持某项操作时
Coverage differs per service: some are full engines, some are in-process, some answer with
canned responses. Before writing code against a service, check that it is enabled
() and read its page in the published docs
(references/docs.md). If an operation is missing, say so plainly,
suggest a workaround, and point the user to the emulator's issue tracker
() instead of
retrying variations.
floci <tree> services -o jsonhttps://github.com/floci-io/<floci|floci-gcp|floci-az|floci-oci>/issues各服务的覆盖范围不同:有些是完整引擎,有些是进程内实现,有些则返回预置响应。在针对某项服务编写代码前,检查它是否已启用()并阅读已发布文档中的对应页面(references/docs.md)。如果缺少某项操作,请明确说明,提出变通方案,并指向模拟器的 issue tracker(),而不是反复尝试各种变体。
floci <tree> services -o jsonhttps://github.com/floci-io/<floci|floci-gcp|floci-az|floci-oci>/issues