How did I fix «The source cluster was not shut down cleanly» on upgrading Discourse at 2020-09-05

Step 1

I have switched Discourse to the en_US.UTF-8 locale:

env:
  LANG: en_US.UTF-8
  LANGUAGE: en_US.UTF-8
  LC_ALL: en_US.UTF-8

meta.discourse.org/t/151236#lc-collate-values-for-database-%E2%80%9Cpostgres%E2%80%9D-do-not-match

Step 2

I upgraded discourse from v2.3.7 to tests-passed:

params:
  version: tests-passed

Step 3

./launcher start <container>
./launcher enter <container>
chown -R postgres postgres_data
exit
./launcher rebuild <container>

meta.discourse.org/t/153713/8

I recommend also check Postgres logs at /usr/local/discourse/shared/<container>/log/var-log/postgres/current