I need a temporary directory for Rustler + Elixir to write to

Has anyone successfully used Rustler in an Elixir project? My build fails because the file system is read-only.

Perhaps there’s a environment variable I can set to a path that Render would allow writing to? I’ve set RUSTUP_TOOLCHAIN to 1.60.0.

The project is open source, so you can see the file here: components_guide/math.ex at master · ComponentsGuide/components_guide · GitHub

Apr 18 05:56:26 PM  info: syncing channel updates for '1.60.0-x86_64-unknown-linux-gnu'
Apr 18 05:56:26 PM  error: could not create temp file /usr/local/rustup/tmp/5xaeur6g1t7vgi4z_file: Read-only file system (os error 30)
Apr 18 05:56:26 PM  == Compilation error in file lib/components_guide/rustler/math.ex ==
Apr 18 05:56:26 PM  ** (RuntimeError) calling `cargo metadata` failed.
Apr 18 05:56:26 PM      (rustler 0.25.0) lib/rustler/compiler/config.ex:87: Rustler.Compiler.Config.metadata!/1
Apr 18 05:56:26 PM      (rustler 0.25.0) lib/rustler/compiler/config.ex:69: Rustler.Compiler.Config.build/1
Apr 18 05:56:26 PM      (rustler 0.25.0) lib/rustler/compiler.ex:9: Rustler.Compiler.compile_crate/2
Apr 18 05:56:26 PM      lib/components_guide/rustler/math.ex:2: (module)

/usr/ is read-only in Render services. If you’re able to configure where Rustler writes to, the /tmp directory would be your best bet. You may have better luck reaching out to the Rustler community to see if there is a way to configure which directory is used.

1 Like

I have opened an issue in the Rustler repo, thank you: How to write to `/tmp/…` instead of `/usr/…` to fix build on Render.com · Issue #449 · rusterlium/rustler · GitHub

I was able to workaround this by setting CARGO_HOME env variable in Render.com to /tmp/.cargo

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.