pmjoe
I need to develop a CLI application and I’m wondering how suitable Elixir is for this kind of application. The application must be distributed to clients and it should be as simple as possible to run, ideally a static build with a single binary. I know Elixir has some build systems and I’m wondering if some of these systems can produce a binary, in the end, packing everything inside like the Erlang VM, etc, etc…
Protecting the source code is also desirable.
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
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
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
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
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
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ityonemo
You should not use elixir for this.
hauleth
Use Go, Zig, or Rust for that. Elixir is a poor choice there.
ityonemo
maybe I should be more specific about the different points:
Not generally possible. If you’re okay with a zipped artifact that decompresses into a directory, I would argue that deployment with Elixir as a client application in theory could be easier, than say python, but I have not heard of anyone who has done this.
Releases (zipped directory) do this. But you must know a considerable amount about your target environment for this to work successfully.
This is probably a show-stopper.
Other concerns, if you are expecting a responsive cli app (think like grep) where you might be integrating it as a part of a toolchain that runs very quickly (like generating tab-completion suggestions on a command line), this is not going to be feasible. But if you’re building something where it is going to do something necessarily long-running (like fetching files over the internet) it’s not the worst. I deployed an internal CLI tool once that concurrently-downloaded files from dropbox, S3, box, gcloud… but this was internal and not meant for customer distribution, so realistically it only had to work on one flavor of MacOS, and one flavor of linux.
Also, the erlang vm will default to hogging as many processes as there are CPUs on your system, so you may want to think about that too.
HDT186
You can have a look at Bakeware, which compiles an Elixir, a Scenic or a Phoenix application into single executable binary.
hauleth
Bakeware still doesn’t main problem with Elixir for CLI tooling - startup time. Most of the CLI tools is one-time quick tools that are launched often and that finish quickly. In such environment Erlang features aren’t that appealing and do not bring much to the table except familiarity.
jswny
Any language with a runtime that’s not super light like Go is not going to be good for CLI applications. If you are making a CLI app which is going to run for a bit and won’t need to be called quickly and opened many times or piped into etc, you could get away with it. It depends on the use case but in general Elixir is definitely not good for this use case.
hauleth
Disagree. Python, Ruby, Perl, etc. are quite good solution for CLI tools. Sometimes even Java is ok solution.
tme_317
I’ve written several CLI apps in elixir for interactive use (i.e. converting data, automating ansible, etc) using escripts. Due to familiarity I write Elixir code much faster than anything else and it works great if you can don’t mind the ~200ms “boot time” (depending on machine of course) to run the CLI app as the whole VM must be brought up even for a quick task.
For me that is a good tradeoff for interactive use as I can control the small internal team’s environment these tools are distributed to and make sure proper Erlang is installed. Your case of “packing … Erlang VM” and “distributed to clients” leads me to suggest what others have already said in Go, Rust, etc which would be much faster to boot and easier to distribute. I haven’t tried Bakeware maybe that solves the distribution problem at least.
derek-zhou
From a pure runtime startup time perspective:
perl < python2 < python3 < ruby < java < elixir < nodejs
So elixir is not the worst. Hell, many CLI programs are written in nodejs; I cringe every time I run webpack.
carterbryden
I think really the main reasons why I usually wouldn’t go for elixir for a CLI app is that you probably won’t get or need it’s best benefits in a CLI too. Things like reliability and recovery features, distributed computing, maybe concurrency. But you’d still have to deal with a lot of the tradeoffs - lower portability, startup times, etc.
Elixir is designed to do a lot of things really well but it’s hard to beat languages that were designed specifically to be good for CLI tools without trading off the things that make it great for all other stuff.
Then again if your cli tool needs to be able to run a long lived command with a focus on reliability and concurrency, elixir would probably be great.