Postgres 12 のアップグレード失敗により再構築できません

こんにちは、

以下の点でつまずいています。コマンド ./discourse-setup を実行すると、次のエラーが表示されます。

メッセージの意味がわかりません。私のウェブサイトは https://cp2077.eu/ で SSL 付きで稼働しています。

以下が私の app.yml です。

## これはオールインワンのスタンドアロン Discourse Docker コンテナテンプレートです
##
## このファイルを編集した後、必ず再構築してください
## /var/discourse/launcher rebuild app
##
## 編集時には非常に注意してください!
## YAML ファイルは空白やアライメントの誤りに非常に敏感です!
## 必要に応じて http://www.yamllint.com/ でこのファイルを検証してください

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/sshd.template.yml"
  - "templates/web.ratelimited.template.yml"
## Lets Encrypt (https) を追加したい場合は、以下の 2 行のコメントを外してください
##  - "templates/web.ssl.template.yml"
##  - "templates/web.letsencrypt.ssl.template.yml"
  - "templates/web.socketed.template.yml"
## このコンテナが公開する TCP/IP ポートはどれですか?
## Discourse を Apache や nginx などの他のウェブサーバーとポートを共有したい場合は、
## https://meta.discourse.org/t/17247 を参照してください
#expose:
# - "2045:80"   # http
# - "1443:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

  ## db_shared_buffers を総メモリの最大 25% に設定します。
  ## 検出された RAM に基づいてブートストラップが自動的に設定するか、上書きすることも可能です
  db_shared_buffers: "1024MB"

  ## ソートパフォーマンスを向上させることができますが、接続ごとにメモリ使用量が増加します
  #db_work_mem: "40MB"

  ## このコンテナで使用する Git リビジョンはどれですか?(デフォルト: tests-passed)
  #version: tests-passed

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

  ## 同時にサポートされるウェブリクエストの数ですか?メモリと CPU コア数に依存します。
  ## 検出された CPU に基づいてブートストラップが自動的に設定するか、上書きすることも可能です
  UNICORN_WORKERS: 4

  ## TODO: この Discourse インスタンスが応答するドメイン名
  ## 必須です。Discourse は IP アドレスのみでは動作しません。
  DISCOURSE_HOSTNAME: cp2077.eu

  ## コンテナを上記で指定したホスト名(-h オプション)と同じホスト名で起動したい場合は、
  ## 以下のコメントを外してください(デフォルト: "$hostname-$config")
  #DOCKER_USE_HOSTNAME: true

  ## TODO: 初期サインアップ時に管理者および開発者として登録されるメールアドレスのカンマ区切りリスト
  ## 例: 'user1@example.com,user2@example.com'
  DISCOURSE_DEVELOPER_EMAILS: 'myemail@yandex.com'

  ## TODO: 新しいアカウントの検証や通知の送信に使用する SMTP メールサーバー
  # SMTP アドレス、ユーザー名、パスワードは必須です
  # 警告: SMTP パスワードに含まれる文字 '#' は問題を引き起こす可能性があります!
  DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: ******
  DISCOURSE_SMTP_PASSWORD: ******
  DISCOURSE_SMTP_ENABLE_START_TLS: true           # (オプション、デフォルトは true)

  ## Lets Encrypt テンプレートを追加した場合、以下のコメントを外して無料の SSL 証明書を取得してください
  LETSENCRYPT_ACCOUNT_EMAIL: myemail@yandex.com

  ## この Discourse インスタンスの http または https CDN アドレス(プル用に設定)
  ## 詳細は https://meta.discourse.org/t/14857 を参照してください
  #DISCOURSE_CDN_URL: https://discourse-cdn.example.com

## Docker コンテナはステートレスです。すべてのデータは /shared に保存されます
volumes:
  - volume:
 host: /var/discourse/shared/standalone
  guest: /shared
  - volume:
  host: /var/discourse/shared/standalone/log/var-log
  guest: /var/log

## プラグインはここに追加します
## 詳細は https://meta.discourse.org/t/19157 を参照してください
hooks:
  after_code:
- exec:
    cd: $home/plugins
    cmd:
      - git clone https://github.com/discourse/docker_manager.git

## ビルド後に実行する任意のカスタムコマンド
run:
  - exec: echo "カスタムコマンドの開始"
  ## 最初の登録時の 'From' メールアドレスを設定したい場合は、以下のコメントを外して変更してください
  ## 最初のサインアップメールを受け取った後、再度コメントアウトしてください。一度だけ実行すれば十分です
  ## - exec: rails r "SiteSetting.notification_email='beatlicious@yandex.com'"
  - exec: echo "カスタムコマンドの終了"

コマンド ./launcher rebuild app を実行すると、次のエラーが表示されます。

fatal: not a git repository (or any of the parent directories): .git
古いコンテナを停止中
+ /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 -- : 
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.568449 #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.582907 #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.619807 #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 ** 上記にスクロールして、より早いエラーメッセージを確認してください。複数のエラーが存在する可能性があります。
./discourse-doctor で問題を診断できるかもしれません。
atlas@sknet:~/www/cp2077$

Discourse のインストールとセットアップ方法をアドバイスしていただけませんか?ガイドに従って進めましたが、ここでつまずいています。よろしくお願いいたします。

「いいね!」 1

You followed Discourse official Standard Installation?

I don’t see how that site could be from the app.yml you include.

I’d create a new droplet and follow the directions again.

「いいね!」 1

I followed the guide yes, as you noticed I said after executing the command I am getting errors. What do you mean you don’t see how the site could be from the app.yml? its the same host domain name. Can you elaborate on that?

This means You have DNS issues. Your domain is pointing to some other IP.

Could you confirm this is the correct IP?

「いいね!」 2

That’s the IP of my website yeah. I checked my DNS, everything is set correctly otherwise you wouldn’t see that the website is live.

If you ping my website, you will see the same IP address.

「いいね!」 1

There might be some issue with your nginx (or other) conf ? :roll_eyes:

did it work before? with the port exposed?

「いいね!」 3

Below my 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; # up from 3m default

    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;

    }


}

To be honest I have no clue what else is wrong. The website is up and running and is connected to port 443.

Does not matter what I change, as soon as I run the commend ./launcher rebuild app, it throws an error as well

$  ./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.

You have a formatting error on your yml file.

「いいね!」 2

I already pasted here the yml file, I don’t see any formating error there, do you?

Yes, the indentation is bad there.

「いいね!」 5

The app.yml file comes from templates and what never touched the lines that you are suggesting me so I don’t understand how it could be bad if that is what has been provisioned from you guys.

Ok, regardless, you have next steps on what to do, so I suggest you follow them :wink:

「いいね!」 3

I think the error Discourse setup is giving is legit because of the reverse proxy.

I see that you’ve already got changes done to the app.yml so why not just ./launcher rebuild app ?

I’ve pasted it here many times but I will do it again. Here is what I get when running that command:

$ ./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.

Why are you proxying your discourse site instead of using a subdomain?

Im not sure I understand. I want my discourse forum to be on my main domain not as a subdomain.

If this is your first install you should really get it up and running as per the official guide before changing the configuration. It’s well documented elsewhere here on meta that subfolder has no benefits, it’s considered an advanced topic which can break at any time with updates.

「いいね!」 1

No this is not my first install. This is actually my second install on another domain. Sometimes few months back I installed discourse on another domain using the same guide. I am repeating it again today and stuck with those problems above. There is nothing special that I did, I was following the guide as it was before.