# Beta 3.1.x에서 최신 버전으로 업그레이드 중 오류 발생

**URL:** https://meta.discourse.org/t/error-during-upgrading-from-beta-3-1-x-to-latest/252427
**Category:** Self-hosting
**Created:** [1월 20, 2023, 3:33오후 UTC](https://meta.discourse.org/t/error-during-upgrading-from-beta-3-1-x-to-latest/252427 "2023-01-20T15:33:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![uwe\_keim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/uwe_keim/32/326762_2.png) [@uwe\_keim](https://meta.discourse.org/u/uwe_keim)
#### Post date: [1월 20, 2023, 3:33오후 UTC](https://meta.discourse.org/t/error-during-upgrading-from-beta-3-1-x-to-latest/252427/1 "2023-01-20T15:33:25Z")

</div>

최근 업데이트를 대략 2~3일 간격으로 수행해 왔으며, 마지막 업데이트는 성공적으로 완료되었습니다.

오늘 `/admin/upgrade` URL을 통해 업데이트를 시도했으나 처음에는 실패했습니다.

이후 평소처럼 다음 명령을 실행했습니다:

```plaintext
cd /var/discourse
sudo git pull
sudo ./launcher rebuild app

```

이 역시 오류가 발생했습니다:

```plaintext
/var/www/discourse/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2023-01-20T15:27:00.834259 #1] INFO -- : == 20230118020114 AddPublicTopicCountToTags: migrating ========================
-- add_column(:tags, :public_topic_count, :integer, {:default=>0, :null=>false})
   -> 0.0138s
-- execute("UPDATE tags t\nSET public_topic_count = x.topic_count\nFROM (\n SELECT\n COUNT(topics.id) AS topic_count,\n tags.id AS tag_id\n FROM tags\n INNER JOIN topic_tags ON tags.id = topic_tags.tag_id\n INNER JOIN topics ON topics.id = topic_tags.topic_id AND topics.deleted_at IS NULL AND topics.archetype != 'private_message'\n INNER JOIN categories ON categories.id = topics.category_id AND NOT categories.read_restricted\n GROUP BY tags.id\n) x\nWHERE x.tag_id = t.id\nAND x.topic_count <> t.public_topic_count;\n")

I, [2023-01-20T15:27:00.834823 #1] INFO -- : Terminating async processes
I, [2023-01-20T15:27:00.834868 #1] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 42
I, [2023-01-20T15:27:00.835173 #1] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 103
2023-01-20 15:27:00.835 UTC [42] LOG: received fast shutdown request
103:signal-handler (1674228420) Received SIGTERM scheduling shutdown...
2023-01-20 15:27:00.849 UTC [42] LOG: aborting any active transactions
2023-01-20 15:27:00.851 UTC [42] LOG: background worker "logical replication launcher" (PID 51) exited with exit code 1
2023-01-20 15:27:00.855 UTC [46] LOG: shutting down
2023-01-20 15:27:00.901 UTC [42] LOG: database system is shut down
103:M 20 Jan 2023 15:27:00.905 # User requested shutdown...
103:M 20 Jan 2023 15:27:00.905 * Saving the final RDB snapshot before exiting.
103:M 20 Jan 2023 15:27:00.950 * DB saved on disk
103:M 20 Jan 2023 15:27:00.950 # Redis is now ready to exit, bye bye...

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 390 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.1.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
**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.
37cbe5dc5c82e0a41e9e1deea5b99f5e643bfe6bcd53d52c38e3e855a85ed81e

```

더 위로 스크롤하면 다음과 같은 항목을 볼 수 있습니다:

```plaintext
PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_tags_on_name"
DETAIL: Key (name)=(net) already exists.

```

어떻게 수정/해결해야 할지 정말로 막막합니다.

[저의 포럼](https://entwicklergate.de/)이 현재 오프라인 상태입니다. `sudo ./launcher rebuild app`을 다시 실행해 보았으나, 이 또한 실패했습니다.

해결 방법에 대한 조언을 주실 수 있을까요?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [1월 20, 2023, 4:11오후 UTC](https://meta.discourse.org/t/error-during-upgrading-from-beta-3-1-x-to-latest/252427/2 "2023-01-20T16:11:00Z")

</div>

오래된 이미지를 재부팅하려면 `./launcher start app`을 실행해 주세요. 이렇게 하면 포럼이 다시 온라인으로 복구될 수 있습니다.

---

<div class="post-metadata">

### Author: ![uwe\_keim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/uwe_keim/32/326762_2.png) [@uwe\_keim](https://meta.discourse.org/u/uwe_keim)
#### Post date: [1월 20, 2023, 4:15오후 UTC](https://meta.discourse.org/t/error-during-upgrading-from-beta-3-1-x-to-latest/252427/3 "2023-01-20T16:15:13Z")

</div>

감사합니다.

컨테이너가 다시 실행되고 있지만, 여전히 오류가 지속됩니다.

아마도 다음과 같은 동일한 문제를 겪고 있는 것 같습니다:

> [@컨테이너가 시작되지 않으면 SQL 쿼리를 어떻게 실행합니까? (리빌드 실패)](https://meta.discourse.org/t/how-does-one-run-sql-queries-if-the-container-doesnt-start-rebuild-failed/252126?u=uwe_keim):
>
> Hello. I tried to run updates & rebuild, but I ended up with this beautiful error: I, [2023-01-18T08:05:48.701709 #1] INFO -- : \> cd /var/www/discourse && su discourse -c 'LOAD\_PLUGINS=0 bundle exec rake plugin:pull\_compatible\_all' I, [2023-01-18T08:05:52.431210 #1] INFO -- : I, [2023-01-18T08:05:52.431807 #1] INFO -- : \> cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' 2023-01-18 08:05:59.081 UTC [1166] discourse@discourse ERROR: could not create unique index "index\_…

거기서 설명된 방식대로 해결을 시도하지는 않을 것입니다.

### 업데이트 1 - 해결 방법

다음 단계를 통해 해결할 수 있었던 것 같습니다:

1. `app.yaml` 파일을 편집하여 다음을 수행했습니다:
  - [Data Explorer 플러그인](https://meta.discourse.org/t/discourse-data-explorer/32566)을 [설치](https://meta.discourse.org/t/install-plugins-in-discourse/19157/1)했습니다.
  - [버전을 이전 버전으로 고정](https://meta.discourse.org/t/how-does-one-run-sql-queries-if-the-container-doesnt-start-rebuild-failed/252126/2?u=uwe_keim)했습니다.

2. 이미지를 다시 빌드했습니다.
3. [Data Explorer](https://meta.discourse.org/t/32566?silent=true) 플러그인을 활성화하고 시작하여, [이 쿼리](https://meta.discourse.org/t/how-does-one-run-sql-queries-if-the-container-doesnt-start-rebuild-failed/252126/3?u=uwe_keim)를 사용하여 중복된 태그를 식별했습니다.
4. 일반 관리자 GUI를 사용하여 태그를 식별했습니다. 그런 다음 한 태그를 다시 고유하도록 이름 변경했습니다.
5. 고정된 버전을 다시 제거했습니다.
6. Discourse를 다시 빌드했습니다 `sudo ./launcher rebuild app`. 이제 성공적으로 실행되었습니다.
7. Discourse를 시작한 후, 태그 관리 영역으로 이동하여 중복된 태그를 추가로 작업했습니다(다른 태그를 할당한 후, 기존 중복 태그 중 하나를 삭제했습니다).

---

<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: [2월 19, 2023, 4:16오후 UTC](https://meta.discourse.org/t/error-during-upgrading-from-beta-3-1-x-to-latest/252427/4 "2023-02-19T16:16:12Z")

</div>

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