Maintaining an up-to-date development environment

I’m trying to set up a new dev machine and bundler is missing. I look at and see that it’s still installing ruby_version="2.7.6". And re-running that script has never seemed like a very reliable way to get a dev machine updated.

How does anyone else do this? Is everyone really just using Install Discourse for development using Docker?

For developing my dashboard I pass a bunch of settings on the command line with a pfaffmanager-discourse script that will also pull the latest discourse and migrate the database. I guess I can contrive to do that somehow in the docker version as well.

Am I just old school thinking that I should have a native dev instance rather than doing it in docker?

I use ansible to set up new machines all the time, the only thing that setup is missing is a discourse dev script. Would anyone else want such a thing? Could we move it into core so that you could just clone discourse and then run a playbook to get Ruby and imagemagick and whatever else at the proper versions?

1 Like

AFAIK almost everyone in the development team uses a native dev environment.

I’ve been using asdf to manage versions for the many tools I use, so for me it’s just a

asdf install ruby 3.1.3
asdf local ruby 3.1.3

to get Discourse running in the new Ruby.

Very useful for me since I’ve been benchmarking Discourse across rubies and handling the Ruby upgrade.


I’ve moved to a Docker Compose solution for the time being, with a Dockerfile determining the build of Discourse I’m working on. For basic stuff this is working well so far but it is obviously a little slower than a direct “on the metal” Ubuntu environment …


Off topic, yeah, very impressed with the YJIT !!.. does Discourse support Ruby 3.2 completely already?


Is there some secret repo that they all use to keep stuff up to date?

Thanks! asdf is a huge help! I think I have seen it before but wanted to avoid Yet Another Package Manager. If it’s good enough for you, I’m all in.

And it looks like nodejs is out of date in the install script as well. A recent install has v18.12.1 and the script installs 16.

So it looks like

          git clone ~/.asdf --branch v0.10.2
          asdf plugin add ruby
          asdf plugin add imagemagick
          asdf install imagemagick 7.1.0-55
          asdf plugin add nodejs
          asdf install nodejs 18.12.1

Assuming that you get this in your .bashrc (or similar) somehow:

. $HOME/.asdf/
. $HOME/.asdf/completions/asdf.bash

And installing these gems:

      - bundler
      - discourse_theme
      - minitar
      - listen
      - rb-fsevent
      - rb-inotify
      - ffi
      - multipart-post
      - tty-prompt
      - pastel
      - tty-color
      - tty-reader
      - tty-screen
      - advancecomp
      - gifsicle
      - jpegoptim
      - libjpeg-progs
      - optipng
      - pngcrush
      - pngquant
      - jhead
      - rails 

Some of those I might have added for some reason other than Discourse, though I’m not quite sure.


apt-get install -y git build-essential libxslt1-dev libcurl4-openssl-dev libksba8 \
libksba-dev libreadline-dev libssl-dev zlib1g-dev libsnappy-dev \
sqlite3 libsqlite3-dev postgresql postgresql-server-dev-all \
postgresql-contrib libpq-dev redis-server golang-go 
go get

(Probably not in that order) Comes pretty close. The current redis included with ubuntu is Good Enough for 99% of developers ~~(it’s 7.0.7 and not 6.x)~~Oh! 7.0.7 is now what’s included. But there is an asdf plugin for redis as well.

Such a script would then be pretty easy to maintain in core when there was a version bump in node, imagemagick, or Ruby, and then a lazy developer could run that script once a week or with every new pull and have a current development environment. With an hour or three someone clever could make it cross-platform enough for Linux, Mac/homebrew, and Windows/WSL in a couple of hours. I thankfully don’t have easy access to Windows these days, so I’m not volunteering.

But I think if I watch changes to discourse_docker maybe I’ll notice when those get updated and my hacked together additions to my newmachine ansible playbook may now do the job.

Thanks for the tip! I think I can now have a dev setup on any machine with a single command.

1 Like

While I can see how cool would be to have that all automatically handled, for me handling my dev environment, updates and all, is an essential part of the job.

It sucks for newcomers, and that’s were tools like GitHub Codespaces shine, but for people in the weeds of Discourse development day to day understanding and being able to manipulate the dev environment is helpful to understand how the parts all fit together.


Well, the guy doing Ruby benchmarking is far from a typical developer, but fair enough! I guess we’re all a bit different in how we like to manage things anyway.

Thanks to your asdf recommendation, I think with that I’ll be able to keep things straight on my various machines.

1 Like

I did most of the compatibility work already on the 3.1 push, so we are already all set on the 3.2 move and will be doing so soon.


Falco, could I check this one with you?:

rake dev:populate

now seems to produce an error:

Psych::DisallowedClass: Tried to load unspecified class: Date

Is this related to new Ruby or Rails version?


I wonder how much TTFB will improve with the new YJIT

1 Like

This issue appears resolved on latest, thanks to whoever fixed it! :pray: It is a critical facility to help efficiently build test fixtures.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.