[HN Gopher] Social virtual spaces with Elixir at Mozilla
       ___________________________________________________________________
        
       Social virtual spaces with Elixir at Mozilla
        
       Author : thibaut_barrere
       Score  : 164 points
       Date   : 2021-06-04 17:06 UTC (5 hours ago)
        
 (HTM) web link (elixir-lang.org)
 (TXT) w3m dump (elixir-lang.org)
        
       | spicybright wrote:
       | Why floating torsos without limbs? Could they have designed
       | something less creepy to talk to?
        
         | LinusPrime wrote:
         | Limbs can be tricky to animate correctly in VR... I still get
         | nightmares from some of the abominations I've seen in VR Chat.
        
         | jayd16 wrote:
         | Usually all you have is head position and hand position. You
         | don't have torso tracking separate from head tracking and
         | because of that doing elbow IK can be really hard. This style
         | keeps you out of the uncanny valley.
         | 
         | Although, the realistic torso shape might go a bit too far.
        
           | gfodor wrote:
           | Worth noting Hubs is more like Wordpress for social VR - the
           | content is largely up to the user (to either adopt or create)
           | - so the avatars in screenshots say less about some kind of
           | universal art design choices than whatever specific setup the
           | user was in.
        
         | gfodor wrote:
         | Believe me, not creepy is harder than it seems, especially in
         | VR.
        
       | teeray wrote:
       | I can't believe this has been around since 2018 and this is the
       | first I've heard of it. I can think of a bunch of events over the
       | past year where this would have been awesome to use. Shame that
       | the marketing hasn't been better.
        
       | fsiefken wrote:
       | I'd like to run Hubs Cloud on premises (my own home), but it's
       | currently only offered as Digital Ocean droplet and Amazon
       | https://hubs.mozilla.com/docs/hubs-cloud-intro.html
       | 
       | I found some repositories here and there but it's all dated. I
       | wondered if there is a more recent reticulum docker and
       | installation document I could re-use and found the links below.
       | If anyone has other tips, installation flows/scripts or pointers,
       | feel free to share.
       | 
       | https://sophiadigitalart.com/setup-your-own-hubs-server/
       | 
       | https://github.com/mozilla/hubs
       | 
       | https://github.com/xr3ngine-archive/mozilla-hubs-docker
       | 
       | https://gitlab.nautilus.optiputer.net/ar-noc/mozilla-hubs-do...
        
       | sergiomattei wrote:
       | These frequent posts about Elixir are tempting me to give it
       | another shot...
       | 
       | But the last time I tried (weeks ago), it was a total pain. I
       | could barely find documentation for the authentication packages I
       | was trying for Phoenix and the docs I did find were usually
       | outdated. Packages were unmaintained left and right and there's
       | no official libraries for things like Stripe.
       | 
       | It was a real shame because I seriously align with the ideology
       | behind it. It just slows me downvand for that reason I can't use
       | it.
        
         | pablodavila wrote:
         | Someone shared a boilerplate template on the Elixir subreddit
         | the other day, might help out. Can't really recommend anything
         | for Stripe, though. From what I've seen people usually use
         | Stripity Stripe.
         | 
         | - https://alex-min.fr/open-sourcing-my-phoenix-boilerplate/ -
         | https://hex.pm/packages/stripity_stripe
        
           | remi wrote:
           | Shamless plug for our Elixir boilerplate we've been
           | maintaining for three years :)
           | https://github.com/mirego/elixir-boilerplate
        
           | realusername wrote:
           | I'm the author of the boilerplate mentioned here if people
           | have any question about it, thanks for sharing! I've had the
           | same struggles personally when building my web app so that's
           | why I backported some my code into this repo, the defaults
           | with Phoenix are great but there's a long way to make it kind
           | of usable for real users.
        
         | shijie wrote:
         | I have had a completely opposite experience during the last 5+
         | years as full-time Elixir dev, but I can empathize with running
         | into a few scenarios where some library wasn't implemented in
         | Elixir, or the library you want to use is no longer supported.
         | 
         | If you're looking for an "every feature I will ever need to
         | implement has a library for it" experience a la Rails or JS,
         | you might not be happy with Elixir (although we shall see what
         | 5 more years does to the ecosystem).
         | 
         | I don't have problems wrapping a service's API and creating my
         | own library every once in a while, if it means I don't have to
         | trade off slapping together a 5+ service behemoth just to get a
         | good concurrent queue working. This is where Elixir/OTP shines:
         | the hard stuff is easy.
        
           | spicybright wrote:
           | Can you elaborate a bit more how the hard stuff is easy?
        
             | syspec wrote:
             | The code writes itself!
        
             | pdimitar wrote:
             | Paralellizing data processing is trivial, it's literally
             | 2-5 more lines of code in many scenarios.
             | 
             | I've tried -- and failed -- to replicate what Elixir does
             | in this regard, in several other programming languages. Age
             | those tries incurred hundreds of coding lines. Only Rust
             | came close, although it's a bit verbose, but the code still
             | did the job.
        
               | itake wrote:
               | What do you think about Golang's concurrency patterns?
        
               | pdimitar wrote:
               | They are mostly okay but I find their caveats tiring to
               | mentally keep track of.
               | 
               | As a fairly experienced dev I prefer the technology to
               | slap me hard on the cheek and not make me triple check
               | things.
               | 
               | But Golang's concurrency is definitely a big step up from
               | all the naked multithreading we had to endure and groom
               | for decades -- that is unequivocally true!
               | 
               | I still find Erlang/Elixir's message passing paradigm
               | superior though. Plus every "process" there (a fiber /
               | green thread basically) is being transparently
               | parallelized on another CPU core without you thinking
               | about it at all.
               | 
               | As a personal scoreboard:
               | 
               | 1. Erlang/Elixir's messages.
               | 
               | 2. OCaml's "domain" effects (mutable shared state managed
               | by multiple threads in a safe manner).
               | 
               | 3. Golang's channels and messages.
        
               | lostcolony wrote:
               | I'll add - the synchronous by default, typed nature of
               | Golang creates a massive amount of bookkeeping, as well
               | as some fault tolerance issues you can walk into trying
               | to build a robust service. It's definitely better than
               | handling raw threads, but Erlang/Elixir beat it hands
               | down.
        
               | jfim wrote:
               | > Paralellizing data processing is trivial, it's
               | literally 2-5 more lines of code in many scenarios. I've
               | tried -- and failed -- to replicate what Elixir does in
               | this regard, in several other programming languages.
               | 
               | Scala's parallel collections handled this cleanly. I
               | believe they've been removed from the built in libraries
               | (still available as a JAR though), but the idea was that
               | you'd just add a .par call in your data processing chain
               | and it would use a parallel collection instead of a
               | regular sequential one.
               | 
               | These examples from the documentation
               | (https://docs.scala-lang.org/overviews/parallel-
               | collections/o...) show how to turn a regular sequential
               | computation:                 val list = (1 to
               | 10000).toList       list.map(_ + 42)
               | 
               | Into a parallel one                 list.par.map(_ + 42)
               | 
               | Oftentimes, for data processing, being able to
               | parallelize parts of the computation makes it fast enough
               | that one does not need to go beyond a single machine.
               | Spark's RDDs are basically a distributed version of
               | Scala's collection library.
               | 
               | One of the areas where Elixir and Erlang shine is
               | distributed applications.
               | 
               | For anyone who has written socket code, the ability to
               | easily send regular Elixir data structures as messages to
               | processes that may run locally or remotely is pretty
               | awesome. And once you realize that you can also send
               | closures over the network (ie. one node can send a
               | snippet of code to another mode and it'll be executed
               | there), mind blown.
        
               | [deleted]
        
         | pdimitar wrote:
         | It's true that some library coverage is definitely the weak
         | point of Elixir. Authentication in particular is a gaping hole
         | although efforts like `Pow` and `phx.gen.auth` do help to no
         | small extent.
         | 
         | The community is excellent though. You'll rarely find such a
         | welcoming and ready-to-help community as ElixirForum (although
         | the occasional exceptions do happen like everywhere else).
         | 
         | Elixir is not about the syntax or anything. It's about (a) the
         | underlying runtime, (b) the very powerful metaprogramming
         | facilities and (c) Phoenix / Absinthe / a few others.
        
           | sergiomattei wrote:
           | Agreed on the community! They have been nothing but
           | supportive on forums and chats. The brightest point of Elixir
           | is their warm and friendly folks.
        
         | vaer-k wrote:
         | In my experience the documentation around Elixir has been
         | ideal. People are modeling the absolute best of behavior,
         | generally. The popular auth libraries (like guardian) are a bit
         | of an exception in my opnion, for some strange reason. (Pow
         | does a good job, though)
        
         | dudul wrote:
         | What auth packages were you trying? Documentation in the Elixir
         | ecosystem is often excellent. The recommended auth library with
         | Phoenix is now phx_gen_auth if it helps.
         | 
         | As for Stripe, this looks pretty mature to me
         | https://github.com/code-corps/stripity_stripe
         | 
         | Definitely not a lot of "official" libs/clients in Elixir,
         | companies aren't gonna spend a lot of resources maintaining
         | that.
        
           | sergiomattei wrote:
           | My experience with phx_gen_auth was like this:
           | 
           | 1. Install Phoenix, expect the command to be available
           | because everyone is raving about it.
           | 
           | 2. Missing command.
           | 
           | 3. Dig through docs.
           | 
           | 4. Pull the development branch of Phoenix because
           | phx_gen_auth is only available there.
           | 
           | 5. Run the generator within the Phoenix git repo because it
           | won't allow me to run it elsewhere using a development
           | version.
           | 
           | 6. Use the generator.
           | 
           | 7. Never figure things out because the phx_gen_auth command
           | is barely documented and now I've got files everywhere that I
           | don't understand.
           | 
           | I tried implementing API authentication as well and while I
           | got it working, it was less pleasant than my usual Django
           | stack.
           | 
           | Another example. The colossal amount of docs referring to a
           | missing Phoenix plugin for Guardian that got removed in a
           | random update made me scratch my head and spend an hour
           | digging through their changelog and commits to figure out why
           | my code wasn't working. The change was not documented at all.
           | 
           | All in all, there were roadblocks every step of the way with
           | poor docs and big undocumented breaking changes in libraries
           | like Guardian. I want to love this thing but it made me so
           | unproductive in the first couple weeks of using it for basic
           | web/api development that I simply noped out.
        
             | devoutsalsa wrote:
             | I feel your pain. I personally felt like the learning curve
             | was on Elixir was quite steep, partially because I lacked a
             | strong foundation in software engineering when I started.
             | Fortunately I had the luxury of learning on the job & was
             | given enough time to ramp up. Now I really like it.
        
             | ch4s3 wrote:
             | Yeah, phx_gen_auth hasn't landed in main phoenix yet. As
             | another poster mentioned, you should try
             | https://github.com/aaronrenner/phx_gen_auth if you're going
             | to use a generator. You might however get more mileage out
             | of Programming Phoenix[1] where you'd learn what all of the
             | files are for and how to build auth yourself. Plug and Ecto
             | make it quite easy to do password auth. Guardian was
             | popular in the past, but isn't widely used these days. You
             | could use joken, or just roll it yourself.
             | 
             | Generally the docs for Elixir libraries are very good, but
             | you have indeed found some poorly documented things. I
             | might suggest scraping together something simple and then
             | trying out parts of the ecosystem that offer something new,
             | like channels, live_view, broadway, or something else that
             | takes advantage of OTP. Otherwise you're only going to see
             | the gaps compared to Django and none of the benefits.
             | 
             | [1] https://pragprog.com/titles/phoenix14/programming-
             | phoenix-1-...
        
               | sergiomattei wrote:
               | Will do :)
        
             | dudul wrote:
             | Damn, did you try it 6 months ago while it was still
             | experimental? I started like 4 projects in the past 2
             | months with it and this does not at all mirror my milage.
             | 
             | And I like it much better than a library because the code
             | is just plain phoenix/ecto that is can customize easily.
        
               | sergiomattei wrote:
               | No, a month ago.
        
             | bostonvaulter2 wrote:
             | Yeah, unfortunately there are still some sharp edges. Was
             | there a particular reason you decided to use the unreleased
             | version of Phoenix 1.6 instead of using the current version
             | of phx_gen_auth (from
             | https://github.com/aaronrenner/phx_gen_auth/)? There's a
             | decent bit of documentation there too.
             | 
             | I haven't used guardian (not a fan of JWT) so I can't
             | comment on it.
        
         | gregors wrote:
         | I haven't tried this yet - but I just recently saw this rolled
         | up version of Phoenix - with a bunch of defaults.
         | 
         | https://legendaryframework.org/
        
         | freedomben wrote:
         | Coming from the Ruby and Node eco-systems I know what you mean,
         | but I've also found it to be not that bad to roll my own
         | depending on the complexity of the service. In some cases I'm
         | finding I like it _better_ that way because it 's less "magic."
         | For example, I can open the module anytime and see how the HTTP
         | request is being made to the K8s API.
         | 
         | Definitely not for everyone or everything, just thought I'd
         | share the thought.
        
       | syspec wrote:
       | I really want to try elixir, but I need an IDE based debugger!
       | 
       | I tried the IntelliJ plugin, but it did not work (would work once
       | the disconnect when the first BP was hit)
       | 
       | JetBrains if you're listening, please make an official app /
       | plug-in! Pretty please
       | 
       | -
       | 
       | My other gripe is the state of abandoned packages
        
       | benatkin wrote:
       | Mozilla licenses almost everything under the MPL, which seems to
       | reduce interaction with other open source organizations. I wonder
       | if it bothers them, or they're OK with it.
        
       | princevegeta89 wrote:
       | I started dabbling with elixir in 2017. The platform is
       | phenomenal in terms of performance and the preciseness you can
       | write code with.
       | 
       | The pains I've seen are
       | 
       | - thinking everything in a "functional" way
       | 
       | - ide support
       | 
       | - the library ecosystem, though rich in selection, could use some
       | more help.
       | 
       | Functional thinking becomes easier the more time you spend on it.
       | I've recently solved the ide part with VSCode and ElixirLS. I use
       | Docker and I'm able to get all interpretation and dynamic
       | compiling along with suggestions, warnings using the VSCode
       | Remote Containers plug in.
       | 
       | Overall, the platform seems to be growing and it is great to see
       | big players taking some steps here.
        
       | gfodor wrote:
       | Hello, I'm sure Mozilla folks will be here too (I no longer work
       | on Hubs) but I am quoted a few times in this article and happy to
       | answer any questions I can!
        
       | pqb wrote:
       | This submission is probably the first example of usage Phoenix
       | Framework in big company that I know. I remember how many there
       | were Elixir vs Go "battles" on HN in last three years but what I
       | have noticed the Phoenix have worse traction and new adopters
       | evangelizing it. That's sad, because I think Elixir and Phoenix
       | Framework definitely is worth some attention.
        
         | ch4s3 wrote:
         | We use it at Pepsi eConmerce for multiple teams. In fact all of
         | our newer backend projects use it.
        
           | devoutsalsa wrote:
           | Silly question... what is Pepsi e-commerce all about? I've
           | been contacted multiple times over the years by recruiters
           | about Pepsi, but I never interviewed there.
        
         | dudul wrote:
         | There are plenty of big companies using Elixir/Phoenix.
         | Bleacher Report, Cars.com, Pinterest and many more.
        
           | enraged_camel wrote:
           | Discord uses Elixir too, I think?
        
             | bcrosby95 wrote:
             | They use Elixir but not Phoenix.
        
         | dnautics wrote:
         | I have heard pagerduty deploys their elixir microservices using
         | a (very cut down) version of Phoenix. Somewhere they have a
         | private "miniPhoenix" template that autogenerates everything
         | for them.
         | 
         | There are some big non-tech companies that you probably know
         | that use elixir-phoenix, off the top of my head, PepsiCo, MBTA,
         | BBC, PRX (of NPR/public radio fame).
        
           | ch4s3 wrote:
           | You can roll out your own mini Phoenix with flags passed to
           | mix phi.new
        
       ___________________________________________________________________
       (page generated 2021-06-04 23:00 UTC)