Migrating from Rails to Elixir, bit by bit

At my company, we decided to slowly move away from our current Rails application to Elixir. At the same time, we don’t have the resources or time to freeze all development for 6 monts and rewrite everything from scratch. That won’t happen.

What we thought is the way to go is that we might start replacing specific routes / components with Elixir applications (going to use Umbrella applications for that).

A large chunk of the Rails application that needs to be ported first is accessible as HTML or JSON/REST. We thought that one possible solution would be to have an Elixir / Phoenix application that would act as a proxy for the requests. If a specific route was already ported to Elixir, it would render the specific route. If not, it would fall back to the Rails application. Also, a quick switch would be nice, so that we can go back and forth in case stuff goes bad during the migration.

Any ideas / suggestions on how to implement that? The closest I could get to this approach is by using Nginx as a proxy, but it’s a bit more complex to allow the switching in a more or less dynamic way.

I’m hoping there is a way to do this in Elixir. Any ideas?

3 Likes

This might be a nice start: https://github.com/poteto/terraform

6 Likes

reverse proxy, with either rails or phoenix in front… (in your case it sounds like you would keep rails in front, given a slower tempo)

phoenix in front:
https://blog.fourk.io/replace-your-production-api-with-elixir-today-4426a8903642

rails in front:

depending on your setup/use case you can also run with two URIs on the client - (eg if you do header auth or something)

5 Likes