No, if bundle
wasn’t the right program, it wouldn’t have a known to look at the Gemfile; however, I’m guessing that there are several versions of Ruby installed on the machine and bundler was using an outdated Ruby. The shorthand hash assignment notation symbol: "value"
(instead of :symbol => "value"
) was introduced with Ruby 1.9.
The pg
gem requires the native PostgreSQL client library and its C header files. On Ubuntu, sudo apt-get install libpq-dev
should install these files.
Either install the gem with sudo
or install it in your user’s home directory with gem install --user-install mysql2
. Newer versions of rubygems should actually do this automatically when run by a non-root user…
This time around, you were running inside Discourse’s production container. The container hosts an Ubuntu userland separate from your host machine, so packages you installed on the host - e.g. the mysql
client library - aren’t available inside. Running apt-get install libmysqlclient-dev
in the container should fix this.
I tend to disagree. The problem is that Ubuntu, even in the “server” flavour, is targeting ex-point&click users. Like many other binary distributions, compiling C code against libraries installed by the system package manager is impossible unless an additional -dev
package is installed as well. Ruby, on the other hand, assumes that it runs on a full-featured POSIX platform where it is and always has been the custom to keep required C header files alongside installed library binaries.
Yes, that I fully agree with, but I have no ideas for an easy solution. Perhaps an alternative docker image that includes mysql dependencies?