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:
conn = op.get_bind()
# Find code-server tool types with broken command overrides
# Fix tool_types templates in DB
result = conn.execute(
sa.text("""
SELECT id, compose_template
@@ -64,45 +64,56 @@ def upgrade() -> None:
)
print(f"Removed broken command override from LSIO template ({tool_id})")
# Also clean up existing instance compose files on disk
result = conn.execute(
# Fix existing instance compose files on disk
# Use information_schema to check if compose_path column exists
col_result = conn.execute(
sa.text("""
SELECT id, compose_file_path
FROM tool_instances
WHERE compose_file_path IS NOT NULL
SELECT column_name
FROM information_schema.columns
WHERE table_name = 'tool_instances'
AND column_name = 'compose_path'
""")
).fetchall()
).fetchone()
for instance_id, compose_path in result:
path = Path(compose_path)
if not path.exists():
continue
try:
content = path.read_text()
data = yaml.safe_load(content)
except Exception:
continue
if col_result:
result = conn.execute(
sa.text("""
SELECT id, compose_path
FROM tool_instances
WHERE compose_path IS NOT NULL
""")
).fetchall()
if not data or "services" not in data:
continue
modified = False
for svc in data["services"].values():
image = svc.get("image", "")
if not image or "linuxserver" not in image:
for instance_id, compose_path in result:
path = Path(compose_path)
if not path.exists():
continue
try:
content = path.read_text()
data = yaml.safe_load(content)
except Exception:
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})"
)
if not data or "services" not in data:
continue
modified = False
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: