Our Discourse instance failed to (manually) upgrade

we have a discourse instance (https://community.metabrainz.org/) with 3 containers setup (web, data, redis), and two days ago a manual upgrade was required, which is quite usual.
But, and that’s unusual, it went bad.

This is the log output after running ./launcher rebuild web:

/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/var/www/discourse/lib/migration/safe_migrate.rb:50:in `migrate'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2018-11-18T14:09:52.795384 #14]  INFO -- : == 20180916195601 MigrateS3BackupSiteSettings: migrating ======================
-- execute("UPDATE site_settings\nSET name      = 'backup_location',\n    data_type = 7,\n    value     = 's3'\nWHERE name = 'enable_s3_backups' AND value = 't';\n")
   -> 0.0011s
-- execute("DELETE\nFROM site_settings\nWHERE name = 'enable_s3_backups';\n")
   -> 0.0004s
== 20180916195601 MigrateS3BackupSiteSettings: migrated (0.1247s) =============

== 20180927135248 CreateJavascriptCaches: migrating ===========================
-- create_table(:javascript_caches)
   -> 0.4579s
== 20180927135248 CreateJavascriptCaches: migrated (0.4604s) ==================

== 20181005084357 AddSsoProviderSecretsToSiteSettings: migrating ==============
-- execute("INSERT INTO site_settings(name, data_type, value, created_at, updated_at)\n             VALUES ('sso_provider_secrets', 8, '*|\#@hHBok|9ZU\"]~Ht&>Y`G9dr({t3aSm:BTH~`9dCRdH.h['1W@e|E_Z8;Dpt&+:', now(), now())")

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 272 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --without development --retry 3 --jobs 4'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

I changed a bit the sso_provider_secrets value (it’s a secret…) but punctuation is displayed as it was logged, likely related to https://github.com/discourse/discourse/commit/27e732a58d92b051ce36ca6886a119581c335a59

We went back to previous working version (v2.2.0.beta3 +4), which is currently running.

This issue blocks any further upgrade, which is annoying :wink:


@maja can you have a look? We should properly escape this value :wink:


I have added a fix

Can you try to upgrade again?


Yes, it was it, upgrade went smoothly.
Thanks :+1: