Is Discourse using Ruby 2.0? Howto use Ruby 2.2


(Oleg Bovykin) #1

Hi!
Today I looked at my Discourse installation and after rebuilding app image, somehow decided to check ruby version.

./launcher enter app
ruby -v
ruby 2.0.0p647 (2015-08-18 revision 51631) [x86_64-linux]

It really surprised me, because 2.0 branch is not officially supported anymore.
Am I doing something wrong? Or Discourse really use 2.0 ruby?

I started looking for PosgreSQL version and found 9.3.11. I found 9.5 template, but no info about how to upgrade to it. Is it not complete yet?

Answer Thanks to @sam


(Mittineague) #2

Hmmm, that doesn’t look like my localhost version

ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [i386-linux-gnu]


(Rafael dos Santos Silva) #3

Discourse Docker is still on Ruby 2.0 and PostgreSQL 9.3 indeed.

Updating to 2.3 will add more memory pressure, so it’s a risk.

PostgreSQL however will bring some perf increases, and PostgreSQL 9.6 later this year will be a very good perf increase for multi-cores installs.


(Oleg Bovykin) #4

Is localhost for dev? I am talking about docker container

But its not the way to sit on 2.0. Rails 5 will need 2.2 minimum version.

Any info about upgrade process?


(Mittineague) #5

Yes.

So t’s more correct to say that Docker is using Ruby 2.0 rather than Discourse is using Ruby 2.0 ?


(Rafael dos Santos Silva) #6

:nerd:


They are going to take this updates when possible. On this release they are working on updating Ember.

If I was they PM I was going to take PostgreSQL update when 9.6 lands. Parallel scans are too good to pass :smile:.

And on Ruby IDK, they don’t really need Action Cable. And Discourse works on ruby 2.3 and is already tested on travis on it.


(Sam Saffron) #7

Memory usage is higher but almost back on 2.3

https://rubybench.org/ruby/ruby/releases?result_type=discourse_memory_usage

Also performance is a bit slower on the 50 percentile, which is pretty much all the consumers of the docker image see cause we do out-of-band GC

https://rubybench.org/ruby/ruby/releases?result_type=discourse_categories

That said, my hand is forced and I am going to have just run Ruby 2.3.1 in our latest images cause 2.0 is no longer supported.

We already have 2.2 with Github patches image that is running here on meta. It is activated with:

base_image: discourse/discourse_fast_switch:1.0.17

run:
   exec: use_22

(Oleg Bovykin) #8

@sam Thanks for the answer.
Where should we put this code? I tried to put in in the beginning of my app.yml.
Then tried to put run section to first place of run yml, but after rebuilding container my app is down.
There are no errors in log files. Looks like unicorn dont start at all.
I noticed, that

use_22

runs after bundler completes installing gems.
What I doing wrong?


(Sam Saffron) #9

Yeah probably you need to use a the before_web hook

I would not worry about it, we are going to upgrade Ruby to 2.3.1 next week


(Oleg Bovykin) #10

Thanks!

And what about postgres? Are you planning to move to 9.5? Or will wait for 9.6? Can I help with it?


(Sam Saffron) #11

We plan to move to 9.5 as well


(Erick Guan) #12

I bootstrapped a multi-site with new base image and pg9.5. Except 100MB more base image size issue, it works quite good at a stage site.

I also have a illusion of fast. Nice work! :wink:

Warning: Don’t try this if you don’t understand the code. Don’t do it in production.

base_image: discourse/discourse:1.3.0

templates:
  - "templates/new.postgres.template.yml"