News for hackers. Stuff that matters.
Re:Elixir and Ruby can talk to each other using Erlix by poorman on Monday December 05, 2016 @01:43PM (#13108019)
I don't see any practical use for this. You're just sending text around. This breaks most OTP conventions, you lose insight from the Observer, etc..

If all you want is message passing you should just use something like zeromq which would allow for a lot more than just Elixir to Ruby.

Re:Elixir and Ruby can talk to each other using Erlix by davidw on Monday December 05, 2016 @01:53PM (#13108123)
> You're just sending text around.

Unless I'm mistaken, it's using Erlang's distribution protocol, which is not 'just text'.

http://erlang.org/doc/apps/erts/erl_dist_protocol.html

As to whether some other form of sharing data between Ruby and Erlang is more appropriate, I'm sure it depends entirely on the application. At $current_job - 1 we used the Java/Erlang libs to let Android and Erlang talk, and it worked pretty well. We did not need other systems to access the same data, or the additional overhead an extra piece of software would have required.

Re:Elixir and Ruby can talk to each other using Erlix by poorman on Monday December 05, 2016 @02:20PM (#13108375)
Ah, I see this now: https://github.com/KDr2/erlix#about-the-class-erlixmessage. So I guess it is handling encoding.

P.S. zeromq doesn't require you to run another system, it's just a lib.

Re:Elixir and Ruby can talk to each other using Erlix by davidw on Monday December 05, 2016 @03:08PM (#13108940)
Well, yeah, 'just' an extra lib with its own encoding and decoding. If your system as a whole revolves around Erlang, it's a fine choice for a protocol. Other times, something more 'standard' that lots of disparate pieces can talk to is better. Totally something to be decided by whoever is building it.
Re:Elixir and Ruby can talk to each other using Erlix by vertex-four on Monday December 05, 2016 @03:09PM (#13108951)
While it's just a lib, it does implement an alternative networking system to the one you're using everywhere else in Erlang, which requires different ways of interacting with it and different knowledge of all the fun edge cases.
Re:Elixir and Ruby can talk to each other using Erlix by felixgallo on Monday December 05, 2016 @02:51PM (#13108740)
Re:Elixir and Ruby can talk to each other using Erlix by rad_gruchalski on Monday December 05, 2016 @03:05PM (#13108904)
There's even a ruby lib for that: https://github.com/mojombo/bert
Re:Elixir and Ruby can talk to each other using Erlix by elcritch on Tuesday December 06, 2016 @03:07AM (#13112998)
Alas, most of the libraries are pretty old and not currently active. But still seems to be a decently simple/useful spec. However, messagepack protocol seems much more broadly supported and some new rock libs are popping up, but no common rpc spec.

Based on those facts, I decided to build a Bert-rpc but using message pack and geared for embedded devices. Just released (as in tonight!) the initial code for an Arduino RPC library. It uses the msg pack for Arduino (https://github.com/HEADS-project/arduino_msgpack), a great little library. Enjoying it much more than most JSON libraries.

It's intended purpose is to make interacting with sub-1ghz radios and be easy to interface with elixir. Only have basic Call and Cast semantics at the moment, but it's only two days old. :-) If anyone's interested in helping, I think C++11 lambda might be a feasible way to create rpc callbacks that non-devs could use (maybe...).

Re:Elixir and Ruby can talk to each other using Erlix by felixgallo on Tuesday December 06, 2016 @08:47PM (#13119876)
You might also look into google protobufs ('gpb') and grpc, which are newer solutions that make some interesting tradeoffs but focus on performance and small size.
Re:Elixir and Ruby can talk to each other using Erlix by justin66 on Monday December 05, 2016 @06:56PM (#13111037)
I've got something for this... wait for it... Inter-Bandwagon Communication. IBC for short.
Re:Elixir and Ruby can talk to each other using Erlix by rozap on Monday December 05, 2016 @10:15PM (#13111953)
Hm, not exactly. This is the same model as JInterface, which is built and maintained by Ericcson and has been around for quite a while and targets the JVM. This is nicer than using ports as datatypes "just work". The whole runtime (Ruby or JVM) just appears as an erlang process, which you can send/receive messages to/from.

We use JInterface at work to leverage a bunch of stuff on the JVM that we already built. Integrating it with our Elixir project took less than a day and to be frank there's significantly less fucking around than there would have been had we deployed the JVM functionality as a microservice, and locality is preserved, which is nice.

JInterace (and i'm assuming Erlix because it's the same model) has been a really nice, low friction way to re-use a bunch of code that already works.

Re:Elixir and Ruby can talk to each other using Erlix by mmartinson on Monday December 05, 2016 @12:34PM (#13107278)
I'd be curious to see if this becomes viable as an interface wrapper for teams that writing new services in Elixir while supporting important pieces of legacy Ruby code. This seems to be the situation in a lot of Ruby shops, and it would be fantastic to see someone getting this working at a big scale and seeing some industry best practices emerge.
Re:Elixir and Ruby can talk to each other using Erlix by holydude on Monday December 05, 2016 @02:51PM (#13108744)
I am not sure why we need to replace Ruby with Elixir. Nor do I understand why it is necessary to write every new code in Elixir. I mean when Crystal gets production ready are you guys going to rewrite everything from Elixir to Crystal ? :-| Elixir is not a substitute for Ruby. It's completely different paradigm and language. Same for Crystal. They just happen to feel like Ruby but are missing a lot from Ruby/Rails ecosystem.

I really like lispness of Ruby and the rails ecosystem. For a lot of things it's still numero uno technology.

Re:Elixir and Ruby can talk to each other using Erlix by dakull on Monday December 05, 2016 @08:17PM (#13111469)
The first things that come to mind:

- true parallelism (this is why we need guilds in Ruby 3)

- the BEAM

- functional yet OO at a higher level [0]

- all the Erlang/OTP goodies for free

- Phoenix/Ecto are quite nice frameworks and solid alternatives to the server-side JS world

- “looks” like Ruby though is an entirely different beast

Crystal on the other hand looks more like a Rust alternative to implement almost-as-C-fast Ruby gems. I'm sure it can evolve into an ecosystem but since it's quite far from being stable it will take some time, time in which the Elixir ecosystem will grow because its Erlang foundation already fixed the big issues.

[0] - https://www.infoq.com/interviews/johnson-armstrong-oop

Re:Elixir and Ruby can talk to each other using Erlix by enraged_camel on Monday December 05, 2016 @01:16PM (#13107729)
Yeah, in the most recent Who Is Hiring post, every mention of Elixir also mentioned Ruby somewhere, usually in the context you described.
Re:Elixir and Ruby can talk to each other using Erlix by sjtgraham on Monday December 05, 2016 @01:31PM (#13107880)
Most of those postings seem like Ruby shops that have pipe dreams of doing Elixir stuff, some day. I'm skeptical many will get there, which is a shame because Elixir is the most fun I've had writing software.
Re:Elixir and Ruby can talk to each other using Erlix by tyre on Monday December 05, 2016 @01:48PM (#13108073)
We started in Ruby and have moved to Elixir (not a pipe dream!). If you have an SOA already, adding Elixir isn't a big hurdle. Experienced engineers can pick it up super quickly.

I agree it is incredibly fun! All of the hard work put into BEAM plus the easy-of-use of Ruby and the joys of functional programming make for a wonderful developer experience.

Re:Elixir and Ruby can talk to each other using Erlix by mmartinson on Monday December 05, 2016 @02:01PM (#13108217)
Ya I've actually seen a number a few shops making real moves in that direction, at least here in Vancouver. The OSS ecosystem is obviously pretty immature but I think it's getting good enough that it's starting to seem like a pretty viable option.
Re:Elixir and Ruby can talk to each other using Erlix by dakull on Monday December 05, 2016 @02:56PM (#13108801)
Indeed, it seems Elixir is one part complementary to Ruby and the other a great replacement whilst also keeping the main tenets of Ruby in-place.

The only issue so far is that the libraries ecosystem is indeed quite young but that is natural.

Still, Ruby (even without Rails) is at the moment a more productive environment.

I really hope Ruby "3x3" [0] will be released soon enough and projects like Hanami [1] become production ready so that it can coexist in a complementary way rather than becoming replaceable.

[0] - https://blog.heroku.com/ruby-3-by-3

[1] - http://hanamirb.org

Re:Elixir and Ruby can talk to each other using Erlix by lojack on Monday December 05, 2016 @02:14PM (#13108326)
Anecdotal, I know, but I work for one of these companies. Definitely not a pipe dream for us. Most new projects are still in Ruby, but Elixir is now supported company-wide, and there's a number of projects being built in Elixir.
Re:Elixir and Ruby can talk to each other using Erlix by ch4s3 on Monday December 05, 2016 @02:38PM (#13108572)
I work at a healthcare company, where our primary language had been Ruby. All of our new development, except 1 off scripts, is in Elixir.
Re:Elixir and Ruby can talk to each other using Erlix by rubiquity on Monday December 05, 2016 @05:32PM (#13110412)
Same here all across the board: healthcare, previously Ruby, everything new is in Elixir.
Re:Elixir and Ruby can talk to each other using Erlix by ch4s3 on Monday December 05, 2016 @07:02PM (#13111063)
Awesome to hear. If you're ever interested in chatting about elixir in healthcare, shoot me an email. Mine is in my profile.
Re:Elixir and Ruby can talk to each other using Erlix by dakull on Monday December 05, 2016 @06:36PM (#13110923)
How did the migration go if I may ask? Was it progressive or clean slate? i.e. develop in parallel the new Elixir implementation and just switch when everything is green and all the specs match the Ruby app.
Re:Elixir and Ruby can talk to each other using Erlix by rubiquity on Tuesday December 06, 2016 @10:34AM (#13115271)
It's going well! Most of the team is eager to learn something new. The developer ergonomics in Elixir/Phoenix are quite a bit better than Ruby/Rails, which is really saying something because Ruby/Rails has been really great to us!

We're starting new projects in Elixir. We haven't ported anything from Ruby to Elixir yet, but we have a 9 year old ~100k lines of code (not counting views/tests) Rails app that we could make an argument to extract some functionality from.

Re:Elixir and Ruby can talk to each other using Erlix by ch4s3 on Monday December 05, 2016 @07:02PM (#13111065)
For us, we just do new parts and projects in Elixir.
Re:Elixir and Ruby can talk to each other using Erlix by gamache on Monday December 05, 2016 @04:39PM (#13109928)
Anecdata/shameless plug: Appcues is an Elixir shop with no Ruby at all. And we're hiring!

https://news.ycombinator.com/item?id=13080548

Re:Elixir and Ruby can talk to each other using Erlix by eropple on Monday December 05, 2016 @07:48PM (#13111323)
I liked you more when you were a role model for Ruby snobbery. :( (Said, like, 95% in jest. I think. I think I think?)

But, yeah, I don't often stump for people around here but Pete is good people to work with if you're looking. I would rather have fire ants poured in my pants than do web work, but I'd jump at the opportunity to work with him again and if you're looking, you could do a lot worse.

Re:Elixir and Ruby can talk to each other using Erlix by abritinthebay on Tuesday December 06, 2016 @01:45AM (#13112709)
I can only speak to what we do at Bleacher Report, but we were mostly Ruby - now Ruby is mostly legacy apps.

Elixir for the services and Node for the client/frontend is how we're rolling now. I don't think any of the Ruby guys want to go back.

While we're not against Ruby - and as I said, we still use it - at our scale Elixir is much more performant & scales better.

Re:Elixir and Ruby can talk to each other using Erlix by misterbowfinger on Monday December 05, 2016 @01:19PM (#13107761)
Interesting - makes me think of ErRuby:

https://github.com/johnlinvc/erruby

Like JRuby, but s/Java/Erlang.

Re:Elixir and Ruby can talk to each other using Erlix by mackdaddysly on Monday December 05, 2016 @12:22PM (#13107108)
I wonder what the benefits of this approach is to say, a json driven microservice between elixir and ruby?
Re:Elixir and Ruby can talk to each other using Erlix by sjtgraham on Monday December 05, 2016 @01:35PM (#13107922)
Running your applications in Erlang is its own microservices architecture. Each process is essentially microservice that can interact with others on any node in your cluster by sending messages. Everything is handled for your by the runtime. Processes on a different node? No problem, they're easy to discover and if a message does go to another node the serialization is handled for you. Erlang is so powerful I'd actually invert your question.
Re:Elixir and Ruby can talk to each other using Erlix by dfischer on Monday December 05, 2016 @04:45PM (#13109981)
I hesitate using Erlang/elixir for this than aws lambda + event distribution. Any thoughts?
Re:Elixir and Ruby can talk to each other using Erlix by abritinthebay on Tuesday December 06, 2016 @01:48AM (#13112716)
If you don't need low latency and are ok with the extra architectural overhead... there's nothing wrong with that.

Different use cases

Re:Elixir and Ruby can talk to each other using Erlix by dfischer on Tuesday December 06, 2016 @02:28AM (#13112855)
Many are preaching erlang/elixir on the OTP/microservice alternative paradigm – that doesn't seem as attractive as the low latency resiliency.

At least to me, as a story.

Re:Elixir and Ruby can talk to each other using Erlix by abritinthebay on Tuesday December 06, 2016 @11:22AM (#13115787)
Well... it's a win for both. It means it's easy to write performant and highly concurrent microservices.

Latency is part of that.

Re:Elixir and Ruby can talk to each other using Erlix by vikiomega9 on Monday December 05, 2016 @05:07PM (#13110168)
Isn't aws lambda better suited for short running tasks?
Re:Elixir and Ruby can talk to each other using Erlix by dfischer on Tuesday December 06, 2016 @12:34AM (#13112483)
What's a long running task?
Re:Elixir and Ruby can talk to each other using Erlix by vikiomega9 on Tuesday December 06, 2016 @11:08AM (#13115620)
I think heuristic is running time of about 5 or 10 minutes.
Re:Elixir and Ruby can talk to each other using Erlix by davidw on Monday December 05, 2016 @01:16PM (#13107735)
Probably faster and more direct and less fiddling around with encoding stuff in JSON. I'm pretty sure both Ruby and Erlang have richer types than JSON.
Re:Elixir and Ruby can talk to each other using Erlix by 15155 on Monday December 05, 2016 @12:28PM (#13107171)
I would like to see a DRB <-> Erlang C Node (but in Ruby) system.

Start Ruby process, get Erlang node.

Re:Elixir and Ruby can talk to each other using Erlix by dakull on Monday December 05, 2016 @12:25PM (#13107140)
>the Erlang node, witch is connected to Erlang VM over the network.

Witches are connected to the BEAM? :) funny typo.

Re:Elixir and Ruby can talk to each other using Erlix by Cyph0n on Monday December 05, 2016 @12:40PM (#13107342)
Well, BEAM is somewhat magical, so... Freudian slip?
Re:Elixir and Ruby can talk to each other using Erlix by pmontra on Monday December 05, 2016 @12:18PM (#13107066)
Interesting. Any real world application this has been used for?
Re:Elixir and Ruby can talk to each other using Erlix by amorphid on Monday December 05, 2016 @01:55PM (#13108157)
Is this more or less useful than C bindings in either language?
Re:Elixir and Ruby can talk to each other using Erlix by dfischer on Monday December 05, 2016 @04:00PM (#13109512)
With aws lambda elixir is less attractive to me. I wonder if anyone has similar thoughts?
Re:Elixir and Ruby can talk to each other using Erlix by gamache on Monday December 05, 2016 @04:45PM (#13109979)
At Appcues, we use a combination of both approaches.

We have our Elixir backend where we need some combination of:

- Low latency -- Lambda + API Gateway requests typically incur a ~200ms invocation latency

- Persistent connections, e.g. WebSockets

- High performance

- Continuous usage, let's say at least ten calls per second all day every day forever

For everything else, Lambda and API Gateway have been fantastic, even without a framework like Serverless. It's so cheap! It's so convenient! It's so reliable-enough!

But we couldn't get along on a 100% Lambda backend, far from it.

Re:Elixir and Ruby can talk to each other using Erlix by dfischer on Tuesday December 06, 2016 @12:35AM (#13112488)
I agree with this a lot. Especially on the web socket front. I've been thinking of an ideal structure for this. I haven't decided between elixir or bet in with Google and Firebase.
Re:Elixir and Ruby can talk to each other using Erlix by gamache on Tuesday December 06, 2016 @03:57PM (#13118273)
For what it's worth: we use Firebase in our stack too, but at this point it's confined to our customer-facing dashboard (as opposed to our end-user-facing service). I don't like it when my critical systems depend on services out of my control, especially when those services go down for hours or days at a time -- as Firebase DB has done twice in the last year, for us.
Re:Elixir and Ruby can talk to each other using Erlix by dfischer on Tuesday December 06, 2016 @05:43PM (#13118942)
How are you delivering sockets to end-user facing service? Through phoenix?
Re:Elixir and Ruby can talk to each other using Erlix by gamache on Wednesday December 07, 2016 @11:30AM (#13123738)
Yes, we have a pool of Elixir + Phoenix servers behind a classic Amazon Elastic Load Balancer (set to TCP/SSL mode, not HTTP/HTTPS, or else WebSockets don't work).
Re:Elixir and Ruby can talk to each other using Erlix by dfischer on Wednesday December 07, 2016 @02:56PM (#13125665)
Hmmm cool. How are you deploying Phoenix?
Re:Elixir and Ruby can talk to each other using Erlix by gamache on Saturday December 10, 2016 @09:31AM (#13145770)
Right now we're using Edeliver and Distillery. We're planning to containerize things soon, so I'm not sure what the toolchain will look like then, but if you have long-lived servers then Edeliver is great.
Re:Elixir and Ruby can talk to each other using Erlix by ZmyWTR on Monday December 05, 2016 @02:45PM (#13108665)
Cool, should be very useful...thanks for posting!