axelson
Scenic Core Team
I’m trying to run erlexec in an escript. It seems like it should be possible, but since erlexec depends on a priv directory by default, (which isn’t supported by escripts) I just need to configure it to point to a different port executable. I should be able to pass a {:portexe, executable_path option, but I’m not sure where to put that configuration because the startup of erlexec happens automatically on since on application boot by Elixir.
Here’s a test repository: GitHub - axelson/erlexec_escript_example: Demonstrate issue with erlexec escript · GitHub
Just run:
mix deps.get
mix escript.build
./erl_exec_test
And you should see an error message like:
22:15:12.827 [warn] Priv directory not available
22:15:12.834 [info] Application erlexec exited: :exec_app.start(:normal, []) returned an error: shutdown: failed to start child: :exec
** (EXIT) bad return value: 'Cannot find file : no such file or directory'
Could not start application erlexec: :exec_app.start(:normal, []) returned an error: shutdown: failed to start child: :exec
** (EXIT) bad return value: 'Cannot find file : no such file or directory'
Relevant links:
- Can't run from within an escript · Issue #92 · saleyn/erlexec · GitHub
- escriptized app and 'Priv directory not available' · Issue #122 · saleyn/erlexec · GitHub
Can anyone point me in the right direction?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
josevalim
My suggestion would be to include the binary inside the escript (you can read it, put it in a module attribute and put it in a function) and then write it down to the user temporary directory. You can delay the start of erlexec by setting it to
runtime: falsein your mix.exs.axelson
Thanks that sounds like it’ll work. Setting it to
runtime: falsewill let me control the startup of the dependency manually and then it should be pretty straightforward to adjust the:portexesetting.axelson
Okay, based on your instructions I’ve created a little helper module that copies the
exec-portbinary into the systems temp folder and it is currently working well:JeremyWildsmith
I ran into the same issue.
I understand I can defer the startup of erlexec by using runtime: false, and I understand how you are extracting the binary into the local file system.
However it isn’t clear to me how I am supposed to configure erlexec at runtime to use the extracted portexe. Could someone please assist me with this part?
I have tried using application.set_env functions, but I don’t think that is the right place to be looking?
axelson
I haven’t looked at this code in a while but I think you’re referring to this part of the snippet above:
I’m calling that function in a GenServer that is part of my supervision tree but you would likely also be okay if you dropped that code directly into your
application.exfile in thestart/2function.Here’s the full code if you want to take a look ls_proxy/ls_proxy/lib/erlexec_init.ex at 2435d956f924813021493a9b292f81b81a7eb00d · axelson/ls_proxy · GitHub
JeremyWildsmith
axelson, thanks for your quick response.
That did indeed work, I misunderstood the purpose of that line of code, but it makes sense now.
Best Regards,