Postgres 업그레이드 문제

PG13 업그레이드를 거부한 사용자의 SSL 인증서가 만료되어 도움을 주려 합니다.

Apt-get update fails inside container yarn repo not signed - #5 by pfaffman 에서 언급된 문제로 인해 상황이 더 복잡할 수 있지만, pg12와 pg13 템플릿을 수정하여 작동하도록 만들었습니다. 그러나 업그레이드를 진행할 수도 없고, pg12 템플릿으로 재빌드도 할 수 없습니다.

업그레이드를 시도했을 때 다음과 같은 상황이 발생합니다:

                                     
fixing permissions on existing directory /var/lib/postgresql/12/main ... ok          
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100                                                                                                              
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC                              
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
                                     
Success. You can now start the database server using:
                                                                                                                                                       
    pg_ctlcluster 12 main start                                                                                                                        
                                                                           
update-alternatives: warning: forcing reinstallation of alternative /usr/share/postgresql/13/man/man1/postmaster.1.gz because link group postmaster.1.g
z is broken                                                                                                                                            
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.             
Processing triggers for postgresql-common (246.pgdg110+1) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:                                                                                                                    
Stopping PostgreSQL 12 database server: main.                                                                                                          
Stopping PostgreSQL 13 database server: main.                                                                                                          
Performing Consistency Checks               -----------------------------                                                                                                                          
Checking cluster versions                                   ok                                                                                         
Checking database user is the install user                  ok                                                                                         
Checking database connection settings                       ok                                                                                         
Checking for prepared transactions                          ok                                                                                         
Checking for system-defined composite types in user tables  ok                                                                                         
Checking for reg* data types in user tables                 ok                                                                                         
Checking for contrib/isn with bigint-passing mismatch       ok                                                                                         
Creating dump of global objects                             ok                                                                                         
Creating dump of database schemas                                                                                                                      
  discourse                                                                                                                                            
                                                                                                                                                       
*failure*                                                                                                                                              

Consult the last few lines of "pg_upgrade_dump_16566.log" for
the probable cause of the failure.
Failure, exiting
-------------------------------------------------------------------------------------
UPGRADE OF POSTGRES FAILED

Please visit https://meta.discourse.org/t/postgresql-13-update/172563 for support.

You can run ./launcher start app to restart your app in the meanwhile

업그레이드 없이 재빌드를 시도하면 데이터베이스 마이그레이션 과정에서 다음과 같은 오류가 발생합니다:

PG::InsufficientPrivilege: ERROR:  permission denied to create extension "unaccent"                                                                    

결국 깨끗한 설치와 몇 일 전의 최신 백업으로 되돌려야 할 것 같습니다.

아래 내용을 hooks에 추가하여 unaccent 확장이 없으면 생성하도록 할 수 없나요?

after_postgres:
    - exec: su postgres -c 'psql discourse -c "create extension if not exists unaccent;"'

좋은 계획이네요! 내일 아침에 확인해볼게요. 감사합니다.

그렇게 하니까 해결됐네요! pg12와 postgres에 추가해야 했어요.

PG12에서 다시 실행되게 하기는 충분했지만, PG13 업그레이드는 끝내 작동하지 않았어요. 백업을 만들고, postgres 관련 파일을 백업 디렉터리로 이동한 뒤, 다시 빌드하고 백업을 복원했어요.