bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
8.85k stars 9.14k forks source link

bitnami/discourse How to upgrade Discourse? #5168

Closed timothydowney closed 3 years ago

timothydowney commented 3 years ago

How do I perform a Discourse upgrade using the bitnami/discourse chart? I'm running an instance of the chart inside of my Kubernetes cluster and having issues when attempting an upgrade.

Firstly, thanks for this chart! It's well done and has saved me a lot of time.

This is part of a process of migration out of an EC2 instance into Kubernetes. The steps I've followed are:

I'm able to repeatedly perform the first steps to get a copy of my existing EC2 instance up and running with all content inside of my k8s cluster, but when I attempt to upgrade to 2.6.0 I'm faced with issues at pod startup.

Here is the error that I am seeing:

discour INFO  Patching Discourse...
postgre INFO  Trying to connect to PostgreSQL server
postgre INFO  Found PostgreSQL server listening at discourse-postgresql:5432
postgre INFO  PostgreSQL server listening and working at discourse-postgresql:5432
discour INFO  Preparing Discourse environment...
discour INFO  Configuring the Discourse database files...
discour INFO  Configuring Redis...
discour INFO  Setting up SMTP in Discourse...
discour INFO  Migrating database...
Error executing 'postInstallation': `enabled_site_setting_filter` is deprecated
rake aborted!
ActiveModel::UnknownAttributeError: unknown attribute 'email_private_messages' for UserOption.
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:52:in `_assign_attribute'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:43:in `block in _assign_attributes'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:42:in `each'
/opt/bitnami/discourse/vendor/bundle/ruby/2.6.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:42:in `_assign_attributes'

I am using version 2.1.2 of the bitnami/discourse chart.

Has anyone been able to perform an upgrade? Am I missing a step that is required before attempting to upgrade the discourse container tag?

javsalgar commented 3 years ago

Hi,

Thank you for using Bitnami. How was the backup/restore done? Was it using the Discourse interface? Could it be that you had extensions/plugins in your initial installation that were not transferred to the new instance? Does the issue happen when upgrading to an intermediate version, such as 2.3.0 or 2.4.0 (this is important for us to isolate the issue)

timothydowney commented 3 years ago

Hi @javsalgar -- This is a good lead. I have two plugins from the initial install that I have not been able to migrate. To answer your other question I grabbed a tarball of a backup from my original instance and I'm using the built-in restore capability on my new k8s instance to restore it.

As for the plugins -- On my existing EC2 instance, I have three plugins installed:

I'm using the install plugin method defined in 4624, i.e.

RAILS_ENV=production bundle exec rake plugin:install repo=https://github.com/jonmbake/discourse-ldap-auth
RAILS_ENV=production bundle exec rake assets:precompile

This works for discourse-ldap-auth, but is failing on the precompile for both discourse-solved and discourse-voting. I'm getting errors like:

root@discourse-75c4684f67-xsrrc:/opt/bitnami/discourse# RAILS_ENV=production bundle exec rake assets:precompile
rake aborted!
NoMethodError: undefined method `redis' for Discourse:Module
/opt/bitnami/discourse/plugins/discourse-solved/plugin.rb:34:in `block in activate!'
/opt/bitnami/discourse/lib/plugin/instance.rb:320:in `block in notify_after_initialize'
/opt/bitnami/discourse/lib/plugin/instance.rb:318:in `each'
/opt/bitnami/discourse/lib/plugin/instance.rb:318:in `notify_after_initialize'
/opt/bitnami/discourse/config/application.rb:275:in `each'
/opt/bitnami/discourse/config/application.rb:275:in `block in <class:Application>'
/opt/bitnami/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2.1/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
/opt/bitnami/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control

I'm not really clear why redis wouldn't be available. The chart has installed and is running the redis pod, but I'm not really sure how to tell if Discourse is using it. I'm assuming that there is something in the environment setup that isn't bringing in the right deps. Either way, I'm unable to install those two plugins which could be leading to the original reported problem since my install & restore is not like-for-like.

I've also tried a suggestion from elsewhere suggesting to try adding config.assets.initialize_on_precompile = false to production.rb. It appears to have no helpful effect.

Any advice on how to get the plugins installed?

javsalgar commented 3 years ago

Hi,

I tried installing the latest version of the chart and found no issues when installing the plugin .

image

I'm curious if the latest discourse admin can import backups from previous versions. Did you try that?

timothydowney commented 3 years ago

Hi,

Ok, it would appear that order matters in my case. In order for it to work, here's what I had to do.

When following those steps, I was able to successfully migrate an instance running 2.2.4 to 2.6.0.

Thanks for the assistance!