bitnami / containers

Bitnami container images
https://bitnami.com
Other
3.36k stars 4.83k forks source link

[bitnami/discourse] Discourse container is unabel to download ruby #31503

Closed jennso closed 1 year ago

jennso commented 1 year ago

Name and Version

10.0.5

What architecture are you using?

amd64

What steps will reproduce the bug?

First issue is the discourse container does not have curl or wget to download ruby, I installed it manually inside the contianer before It started the download, It tried to download ruby form 3 different urls but none are working, seems like the version of ruby that the container is called is not available oline anymore. here is the log

No curl or wget:

discourse_1   | You can stop Phusion Passenger(R) Standalone by pressing Ctrl-C.
discourse_1   | Problems? Check https://www.phusionpassenger.com/library/admin/standalone/troubleshooting/
discourse_1   | ===============================================================================
discourse_1   | [ N 2023-04-24 11:33:38.9577 737/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)
discourse_1   | App 793 output:  [passenger_native_support.so] trying to compile for the current user (discourse) and Ruby interpreter...
discourse_1   | App 793 output:      (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
discourse_1   | App 793 output:      Warning: compilation didn't succeed. To learn why, read this file:
discourse_1   | App 793 output:      /tmp/passenger_native_support-xpz2t9.log
discourse_1   | App 793 output:  [passenger_native_support.so] finding downloads for the current Ruby interpreter...
discourse_1   | App 793 output:      (set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable)
**discourse_1   | App 793 output:      Could not download https://github.com/phusion/passenger/releases/download/release-6.0.17/rubyext-ruby-3.1.4-x86_64-linux.tar.gz: no download tool found (curl or wget required)**
discourse_1   | App 793 output:      Trying next mirror...
discourse_1   | App 793 output:      Could not download https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release/6.0.17/rubyext-ruby-3.1.4-x86_64-linux.tar.gz: no download tool found (curl or wget required)
discourse_1   | App 793 output:      Trying next mirror...
discourse_1   | App 793 output:      Could not download https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release/6.0.17/rubyext-ruby-3.1.4-x86_64-linux.tar.gz: no download tool found (curl or wget required)
discourse_1   | App 793 output:  [passenger_native_support.so] will not be used (can't compile or download)
discourse_1   | App 793 output:   --> Passenger will still operate normally.

url not found:

discourse_1   | You can stop Phusion Passenger(R) Standalone by pressing Ctrl-C.
discourse_1   | Problems? Check https://www.phusionpassenger.com/library/admin/standalone/troubleshooting/
discourse_1   | ===============================================================================
discourse_1   | [ N 2023-04-24 11:45:08.4366 936/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)
discourse_1   | App 992 output:  [passenger_native_support.so] trying to compile for the current user (discourse) and Ruby interpreter...
discourse_1   | App 992 output:      (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
discourse_1   | App 992 output:      Warning: compilation didn't succeed. To learn why, read this file:
discourse_1   | App 992 output:      /tmp/passenger_native_support-1lcle4j.log
discourse_1   | App 992 output:  [passenger_native_support.so] finding downloads for the current Ruby interpreter...
discourse_1   | App 992 output:      (set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable)
**discourse_1   | App 992 output:      Could not download https://github.com/phusion/passenger/releases/download/release-6.0.17/rubyext-ruby-3.1.4-x86_64-linux.tar.gz: The requested URL returned error: 404**
discourse_1   | App 992 output:      Trying next mirror...
**discourse_1   | App 992 output:      Could not download https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release/6.0.17/rubyext-ruby-3.1.4-x86_64-linux.tar.gz: The requested URL returned error: 404**
discourse_1   | App 992 output:      Trying next mirror...
**discourse_1   | App 992 output:      Could not download https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release/6.0.17/rubyext-ruby-3.1.4-x86_64-linux.tar.gz: The requested URL returned error: 403 Forbidden**
discourse_1   | App 992 output:  [passenger_native_support.so] will not be used (can't compile or download)
discourse_1   | App 992 output:   --> Passenger will still operate normally.
discourse_1   | Started HEAD "/" for 127.0.0.1 at 2023-04-24 11:45:21 +0000

What is the expected behavior?

for curl or wget to be in the docker image to be used to download ruby, for the urls to work

What do you see instead?

no curl or ruby found even after installing them the urls are broken

carrodher commented 1 year ago

Please, note that the Bitnami team is not actively monitoring GitHub Issues for this project. This issue will stay open for 20 days to allow the community to contribute, after 15 days without activity the issue will be marked as stale, being closed after 5 days.

If you would like to contribute to this container image by fixing a bug or adding a new feature, feel free to create a PR, the Bitnami team will be happy to review it and provide feedback.

jennso commented 1 year ago

Where is the bitnami team monitoring issues for this project

manish-nference commented 1 year ago

+1

manish-nference commented 1 year ago

The website works in safe-mode. url/safe-mode . I don't have any plugin installed and if I use disable all plugins it works.

But not sure yet how to delete the plugin that comes with core discourse styleguide, even though that is disabled.

manish-nference commented 1 year ago

I made my website work by moving plugins directory to someplace else. The blank page is gone even if you re-add the plugins directory to the same place.

di-rect commented 1 year ago

Where is the bitnami team monitoring issues for this project

I wonder why they don't monitor something the made themselves.

prsyahmi commented 1 year ago

phusion/passanger doesn't release binary for ruby 3.1.4

I tried to downgrade the ruby to version 3.1.3 in Dockerfile and add wget, however the ruby was compiled static and still unable to load library.

App 13885 output:  [passenger_native_support.so] trying to compile for the current user (discourse) and Ruby interpreter...
App 13885 output:      (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
App 13994 output:      Warning: compilation didn't succeed. To learn why, read this file:
App 13994 output:      /tmp/passenger_native_support-1939eg6.log
App 13994 output:  [passenger_native_support.so] finding downloads for the current Ruby interpreter...
App 13994 output:      (set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable)
App 13994 output:      # tar xzf rubyext-ruby-3.1.3-x86_64-linux.tar.gz
App 13994 output:      # rm -f rubyext-ruby-3.1.3-x86_64-linux.tar.gz
App 13994 output:      Checking whether downloaded binary is usable...
App 13994 output:      # /opt/bitnami/ruby/bin/ruby -I. test.rb
App 13994 output:      test.rb:2:in `require': libruby.so.3.1: cannot open shared object file: No such file or directory - /tmp/passenger-native-support-mcoe5z/passenger_native_support.so (LoadError)
App 13994 output:       from test.rb:2:in `<main>'
App 13994 output:      Binary is not usable.
App 13994 output:  [passenger_native_support.so] will not be used (can't compile or download)
App 13994 output:   --> Passenger will still operate normally.
prsyahmi commented 1 year ago

I take another look at another log file, apparently, the passenger will try to compile itself and the precompiled binary is provided for convenience only.

It seems we need to include build essentials to the docker image for this to be able to compile

checking for alloca.h... *** src/ruby_native_extension/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=src/ruby_native_extension
        --curdir
        --ruby=/opt/bitnami/ruby/bin/$(RUBY_BASE_NAME)
        --with-alloca-dir
        --without-alloca-dir
        --with-alloca-include
        --without-alloca-include=${alloca-dir}/include
        --with-alloca-lib
        --without-alloca-lib=${alloca-dir}/lib
/opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:490:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:616:in `block in try_compile'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:565:in `with_werror'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:616:in `try_compile'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:1157:in `block in have_header'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:989:in `block in checking_for'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:354:in `block (2 levels) in postpone'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:324:in `open'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:354:in `block in postpone'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:324:in `open'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:350:in `postpone'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:988:in `checking_for'
        from /opt/bitnami/ruby/lib/ruby/3.1.0/mkmf.rb:1156:in `have_header'
        from src/ruby_native_extension/extconf.rb:45:in `<main>'

Install required build tools.

apt update
apt install gcc cmake zlib1g-dev

And... after that

App 3270 output:  [passenger_native_support.so] trying to compile for the current user (discourse) and Ruby interpreter...
App 3270 output:      (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
App 3270 output:      Compilation successful. The logs are here:
App 3270 output:      /tmp/passenger_native_support-16opj8t.log
App 3270 output:  [passenger_native_support.so] successfully loaded.
migruiz4 commented 1 year ago

Hi there,

Thank you for reporting this issue. Our Discourse package already includes the passenger_native_support.so library. When unpacked, the file is located at /opt/bitnami/discourse/lib, and during the execution of postunpack.sh it is moved to /opt/bitnami/ruby/lib:

https://github.com/bitnami/containers/blob/b6aee772174a903cf5a8f50e8bdf4c4369d16efc/bitnami/discourse/3/debian-11/rootfs/opt/bitnami/scripts/libdiscourse.sh#L459-L474

The problem is that Ruby is looking for that file in other paths different from /opt/bitnami/ruby/lib:

cannot load such file -- /opt/bitnami/ruby/lib/6.0.17/ruby-3.1.4-x86_64-linux/passenger_native_support.so
cannot load such file -- /opt/bitnami/discourse/vendor/bundle/ruby/3.1.0/gems/passenger-6.0.17/buildout/ruby/ruby-3.1.4-x86_64-linux/passenger_native_support.so
cannot load such file -- passenger_native_support
cannot load such file -- /root/.passenger/native_support/6.0.17/ruby-3.1.4-x86_64-linux/passenger_native_support.so

We are currently working on a fix so that the packaged passenger_native_support.so is placed in the right directory and successfully loaded.

migruiz4 commented 1 year ago

Hi there, we have released a new version of the bitnami/discourse image tagged 3.0.3-debian-11-r7 fixing the passenger native support library issue. I will now close this issue, please let me know if you find any further issues.

prsyahmi commented 1 year ago

Hi @migruiz4, thanks for the updates.