News for hackers. Stuff that matters.
Re:From Node to Ruby on Rails by haarts on Thursday December 16, 2021 @09:27AM (#29578423)
I couldn't agree more.

Recently I switched back to Rails after 10 years. I can't say I enjoy the whole asset pipeline business but I yearn for a simpler time and Rails gives that (to a degree).

My only wish it was simpler to host. I don't necessary want to buy into render.com or heroku.

Re:From Node to Ruby on Rails by Toutouxc on Thursday December 16, 2021 @09:38AM (#29578541)
Why do you think it isn't simple to host? If you yearn for the simple times, no one is stopping you from just spinning up a VPS with Ruby, Passenger, Nginx and your favorite database.

Of course the larger your project is, the more hassle, but that's not specific to Rails.

Re:From Node to Ruby on Rails by berkes on Thursday December 16, 2021 @12:48PM (#29581229)
I have been doing this for upwards of 10 Ruby projects for over a decade.

It is not simple. Python or Node.Js suffer the same issues, though.

Compared to dropping a go-binary or rust build somewhere and firing that up, Rails/Ruby (Rack, Sintra, Rails etc) are a mess.

In no particular order, the issues I had to deal with in the last three months:

* asset pipelines crashed randomly; turned out the ~2GB build VPS had too little memory to run the asset pipeline.

* puma and unicorn and phusion cannot be ran and configgured easily on one server.

* rbenv builds are hard to manage.

* getting the correct gems on your server is a mess. There is bundler, rbenv, vendored, rubygems.org, gem, Gemfile, Gemfile.lock, ruby-version in gemfile, ruby version .ruby-version, all of which can -and will- conflict at some point.

Add to that, that a typical Rails app requires at least redis, postgresql/mysql, quite some lib-x headers to build native gems, and imagemagick etc, and you have a very complex setup.

This isn't more complex than your typical Django, Laravel or ExpressJs setup. But it is far more complex than deploying a go, rust, or Java bundle.

Re:From Node to Ruby on Rails by jaredcwhite on Thursday December 16, 2021 @01:19PM (#29581704)
This hasn't been my experience at all. Deploying Ruby-based projects in recent years is streamlined and repeatable. The term soup you're throwing out there makes me wonder why you're either overthinking this or not streamlining your own processes.
Re:From Node to Ruby on Rails by berkes on Friday December 17, 2021 @04:55AM (#29590044)
One cause of the problems is that the servers are handling multiple ruby deamons amongst which some Rails apps.

I know things get simpler when you keep "one app/thread - one server". But price-wise that doesn't make sense, especially since many common Rails apps hardly run on a the cheapest VPS (a throttled dual-core 500MB server). If you run ten tiny services, ten servers add up quickly.

I also host some larger apps on their own server, some loadbalanced over multiple servers.

But throwing 10+ ruby services on a VPS is hard. Especially if you don't want to, or cannot constrain their ruby-versions, app-server, etc.

It is hard for the exact same reason why setting up a local env may be hard. I recently had to help a co-worker on an old MacOS machine who broke her entire mac-desktop because she installed RVM because somehow that was in the tutorial for getting the app locally.

Anything with a runtime is harder than anything without that runtime. This is too obvious, but does warrant some highlighting. Ruby's runtime is one of the hardest of all runtimes because it comes with so many moving parts. Python is a close second, and on Ubuntu (my main driver) probably worse than Ruby, because fing up Node is fine, but fing up Python can render your machine unusable, unrecoverable so without good understanding of all python things.

Re:From Node to Ruby on Rails by awestroke on Thursday December 16, 2021 @03:35PM (#29583526)
I started prebuilding assets in ci or locally and rsyncing to the server. Much faster and avoids the issues with constrained resources on the vps. Also saves me from installing asset-related gems and node modules on the server. Let me know if interested and I'll share my capistrano setup
Re:From Node to Ruby on Rails by eashman on Friday December 17, 2021 @10:19AM (#29593303)
I would love to see how you’re doing this. Could help a lot with Docker builds as well.
Re:From Node to Ruby on Rails by duffyjp on Friday December 17, 2021 @02:37PM (#29597310)
I've been doing Rails for about 12 years and at our shop we have it down. `cap production deploy` and it's done. Essentially zero downtime for deploys.

Some things I'd note-- * Don't use puma or unicorn. Phusion Passenger and Apache is just fine performance-wise and is much more robust IMO. * To avoid ruby version conflicts use .ruby_version as your sole source of versioning. I use this in all my Gemfiles: `ruby File.read('.ruby-version').strip` * RVM isn't as popular as rbenv but it's amazing and you won't run into the issues you mentioned. It integrates with Capistrano and Passenger+Apache really well. * 2GB might be a bit light for a production app even with light load. We start our new VMs at 8GB and then adjust up or down as makes sense.

We still do a single Ubuntu LTS VM for each app rather than anything fancy. Once you've added the stuff you need via apt it just works. Our sysops folks use Ansible playbooks that automate everything so there's no mystery when we need to do an OS upgrade or spin up a new VM.

Re:From Node to Ruby on Rails by TheRealDunkirk on Thursday December 16, 2021 @01:25PM (#29581794)
I've been using Rails for 12 years, over at least a couple dozen apps. I use RVM to manage my environments, and use Capistrano to deploy. I've hosted on full servers, on shared servers, and on Heroku. With the exception of the classic bugaboo of getting the older execjs compiled in different environments, I have never had the sort of problems you say you're having trying to keep gems sorted. In fact, I would have said that was one of the stacks' greatest strengths, to keep that sorted out for you. I guess my takeaway is that RVM > rbenv, but I REALLY don't intend to start a flamewar about it.

And please don't try to tell us that a real-world Java web application is simpler than, well, anything. ;-)

Re:From Node to Ruby on Rails by berkes on Friday December 17, 2021 @05:05AM (#29590134)
Are you hosting multiple ruby versions and multiple apps on one server? Because as I explain below, that is the main (but not the only) cause of many issues.

Execjs, libreadline, libsqlite3, lib-postgres, (older)nokogiri etc. Quite a lot of the headers keep being a problem. Not major, often a mere ddg+apt-get away, but still annoying. It does get problematic when you have multiple apps depend on different libreadlines, for example.

And I'm not often deploying java, but at least the runtime and tooling has become omnipresent. The latest deploys were a mere "move all files there, and restart the service". With Rails you at least need to rebuild the gems.

Often java-services are an `apt get jenkins` away. There is no equivalent apt-get gitlab or apt-get mastodon that just sets up the stack entirely. But that is probably due to their popularity more than technology.

Re:From Node to Ruby on Rails by jashmatthews on Friday December 17, 2021 @10:27AM (#29593440)
The solution you're looking for is Docker. Gitlab distributes as a Docker image.
Re:From Node to Ruby on Rails by KronisLV on Thursday December 16, 2021 @03:10PM (#29583227)
> And please don't try to tell us that a real-world Java web application is simpler than, well, anything. ;-)

Tongue in cheek, but honestly, that's probably debatable.

Under the hood, Java apps (at least in my experience) are Eldritch horrors with hundreds of beans/proxies/servlets/God knows what, needless layers upon layers of abstractions and dangerous amounts of reflection and dynamic behavior, all to launch and initialize a web application in a "simple" manner. I've always seen the exact same horror, be it working with Spring Boot, Spring, JavaEE, Struts, or even something like Dropwizard (though it seemed a bit more sane). Only the microframeworks seemed decent in comparison, something like Vert.X (has a different paradigm, though), or Quarkus/Helidon.

But when it comes to running them... well, historically they were still a nightmare, if packaged with .war and relying on certain application servers/JDK versions being present. But packaging them as executable .jar files (think Spring Boot) makes them similarly easy to Go, at least as long as you have the JDK version that you need. You just drop the file in a folder and if you have some configuration (which your Go app would also need in one way or another), you can probably launch it.

> I have never had the sort of problems you say you're having trying to keep gems sorted.

Ruby suffers from the same problem that Python, Node, PHP and other non-statically compiled technologies suffer from - messing around with dependencies. If i develop on Ruby locally against version X.Y.Z, but only X.Y.W is available on the server due to Debian packaging older versions, then i'll run into problems because of the project refusing to build/run. I've also run into situations where building the native stuff (DB drivers in this case) will fail, for example, when libpq-fe.h headers were missing and pg couldn't been installed, so the gem native extension couldn't build. Also, on Windows, Ruby 2.7 downloaded the sqlite gem with 3 different trojans (Win64.Alien.eg, Win64.Alien.ef, Win32.Agent.xahigh) in the extensions (btreeinfo.dll, memstat.dll, memvfs.dll), as picked up by Kaspersky. No idea how that happened, or whether that could have been a false positive, but i didn't appreciate that much either.

That said, i have a folder that has about 112 images of all sorts of software breaking in various ways to date, and the number is only so low because i don't screenshot things on my work computer and not even every small instance of something breaking. In my experience, all of the technologies out there are bad in some ways, it's just about identifying and managing these tradeoffs towards whatever is suitable for your circumstances.

Re:From Node to Ruby on Rails by ivolimmen on Thursday December 16, 2021 @04:49PM (#29584446)
Well... Java developer here, 20+ years exp... yada yada yada.. I haven't deployed a war file in over a decade. No you do not NEED a specific kind of server, just like any programming language there are LOADs of options for deployment. Nowadays we have an NGINX + Docker container. Image just contains an executable JAR. Without docker it is not much different, you just have a Spring boot executable JAR. But even if you loathe Spring, you can build an executable JAR using a build in webserver (Tomcat, Jetty, what ever). For ruby, PHP and Python my guess is Docker is the solution as well. And if you are building applications daily with it you know the best ways of deployment. I think we should all stop bashing ANY programming language; they all have their key selling points. There is always someone willing to stand up against the bashing of their programming language their are working with. I do not program in Java exclusively; I use BASH, Groovy, Scala, TypeScript, JavaScript, as well. I get angry at Node sometimes at well but then I remember that I do not use it nearly as much as I do Java...and go to stackoverflow...

Just my 2 cents

Re:From Node to Ruby on Rails by pmontra on Thursday December 16, 2021 @04:59PM (#29584555)
> If i develop on Ruby locally against version X.Y.Z, but only X.Y.W is available on the server due to Debian packaging older versions

Either you use RVM locally to develop with Ruby X.Y.W or you install RVM on the server to use Ruby X.Y.Z there. Of course if the OS on the server is too old or too new there could be some versions of Ruby that won't work. It happened to me because of versions of openssl.

Re:From Node to Ruby on Rails by smw on Thursday December 16, 2021 @07:59PM (#29586304)
Have you not heard of docker?
Re:From Node to Ruby on Rails by KronisLV on Friday December 17, 2021 @09:14AM (#29592401)
Docker is amazing for deploying things on servers and i use it extensively - nowadays almost everything on my homelab is containerized since i no longer need to have that many separate VMs anymore...

That said, Docker is also oftentimes a poor option for local development, unless you're talking about external dependencies the app needs (e.g. MariaDB/PostgreSQL, RabbitMQ, Redis etc.), or maybe very specific setups that just won't be achievable otherwise (specific userland needed).

For example, when trying to run Ruby/PHP/Node/Python/Java apps in Docker containers, i've run into the following:

  - problems with file permissions
  - problems with file line endings
  - problems with Docker Desktop bind mounts (e.g. directory won't be mounted, path parsed incorrectly etc.)
  - problems with Docker Desktop bind mount performance
  - problems with networking (e.g. host.docker.internal sometimes refusing to route to non-containerized stuff on the host)
  - problems with run profiles (e.g. your IDE + Rails integration just won't work, at best you can just launch a different container/Compose stack with some other parameters)
  - problems with test runs and coverage (if you use the IDE integration, though that depends on the stack and how deeply your IDE is integrated, e.g. Java with IntelliJ IDEA)
  - problems with remote debugging, breakpoints, flame graphs etc. (most of those either don't work when the code is inside of a container, or need additional setup, e.g. remote debugging, where supported)
In my eyes, whenever possible, develop locally with the native runtimes for the IDE integration etc., use Docker for deployment or maybe QA/test environments as well - anything that will go on a server somewhere.
Re:From Node to Ruby on Rails by pmontra on Friday December 17, 2021 @05:20AM (#29590241)
I find RVM much easier to manage than docker, for local development. To deploy on servers, it depends. Deploying with Capistrano to one server is easier than building a docker container and push / pull it. For cloud / serverless environments... the number of companies that really need that is surprisingly low. Most businesses are small and are well served by a single VPS.
Re:From Node to Ruby on Rails by lenkite on Sunday December 19, 2021 @04:36AM (#29612596)
What is complex about a real-world Java web-app ? Asking seriously.
Re:From Node to Ruby on Rails by jfabre on Thursday December 16, 2021 @09:31AM (#29578467)
You should try phoenix and elixir, only been playing with them for less than a week and as a long time rails/ruby developer this is what it feels like again.
Re:From Node to Ruby on Rails by jspash on Thursday December 16, 2021 @11:18AM (#29579791)
I bounced from Rails to Phoenix and couldn't be happier. I've done lots of functional programming before my Ruby days but never saw it coordinated in such a way that made sense to me. And since I only do web dev it was a perfect fit.

That said, I'm _really_ excited to get into all the goodness that Rails 7 has to offer. I really thought they lost their way with the whole webpacker debacle. I recently installed a fresh Rails 7 app and the word webpack doesn't even exist anymore! It's like a breath of fresh air to be done with that. Those were some dark days. (I'm exaggerating only a little)

Re:From Node to Ruby on Rails by aantix on Thursday December 16, 2021 @12:19PM (#29580750)
Currently using Jumpstart Rails ( https://jumpstartrails.com/ ) with esbuild for a personal project and it's so fast..
Re:From Node to Ruby on Rails by Toutouxc on Thursday December 16, 2021 @09:41AM (#29578572)
I'm also a Rails dev, currently doing Advent of Code in Elixir, I haven't tried Phoenix yet, but writing Elixir feels a lot like writing Ruby for the first time. It's the same kind of sexy, of-course-you-can-do-that feeling.
Re:From Node to Ruby on Rails by AlchemistCamp on Thursday December 16, 2021 @10:29AM (#29579133)
For me Elixir didn't feel too much like Ruby, but Phoenix sure felt a lot like Rails. YMMV since Phoenix has gradually become more and more of its own thing than it felt like in 2016 when I learned it.

There's really nothing I miss about Ruby for web dev and Elixir feels like a complete win to me these days. Ruby is still far nicer for unix-y scripting, though.

Re:From Node to Ruby on Rails by dnautics on Thursday December 16, 2021 @09:50AM (#29578677)
That's really funny, my perception of Elixir is generally the sentiment "of course you can't do that". (that's a good thing).
Re:From Node to Ruby on Rails by Toutouxc on Thursday December 16, 2021 @09:55AM (#29578724)
Funny, you're also right. Of course you can't do that weird hacky thing you could totally do in Ruby but maybe shouldn't.

I meant something more like "of course there's a function for that with the name you'd expect".

Re:From Node to Ruby on Rails by montblanc on Thursday December 16, 2021 @12:07PM (#29580553)
Elixir and Ruby have nothing in common as languages and ecosystems, I really don't get why the 2 keep being brought up together. Oh I do get it - whenever someone mentions Ruby some Elixir user will say - hey have u tried Elixir?
Re:From Node to Ruby on Rails by regularfry on Thursday December 16, 2021 @12:20PM (#29580764)
Ruby and Elixir do have surface syntax in common, and Rails and Phoenix are clearly from the same conceptual direction. They're more similar than, say, Rails and Spring Boot.

This is not surprising: the Elixir folks were fairly high-visibility in the Ruby community before they did Elixir and Phoenix.

Re:From Node to Ruby on Rails by montblanc on Thursday December 16, 2021 @12:29PM (#29580913)
I'll give you surface syntax in common, other than that not much. I think a Rails dev would have a much easier time picking up Django or Laravel than Phoenix. How hard is the switch from Rails to Django? Probably trivial. But Ruby to Elixir is a mind shift.
Re:From Node to Ruby on Rails by eropple on Thursday December 16, 2021 @01:00PM (#29581426)
Ruby to Elixir is a mind shift. Rails to Phoenix...I don't think so.

But most Rails programmers write Rails, not Ruby, and it's important to differentiate them. Ruby is a big playground. Rails is...not, by design. (This is why I do not like Rails, personally--if I am choosing to write code in Ruby, it's because I expect to need to get weird with it.)

Rails->Phoenix omits a lot of the stuff that makes Elixir cool, both in itself and in OTP, but that's not a bad thing and I do think the transfer isn't too onerous for somebody coming purely from Rails.

Re:From Node to Ruby on Rails by montblanc on Thursday December 16, 2021 @01:18PM (#29581689)
> But most Rails programmers write Rails, not Ruby

You're really exaggerating.

Re:From Node to Ruby on Rails by eropple on Thursday December 16, 2021 @01:32PM (#29581906)
I'm really not. I've built tools and systems around Rails for a long time. Most Rails programmers I've worked with live in the controller and the view. Absolutely there are those who do not--and they're often building libraries and tooling for those who do. IME, at the hireable junior/mid levels, Rails driving is pretty tightly coupled to the framework--this is often a positive, to be clear, and not a dunk on anybody. This is the baseline way to get a web application out the door.

Roughly equivalent interfaces exist in Phoenix, and the mapping isn't quite 1:1 but it's close enough that the adjustment is an adjustment, I think, and not a re-learning.

Re:From Node to Ruby on Rails by montblanc on Thursday December 16, 2021 @01:42PM (#29582047)
I partly agree with what you're saying but still - you're exaggerating. Doing Rails without a decent knowledge in Ruby is exactly what you said - it's being a junior. You'll rely on the existing codebase without any ability to provide your own ideas, only shifting code from here to there without fully understanding what you're doing and will always need a senior whenever things go awry. That's what being a junior is like in any language.

I don't think we can compare languages based solely on the experience of juniors. I'm not saying it's irrelevant, it is, but it's only a part of what writing software is. In the end of the day you need the seniors and people who really get it to maintain the code and steer the ship in the right direction.

But I do agree that Rails is a kind of dialect of Ruby and that you can get pretty far with Rails without being great in Ruby (you still need to be decent though, no way of getting around that).

> Most Rails programmers I've worked with live in the controller and the view

Where is the business logic at? They also write services or something similar or stick it in the Model. Whatever isn't ActiveRecord will be pure Ruby - Rails has no opinions there.

Re:From Node to Ruby on Rails by eropple on Thursday December 16, 2021 @02:20PM (#29582558)
> You'll rely on the existing codebase without any ability to provide your own ideas, only shifting code from here to there without fully understanding what you're doing and will always need a senior whenever things go awry.

Absolutely, and I would submit that this is most developers' experience up until a senior-ish role. Not title, you can have juniors doing this, but the pyramid of tool-users versus tool-makers.

> In the end of the day you need the seniors and people who really get it to maintain the code and steer the ship in the right direction.

Again agreed--but jeez, there are just so many fewer tool-makers at most places I've found myself. (This worked out great for me early in my career because there were tons of vacuums to start doing that work even in my first year out of college--building systems that other people could rely on to go faster, because nobody else was doing it!) Thinking about it, this impression perhaps sticks more because of the businesses I consulted for, which is perhaps where my perspective comes from--hiring uncritically 'til you're in a pit where you're paying the medium bucks to get somebody to come dig you out.

> Where is the business logic at? They also write services or something similar or stick it in the Model.

Found the guy who hasn't seen too many 10KLOC controllers in his time out there. ;)

You may be right that I am grim about this, but at the same time, reading your description makes me go "I haven't seen too many places that actually do-it-right". The truth's probably somewhere in the middle, and outliers exist on both sides. But yeah, I've absolutely been consulting for more than one company whose primary product was thin models, gargantuan controllers, and no service abstraction to speak of. They make a lot of money, too. (Fortunately for me, they brought me in for devops stuff, not "please save our megamonolith".)

Re:From Node to Ruby on Rails by montblanc on Thursday December 16, 2021 @03:00PM (#29583122)
> But yeah, I've absolutely been consulting for more than one company whose primary product was thin models, gargantuan controllers, and no service abstraction to speak of.

I don't get why this is still happening. It's kinda common wisdom now to not let your controllers get fat. I"m not saying that fat models are great but as a community we kinda agree that most business logic stuff is easier tested on the model/service and should be placed there. CTO's/team leaders have to be real sloppy to let teams build code as you describe At the same time - being a consultant, don't you more often than not see codebases in bad state? I mean those are the ones that usually need consulting. So maybe you have an overly negative view on how Rails projects usually look.

Re:From Node to Ruby on Rails by innocentoldguy on Thursday December 16, 2021 @10:50PM (#29587499)
> Rails->Phoenix omits a lot of the stuff that makes Elixir cool, both in itself and in OTP, but that's not a bad thing and I do think the transfer isn't too onerous for somebody coming purely from Rails.

I'm not following you here. Could you please explain your position a bit more?

The reason I'm confused by your commentary is that Phoenix makes extensive use of OTP and since it is just Elixir + macros, there is nothing at all limiting you from employing every Elixir (and Erlang, for that matter) feature you want to in your Phoenix apps.

Re:From Node to Ruby on Rails by eropple on Saturday December 18, 2021 @10:07AM (#29604977)
Sorry - omits is the wrong word, because of course Phoenix uses that stuff. More that in my experience, for the kind of "in the framework" developer that I've run into in the Rails space, the mapping to using Phoenix is very simple and doesn't demand of the end user the conscious use of processes, genservers, etc. -- it can, and from POV often seems to be used as, plug-and-chug. This totally isn't a criticism either, I want to stress; it's the mark of a good framework, that you don't necessarily have to care about that stuff to ship a thing.

At my current company, we use Phoenix and we use a lot of its bells and whistles. But we also have a lot of people who understand OTP--definitely way more than I do. I also see people ship Phoenix apps without getting deep into that when their needs are relatively small.

Re:From Node to Ruby on Rails by mwcampbell on Thursday December 16, 2021 @04:11PM (#29583974)
> Rails->Phoenix omits a lot of the stuff that makes Elixir cool, both in itself and in OTP

How do you think Phoenix could better take advantage of Elixir and OTP? IMO, it already is doing plenty to take advantage of what's cool about OTP, through channels and especially LiveView. I suppose Phoenix apps could use Mnesia instead of relational databases. But would the benefits actually outweigh the costs?

Re:From Node to Ruby on Rails by innocentoldguy on Thursday December 16, 2021 @10:40PM (#29587413)
I have extensive experience with Elixir/Phoenix, Ruby on Rails, Laravel, and Django and I have to say I disagree. Rails and Phoenix are both opinionated in similar ways, both have similar generators, both have excellent/similar tooling, and many of the same ideas exist in both (e.g., Channels and Action Cable). I view Elixir/Phoenix as a natural evolution of Ruby/Rails.
Re:From Node to Ruby on Rails by NoInkling on Thursday December 16, 2021 @11:17PM (#29587685)
The creator of Elixir was on the Rails core team and involved in the Ruby community, even for a little while after Elixir was released (until about the time Phoenix came around). The Ruby community is where Elixir gained a big chunk of its initial attention from.
Re:From Node to Ruby on Rails by montblanc on Friday December 17, 2021 @04:08AM (#29589708)
That doesn't mean much. He came from Rails and then switched direction to a functional, Erlang based new language. The historical "initial traction" also doesn't mean much. The two languages aren't similar at all.
Re:From Node to Ruby on Rails by bgroat on Thursday December 16, 2021 @09:43AM (#29578589)
In terms of ease of hosting?

I'm considering migrating to Phoenix and my biggest concern is ease of deployment

Re:From Node to Ruby on Rails by AlchemistCamp on Thursday December 16, 2021 @10:41AM (#29579284)
It's ridiculously easy.

Even 6 years ago when I started, you could just run it in production with `mix phx.server`, much like running `rails server` and use the exact same deployment patterns. Or you could build a release and copy it up to the server however you saw fit. At that time it was painful for some coming from different habits that involved pulling in config at run-time rather than compile time, but those patterns have also been supported since at least 2019.

Since then, the team has been continually making it easier.

Now there's a single command line to do a deploy to Fly and also one to build a docker container for you if that's what you want: https://twitter.com/chris_mccord/status/1468998944009166849

Re:From Node to Ruby on Rails by jfabre on Thursday December 16, 2021 @09:50AM (#29578676)
I've just tried heroku so far and took me about 30 min to deploy my prototype, but I read there are limitations. Go take a look at fly.io and I think there's also another one that specialize in elixir hosting. Once I understand elixir/erlang better, I will probably want to host there.
Re:From Node to Ruby on Rails by jamil7 on Thursday December 16, 2021 @10:25AM (#29579068)
I got around to trying https://render.com/ recently, it's also pretty easy and cheaper than Heroku, I think they support Phoenix/Elixir but I've never used it or tried. Also side note Heroku seems to have just stalled and atrophied as a product since the Salesforce acquisition, still one of the easiest hosts though.
Re:From Node to Ruby on Rails by AlchemistCamp on Thursday December 16, 2021 @10:33AM (#29579177)
Yes, they support Elixir (including clustered apps) and it's very easy. I wrote a tutorial and did a 6 minute screencast on that a while back: https://alchemist.camp/articles/elixir-releases-deployment-r...

I generally use a VPS, but Render is a top-notch host if you want something managed. In many ways, I think it's like Heroku was before Salesforce bought them.

Re:From Node to Ruby on Rails by anurag on Thursday December 16, 2021 @12:18PM (#29580730)
(Render founder) Lots of Phoenix/Elixir apps are hosted natively (no Docker) on Render, and of course we support Dockerized apps as well.

https://render.com/docs/deploy-phoenix

Re:From Node to Ruby on Rails by Inversechi on Thursday December 16, 2021 @11:16AM (#29579754)
On the topic of render there was a really nice podcast on Software Engineering Daily from the founder talking about their product.

https://softwareengineeringdaily.com/2021/12/07/render-with-...

Re:From Node to Ruby on Rails by leodriesch on Thursday December 16, 2021 @10:42AM (#29579292)
You can deploy pretty much anything on Render, AFAIK it’s all container based.

Here’s the docs for Phoenix deployments: https://render.com/docs/deploy-phoenix

Re:From Node to Ruby on Rails by bliteben on Thursday December 16, 2021 @10:45AM (#29579334)
what a horrible name for a site, I can't imagine googling for how to add x extension to postgres with render.
Re:From Node to Ruby on Rails by toqy on Thursday December 16, 2021 @12:18PM (#29580721)
what type of results do you imagine you'd get for that kind of query rather than what you'd want to get? especially given the context of postgres extension, i'd assume if there was content out there that google would find it with that query.

A friend of mine who worked at an SEO agency once had a client who's company name was a misspelling of some noun that google would automatically fix which i found hilarious.

Re:From Node to Ruby on Rails by jamil7 on Friday December 17, 2021 @03:22AM (#29589399)
Query + render.com seems to do the trick.
Re:From Node to Ruby on Rails by lostcolony on Thursday December 16, 2021 @10:23AM (#29579047)
https://www.gigalixir.com/ is likely what you're referencing. Since they're focused on Elixir first it supports a buncha the nice things the BEAM supports, such as native clustering, hot upgrades, and opening a REPL to a running cluster.
Re:From Node to Ruby on Rails by SkyPuncher on Thursday December 16, 2021 @10:35AM (#29579204)
I've deployed Rails at a few different companies. I wouldn't quantify it has hard by any means, there's just a lot of configurations to read through and verify every time. Realistically, the defaults are complete sane and could be deployed as is without much change.
Re:From Node to Ruby on Rails by cultofmetatron on Thursday December 16, 2021 @10:13AM (#29578926)
at a base, you can use heroku. That said, you won't be able to have your nodes communicate with each other. This restricts you from some of the more advanced featues. For Example, at my startup, we use horde to dynamically spin up individual websocket connections per customer for a integration partner. This was easy to do using horde and simply connecting the nodes together. Additionally, we can use the built in key store which is global to the cluster.

I would take a look at render.com. they support connected nodes and autodiscovery

Re:From Node to Ruby on Rails by dnautics on Thursday December 16, 2021 @09:50AM (#29578672)
I hear fly.io is good.
Re:From Node to Ruby on Rails by nix23 on Thursday December 16, 2021 @10:07AM (#29578856)
It's excellent, and a pretty generous free-tier i think.
Re:From Node to Ruby on Rails by pier25 on Thursday December 16, 2021 @10:04AM (#29578820)
It's great
Re:From Node to Ruby on Rails by cutler on Friday December 17, 2021 @06:54AM (#29591000)
Agreed. Immutable functional Elixir is the very opposite programming model of mutable state Ruby OOP.
Re:From Node to Ruby on Rails by dqv on Thursday December 16, 2021 @09:50AM (#29578675)
It really is a nice experience. The BEAM family of languages was the first for me where doing multiple things at once came natural. It doesn’t require pulling in a library or adding redis or having to worry about shared state. You just add a process to a supervisor.
Re:From Node to Ruby on Rails by machiaweliczny on Thursday December 16, 2021 @02:16PM (#29582517)
Yeah and then how do you deploy new version? In practice you still need Redis for most stuff. Also if anyway you have to deploy containers then value of BEAM is dimnished and provably better go with Go.
Re:From Node to Ruby on Rails by innocentoldguy on Thursday December 16, 2021 @11:03PM (#29587580)
Could you be more specific about the issue you're having with deployments?

I've never used Redis in any of my Elixir/Phoenix apps. In cases where I might need something like Redis to store state, I'd reach for a GenServer or maybe Mnesia instead. I've never had an issue with deployments using this strategy. Also, K8s and BEAM work together just fine using libcluster. I'm not a fan of K8s or Docker and don't use either one, but you easily can.

The benefit of BEAM is that it can surgically handle a vast array of failures without restarting the node. K8s, on the other hand, will take the pod down and restart it. In many cases, solving a problem with BEAM is like using tweezers to remove a splinter whereas K8s is more like using a sledgehammer.

Re:From Node to Ruby on Rails by 1_player on Thursday December 16, 2021 @07:03PM (#29585786)
You don't need Redis if you learn the BEAM and OTP. Elixir runs on top of a distributed VM with builtin clustering. Use it.

And I see nothing wrong with having the BEAM run in Docker or K8s. There's some overlap in concepts, but they work at totally different layers. Using the BEAM is like having resilient microservices _inside_ your app with none of the downsides.

Re:From Node to Ruby on Rails by cultofmetatron on Thursday December 16, 2021 @10:10AM (#29578880)
as someone on his 3rd year on a startup built on elixir, you're making the right choice. Our system is faster than an equivalent node setup while building features is almost as productive as rails. In some ways better. Plus, if you're goal is realtime or anything heavily websocket based, its going to easily outperform node or rails.
Re:From Node to Ruby on Rails by proxyon on Thursday December 16, 2021 @10:44AM (#29579323)
I simply cannot understand why people care about "fast" anymore with cheap containerization, CI/CD infra and no more dedicated servers. Who cares if its fast? Just add another box. I have this suspicion that anyone who still cares about backend speeds is stuck in the vertical scaling mindset where they need to keep adding cores and processes to a single machine
Re:From Node to Ruby on Rails by cultofmetatron on Thursday December 16, 2021 @11:54AM (#29580348)
Not everything scales horizontally. Your database for instance is going to be scaled vertically to its max long before you think about using federated write servers. Sure you can use planetscale but that comes with its own considerations and tradeoffs.

Also, higher performance translates to lower machine costs. Our server costs would easily be 4x if we ran rails. given that elixir is 80-90% as productive for writing code in the short term, its a fair deal. Over the long term, we've found elixir to be more maintainable since there's very little magic and the immutable data structures and lack of magic make it super easy to debug.

Thanks to the performance of our system, we've also managed to get by without setting up caching. (we'll probably need it eventually but our performance gains have come mostly though fine tuning our sql queries. Ecto gives us way better control over the output sql than active record or sequalize)

Re:From Node to Ruby on Rails by montblanc on Thursday December 16, 2021 @12:11PM (#29580611)
A lot of engineers take great pride in improving performance even if it's mostly meaningless to the company. The users don't really care if the number of instances went down from 30 to 20. It is what it is, engineers will be engineers.
Re:From Node to Ruby on Rails by coldtea on Thursday December 16, 2021 @11:06AM (#29579604)
>I simply cannot understand why people care about "fast" anymore with cheap containerization, CI/CD infra and no more dedicated servers. Who cares if its fast?

People who pay for those extra boxes? Not everybody has your budget (especially when they're building things themselves, on the side, so they aren't even paid).

Re:From Node to Ruby on Rails by montblanc on Thursday December 16, 2021 @12:12PM (#29580617)
Getting to that scale on the side is a nice problem to have. Maybe it shouldn't be on the side anymore.
Re:From Node to Ruby on Rails by proxyon on Thursday December 16, 2021 @01:24PM (#29581772)
A cheap micro container is $5 a month. A cheap dedicated server can be had for $20 a month. Budget is not the issue here.
Re:From Node to Ruby on Rails by true_religion on Thursday December 16, 2021 @02:36PM (#29582764)
An expensive dedicated server can also be had for $1300 a month.

Scaling vertically can take you a long long way before you actually have to start separating services.

Re:From Node to Ruby on Rails by proxyon on Thursday December 16, 2021 @07:16PM (#29585933)
Ok? That's a non sequitur. No one is forcing you to buy a dedicated server for $1300 a month which probably has the same performance as $250 worth of separate boxes. And separating services isn't what we're talking about here. It's adding horizontal processes across machines instead of on one machine.
Re:From Node to Ruby on Rails by manmal on Thursday December 16, 2021 @02:45PM (#29582890)
Doesn’t „fast“ directly translate into shorter page loading times? Static pages (JAMStack) load so fast it’s delightful everytime.
Re:From Node to Ruby on Rails by proxyon on Thursday December 16, 2021 @07:19PM (#29585955)
It doesn't. They mean "fast" as in one box can handle more load which in their opinion is cheaper because you don't need to containerize and horizontally scale. I find that unlikely.
Re:From Node to Ruby on Rails by danjac on Thursday December 16, 2021 @12:40PM (#29581103)
What's Phoenix/Elixir like for deploying these days? When I last seriously played with it a few years ago the development was a lot of fun (and Elixir has influenced how I write and architecture on other platforms) but I remember deployment to production being a pain.
Re:From Node to Ruby on Rails by OkayPhysicist on Thursday December 16, 2021 @02:46PM (#29582917)
"mix release" makes it pretty much a breeze. I find myself spending more time setting up a Postgres server than mucking about launching my backend.
Re:From Node to Ruby on Rails by ch4s3 on Thursday December 16, 2021 @12:45PM (#29581179)
It's pretty easy if you use something like fly or render, anything dockerized really.
Re:From Node to Ruby on Rails by 1_player on Thursday December 16, 2021 @07:07PM (#29585827)
It's not harder to Dockerise than any other language.
Re:From Node to Ruby on Rails by strzibny on Thursday December 16, 2021 @04:13PM (#29584006)
> My only wish it was simpler to host

I think it can be simple if you keep it simple :). In my book Deployment from Scratch I show people how to run Rails on a cheap VPS with a couple hundreds lines of Bash.

Just Ruby + chruby + Puma + systemd (and optional systemd socket activation).

I include a scripted demo (so you don't have to do it yourself) which demonstrates all of the this:

- Setting up a git-pust deployment for Ruby applications

- Using chruby to automate installing requested Ruby versions

- Configuring NGINX as a proxy using UNIX sockets

- Setting up systemd socket activation for graceful restarts

- Configuring NGINX to serve static assets

- Configuring NGINX to proxy WebSockets connections for Action Cable

- Automatic SSL/TLS certificates with Let's Encrypt

- Redirecting HTTP traffic and subdomains to main domain over HTTPS

- Running PostgreSQL and Redis on the same server

- Building a custom SELinux module

- Configuring firewall

- Setting up automatic weekly system update

- Setting up log rotation for NGINX and PostgreSQL logs and max limit for system log

- Doing application backups and restores

- Creating admin tasks

Although it sounds like a lot, the demo is reasonably small and clean so you can go through all the files in 2 hours.

I think people many times complicate what they don't need to complicate...

Re:From Node to Ruby on Rails by dmitriid on Thursday December 16, 2021 @05:59PM (#29585190)
> I think it can be simple if you keep it simple :).

> a couple hundreds lines of Bash.

One or the other. It can't be both.

Re:From Node to Ruby on Rails by yblu on Thursday December 16, 2021 @04:39PM (#29584305)
I'm sorry, but how is this simple?
Re:From Node to Ruby on Rails by mkull on Thursday December 16, 2021 @05:54PM (#29585132)
That sounds fucking complicated
Re:From Node to Ruby on Rails by mawise on Thursday December 16, 2021 @09:39AM (#29578548)
You're welcome to adapt the AWS deployment scripts I setup for Haven[1]. I tend to adapt them when deploying other personal projects like the sites I've built for my family tree or privately hosting/sharing old family home movies.

[1]: https://github.com/havenweb/haven/tree/master/deploymentscri...

Re:From Node to Ruby on Rails by anurag on Thursday December 16, 2021 @11:52AM (#29580330)
(Render founder; genuinely curious) what about Render makes you not want to use it?
Re:From Node to Ruby on Rails by danjac on Thursday December 16, 2021 @12:44PM (#29581169)
Python/Django developer here, but I've found Digital Ocean+Dokku to be a pretty decent cheap alternative with more flexibility than Heroku, especially for an early-stage side project where a single server is enough for your needs.
Re:From Node to Ruby on Rails by rronalddas on Friday December 17, 2021 @06:54AM (#29591004)
I used to use Dokku a lot for hosting Flask APIs, am now using Caprover , the added GUI is great
Re:From Node to Ruby on Rails by kovacs on Thursday December 16, 2021 @01:30PM (#29581871)
Take a look at Cloud66. Been using it for every project over the last 10 years or so... It's like Heroku except you can control a lot more and not get locked into "enterprise" pricing when you need to scale or simply don't want to expose your database to the open internet (imagine that).
Re:From Node to Ruby on Rails by adriand on Thursday December 16, 2021 @01:41PM (#29582028)
Check out https://www.hatchbox.io/, it lets you easily host stuff on various hosting platforms (using your own account) with similar ease to Heroku. Which also means it's WAY cheaper. Heroku's pricing has always seemed insane to me.
Re:From Node to Ruby on Rails by mrinterweb on Thursday December 16, 2021 @05:26PM (#29584840)
I think it used to be harder to host than it is now. I think the only thing that might be hard now is sifting through all the tools for hosting and the analysis paralysis that can come with that. Heroku can get pricey at scale, but heroku and others are options that make it dead simple. Then there are a ton of options for how you might want to self-host. There are plenty of guides for getting docker setup with it, opensource heroku-like alternatives (most using docker under the hood), and plenty of resources (maybe too much).
Re:From Node to Ruby on Rails by 1337shadow on Thursday December 16, 2021 @10:41AM (#29579288)
Did you try uwsgi? I have been hosting everything with this thing for over a decade and I still love it: https://uwsgi-docs.readthedocs.io/en/latest/Ruby.html
Re:From Node to Ruby on Rails by jamiequint on Thursday December 16, 2021 @10:39AM (#29579260)
It’s been a long time, but I used to use convox for this back in the day, may still be worth checking out: https://docs.convox.com/example-apps/rails/
Re:From Node to Ruby on Rails by colbyhub on Thursday December 16, 2021 @05:04PM (#29584628)
I've had good success on my side-business with Piku: https://piku.github.io It's essentially a lightweight PaaS that you can run on your own hardware (even ARM)
Re:From Node to Ruby on Rails by Lukas_Skywalker on Thursday December 16, 2021 @04:21PM (#29584072)
I have been using a software called dokku for about six years. It‘s like Heroku, but you self host. It even uses the same buildpacks. You just run the dokku installer and off you go.
Re:From Node to Ruby on Rails by daveungerer on Thursday December 16, 2021 @06:53PM (#29585704)
If you don't mind hosting on AWS, Elastic Beanstalk is a pretty streamlined way to host Rails apps, and it doesn't cost anything more than the AWS resources you consume.
Re:From Node to Ruby on Rails by jhgb on Thursday December 16, 2021 @09:32AM (#29578474)
See, emteycz? Popularity is not the same thing as satisfaction. ;)
Re:From Node to Ruby on Rails by firecall on Thursday December 16, 2021 @08:30PM (#29586582)
I'm using hatchbox.io on Linode!

And it's great!

Hatchbox takes the maintenance and setup out of DevOps for me!

Using Hatchbox makes it easier to treat servers like cattle and less like pets!

Re:From Node to Ruby on Rails by pkz on Thursday December 16, 2021 @10:52AM (#29579412)
Agree on the hosting part. I would like an official docker compose for production that had everything tied together nicely.