bryanhuntesl
I’ve done this a lot when using distillery - for example, bundling a script which will execute an ecto.migration task.
Here’s an example of with this kind of configuration.
The reason this is important is for kubernetes. Kubernetes has various lifecycle hooks such as healthcheck, startup, etc.
It’s very nice to provide the cluster administrators with the means to run extra tasks - and it’s even nicer when you package this with the application so that you have targets like this :
docker run --rm -ti \
-e POSTGRES_HOSTNAME=postgres.notifications \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DATABASE=notifications_dev \
-e DATADOG_AGENT_HOSTNAME=localhost \
-e DATADOG_AGENT_APM_PORT=8126 \
-e EXQ_HOST=redis.notifications \
-e EXQ_PASSWORD= \
-e EXQ_PORT=6379 \
-e EXQ_NAMESPACE=exq \
--name notificatons \
--network notifications \
--hostname notifications \
-p 4000:4000 \
foo/notifications:latest help
Usage: notifications COMMAND [ARGS]
The known commands are:
start Starts the system
start_iex Starts the system with IEx attached
daemon Starts the system as a daemon
daemon_iex Starts the system as a daemon with IEx attached
eval "EXPR" Executes the given expression on a new, non-booted system
rpc "EXPR" Executes the given expression remotely on the running system
remote Connects to the running system via a remote shell
restart Restarts the running system via a remote command
stop Stops the running system via a remote command
pid Prints the OS PID of the running system via a remote command
version Prints the release name and version to be booted
--> run_migration Run ecto migration
--> update_email_templates Update email templates (for example)
ERROR: Unknown command help
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
Hello folks!
So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
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
- #ai
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
bryanhuntesl
https://github.com/bitwalker/distillery
bryanhuntesl
Not getting a lot of responses - might need to go back to using distillery
bryanhuntesl
So I actually read the docs properly - and there is some description given to adding custom tasks -mix release — Mix v1.20.2
What I’m wondering though, is what’s the idiomatic way to package them up nicely with the bin/ init script? Is there a standard extension point?
josevalim
You can define them in
lib. Here is an example from Phoenix release guides: Deploying with Releases — Phoenix v1.8.8bryanhuntesl
Apologies - I’ve communicated appallingly badly, so what I’d like to do (end user ergonomics/tight integration) is build in such a way that rather than the end user invoking:
The end user invokes:
I should have asked is there an extension point or idiomatic way to extend the startup script.
josevalim
Ah, ok! No, there isn’t a way today to extend the built-in script. We considered this but we are unsure if this is really the direction we want to go. For example, wouldn’t it be better to have separate script in
bin/? Or maybe, if the goal is to provide an API for users with no experience of Elixir, have a separate script altogether?LostKobrakai
That‘s what I‘ve gone with:
https://github.com/LostKobrakai/doist
bryanhuntesl
A script in bin for running
mix ecto.setup? Apart from hard coding, how would it know where the application code, etc lived?josevalim
@bryanhuntesl to be clear, I mean it could be called
bin/setup-dband inside it does./my_app eval "..."and that’s all.bryanhuntesl
That’s a pragmatic solution - I’ll give it a go - I was getting too dogmatic there - still, I’d consider distillery’s approach just from the perspective of UX.