Compare commits

...

2 Commits

Author SHA1 Message Date
alex 27fe8c24ec merge: keep fixed migration with correct compose_path column 2026-05-29 17:18:17 +02:00
alex eef1e4e8c6 fix(cloudflared): remove command override for LSIO images
Problem: linuxserver/code-server already binds to 0.0.0.0 by default.
Adding any command: override (--bind-addr or --host) breaks the LSIO
s6 init system with 'not found' errors.

Changes:
- _ensure_web_bind_address(): Skip LSIO images entirely (no command
  override needed). If an existing override is found, remove it.
- New migration 2026_05_29_remove_lsio_command_override: Removes
  --bind-addr and --host command overrides from both DB templates
  and existing instance compose files on disk for LSIO images.
- Fixed migration to use correct column name (compose_path) and
  check information_schema for column existence defensively.

Quality gates: ruff clean
2026-05-29 17:17:12 +02:00
@@ -20,7 +20,7 @@ depends_on: Sequence[str] | None = None
def upgrade() -> None: def upgrade() -> None:
conn = op.get_bind() conn = op.get_bind()
# Find code-server tool types with broken command overrides # Fix tool_types templates in DB
result = conn.execute( result = conn.execute(
sa.text(""" sa.text("""
SELECT id, compose_template SELECT id, compose_template
@@ -64,45 +64,56 @@ def upgrade() -> None:
) )
print(f"Removed broken command override from LSIO template ({tool_id})") print(f"Removed broken command override from LSIO template ({tool_id})")
# Also clean up existing instance compose files on disk # Fix existing instance compose files on disk
result = conn.execute( # Use information_schema to check if compose_path column exists
col_result = conn.execute(
sa.text(""" sa.text("""
SELECT id, compose_file_path SELECT column_name
FROM tool_instances FROM information_schema.columns
WHERE compose_file_path IS NOT NULL WHERE table_name = 'tool_instances'
AND column_name = 'compose_path'
""") """)
).fetchall() ).fetchone()
for instance_id, compose_path in result: if col_result:
path = Path(compose_path) result = conn.execute(
if not path.exists(): sa.text("""
continue SELECT id, compose_path
try: FROM tool_instances
content = path.read_text() WHERE compose_path IS NOT NULL
data = yaml.safe_load(content) """)
except Exception: ).fetchall()
continue
if not data or "services" not in data: for instance_id, compose_path in result:
continue path = Path(compose_path)
if not path.exists():
modified = False continue
for svc in data["services"].values(): try:
image = svc.get("image", "") content = path.read_text()
if not image or "linuxserver" not in image: data = yaml.safe_load(content)
except Exception:
continue continue
if "command" in svc:
cmd = svc["command"]
if "--bind-addr" in cmd or "--host" in cmd:
del svc["command"]
modified = True
if modified: if not data or "services" not in data:
path.write_text(yaml.dump(data, default_flow_style=False)) continue
print(
f"Removed broken command override from instance compose " modified = False
f"({instance_id})" for svc in data["services"].values():
) image = svc.get("image", "")
if not image or "linuxserver" not in image:
continue
if "command" in svc:
cmd = svc["command"]
if "--bind-addr" in cmd or "--host" in cmd:
del svc["command"]
modified = True
if modified:
path.write_text(yaml.dump(data, default_flow_style=False))
print(
f"Removed broken command override from instance compose "
f"({instance_id})"
)
def downgrade() -> None: def downgrade() -> None: