Assets precompile require redis

Building a docker container that provides additional plugins with Discourse: https://github.com/Monogramm/docker-bitnami-discourse.

When building the container by itself, bundle exec rake assets:precompile fails trying to connect to Redis:

e[0me[91m+ e[0me[91mbundlee[0me[91m exece[0me[91m rakee[0me[91m assets:precompilee[0me[91m
e[0me[91mFailed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 2 Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) subscribe failed, reconnecting in 1 second. Call stack ["/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis/client.rb:362:in `rescue in establish_connection'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis/client.rb:343:in `establish_connection'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis/client.rb:107:in `block in connect'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis/client.rb:308:in `with_reconnect'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis/client.rb:106:in `connect'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis/client.rb:289:in `with_socket_timeout'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis/client.rb:139:in `call_loop'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis/subscribe.rb:44:in `subscription'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis/subscribe.rb:14:in `subscribe'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis.rb:3506:in `_subscription'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis.rb:2326:in `block in subscribe'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis.rb:69:in `block in synchronize'", "/opt/bitnami/ruby/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis.rb:69:in `synchronize'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis.rb:2325:in `subscribe'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-3.3.1/lib/message_bus/backends/redis.rb:287:in `global_subscribe'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-3.3.1/lib/message_bus.rb:754:in `global_subscribe_thread'", "/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-3.3.1/lib/message_bus.rb:702:in `block in new_subscriber_thread'"]
e[0me[91mrake aborted!
e[0me[91mPG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
e[0me[91m/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/pg-1.2.3/lib/pg.rb:58:in `new'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/pg-1.2.3/lib/pg.rb:58:in `connect'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:46:in `postgresql_connection'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_handling.rb:221:in `retrieve_connection'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_handling.rb:189:in `connection'
/opt/bitnami/discourse/lib/site_settings/db_provider.rb:61:in `table_exists?'
/opt/bitnami/discourse/lib/site_settings/db_provider.rb:16:in `all'
/opt/bitnami/discourse/lib/site_settings/defaults_provider.rb:29:in `db_all'
/opt/bitnami/discourse/lib/site_setting_extension.rb:287:in `block in refresh!'
/opt/bitnami/discourse/lib/site_setting_extension.rb:284:in `synchronize'
/opt/bitnami/discourse/lib/site_setting_extension.rb:284:in `refresh!'
/opt/bitnami/discourse/lib/site_setting_extension.rb:505:in `block in setup_methods'
/opt/bitnami/discourse/config/initializers/004-message_bus.rb:120:in `<main>'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:318:in `block in load'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:291:in `load_dependency'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:318:in `load'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/engine.rb:666:in `block in load_config_initializer'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:182:in `instrument'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/engine.rb:665:in `load_config_initializer'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/engine.rb:625:in `block (2 levels) in <class:Engine>'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/engine.rb:624:in `each'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/engine.rb:624:in `block in <class:Engine>'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:32:in `instance_exec'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:32:in `run'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:50:in `each'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:50:in `tsort_each_child'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:60:in `run_initializers'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/application.rb:363:in `initialize!'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/railtie.rb:190:in `public_send'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/railtie.rb:190:in `method_missing'
/opt/bitnami/discourse/config/environment.rb:7:in `<main>'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:324:in `block in require'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:291:in `load_dependency'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:324:in `require'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/application.rb:339:in `require_environment!'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/application.rb:523:in `block in run_tasks_blocks'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/opt/bitnami/ruby/bin/bundle:23:in `load'
/opt/bitnami/ruby/bin/bundle:23:in `<main>'
e[0me[91mTasks: TOP => environment
e[0me[91m(See full trace by running task with --trace)
e[0mThe command '/bin/sh -c set -ex; bundle exec rake plugin:install[https://github.com/jonmbake/discourse-ldap-auth]; bundle exec rake plugin:install[https://github.com/discourse/discourse-adplugin]; bundle exec rake plugin:install[https://github.com/discourse/discourse-affiliate]; bundle exec rake plugin:install[https://github.com/discourse/discourse-akismet]; bundle exec rake plugin:install[https://github.com/discourse/discourse-auto-deactivate]; bundle exec rake plugin:install[https://github.com/discourse/discourse-bbcode]; bundle exec rake plugin:install[https://github.com/discourse/discourse-bbcode-color]; bundle exec rake plugin:install[https://github.com/discourse/discourse-cakeday]; bundle exec rake plugin:install[https://github.com/discourse/discourse-canned-replies]; bundle exec rake plugin:install[https://github.com/discourse/discourse-characters-required]; bundle exec rake plugin:install[https://github.com/discourse/discourse-chat-integration]; bundle exec rake plugin:install[https://github.com/discourse/discourse-checklist]; bundle exec rake plugin:install[https://github.com/discourse/discourse-data-explorer]; bundle exec rake plugin:install[https://github.com/discourse/discourse-fingerprint]; bundle exec rake plugin:install[https://github.com/discourse/discourse-footnote]; bundle exec rake plugin:install[https://github.com/discourse/discourse-graphviz]; bundle exec rake plugin:install[https://github.com/discourse/discourse-math]; bundle exec rake plugin:install[https://github.com/discourse/discourse-matomo-analytics]; bundle exec rake plugin:install[https://github.com/discourse/discourse-oauth2-basic]; bundle exec rake plugin:install[https://github.com/discourse/discourse-patreon]; bundle exec rake plugin:install[https://github.com/discourse/discourse-plugin-linkedin-auth]; bundle exec rake plugin:install[https://github.com/discourse/discourse-push-notifications]; bundle exec rake plugin:install[https://github.com/discourse/discourse-saved-searches]; bundle exec rake plugin:install[https://github.com/discourse/discourse-signatures]; bundle exec rake plugin:install[https://github.com/discourse/discourse-sitemap]; bundle exec rake plugin:install[https://github.com/discourse/discourse-staff-notes]; bundle exec rake plugin:install[https://github.com/discourse/discourse-styleguide]; bundle exec rake plugin:install[https://github.com/discourse/discourse-tooltips]; bundle exec rake plugin:install[https://github.com/discourse/discourse-user-card-badges]; bundle exec rake plugin:install[https://github.com/discourse/discourse-voting]; bundle exec rake assets:precompile' returned a non-zero code: 1
build hook failed! (1)

Yes, the bootstrap process needs to connects to both PostgreSQL and Redis. That is not a problem for instances running under a supported install following Discourse official Standard Installation.

The third-party Bitnami images aren’t supported by the Discourse team, and we have no involvement with those.

3 Likes

@Falco I know you obviously do not provide support for Bitnami docker image, which is why my question was merely regarding the use of redis during assets compilation. I only provided the link to the repo for reference to the source code.

By the way, I know of the Discourse official Standard Installation but it does not answer our needs for an easy and straight-forward docker-compose based deployment, which is why we decided to go with Bitnami image.

Right, but unsupported installs do not answer our needs for an easy and straightforward way to support open source installs here on meta :wink:

1 Like