업그레이드 실패

Debian 11에서 Docker를 사용해 단일 컨테이너로 Discourse를 실행하고 있습니다.

./launcher rebuild app을 사용해 업데이트를 시도해 보았습니다.

아래 메시지와 함께 실패합니다.

I, [2023-01-04T20:53:09.920876 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!

다시 실행할 방법을 찾지 못하고 있습니다.

어떤 아이디어라도 있을까요?

소유자가 잘못되었음을 확인했습니다

drwxr-xr-x 15 sshd             netdev          4096 Jan  4 21:43 .
drwxr-xr-x  3 root             root            4096 Jan  3  2018 ..
drwxr-xr-x  3             1000 www-data        4096 Jan  3  2018 backups
drwxr-xr-x  8 sshd             netdev          4096 Feb  2  2021 letsencrypt
drwxr-xr-x  4 sshd             netdev          4096 Jan  3  2018 log
drwxr-xr-x  2 systemd-timesync systemd-resolve 4096 Jan  3  2018 postgres_backup
drwx------ 19 systemd-timesync systemd-resolve 4096 Jan  4 21:53 postgres_data
drwx------ 19 sshd             netdev          4096 Jan  4 20:49 postgres_data_new
drwxrwsr-x  6 systemd-timesync systemd-resolve 4096 Jan  4 21:53 postgres_run
drwxr-xr-x  2 systemd-resolve  kvm             4096 Jan  4 21:53 redis_data
drwxr-xr-x  2 sshd             netdev          4096 Jan 22  2021 ssl
drwxr-xr-x  2 sshd             netdev          4096 Jan 21  2021 ssl_old
drwxr-xr-x  4 sshd             netdev          4096 Jan  3  2018 state
drwxr-xr-x  4             1000 www-data        4096 Jan  4 21:28 tmp
drwxr-xr-x  4             1000 www-data        4096 Jan  5  2018 uploads

./launcher start app 명령을 사용하여 컨테이너를 시작합니다. 그런 다음 ./launcher enter app 명령으로 컨테이너에 진입합니다.

소유권을 chown -R postgres:postgres /shared/ 명령으로 초기화합니다.

그렇게 하면 소유자가 올바르게 수정됩니다. 하지만 앱을 다시 빌드하면 소유자가 다시 잘못됩니다…

이건 에러가 아닙니다. 더 위쪽에서 발생했을 가능성이 크니 로그를 더 많이 확인해야 합니다.

2023-01-04 20:48:05.355 UTC [41] LOG:  starting PostgreSQL 13.9 (Debian 13.9-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2023-01-04 20:48:05.377 UTC [41] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-01-04 20:48:05.377 UTC [41] LOG:  listening on IPv6 address "::", port 5432
2023-01-04 20:48:05.566 UTC [41] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-01-04 20:48:05.734 UTC [44] LOG:  database system was shut down at 2023-01-04 20:46:17 UTC
2023-01-04 20:48:05.878 UTC [41] LOG:  database system is ready to accept connections
I, [2023-01-04T20:48:09.779985 #1]  INFO -- :
I, [2023-01-04T20:48:09.780390 #1]  INFO -- : > su postgres -c 'createdb discourse' || true
2023-01-04 20:48:10.014 UTC [54] postgres@postgres ERROR:  database "discourse" already exists
2023-01-04 20:48:10.014 UTC [54] postgres@postgres STATEMENT:  CREATE DATABASE discourse;
createdb: error: database creation failed: ERROR:  database "discourse" already exists
I, [2023-01-04T20:48:10.017003 #1]  INFO -- :
I, [2023-01-04T20:48:10.017425 #1]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2023-01-04 20:48:10.188 UTC [58] postgres@discourse ERROR:  role "discourse" already exists
2023-01-04 20:48:10.188 UTC [58] postgres@discourse STATEMENT:  create user discourse;
ERROR:  role "discourse" already exists
129:M 04 Jan 2023 20:48:21.224 # Failed listening on port 6379 (TCP), aborting.

다른 에러는 보이지 않습니다.

:man_shrugging:

컨테이너 안에서 postgresql 서비스를 시작하려고 하면 오류가 발생합니다.

root@server /var/discourse # ./launcher enter app
x86_64 arch detected.
root@discourse:/var/www/discourse# service postgresql start
[FAIL] Starting PostgreSQL 13 database server: main[....] Error: Config owner (postgres:105) and data owner (systemd-timesync:101) do not match, and config owner is not root ... failed!
 failed!
root@discourse:/var/www/discourse#

공유 폴더 내 파일의 소유자를 변경하면 설치에 문제가 발생합니다. 해결 방법으로는 재설치 후 백업 복원, 또는 해당 소유자를 수동으로 수정하는 두 가지가 있습니다.

@Falco: 감사합니다!

업그레이드가 실패한 후에 소유자를 변경했습니다. 어딘가의 게시물에서 chown 힌트를 찾았거든요.

현재 상태로 백업을 만드는 방법은 무엇인가요?

소유자를 수동으로 수정하는 방법은 무엇인가요?

다시 한번 감사합니다!

컨테이너 안에서 discourse backup를 시도해 보았습니다. Redis가 실행 중이 아니라는 메시지가 표시됩니다. “current” Redis 로그의 끝에 다음과 같은 줄을 발견했습니다…

10316:M 05 Jan 2023 08:05:27.314 # Server initialized
10316:M 05 Jan 2023 08:05:27.314 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
10316:M 05 Jan 2023 08:05:27.314 # Can't handle RDB format version 10
10316:M 05 Jan 2023 08:05:27.314 # Fatal error loading the DB: Invalid argument. Exiting.
10321:C 05 Jan 2023 08:05:28.345 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
10321:C 05 Jan 2023 08:05:28.345 # Redis version=6.2.3, bits=64, commit=00000000, modified=0, pid=10321, just started
10321:C 05 Jan 2023 08:05:28.345 # Configuration loaded
10321:M 05 Jan 2023 08:05:28.346 * monotonic clock: POSIX clock_gettime
10321:M 05 Jan 2023 08:05:28.347 * Running mode=standalone, port=6379.
10321:M 05 Jan 2023 08:05:28.347 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
10321:M 05 Jan 2023 08:05:28.347 # Server initialized
10321:M 05 Jan 2023 08:05:28.347 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
10321:M 05 Jan 2023 08:05:28.348 # Can't handle RDB format version 10
10321:M 05 Jan 2023 08:05:28.348 # Fatal error loading the DB: Invalid argument. Exiting.

컨테이너 내에서 이렇게 권한을 수정했습니다:

그 후 ./launcher restart app 명령으로 컨테이너를 재시작했습니다. 이제 Discourse에 접근할 수 있습니다. 하지만 어제 3.0.0.beta16으로 업그레이드하려고 했던 구버전 2.8.3이 실행 중입니다.

Discourse를 업그레이드하려면 어떻게 진행해야 할지 잘 모르겠습니다.

제 문제는 이 스레드와 관련이 있을 것 같습니다: Problem upgrading multi-site/multi-containers Discourse instance - #5 by jtraulle

이전에 업그레이드 문제를 겪은 적이 있지만, 그 원인을 조사해 본 적은 없습니다.

./launcher rebuild app

app.yml에서 커밋 ID를 "version"으로 설정하여 버전을 2.9.0.beta2 (커밋 ID: 88a8584348ed93a28286839bfc1c32b06bd50b3f)로 지정할 수 있었습니다. 이번에는 업그레이드가 성공적으로 완료되었고, 이후 3.0.0.beta16으로 업그레이드할 수 있었습니다.

모두 감사합니다.