Commit Graph
8 Commits
Author SHA1 Message Date
soreavis 7bc0562e38 feat(start): add --bind to publish the port on one host address (#90)
* feat(start): add --bind to publish the port on one host address

start published the API port with no host address, so it went on every
interface unless the runtime's default was changed, and the CLI had no
option to choose the address.

--bind ADDR publishes it on that address; on AWS it also sets
FLOCI_SERVICES_UI_BIND_ADDRESS so the web console follows. It is also a
profile key and a config profile create flag. The address is parsed as
one IP literal and passed on in one form, IPv4 dotted and IPv6 in full,
so docker and podman only see a form they read. A value that is not an
IP literal, an IPv6 zone or IPv4 not written dotted is refused with exit
2, before restart stops anything. The CLI still connects to 127.0.0.1,
so any address but 127.0.0.1 or 0.0.0.0 also needs --endpoint.

start records the address in a floci_bind label, and restart keeps it,
from the profile or else from that label. A container without the label
restarts without --bind: the addresses a runtime reports also hold its
own defaults (Podman's 0.0.0.0, default_host_ips), so they are not read
back.

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>

* fix(start): probe the --bind address in the port check

The port check before start bound the wildcard address. Linux refuses
that while another socket holds the port on 127.0.0.1, so start --bind
with a LAN address exited 1 on that port although the address was free.

With --bind the check now binds that address. When that works, the
port is free only if nothing answers there, since macOS and Windows let
the bind share the port with a listener on the wildcard. When it fails,
a bind on port 0 tells whether this machine has the address at all (the
error text cannot: Linux translates it). If it does not, docker judges
the address. If it does, the old rule decides, and below 1024 it asks
whether something answers on that address instead of on loopback.
Without --bind, or with --bind 0.0.0.0 or ::, the check is unchanged.

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>

---------

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>
2026-11-27 17:01:30 -06:00
Hector Ventura e23bc9a481 fix(start): mount the podman machine's own socket on macOS (#81)
* fix(start): mount the podman machine's own socket on macOS

With podman machine on macOS, the socket the docker CLI reaches is a
forwarder on the Mac, and start bind-mounted that path into a container
that runs inside the VM. Depending on the podman version the start
failed ("operation not supported"), or it reported ready while the
emulator could not reach the daemon, so every Docker-backed service
failed later.

When the daemon is Podman, start now asks podman for the socket the
daemon listens on inside the VM (Host.RemoteSocket.Path) and mounts
that. DOCKER_SOCK still names the mounted socket and turns the lookup
off. When podman cannot answer, start warns and keeps the old mount.

Closes #78

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(start): mount DOCKER_SOCK on macOS even when DOCKER_HOST is set

start's warning tells the user to set DOCKER_SOCK when podman cannot
report its VM socket, but with DOCKER_HOST on the Mac forwarder the
mount still used the DOCKER_HOST path, so following the warning did not
help. On macOS DOCKER_SOCK is now the mount source whenever it is set.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-11-18 22:47:27 -06:00
soreavis 3c70876448 feat(start): add --security-opt so Floci can reach the socket on SELinux hosts (#70)
* feat(start): add --security-opt so Floci can reach the socket on SELinux hosts

With SELinux enforcing, as in the podman machine VM, the emulator
cannot connect to the mounted Podman socket: the kernel denies
connectto from container_t to the daemon's container_runtime_t, and
the web console fails with java.net.BindException: Permission denied.
Relabeling the mount with :z fixes access to the socket file but not
that check. --security-opt label=disable gets past it, and start had
no way to pass it.

The option is repeatable and goes to docker run unchanged. A restart
without --profile reads it back from the running container, like the
port, image and services; with --profile the start is rebuilt from
the profile, which has no key for it. docker inspect reports a
seccomp profile file inline, which docker run rejects, so such a
value fails start's validation, and with it the restart, before the
stop removes the container.

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>

* fix(start): keep --security-opt in retry and recovery commands

The failed-pull hint and the restart recovery command rebuild the
start from its flags, so they dropped --security-opt and a retry lost
label=disable. Carry it into both, shell-quoted.

The README's profile workaround stopped the default instance: name
the same profile and product on stop as on start.

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>

---------

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>
2026-11-05 14:25:35 -06:00
Hector Ventura 587860da0f fix(cli)!: stop using the default instance for a missing container (#75)
status no longer probes the default instance for a named container with no known
endpoint, and env, services, snapshot and az setup exit 1 with the next step
instead of acting on it. wait keeps looking for the container until --timeout, and
doctor and version still run. A profile's port is used before its container
starts, and an endpoint from --endpoint, FLOCI_ENDPOINT or another host beats a
local container's published port.

BREAKING CHANGE: in status -o json, endpoint is null when the selected container
has no known endpoint. env, services, snapshot and az setup exit 1 in that case,
where they used to use the default endpoint. An --endpoint or FLOCI_ENDPOINT on
the default port is now honoured even when a local container publishes another
port.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-11-04 17:32:42 -06:00
Hector Ventura 882c0ea7be fix(cli): keep the selected instance in the commands that hints suggest (#74)
Commands printed by errors, env and doctor now carry --profile, --container and
an explicit --endpoint, so pasting one acts on the same instance. After a failed
pull, the suggested start also keeps the --port, --image, --persist, --services
and --namespace you typed.

The env load hint adds -o text after a profile, which may set output: json, and
quotes values for the shell it is for. A value containing a line break prints as a
placeholder, because the hint is a comment in the output people feed to eval.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-11-04 01:48:30 -06:00
Hector Ventura a319e2d242 fix(restart): show how to recover after startup fails (#73)
When restart has removed the old container and the new one does not come up, it
now prints a start command with the same port, image, persist dir, services and
namespace. When the new container is running but did not become ready, it says to
check logs and run wait instead, because start refuses a running container.

The commands name their tree, because a bare floci follows the configured default
product. They keep a typed --endpoint, and --persist prints the directory a local
daemon would mount, so a retry from another directory finds the same state.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-11-04 01:05:50 -06:00
Hector Ventura 94fdf7762c docs(skill): wire Python Secret Manager to the emulator explicitly (#71)
The Python client ignores SECRET_MANAGER_EMULATOR_HOST and still targets
secretmanager.googleapis.com, so the skill's claim that client libraries skip
credentials when these variables are set was wrong for it. Add a recipe with the
REST transport, an explicit endpoint and anonymous credentials, and link it from
the README and the Docker reference.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-11-04 01:00:26 -06:00
Hector Ventura ac52515471 docs(skill): publish the floci agent skill for the CLI and the four emulators (#69)
* docs(skill): publish the floci agent skill for the CLI and the four emulators

skills/floci/ teaches an AI agent to run, wire up and troubleshoot the AWS,
GCP, Azure and OCI emulators through floci-cli, docker run or Docker Compose.

- SKILL.md with the lifecycle, the hard rules (fake credentials only, verify
  the endpoint, name the tree, parse -o json) and one reference per cloud.
- references/docs.md sends the agent to the published documentation of each
  emulator instead of copying coverage lists that go stale.
- references/docker.md and assets/compose/ give docker run equivalents of
  'floci <tree> start' and a ready Compose template per cloud, plus one with
  all four on a network.
- scripts/install-floci.sh and scripts/ensure-running.sh.
- .claude-plugin/marketplace.json publishes it as a Claude Code plugin and the
  root plugin.json as a Kiro power (Agent Plugins format).
- SkillDocsTest checks every floci command and flag the skill quotes against
  the real command tree, its links, its frontmatter and both manifests.
- README: an "AI agents" section with the install commands, a Privacy section
  on what the CLI and the skill send over the network, and support links.
- AGENTS.md: a command, flag, env output or exit code change updates the
  skill in the same change.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* docs(skill): bind published ports to loopback and make the helper fail safely

Addresses the review of #69.

- The Compose templates and the docker run examples publish the emulator on
  127.0.0.1. The emulators accept fake credentials, so a plain 4566:4566
  exposed local resources to the network. docker.md says when to drop it and
  that 'floci <tree> start' still publishes on every interface.
- ensure-running.sh no longer replaces a stopped container: it exits 3 and
  leaves it alone unless FLOCI_REPLACE_STOPPED=1, because start removes the
  container and, without a profile, its settings.
- The documented call is now 'exports="$(...)" && eval "$exports"'. The
  one-step eval succeeded when the helper failed, so later commands ran with
  missing or stale wiring.
- The templates say that container name, namespace and network name are per
  project and change together.
- docker.md lists the network settings to copy into the multi-cloud file
  when an app reaches child containers by name.
- ci.md installs into a user-writable directory instead of assuming
  /usr/local/bin or sudo.
- SkillDocsTest now reads commands inside assignments and across continued
  lines, with a test that a wrong flag is found in each form. The helper's
  own status and env calls were not being checked.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-12 20:27:02 -05:00