# Is Discourse using Ruby 2.0? Howto use Ruby 2.2

**URL:** https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248
**Category:** Self-hosting
**Created:** [May 14, 2016, 6:18pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248 "2016-05-14T18:18:01Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![arrowcircle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arrowcircle/32/100035_2.png) [@arrowcircle](https://meta.discourse.org/u/arrowcircle)
#### Post date: [May 14, 2016, 6:18pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/1 "2016-05-14T18:18:01Z")

</div>

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

> [@sam](#):
>
> We already have 2.2 with Github patches image that is running here on meta. It is activated with:
> 
> ```plaintext
> base_image: discourse/discourse_fast_switch:1.0.17
> 
> before_web:
> exec: use_22
> 
> ```

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [May 14, 2016, 6:30pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/2 "2016-05-14T18:30:05Z")

</div>

Hmmm, that doesn’t look like my localhost version

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

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [May 14, 2016, 6:58pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/3 "2016-05-14T18:58:09Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![arrowcircle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arrowcircle/32/100035_2.png) [@arrowcircle](https://meta.discourse.org/u/arrowcircle)
#### Post date: [May 14, 2016, 7:02pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/4 "2016-05-14T19:02:26Z")

</div>

> [@Mittineague](#):
>
> Hmmm, that doesn’t look like my localhost version

Is localhost for dev? I am talking about docker container

> [@Falco](#):
>
> Updating to 2.3 will add more memory pressure, so it’s a risk.

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

> [@Falco](#):
>
> 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.

Any info about upgrade process?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [May 14, 2016, 7:42pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/5 "2016-05-14T19:42:49Z")

</div>

> [@arrowcircle](#):
>
> Is localhost for dev?

Yes.

> [@Falco](#):
>
> Discourse Docker is still on Ruby 2.0

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

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [May 14, 2016, 7:54pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/6 "2016-05-14T19:54:56Z")

</div>

> [@Mittineague](#):
>
> So t’s more correct to say that Docker is using Ruby 2.0 rather than Discourse is using Ruby 2.0 ?

> [@Mittineague](#):
>
> Discourse **Docker** is still on Ruby 2.0

🤓

* * *

> [@arrowcircle](#):
>
> Any info about upgrade process?

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 😄.

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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 14, 2016, 10:10pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/7 "2016-05-14T22:10:32Z")

</div>

> [@arrowcircle](#):
>
> But its not the way to sit on 2.0. Rails 5 will need 2.2 minimum version.

Memory usage is higher but almost back on 2.3

[https://rubybench.org/ruby/ruby/releases?result\_type=discourse\_memory\_usage](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](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:

```plaintext
base_image: discourse/discourse_fast_switch:1.0.17

run:
   exec: use_22

```

---

<div class="post-metadata">

### Author: ![arrowcircle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arrowcircle/32/100035_2.png) [@arrowcircle](https://meta.discourse.org/u/arrowcircle)
#### Post date: [May 15, 2016, 10:13am UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/8 "2016-05-15T10:13:34Z")

</div>

@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?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 15, 2016, 12:08pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/9 "2016-05-15T12:08:01Z")

</div>

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

---

<div class="post-metadata">

### Author: ![arrowcircle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arrowcircle/32/100035_2.png) [@arrowcircle](https://meta.discourse.org/u/arrowcircle)
#### Post date: [May 15, 2016, 12:09pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/10 "2016-05-15T12:09:46Z")

</div>

Thanks!

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 15, 2016, 12:37pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/11 "2016-05-15T12:37:09Z")

</div>

We plan to move to 9.5 as well

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [May 19, 2016, 8:09pm UTC](https://meta.discourse.org/t/is-discourse-using-ruby-2-0-howto-use-ruby-2-2/44248/12 "2016-05-19T20:09:40Z")

</div>

I bootstrapped a multi-site with new base image and pg9.5. Except [100MB more base image size issue](https://github.com/discourse/discourse_docker/issues/258), it works quite good at a stage site.

I also have a illusion of fast. Nice work! 😉

**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"

```
