The engine runs exactly one copy of a service per box: one folder
(~/.local/share/services/<name>), one systemd unit, one container name,
one port set. Named instances lifts that: ryra add <svc> --instance <slug>
renders a fully independent copy named <svc>.<slug>. Folder = service is
the core invariant, so purge/backup/notify/list work per instance for free.
This is the foundation for dev environments (item 3): a worktree's dev
stack installs as instances beside prod without touching it.
<base>.<slug>; slug validated [a-z0-9-]{1,24} (the base validates as
today). The DOT is the instance separator precisely because service names
use hyphens: paperless-ngx.dev1 parses unambiguously (base = everything
before the first dot). service_home already accepts embedded dots.
validate_rename (ops.rs ~532) rejects dots; instance names are assembled
AFTER validating base and slug separately, never passed through it.
Registry quadlets are written verbatim today; identity comes from
filenames. Only blue/green rewrites anything (deploy.rs
expand_color_quadlets, main container only). Instances need a broader,
surgical pass over every generated file, modeled on it:
- Filename: leading
<base>-><base>.<slug>(supabase-redis.container->supabase.dev1-redis.container; the sidecar keeps its-redistail soquadlet_belongs_toclaims it via the existing hyphen arm). ContainerName=lines whose value starts with<base>.Network=<n>.network/Volume=<n>.volume:refs where<n>starts with<base>(bundle-local identities only).- Unit refs (
Requires=/After=on<base>*.service) same rule. - NEVER a blind string replace:
Image=docker.io/supabase/...must survive. Match only at identity positions, exactly likepodman_color_quadletdoes forContainerName=. - Idempotent: already-suffixed names are left alone (re-render on upgrade).
Placement: around the write loop at lib.rs ~1122 (where
expand_color_quadlets hooks in) plus filename-derived logic inside
process_quadlet_bundle (is_main_container, image extraction key off
filenames — thread the instance name or rewrite before those checks).
The fixed-host-port branch (lib.rs ~723 Some(hp) => hp) is skipped for
instances; they always fall into allocate_port_excluding (pool
10000-11000, excludes installed). This is what makes caddy's 8080 / a
prod supabase's 5432 a non-issue for instances. port_overrides on
upgrade already keys per install, which is per instance. Blue/green +
instance composes (-blue suffixes the instance's main container), but
V1 may simply refuse --instance on blue/green services.
quadlet_belongs_to(filename, svc, all) (lib.rs ~1817): rest.starts_with('.')
returns true immediately, so remove supabase would claim
supabase.dev1.container. The dot arm needs the same longer-prefix guard
the hyphen arm has: another installed name that extends svc past the
dot owns the file.
- Instances do not publish
services.<name>.*template context (the dotted name is ambiguous in the dot-delimited context namespace, and cross-service consumers should wire against the base service). Skip context registration for instances. - Instances are never capability providers (SSO/proxy/SMTP lookups match base names only).
- No public-URL exposure per instance in v1 (loopback + tailscale only); caddy routes per instance come with the dev-environments work.
--instanceon native services deferred (unit rename + binary home interplay); podman services first.
- CLI:
--instance <slug>on add (main.rs args, cli/add.rs, ops::AddRequest). ryra listgroups instances under their base (split at first dot); the apps already group worktree deploys, same presentation slot.- Remove/status/backup take the full dotted name unchanged.
- Tailscale svc naming (
<service>-<host>) and metrics target naming must compose with the suffix once (verify no double-suffix).
M1: single-container podman service end to end. --instance threading,
name validation, port yield, rewrite pass for main container +
network/volume, belongs_to dot fix, list grouping. E2E: two uptime-kuma
instances running side by side; purge one, the other untouched; reset
drill still clean.
M2: multi-container bundles (supabase's sidecars), aux-unit refs, backup/restore per instance E2E.
M3: dev environments (item 3) consume instances: ryra dev up in a
worktree = instances of the app's dependencies with a slug derived from
the dev root; refuse-on-prod-box; RAM plan table.