gitlab을 최신 버전으로 업그레이드 하려는데 db migration에서 아래와 유사한 에러가 발생했다. gitlab-ctl 명령으로 restart를 할 때 postgresql-exporter가 정상적으로 실행이 안 되고 reconfigure할 때 아래 메시지들이 출력되었다.
bash[migrate gitlab-rails database] action run [execute] rake aborted! PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"? /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:55:in `block (3 levels) in (required)>' /opt/gitlab/embedded/bin/bundle:23:in `load' /opt/gitlab/embedded/bin/bundle:23:in `' Tasks: TOP => gitlab:db:configure (See full trace by running task with --trace) E: Sub-process /usr/bin/dpkg returned an error code (1)
먼저 gitlab-ctl stop 으로 모든 서비스를 종료하고 gitlab-ctl pg-upgrade가 제대로 동작하는지 확인한다. 그런 후 다시 gitlab-ctl restart를 하여 모든 gitlab 관련 서비스들이 제대로 동작하는 확인한다. gitlab-ctl reconfigure는 gitlab 서비스들이 정상 실행되고 나서 동작시켜야 db migration 작업이 제대로 수행된다.