Problem upgrading Discourse

Hi,

I’m upgrading Discourse v2.3.0.beta8 +212 → 2.4.0.beta1.

First I upgraded the docker manager from the Web UI. Then the web UI told me I needed to upgrade in the command line, so I did that.

I’ve had repeated errors when upgrading. I run

cd /var/discourse
su ./launcher rebuild app

it runs for a few minutes, then fails on a database upgrade. I rebooted my server, which brought discourse back up (but not upgraded) and tried again. Same error.

Any suggestions for proceeding?

Here’s the last set of lines when I run the rebuild.

Optimizing site icons...
I, [2019-07-09T01:22:18.589503 #13]  INFO -- : Terminating async processes
I, [2019-07-09T01:22:18.589624 #13]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/10/bin/postmaster -D /etc/postgresql/10/main pid: 67
I, [2019-07-09T01:22:18.589816 #13]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 183
2019-07-09 01:22:18.589 UTC [67] LOG:  received fast shutdown request
183:signal-handler (1562635338) Received SIGTERM scheduling shutdown...
2019-07-09 01:22:18.593 UTC [67] LOG:  aborting any active transactions
2019-07-09 01:22:18.599 UTC [67] LOG:  worker process: logical replication launcher (PID 76) exited with exit code 1
2019-07-09 01:22:18.599 UTC [71] LOG:  shutting down
2019-07-09 01:22:18.629 UTC [67] LOG:  database system is shut down
183:M 09 Jul 2019 01:22:18.645 # User requested shutdown...
183:M 09 Jul 2019 01:22:18.645 * Saving the final RDB snapshot before exiting.
183:M 09 Jul 2019 01:22:18.672 * DB saved on disk
183:M 09 Jul 2019 01:22:18.672 # Redis is now ready to exit, bye bye...


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

Edit: The only errors in the full log are these

I, [2019-07-09T01:21:35.162142 #13]  INFO -- : > su postgres -c 'createdb discourse' || true
2019-07-09 01:21:35.330 UTC [80] postgres@postgres ERROR:  database "discourse" already exists
2019-07-09 01:21:35.330 UTC [80] postgres@postgres STATEMENT:  CREATE DATABASE discourse;
createdb: database creation failed: ERROR:  database "discourse" already exists
I, [2019-07-09T01:21:35.332706 #13]  INFO -- :
I, [2019-07-09T01:21:35.333101 #13]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2019-07-09 01:21:35.444 UTC [91] postgres@discourse ERROR:  role "discourse" already exists
2019-07-09 01:21:35.444 UTC [91] postgres@discourse STATEMENT:  create user discourse;
ERROR:  role "discourse" already exists

I notice it quits above after “Optimizing Site Icons…” – maybe there’s a problem here?

You might try searching for “error role discourse already exists”

searched by that term, didn’t find anything that helped

  • some posts mentioned plugins, I disabled plugins in app.yml
  • I had a message about deprecated version of docker, upgraded that
  • ran discourse doctor

same errors.

Attached is the output of launch rebuild.

Any suggestions for where to go next?

rebuild script.txt (140.9 KB)

It’s worth noting I have a relative url root in my app.xml. Could that be messing up the upgrade?

env:
  DISCOURSE_RELATIVE_URL_ROOT: /epicenter/support

run:
  - exec: echo "Beginning of custom commands"

  - exec:
        cd: $home
        cmd:
          - mkdir -p public/epicenter/support
          - cd public/epicenter/support && ln -s ../../uploads && ln -s ../../backups
          - rm public/uploads
          - rm public/backups
  - replace:
       global: true
       filename: /etc/nginx/conf.d/discourse.conf
       from: proxy_pass http://discourse;
       to: |
          rewrite ^/(.*)$ /epicenter/support/$1 break;
          proxy_pass http://discourse;
  - replace:
       filename: /etc/nginx/conf.d/discourse.conf
       from: etag off;
       to: |
          etag off;
          location /epicenter/support {
             rewrite ^/epicenter/support/?(.*)$ /$1;
          }
  - replace:
         filename: /etc/nginx/conf.d/discourse.conf
         from: $proxy_add_x_forwarded_for
         to: $http_fastly_client_ip
         global: true

드디어 세 번째나 네 번째 작업 세션에서 이 문제를 해결했습니다. 문제가 ‘uploads’ 폴더에서 이미지가 누락된 것 때문인 것으로 보였습니다. 해결 방법은 새 설치를 하고, 동일한 ‘app.yml’ 파일을 사용하며, 누락된 이미지에 대해 더미 파일을 사용하여 백업에서 복원하는 것이었습니다.

원래 문제와 별도로, 이전 업그레이드 이후에 여러 아이콘과 이미지가 사라진 것을 발견했습니다. 재구성을 시도했을 때, 로그에 ‘optimizing site images’ 단계에서 프로세스가 중단된 것으로 표시되었습니다. 누락된 이미지에서 멈추어 특정 오류를 기록하지 않고 종료된 것으로 생각됩니다. (누락된 이미지가 문제였는지, 또는 어떤 이미지 파일이 누락되었는지에 대한 어떠한 표시도 없었습니다.)

결국 최신 버전으로 새로운 Discourse 설치를 진행했습니다. 여기서 안내된 방법에 따라 백업에서 복원했습니다. 세 번의 시도가 필요했습니다.

첫째, 백업 스크립트가 업로드된 파일을 찾지 못해 오류가 발생했습니다. 그래서 이전 백업 파일에서 uploads/default 폴더를 복사해 넣었습니다.

복원 스크립트를 다시 실행했습니다. 이번에는 특정 이미지 파일을 찾을 수 없다는 오류가 발생했습니다. 가짜 이미지 파일을 만들어 동일한 이름을 붙이고 지정된 위치에 놓았습니다.

세 번째로 복원 스크립트를 실행했습니다. 성공했습니다! 사이트가 백업에서 복원되어 최신 버전으로 운영되고 있습니다.