Stef-Verniers
Hello
I’ve been coding in Elixir for almost two years now because of my current job where we implemented Elixir in our application. But after two years, there is still so much to discover and knowledge I don’t have obtained yet.
I’m working on a private project now, using Elixir, but I find it kind of hard to learn this new step I want to implement in the private project: The setup of the Makefile
I looked at the Makefile of my job but this was such a huge difference with the examples I’ve came across on different sites. This makes it difficult to know what is necessary and what’s not.
The Makefile for my project should start the server, make sure the database is spinning, Docker containers are online and operating and that’s probably it for now.
How do I start? What’s important, what’s not?
Kind regards
Stef
Trending in Questions
Other Trending Topics
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
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #elixirconf-us
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #security
- #elixirconf-eu
- #api
- #forms
- #hex










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
derek-zhou
Makefiles are for old timers, like me. Yes, it is powerful; however, it comes with a lot of sharp edges and Makefile beyond certain size will be hopelessly unmaintainable.
Before opening a big can of worms, please ask yourself: “Do I really need a Makefile?”
colorfulcms
For a first Makefile, I’d keep it as thin task aliases rather than real build logic. Start with .PHONY targets like
deps(mix deps.get),db(docker compose up -d db),setup(depends on db, then mix ecto.setup) andserver(depends on db, then iex -S mix phx.server). Since Docker Compose already handles starting the containers, you can add a healthcheck to the database service and usedocker compose up -d --waitso the server target only runs once Postgres is actually ready. Remember that recipe lines need tabs, not spaces. If it grows beyond a handful of targets, mix aliases in mix.exs are a good alternative since they stay in Elixir.mudasobwa
You are after a simple bash script. Makefile is an overkill and misuse for this kind of task.
kristoffn
If your goal is to write tasks to set your project up, and not to learn the quirks of make, then I can highly recommend mise and mise tasks.
I’ve found it more usefull than make, because I can pin the tool versions (like databases) and mise installs them. Two advantages over make are the arguments and flags and the task descriptions. No need for a
helptask with awk magic, which in my experience go stale after a while as the Makefile changes and the flags make the invoked scripts tidier.LostKobrakai
Another option imo is Introduction - Just Programmer's Manual. It’s like a makefile, but tries to actually be a task runner not a build system.
Stef-Verniers
Hello,
Since I’m still learning a lot about Elixir, I’m not educated enough to answer in a proper way.
It’s just what I know because of my job.
Sorry for the late response!
Stef-Verniers
That does look interesting. I’ll take a look at it!
Stef-Verniers
Well yes, for local development, I can spin up my docker container from docker desktop en just type in the run phx.server command and those would be the most important tasks.