News for hackers. Stuff that matters.
Re:Bakeware – Compile Elixir applications into single execut... by srgpqt on Thursday September 17, 2020 @10:26AM (#24505012)
+1 on the issue of Mix commands. We also put in boilerplate code for database migrations, but eventually I decided this was stupid. Now I keep the source on the servers and just run Mix commands from there.
Re:Bakeware – Compile Elixir applications into single execut... by l72 on Thursday September 17, 2020 @02:59PM (#24508573)
For Ecto, you can just run a function:

  migrations_path = Path.join(["#{:code.priv_dir(:myapp)}", "repo", "migrations"])
  Ecto.Migrator.run(MyApp.Repo, migrations_path, :up, all: true)
Since migrations are idempotent, and I always want to run up to the latest migration, I just include this in lib/myapp.ex in its start function. That way any time a new release rolls out, the first node with the new release automatically runs the migrations. (We always make sure our migrations are backwards compatible for at least X number of versions, which means never deleting tables or columns so that existing nodes don't break)
Re:Bakeware – Compile Elixir applications into single execut... by rhizome31 on Thursday September 17, 2020 @10:32AM (#24505089)
But then you need to install Erlang/Elixir on the server, which kind of defeats the purpose of releases, don't you? Or have you abandoned releases altogether?
Re:Bakeware – Compile Elixir applications into single execut... by Fire-Dragon-DoL on Saturday September 19, 2020 @03:53AM (#24525918)
I actually find really good that mix commands are not included. Those are Makefile commands, I wouldn't expect them on production.

It's funny that the case highlighted is the one about migrations, which indeed shouldn't be located or connected to the app in the first place. There are a lot of SQL migration tooks available, but even simple bash scripts are enough.