bottlenecked

bottlenecked

How to do proper post-release steps

Hi all, I wanted to ask how the community is dealing with post-release steps.

Today we have Ecto migrations, which make sure that the db has been updated to the new schema etc. before the application starts up.

What I’d need is something similar to migrations but for after the application has started. Sometimes after releasing the new code we need to perform some steps like re-publish some events or re-calculate and store some data, and these steps need the newly-released code to be there.

Today we’re taking care of steps like these by connecting to the running app and issuing the necessary commands by hand. Ideally though we’d be able to script these steps in code (and have them be part of pull requests) and then have them run after the app has started successfully, perhaps even schedule them for e.g. after-work hours. And of course if these steps are scripted in code, we’d only run them once (like how ecto migrations are only run once)

Are you aware of something like this existing in the BEAM ecosystem already? If not, how do you deal with such situations? Do you abuse for example Ecto migrations to run non-db related code? Create one-off Oban jobs? Thanks.

Most Liked

krasenyp

krasenyp

I’d say, for everything which requires some kind of credentials or identification, like inviting or creating users, keep using the manual process. It’s better to have a person do the action than have a script do it unconditionally. For other tasks, you can use eval in scripts to run functions. This is about the invocation.

About the timing, it depends on your deployment target. Approaches might defer when using Kubernetes, AWS Fargate, systemd service on a VPS and so on.

Last Post!

bottlenecked

bottlenecked

Monarch does seem promising, thanks! It’s oriented around data migration, but I guess always returning an empty list from its query/0 function and then running any kind of custom code I might want in the update/1 callback could work. Maybe I could wrap that Monarch behaviour even to only present the exact semantics I’d need…

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130286 1222
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement