fix(2): discourse — mint_admin ruby PATH (bash -c + discover) + BACKUP_VERIFY for post-upgrade backup race
This commit is contained in:
@ -40,11 +40,16 @@ _BOOTSTRAP_RB = (
|
||||
|
||||
def mint_admin(domain: str) -> tuple[str, str]:
|
||||
"""Bootstrap an admin + fresh API key via Rails in the app container. Returns (api_key, username)."""
|
||||
# `bin/rails` is `#!/usr/bin/env ruby`; the bitnami discourse image keeps ruby at
|
||||
# /opt/bitnami/ruby/bin, which is NOT on a login shell's PATH (`bash -lc` resets PATH from
|
||||
# /etc/profile → `env: 'ruby': No such file or directory`, rc=127). Use a non-login shell, discover
|
||||
# ruby (image-ENV PATH first, bitnami fallback), and invoke it explicitly so the shebang is moot.
|
||||
cmd = (
|
||||
"cd /opt/bitnami/discourse && "
|
||||
f"RAILS_ENV=production bin/rails runner \"{_BOOTSTRAP_RB}\""
|
||||
"RUBY=$(command -v ruby || echo /opt/bitnami/ruby/bin/ruby) && "
|
||||
f"RAILS_ENV=production \"$RUBY\" bin/rails runner \"{_BOOTSTRAP_RB}\""
|
||||
)
|
||||
out = lifecycle.exec_in_app(domain, ["bash", "-lc", cmd], service="app", timeout=240)
|
||||
out = lifecycle.exec_in_app(domain, ["bash", "-c", cmd], service="app", timeout=240)
|
||||
key = user = None
|
||||
for line in out.splitlines():
|
||||
line = line.strip()
|
||||
|
||||
Reference in New Issue
Block a user