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’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
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
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
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
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
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
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
- #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 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.