Microservices in Elixir

448 views
Skip to first unread message

fr3dch3n

unread,
Aug 5, 2016, 9:46:56 AM8/5/16
to elixir-lang-talk

Hey fellow elixir developers,


I seek your guidance. In my very few freetime? I'm working on a basic microservice in elixir: Magellan Microservice. (see https://github.com/fr3dch3n/magellan-microservice).


Spending more and more time with elixir, I started wondering if my approach is actually any good. In Magellan I use a basic cowboy server and attach some routes to it.

Here lies kinda the heart of this microservice. The concept enables you to write your own app, start the magellan from within your project and then simply register your own router to the magellan router. All requests that aren't handled by the configurable application-status-endpoints are forwarded to your own router. This way you don't have to worry about server or basic app-status things. (You can simply register a status function at the app-status that gets invoked by a request for the status-page. (The app-status is still in a very early stage, so there is no strategy to provide an useful status.)


Before continuing on this project I wanted to get some feedback to see if my concept is any good.

To provide a more specific question:

Should I prefer phoenix even for such possibly small applications? For me it seems overpowered for this usecase.

I use some Agents for the rare cases where there is a state to safe (e.g. the registered router or registered functions for the app-status). Is this good practice?

What do you think about the whole concept?


We already use the magellan as basis for some monitoring applications, so I want to improve it wherever I can.


I'm greatful for any advice!

fr3dch3n

OvermindDL1

unread,
Aug 5, 2016, 10:17:08 AM8/5/16
to elixir-lang-talk
For note Phoenix *is* the simple use-case.  It is little more than a set of pre-defined plugs.  ;-)

Louis Pilfold

unread,
Aug 5, 2016, 10:30:10 AM8/5/16
to elixir-lang-talk
Hey!

Phoenix is slimmer than it first seems, but if you want something less
opinionated you can also just use raw Plug. I rather enjoy using
Plug.Router

https://github.com/elixir-lang/plug
https://github.com/elixir-lang/plug#the-plug-router

Cheers,
Louis
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-ta...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-talk/60d94703-6336-4782-9429-14ce68c73c7c%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

fr3dch3n

unread,
Aug 5, 2016, 10:47:40 AM8/5/16
to elixir-lang-talk, lo...@lpil.uk
Hey,
That's what I actually do at the moment.
I use it in the way, you can see here:
https://github.com/fr3dch3n/magellan-microservice/blob/master/lib/router.ex
Do you have any suggestions for improvements?
It works surprisingly well to forward all requests that to a custom router which I usually implement with Plug, too.

Scott Ribe

unread,
Aug 6, 2016, 10:45:58 AM8/6/16
to elixir-l...@googlegroups.com
On Aug 5, 2016, at 7:46 AM, fr3dch3n <fredch...@gmail.com> wrote:
>
> Before continuing on this project I wanted to get some feedback to see if my concept is any good.

Phoenix is not Rails; it is lighter and more modular. I have a project that is on a similar path as yours, front end to various services, with multiple router-like things. I started with Phoenix, and ripped out some pieces (templates, rendering, Ecto for instance).

Anyway, yes, it's a valid approach ;-)


--
Scott Ribe
scott...@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice





Bruno Girin

unread,
Aug 24, 2016, 6:57:23 AM8/24/16
to elixir-l...@googlegroups.com
On 5 August 2016 at 14:46, fr3dch3n <fredch...@gmail.com> wrote:

Hey fellow elixir developers,


I seek your guidance. In my very few freetime? I'm working on a basic microservice in elixir: Magellan Microservice. (see https://github.com/fr3dch3n/magellan-microservice).


Spending more and more time with elixir, I started wondering if my approach is actually any good. In Magellan I use a basic cowboy server and attach some routes to it.


Excellent! That's exactly what I'm trying to do at the moment so rather than re-invent another wheel, I might make use of Magellan :)

 

[snip]

Before continuing on this project I wanted to get some feedback to see if my concept is any good.

To provide a more specific question:

Should I prefer phoenix even for such possibly small applications? For me it seems overpowered for this usecase.


That's the conclusion I had come to as well. I know that Phoenix is quite lightweight compared to other MVC frameworks but when what you do requires neither the M nor the V in MVC, it looks like raw plugs are simpler to deal with.


[snip]

We already use the magellan as basis for some monitoring applications, so I want to improve it wherever I can.


Nice! Happy to help with that if I end up using it (which is likely).

Cheers,

Bruno

fr3dch3n

unread,
Aug 25, 2016, 2:07:58 AM8/25/16
to elixir-lang-talk


Am Mittwoch, 24. August 2016 12:57:23 UTC+2 schrieb Bruno Girin:


On 5 August 2016 at 14:46, fr3dch3n <fredch...@gmail.com> wrote:

Hey fellow elixir developers,


I seek your guidance. In my very few freetime? I'm working on a basic microservice in elixir: Magellan Microservice. (see https://github.com/fr3dch3n/magellan-microservice).


Spending more and more time with elixir, I started wondering if my approach is actually any good. In Magellan I use a basic cowboy server and attach some routes to it.


Excellent! That's exactly what I'm trying to do at the moment so rather than re-invent another wheel, I might make use of Magellan :)

I love to hear that. :) 


 

[snip]

Before continuing on this project I wanted to get some feedback to see if my concept is any good.

To provide a more specific question:

Should I prefer phoenix even for such possibly small applications? For me it seems overpowered for this usecase.


That's the conclusion I had come to as well. I know that Phoenix is quite lightweight compared to other MVC frameworks but when what you do requires neither the M nor the V in MVC, it looks like raw plugs are simpler to deal with.


[snip]

We already use the magellan as basis for some monitoring applications, so I want to improve it wherever I can.


Nice! Happy to help with that if I end up using it (which is likely).

I'm not entirely sure how to proceed with Magellan. There are like a few open tasks (like aggregating status function results), but atm I don't know which killer-feature would be nice to have.
I really would like us to make it more awesome. ;-)
 
Cheers,
fr3dch3n

Reply all
Reply to author
Forward
0 new messages