PostgreSQL 12 업그레이드 실패로 재빌드 불가

안녕하세요,

아래 문제에서 막혀 있습니다. ./discourse-setup 명령을 실행하면 다음과 같은 오류가 발생합니다.

메시지를 정확히 이해하지 못하겠습니다. 제 웹사이트는 SSL이 활성화된 상태로 정상적으로 실행 중입니다: https://cp2077.eu/

제 app.yml 파일은 다음과 같습니다.

## this is the all-in-one, standalone Discourse Docker container template
##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/sshd.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
##  - "templates/web.ssl.template.yml"
##  - "templates/web.letsencrypt.ssl.template.yml"
  - "templates/web.socketed.template.yml"
## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
#expose:
# - "2045:80"   # http
# - "1443:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

  ## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  db_shared_buffers: "1024MB"

  ## can improve sorting performance, but adds memory usage per-connection
  #db_work_mem: "40MB"

  ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed

env:
  LANG: en_US.UTF-8
  # DISCOURSE_DEFAULT_LOCALE: en

  ## How many concurrent web requests are supported? Depends on memory and CPU cores.
  ## will be set automatically by bootstrap based on detected CPUs, or you can override
  UNICORN_WORKERS: 4

  ## TODO: The domain name this Discourse instance will respond to
  ## Required. Discourse will not work with a bare IP number.
  DISCOURSE_HOSTNAME: cp2077.eu

  ## Uncomment if you want the container to be started with the same
  ## hostname (-h option) as specified above (default "$hostname-$config")
  #DOCKER_USE_HOSTNAME: true

  ## TODO: List of comma delimited emails that will be made admin and developer
  ## on initial signup example 'user1@example.com,user2@example.com'
  DISCOURSE_DEVELOPER_EMAILS: 'myemail@yandex.com'

  ## TODO: The SMTP mail server used to validate new accounts and send notifications
  # SMTP ADDRESS, username, and password are required
  # WARNING the char '#' in SMTP password can cause problems!
  DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: ******
  DISCOURSE_SMTP_PASSWORD: ******
  DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
  LETSENCRYPT_ACCOUNT_EMAIL: myemail@yandex.com

  ## The http or https CDN address for this Discourse instance (configured to pull)
  ## see https://meta.discourse.org/t/14857 for details
  #DISCOURSE_CDN_URL: https://discourse-cdn.example.com

## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
 host: /var/discourse/shared/standalone
  guest: /shared
  - volume:
  host: /var/discourse/shared/standalone/log/var-log
  guest: /var/log

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
- exec:
    cd: $home/plugins
    cmd:
      - git clone https://github.com/discourse/docker_manager.git

## Any custom commands to run after building
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  ## - exec: rails r "SiteSetting.notification_email='beatlicious@yandex.com'"
  - exec: echo "End of custom commands"

./launcher rebuild app 명령을 실행하면 다음과 같은 오류가 발생합니다:

fatal: not a git repository (or any of the parent directories): .git
Stopping old container
+ /usr/bin/docker stop -t 60 app
app
cd /pups && git pull && /pups/bin/pups --stdin
Already up to date.
I, [2020-07-11T01:41:07.468750 #1]  INFO -- : Loading --stdin
I, [2020-07-11T01:41:07.482322 #1]  INFO -- : > locale-gen $LANG && update-locale
I, [2020-07-11T01:41:07.556578 #1]  INFO -- : Generating locales (this might take a while)...
Generation complete.

I, [2020-07-11T01:41:07.557419 #1]  INFO -- : > mkdir -p /shared/postgres_run
I, [2020-07-11T01:41:07.562170 #1]  INFO -- :
I, [2020-07-11T01:41:07.562833 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2020-07-11T01:41:07.568411 #1]  INFO -- :
I, [2020-07-11T01:41:07.569223 #1]  INFO -- : > chmod 775 /shared/postgres_run
I, [2020-07-11T01:41:07.576449 #1]  INFO -- :
I, [2020-07-11T01:41:07.577398 #1]  INFO -- : > rm -fr /var/run/postgresql
I, [2020-07-11T01:41:07.582904 #1]  INFO -- :
I, [2020-07-11T01:41:07.583623 #1]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2020-07-11T01:41:07.592257 #1]  INFO -- :
I, [2020-07-11T01:41:07.593134 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2020/07/11 01:41:07 socat[27] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2020-07-11T01:41:07.602436 #1]  INFO -- :
I, [2020-07-11T01:41:07.602977 #1]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2020-07-11T01:41:07.608907 #1]  INFO -- :
I, [2020-07-11T01:41:07.609638 #1]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2020-07-11T01:41:07.619803 #1]  INFO -- :
I, [2020-07-11T01:41:07.622598 #1]  INFO -- : > mkdir -p /shared/postgres_run/10-main.pg_stat_tmp
I, [2020-07-11T01:41:07.629638 #1]  INFO -- :
I, [2020-07-11T01:41:07.630522 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run/10-main.pg_stat_tmp
I, [2020-07-11T01:41:07.639523 #1]  INFO -- :
I, [2020-07-11T01:41:07.651076 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown:
I, [2020-07-11T01:41:07.660620 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown:
I, [2020-07-11T01:41:07.668238 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown:
I, [2020-07-11T01:41:07.679949 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown:
I, [2020-07-11T01:41:07.680746 #1]  INFO -- : > chown -R root /var/lib/postgresql/10/main
chown: cannot access '/var/lib/postgresql/10/main': No such file or directory
I, [2020-07-11T01:41:07.685326 #1]  INFO -- :


FAILED
--------------------
Pups::ExecError: chown -R root /var/lib/postgresql/10/main failed with return #<Process::Status: pid 42 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cmd"=>["chown -R root /var/lib/postgresql/10/main", "[ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/10/bin/initdb -D /shared/postgres_data || exit 0", "chown -R postgres:postgres /shared/postgres_data", "chown -R postgres:postgres /var/run/postgresql"]}
d639e83f5451b5039efb2333f3eca1166d34ff6dc582ee29a0734a4274080fa2
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
atlas@sknet:~/www/cp2077$

Discourse를 설치하고 설정하는 방법에 대해 조언해 주실 수 있을까요? 가이드를 따랐지만 여기에서 막혀 있습니다. 감사합니다.

Discourse 공식 표준 설치를 따랐나요?

포함된 app.yml에서 해당 사이트가 어떻게 생성되었는지 이해하기 어렵습니다.

새로운 드롭렛을 생성하고 지침을 다시 따르는 것을 권장합니다.

네, 가이드를 따랐습니다. 말씀하신 것처럼 명령을 실행한 후 오류가 발생하고 있습니다. app.yml에서 사이트가 어떻게 유입되는지 어떻게 이해하지 못한다는 말씀이신가요? 동일한 호스트 도메인 이름인데요. 이 부분을 좀 더 자세히 설명해 주실 수 있나요?

즉, DNS 문제가 있다는 뜻입니다. 도메인이 다른 IP를 가리키고 있습니다.

이것이 올바른 IP인지 확인해 주시겠습니까?

네, 제 웹사이트 IP 주소 맞습니다. DNS를 확인해 봤는데, 모든 설정이 올바르게 되어 있습니다. 그렇지 않았다면 웹사이트가 라이브 상태라는 것을 볼 수 없었을 테니까요.

제 웹사이트를 ping하면 동일한 IP 주소를 확인하실 수 있습니다.

nginx(또는 다른) 설정 파일에 문제가 있는 것 같네요? :roll_eyes:

이전에 포트가 노출된 상태에서 잘 작동했나요?

제 nginx 설정은 다음과 같습니다.

server {

    listen 80;
    listen [::]:80;
    server_name www.cp2077.eu;
    return 301 https://cp2077.eu$request_uri;
}

server {

    listen 443 ssl;
    listen [::]:443 ssl;
    server_name www.cp2077.eu;
    ssl_certificate /etc/letsencrypt/live/cp2077.eu/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/cp2077.eu/privkey.pem;
    return 301 https://cp2077.eu$request_uri;
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name cp2077.eu;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/cp2077.eu/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/cp2077.eu/privkey.pem;

    include /etc/nginx/snippets/ssl.conf;

    http2_idle_timeout 5m; # 기본값 3m에서 5m로 상향 조정

    location / {
        proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Real-IP $remote_addr;

    }


}

솔직히 다른 문제가 무엇인지 전혀 모르겠습니다. 웹사이트는 정상적으로 구동 중이며 443 포트에 연결되어 있습니다.

무엇을 변경하든, ./launcher rebuild app 명령을 실행하는 순간 오류가 발생합니다.

$  ./launcher rebuild app
fatal: not a git repository (or any of the parent directories): .git
Stopping old container
+ /usr/bin/docker stop -t 60 app
app
(<unknown>): did not find expected key while parsing a block mapping at line 10 column 1 -e LANG=en_US.UTF-8
YAML syntax error. Please check your containers/*.yml config files.
$ ./launcher rebuild app
fatal: not a git repository (or any of the parent directories): .git
Stopping old container
+ /usr/bin/docker stop -t 60 app
app
cd /pups && git pull && /pups/bin/pups --stdin
Already up to date.
I, [2020-07-11T17:12:58.113241 #1]  INFO -- : Loading --stdin
I, [2020-07-11T17:12:58.134955 #1]  INFO -- : > locale-gen $LANG && update-locale
I, [2020-07-11T17:12:58.173307 #1]  INFO -- : Generating locales (this might take a while)...
Generation complete.

I, [2020-07-11T17:12:58.174132 #1]  INFO -- : > mkdir -p /shared/postgres_run
I, [2020-07-11T17:12:58.178306 #1]  INFO -- :
I, [2020-07-11T17:12:58.178561 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2020-07-11T17:12:58.181917 #1]  INFO -- :
I, [2020-07-11T17:12:58.182391 #1]  INFO -- : > chmod 775 /shared/postgres_run
I, [2020-07-11T17:12:58.185755 #1]  INFO -- :
I, [2020-07-11T17:12:58.186224 #1]  INFO -- : > rm -fr /var/run/postgresql
I, [2020-07-11T17:12:58.189632 #1]  INFO -- :
I, [2020-07-11T17:12:58.190021 #1]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2020-07-11T17:12:58.192947 #1]  INFO -- :
I, [2020-07-11T17:12:58.193285 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2020/07/11 17:12:58 socat[27] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2020-07-11T17:12:58.199237 #1]  INFO -- :
I, [2020-07-11T17:12:58.199649 #1]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2020-07-11T17:12:58.203817 #1]  INFO -- :
I, [2020-07-11T17:12:58.204106 #1]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2020-07-11T17:12:58.208244 #1]  INFO -- :
I, [2020-07-11T17:12:58.208674 #1]  INFO -- : > mkdir -p /shared/postgres_run/10-main.pg_stat_tmp
I, [2020-07-11T17:12:58.213559 #1]  INFO -- :
I, [2020-07-11T17:12:58.215200 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run/10-main.pg_stat_tmp
I, [2020-07-11T17:12:58.220491 #1]  INFO -- :
I, [2020-07-11T17:12:58.228222 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown:
I, [2020-07-11T17:12:58.234341 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown:
I, [2020-07-11T17:12:58.240097 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown:
I, [2020-07-11T17:12:58.245972 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown:
I, [2020-07-11T17:12:58.246504 #1]  INFO -- : > chown -R root /var/lib/postgresql/10/main
chown: cannot access '/var/lib/postgresql/10/main': No such file or directory
I, [2020-07-11T17:12:58.249988 #1]  INFO -- :


FAILED
--------------------
Pups::ExecError: chown -R root /var/lib/postgresql/10/main failed with return #<Process::Status: pid 42 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cmd"=>["chown -R root /var/lib/postgresql/10/main", "[ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/10/bin/initdb -D /shared/postgres_data || exit 0", "chown -R postgres:postgres /shared/postgres_data", "chown -R postgres:postgres /var/run/postgresql"]}
cf48a849a885246d6bf9b1b444e679ff6c71dd2fa3b298d42fa2cc67694fc9b5
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

yml 파일에 형식 오류가 있습니다.

이미 여기 yml 파일을 붙여넣었는데, 포맷 오류가 보이지 않아요. 혹시 보입니까?

네, 거기의 들여쓰기가 잘못되었습니다.

app.yml 파일은 템플릿에서 가져온 것이며, 귀하가 지적하신 줄들은 제가 절대 건드리지 않았기 때문에, 귀하 팀에서 프로비저닝된 내용이라면 왜 잘못되었다고 할 수 있는지 이해가 되지 않습니다.

음, 어쨌든 다음 단계에 대해 안내를 받으셨으니, 그대로 따르시는 걸 추천해요 :wink:

역시 리버스 프록시 때문에 Discourse 설정이 보고 있는 오류는 정당한 것 같습니다.

app.yml에 이미 변경 사항이 적용된 것을 확인했으니, 그냥 ./launcher rebuild app을 실행해 보시는 건 어떨까요?

여러 번 여기에 붙여넣었지만, 다시 한 번 붙여넣겠습니다. 해당 명령어를 실행할 때 다음과 같은 결과를 얻습니다:

$ ./launcher rebuild app
fatal: not a git repository (or any of the parent directories): .git
Stopping old container
+ /usr/bin/docker stop -t 60 app
app
cd /pups && git pull && /pups/bin/pups --stdin
Already up to date.
I, [2020-07-11T17:12:58.113241 #1]  INFO -- : Loading --stdin
I, [2020-07-11T17:12:58.134955 #1]  INFO -- : > locale-gen $LANG && update-locale
I, [2020-07-11T17:12:58.173307 #1]  INFO -- : Generating locales (this might take a while)...
Generation complete.

I, [2020-07-11T17:12:58.174132 #1]  INFO -- : > mkdir -p /shared/postgres_run
I, [2020-07-11T17:12:58.178306 #1]  INFO -- :
I, [2020-07-11T17:12:58.178561 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2020-07-11T17:12:58.181917 #1]  INFO -- :
I, [2020-07-11T17:12:58.182391 #1]  INFO -- : > chmod 775 /shared/postgres_run
I, [2020-07-11T17:12:58.185755 #1]  INFO -- :
I, [2020-07-11T17:12:58.186224 #1]  INFO -- : > rm -fr /var/run/postgresql
I, [2020-07-11T17:12:58.189632 #1]  INFO -- :
I, [2020-07-11T17:12:58.190021 #1]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2020-07-11T17:12:58.192947 #1]  INFO -- :
I, [2020-07-11T17:12:58.193285 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2020/07/11 17:12:58 socat[27] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2020-07-11T17:12:58.199237 #1]  INFO -- :
I, [2020-07-11T17:12:58.199649 #1]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2020-07-11T17:12:58.203817 #1]  INFO -- :
I, [2020-07-11T17:12:58.204106 #1]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2020-07-11T17:12:58.208244 #1]  INFO -- :
I, [2020-07-11T17:12:58.208674 #1]  INFO -- : > mkdir -p /shared/postgres_run/10-main.pg_stat_tmp
I, [2020-07-11T17:12:58.213559 #1]  INFO -- :
I, [2020-07-11T17:12:58.215200 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run/10-main.pg_stat_tmp
I, [2020-07-11T17:12:58.220491 #1]  INFO -- :
I, [2020-07-11T17:12:58.228222 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown:
I, [2020-07-11T17:12:58.234341 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown:
I, [2020-07-11T17:12:58.240097 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown:
I, [2020-07-11T17:12:58.245972 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown:
I, [2020-07-11T17:12:58.246504 #1]  INFO -- : > chown -R root /var/lib/postgresql/10/main
chown: cannot access '/var/lib/postgresql/10/main': No such file or directory
I, [2020-07-11T17:12:58.249988 #1]  INFO -- :


FAILED
--------------------
Pups::ExecError: chown -R root /var/lib/postgresql/10/main failed with return #<Process::Status: pid 42 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cmd"=>["chown -R root /var/lib/postgresql/10/main", "[ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/10/bin/initdb -D /shared/postgres_data || exit 0", "chown -R postgres:postgres /shared/postgres_data", "chown -R postgres:postgres /var/run/postgresql"]}
cf48a849a885246d6bf9b1b444e679ff6c71dd2fa3b298d42fa2cc67694fc9b5
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

서브도메인을 사용하는 대신 왜 디스커스 사이트를 프록시 처리하나요?

잘 이해가 안 됩니다. 제 디스커스 포럼을 서브도메인이 아니라 메인 도메인으로 설정하고 싶습니다.

이것이 첫 설치라면, 설정을 변경하기 전에 공식 가이드에 따라 먼저 정상적으로 설치하고 실행해 보시는 것이 좋습니다. 메타 사이트의 다른 곳에서도 잘 문서화되어 있듯이, 서브폴더에는 아무런 이점이 없으며, 업데이트 시 언제든 문제가 발생할 수 있는 고급 주제로 간주됩니다.

아니요, 이건 제 첫 설치 değildir. 실제로 다른 도메인에서 두 번째 설치입니다. 몇 개월 전에 같은 가이드를 사용하여 다른 도메인에 Discourse를 설치한 적이 있습니다. 오늘 다시 같은 과정을 반복하고 있지만, 위에서 언급한 문제들에 막혀 있습니다. 특별히 다른 것을 한 것은 없으며, 이전과 똑같이 가이드를 따르고 있습니다.