Skip to content

Commit

Permalink
Merge pull request #31109 from def-/pr-mzdata-fix
Browse files Browse the repository at this point in the history
bin/environmentd: Fix default blob path
  • Loading branch information
def- authored Jan 19, 2025
2 parents 04fb110 + 8b1ded4 commit 7c751cd
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions misc/python/materialize/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
else f"{Arch.host()}-apple-darwin"
)
DEFAULT_POSTGRES = "postgres://root@localhost:26257/materialize"
DEFAULT_BLOB = "file://mzdata/persist/blob"
MZDATA = MZ_ROOT / "mzdata"
DEFAULT_BLOB = f"file://{MZDATA}/persist/blob"

# sets entitlements on the built binary, e.g. environmentd, so you can inspect it with Instruments
MACOS_ENTITLEMENTS_DATA = """
Expand Down Expand Up @@ -234,7 +235,6 @@ def main() -> int:
command += ["--tokio-console-listen-addr=127.0.0.1:6669"]
if args.program == "environmentd":
_handle_lingering_services(kill=args.reset)
mzdata = MZ_ROOT / "mzdata"
scratch = MZ_ROOT / "scratch"
urlparse(args.postgres).path.removeprefix("/")
dbconn = _connect_sql(args.postgres)
Expand All @@ -249,10 +249,10 @@ def main() -> int:
if args.reset:
# Remove everything in the `mzdata`` directory *except* for
# the `prometheus` directory and all contents of `tempo`.
paths = list(mzdata.glob("prometheus/*"))
paths = list(MZDATA.glob("prometheus/*"))
paths.extend(
p
for p in mzdata.glob("*")
for p in MZDATA.glob("*")
if p.name != "prometheus" and p.name != "tempo"
)
paths.extend(p for p in scratch.glob("*"))
Expand All @@ -263,24 +263,25 @@ def main() -> int:
else:
path.unlink()

mzdata.mkdir(exist_ok=True)
MZDATA.mkdir(exist_ok=True)
scratch.mkdir(exist_ok=True)
environment_file = mzdata / "environment-id"
environment_file = MZDATA / "environment-id"
try:
environment_id = environment_file.read_text().rstrip()
except FileNotFoundError:
environment_id = f"local-az1-{uuid.uuid4()}-0"
environment_file.write_text(environment_id)

print(f"persist-blob-url: {args.blob}")
command += [
# Setting the listen addresses below to 0.0.0.0 is required
# to allow Prometheus running in Docker (misc/prometheus)
# access these services to scrape metrics.
"--internal-http-listen-addr=0.0.0.0:6878",
"--orchestrator=process",
f"--orchestrator-process-secrets-directory={mzdata}/secrets",
f"--orchestrator-process-secrets-directory={MZDATA}/secrets",
"--orchestrator-process-tcp-proxy-listen-addr=0.0.0.0",
f"--orchestrator-process-prometheus-service-discovery-directory={mzdata}/prometheus",
f"--orchestrator-process-prometheus-service-discovery-directory={MZDATA}/prometheus",
f"--orchestrator-process-scratch-directory={scratch}",
"--secrets-controller=local-file",
f"--persist-consensus-url={args.postgres}?options=--search_path=consensus",
Expand Down

0 comments on commit 7c751cd

Please sign in to comment.