# 업데이트 후 사이트가 열리지 않고 백업 데이터베이스도 로드되지 않았습니다

**URL:** https://meta.discourse.org/t/after-the-update-the-site-did-not-open-and-the-backup-database-was-not-loaded/295786
**Category:** Self-hosting
**Created:** [2월 18, 2024, 12:58오후 UTC](https://meta.discourse.org/t/after-the-update-the-site-did-not-open-and-the-backup-database-was-not-loaded/295786 "2024-02-18T12:58:13Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![kuaza](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kuaza/32/264151_2.png) [@kuaza](https://meta.discourse.org/u/kuaza)
#### Post date: [2월 18, 2024, 12:58오후 UTC](https://meta.discourse.org/t/after-the-update-the-site-did-not-open-and-the-backup-database-was-not-loaded/295786/1 "2024-02-18T12:58:13Z")

</div>

사이트를 업데이트한 후 nginx 오류가 발생하기 시작했습니다. 사이트에 접속할 수 없었습니다. 어떤 조치를 취해도 해결되지 않았습니다. 그래서 새 설치를 진행했고, 어제의 데이터를 추가하려고 시도했습니다. 하지만 이 역시 성공하지 못했습니다. 백업을 설치할 때 다음과 같은 오류가 발생합니다:

오류 전체:

```plaintext
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
ERROR: unrecognized parameter "dims"
EXCEPTION: psql failed: ERROR: unrecognized parameter "dims"
/var/www/discourse/lib/backup_restore/database_restorer.rb:92:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:51:in `run'
script/discourse:149:in `restore'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
script/discourse:290:in `<top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:451:in `exec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/exe/bundle:28:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/exe/bundle:20:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Trying to rollback...
Rolling back...
Cleaning stuff up...
Dropping functions from the discourse_functions schema...
Removing tmp '/var/www/discourse/tmp/restores/default/2024-02-18-120937' directory...
Unpausing sidekiq...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

```

pgembeddings 코드를 빌드하기 위해 app.yml 업데이트 시 사용된 설정:

````plaintext
hooks:
  after_code:
    - exec:
        cd: $home
        cmd:
          - sudo apt-get install wget ca-certificates
    - exec:
        cd: $home
        cmd:
          - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
    - exec:
        cd: $home
        cmd:
          - sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    - exec:
        cd: $home
        cmd:
          - apt-get update
    - exec:
        cd: $home
        cmd:
          - apt-get -y install -y postgresql-server-dev-${PG_MAJOR}
    - exec:
        cd: $home/tmp
        cmd:
          - git clone https://github.com/neondatabase/pg_embedding.git
    - exec:
        cd: $home/tmp/pg_embedding
        cmd:
          - make PG_CONFIG=/usr/lib/postgresql/13/bin/pg_config
    - exec:
        cd: $home/tmp/pg_embedding
        cmd:
          - make PG_CONFIG=/usr/lib/postgresql/13/bin/pg_config install
    - exec:
        cd: $home
        cmd:
          - su postgres -c 'psql discourse -c "create extension if not exists embedding;"'
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-question-answer.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-gamification.git
          - git clone https://github.com/discourse/discourse-restricted-replies.git
          - git clone https://github.com/discourse/discourse-saved-searches.git
          - git clone https://github.com/discourse/discourse-follow.git
          - git clone https://github.com/discourse/discourse-yearly-review.git
          - git clone https://github.com/discourse/discourse-voting.git
          - git clone https://github.com/discourse/discourse-no-bump.git
          - git clone https://github.com/discourse/discourse-math.git
          - git clone https://github.com/discourse/discourse-akismet.git
          - git clone https://github.com/discourse/discourse-adplugin.git
          - git clone https://github.com/spirobel/discourse-matheditor.git
          - git clone https://github.com/discourse/discourse-google-one-tap.git
          - git clone https://github.com/merefield/discourse-chatbot.git
          - git clone https://github.com/discourse/discourse-ai.git
# - git clone https://github.com/paviliondev/discourse-custom-wizard.git
          - git clone https://github.com/discourse/discourse-reactions.git
# - git clone https://github.com/discourse/discourse-subscriptions.git```
````

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2월 18, 2024, 6:46오후 UTC](https://meta.discourse.org/t/after-the-update-the-site-did-not-open-and-the-backup-database-was-not-loaded/295786/2 "2024-02-18T18:46:04Z")

</div>

@kuaza 님은 제 플러그인과 관련된 이력을 가지고 계시기 때문에, 이 문제를 함께 확인해 보았습니다.

위 오류의 원인이 되었던 문제적인 인덱스를 dump.sql에서 제거하고, 다시 복원했습니다.

해당 인덱스를 삭제하기 위한 업데이트된 스크립트가 있었지만, 플러그인 사용자의 일부는 해당 업데이트를 확인하지 못했을 수 있습니다.

현재 빌드는 완료되었지만, 브라우저에서 연결이 이루어지지 않습니다.

문제적인 인덱스를 제거한 상태로 컨테이너를 다시 구동했으며, pgembedding을 빌드하기 위한 app.yml 안의 기존 스크립트도 모두 제거했으므로, 플러그인은 유지된 채로 깨끗한 상태입니다.

컨테이너는 실행 중입니다 - 이제 바로 진입할 수 있습니다.

psql도 정상적으로 실행 중입니다 - 컨테이너 내에서 데이터베이스 프롬프트를 열 수 있습니다.

컨테이너 내에서 rails c를 문제없이 실행할 수 있습니다.

`/var/discourse/shared/standalone/log/rails# tail -n 200 production.log`

명령어는 명백한 오류 메시지를 표시하지 않습니다.

현재로서는 막막한 상태입니다.

확인해 볼 다른 방법이 있을까요?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2월 18, 2024, 7:16오후 UTC](https://meta.discourse.org/t/after-the-update-the-site-did-not-open-and-the-backup-database-was-not-loaded/295786/3 "2024-02-18T19:16:25Z")

</div>

한 가지 확인을 놓쳤습니다 …

컨테이너에 들어가서 이렇게 실행해야 합니다:

```plaintext
curl 0.0.0.0:3000

```

다음에 이걸 시도해 볼 거예요 …

---

<div class="post-metadata">

### Author: ![kuaza](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kuaza/32/264151_2.png) [@kuaza](https://meta.discourse.org/u/kuaza)
#### Post date: [2월 18, 2024, 8:10오후 UTC](https://meta.discourse.org/t/after-the-update-the-site-did-not-open-and-the-backup-database-was-not-loaded/295786/4 "2024-02-18T20:10:50Z")

</div>

이렇게 하면 설정 HTML 페이지의 코드가 표시됩니다. 이 문제는 DNS로 인해 발생하는 것 같습니다. 이런 엉망진창인 상황이 나를 미치게 만들고 있습니다.

---

<div class="post-metadata">

### Author: ![kuaza](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kuaza/32/264151_2.png) [@kuaza](https://meta.discourse.org/u/kuaza)
#### Post date: [2월 19, 2024, 5:08오후 UTC](https://meta.discourse.org/t/after-the-update-the-site-did-not-open-and-the-backup-database-was-not-loaded/295786/5 "2024-02-19T17:08:01Z")

</div>

이 코드를 실행했을 때 정상적으로 작동하는 것처럼 보였지만, 실제로는 웹서버가 작동하지 않아서 문제가 발생했으며, 이런 방식으로는 원인을 파악할 수 없습니다. 컨테이너에 진입하여 이 코드를 실행하면 nginx가 실행 중인지 확인할 수 있습니다:

```plaintext
nginx -t

```

하지만 이 주제에서 제기된 문제에 대해선, 상대방의 메시지 내용을 복사해서 답변하는 방식으로 해결하고 싶습니다. nginx 문제는 완전히 별개의 사안이며, 저는 새로운 설치 환경에서 별도의 도메인으로 테스트하고 있습니다. 만약 다시 오류가 발생한다면, 별도의 이슈를 열어 보고하겠습니다.

제목에 언급된 백업이 작동하지 않는 문제는 더 이상 사용되지 않는 테이블이나 레코드 때문에 발생합니다. 채팅봇 플러그인이 더 이상 사용하지 않는 레코드였을 것으로 생각되는데, 업데이트 과정에서 삭제되지 않은 것 같습니다. 플러그인 개발자분이 이 문제를 해결하셨을 것으로 생각되니 안심하셔도 될 것 같습니다 🙂 저는 오류가 발생한 줄을 삭제하고 다시 패키징한 후 관리자 패널에서 설치했는데, 아무 문제 없이 작동합니다. 또는 서버에서 직접 다운로드할 수도 있습니다:

**손상된 플러그인 파일 수정 방법 설명:**

- 백업 파일 압축 해제: `tar -xvzf foo.tar.gz`
- dump.sql 파일 압축 해제
- 원치 않는 인덱스를 생성하는 문제 있는 줄 제거:

```plaintext
–
– TOC entry 8020 (class 1259 OID 84313)
– Name: hnsw_index_on_chatbot_post_embeddings; Type: INDEX; Schema: public; Owner: -
–

CREATE INDEX hnsw_index_on_chatbot_post_embeddings ON public.chatbot_post_embeddings_old USING hnsw (embedding) WITH (dims='1536', m='64', efconstruction='64', efsearch='64');

```

- dump.sql 파일 다시 압축
- uploads 폴더와 동일한 디렉터리에 합치기
- 전체를 다시 tar.gz로 압축
- 이 파일을 수동으로 복원

* * *

다른 테이블에 대한 오류가 발생한다면, 위에서 설명한 방법을 사용하여 해당 레코드가 포함된 테이블을 삭제하면 해결될 것이라고 생각합니다.

많은 정성을 들여 구축하고 성장하기 시작한 제 사이트가 이틀 동안 다운되었습니다. 밤샘과 하루의 수고를 잊어서는 안 됩니다. 언제든 이런 일이 우리에게 일어날 수 있습니다. 백업을 만들고, 그 백업이 정상적으로 작동하는지 꼭 확인하세요. 이 과정 동안 도와주신 제 형 @merefield님께 감사의 인사를 전하고 싶습니다. 우리는 함께 새로운 것을 배웠습니다.

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [3월 7, 2024, 5:05오전 UTC](https://meta.discourse.org/t/after-the-update-the-site-did-not-open-and-the-backup-database-was-not-loaded/295786/6 "2024-03-07T05:05:03Z")

</div>

같은 오류가 발생했을 때 이 방법으로 해결되었습니다. 올려주셔서 감사합니다.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [4월 6, 2024, 5:05오전 UTC](https://meta.discourse.org/t/after-the-update-the-site-did-not-open-and-the-backup-database-was-not-loaded/295786/7 "2024-04-06T05:05:49Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
