컨테이너에서 apt-get update 실패: yarn 저장소 서명 안 됨

이미지를 빌드하는 GitHub Action이 있는데, apt-get update를 실행할 때 실패합니다. 그 원인을 아직 조사 중이지만, 2시간 전에 설치한 환경에서 컨테이너 내부에서 apt-get update를 실행하면 다음과 같은 오류가 발생합니다.

root@monstera-web-only:/# apt-get update
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]                                                                                           
Get:3 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]                  
Get:4 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]         
Get:5 http://deb.debian.org/debian bullseye-backports InRelease [49.0 kB]  
Get:6 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease [91.7 kB]
Get:7 http://deb.debian.org/debian bullseye/main amd64 Packages [8,183 kB]     
Err:2 https://dl.yarnpkg.com/debian stable InRelease                                   
  The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx>
Get:8 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [216 kB]             
Get:9 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [14.6 kB]                           
Get:10 http://deb.debian.org/debian bullseye-backports/main amd64 Packages [384 kB]
Get:11 https://deb.nodesource.com/node_18.x bullseye InRelease [4,586 B]   
Get:12 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 Packages [268 kB]
Get:13 https://deb.nodesource.com/node_18.x bullseye/main amd64 Packages [774 B]
Reading package lists... Done                            
W: GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx>
E: The repository 'https://dl.yarnpkg.com/debian stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
1개의 좋아요

일일 이미지 빌드 CI에서 오류가 보이지 않습니다. 컨테이너 내부에서 cat /VERSION 명령의 출력을 공유해 주시겠어요?

이건 표준 설치라고 맹세하는데…

# cat /VERSION 
2.0.20230116

내 CI를 다시 보고 있는데, 뭔가 어리석은 설정이 있는지 확인 중입니다 (전혀 불가능하지 않으니까요). apt-get update를 실행하는 것이 정확히 무엇인지 명확하지 않습니다.

수정: 제 CI에는 vim을 설치하는 템플릿이 있습니다. 거기서 apt-get update가 실행됩니다. 정상적인 설치 과정에서 apt-get update를 실행하는 부분은 제가 볼 때 어디에도 없으므로, 이것이 왜 여러분의 CI가 실패하지 않는지 설명해 줍니다.

많은 import 템플릿과 postgres 업그레이드 템플릿(아래에 나열됨)이 apt-get update를 실행하므로, 이는 언젠가 문제가 될 것입니다.

root@monstera:/var/discourse# grep -lr 'apt-get update'
templates/postgres.9.5.template.yml
templates/postgres.13.template.yml
templates/postgres.template.yml
templates/import/mbox.template.yml
templates/import/mysql-dep.template.yml
templates/import/vanilla.template.yml
templates/import/chrome-dep.template.yml
templates/import/phpbb3.template.yml
templates/postgres.10.template.yml
templates/postgres.12.template.yml
image/base/slim.Dockerfile
1개의 좋아요

네, 저의 다음 질문도 바로 그것이었을 겁니다. 이러한 업데이트를 실행하는 것은 기본 동작이 아니며, 대부분의 사이트는 정적 OS를 사용하고 OS 수준의 업데이트는 새로운 이미지를 의존하기 때문에 추적하기 어려운 변동을 초래할 수 있습니다.

yarn apt 저장소가 깨진다면, 우리의 CI도 함께 깨질 것이라고 가정합니다.

다음 주에 이 부분을 확인해 보겠습니다. 이를 위해 새로운 기본 이미지를 릴리스해야 할 수도 있습니다.

1개의 좋아요

괜찮아 보입니다. 확인 차, 새로운 phpbb3 import 컨테이너를 빌드해야 하는데 빌드할 수 없습니다. 해결 방법을 알려드리겠습니다.

아래 링크를 참고했습니다:

하지만 해당 링크에서는 curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - 명령을 사용하라고 권장하는데, apt-key는 더 이상 사용되지 않습니다(deprecated).

컨테이너에서 다음을 실행하면:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg -o /usr/share/keyrings/yarn-keyring.asc \
    && sed -i '1s;^deb;deb [signed-by=/usr/share/keyrings/yarn-keyring.asc];' /etc/apt/sources.list.d/yarn.list

이후 다음을 실행할 수 있습니다:

root@monstera-web-only:/# apt-get update
Hit:1 https://deb.nodesource.com/node_18.x bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease                                             
Get:3 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]                                    
Get:4 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]                              
Hit:5 http://deb.debian.org/debian bullseye-updates InRelease                           
Hit:6 http://deb.debian.org/debian bullseye-backports InRelease
Get:7 https://dl.yarnpkg.com/debian stable/main all Packages [10.9 kB]
Get:8 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [216 kB] 
Hit:9 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease    
Get:10 https://dl.yarnpkg.com/debian stable/main amd64 Packages [10.9 kB]
Fetched 286 kB in 0s (849 kB/s)     
Reading package lists... Done

마찬가지로, templates/import/phpbb3.template.yml 파일의 apt-get update 명령 전에 아래 내용을 추가하면:

          - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg -o /usr/share/keyrings/yarn-keyring.asc && sed -i '1s;^deb;deb [signed-by=/usr/share/keyrings/yarn-keyring.asc];' /etc/apt/sources.list.d/yarn.list

새로운 컨테이너를 빌드할 수 있습니다.

3개의 좋아요

@Falco 중복 게시물을 올려서 죄송합니다!

@pfaffman 정말 감사합니다! 이 해결 방법이 mysql-dep.template.yml에서도 작동한다는 것을 확인했습니다.

2개의 좋아요

업데이트 중 유사해 보이는 오류가 발생하고 있습니다.

Err:7 https://dl.yarnpkg.com/debian stable InRelease
  The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx>
Get:13 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg/main amd64 Packages [268 kB]
Reading package lists...
FAILED

--------------------

Pups::ExecError: cd /var/www/discourse && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libsqlite3-dev failed with return #<Process::Status: pid 532 exit 100>

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", "cmd"=>["apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libsqlite3-dev", "echo \"gem 'sqlite3'\" >> Gemfile", "su discourse -`Preformatted text`c 'bundle config unset deployment'", "su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'"]}

discourse-doctor 실행 결과:

Checking your domain name . . .

Connection to xxx succeeded.

You should probably remove any non-standard plugins and rebuild.

Attempting to restart existing container. . .

x86_64 arch detected.

WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml

starting up existing container

+ /usr/bin/docker start app

Error response from daemon: driver failed programming external connectivity on endpoint app (c143632e34e1ae05e48759bdf163b4bbe5dc9aaf895f1fb7521f7e3784c26577): Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use

Error: failed to start containers: app

Failed to restart the container.

새로 설치하는 것 외에 제가 할 수 있는 다른 조치가 있을까요?

@fidelio 이 주제로 이 문제를 옮겼습니다. 보고서를 한데 모아두기 위해서예요. :+1:

2개의 좋아요

저는 '열정적인 아마추어’이므로, 간단한 질문 하나 드리겠습니다:
컨테이너 ‘안에서’ Curl 명령어를 실행하는 방법은 무엇인가요?

위의 게시물에서 apt-get을 실행하는 템플릿에 curl 명령을 포함할 수 있다고 언급했습니다. Apt-get update fails inside container yarn repo not signed - #6 by rahim123

@fidelio 안녕하세요, Discourse 인스턴스에서 SQLite와 같은 다른 데이터베이스에 연결해야 하나요? 즉, 다른 포럼에서 데이터를 가져오는 작업을 수행 중인가요? 그렇지 않다면 해당 기능을 비활성화하면 정상적인 Discourse 앱 컨테이너가 문제없이 다시 빌드됩니다.

제 생각에는 아직 PG 13으로 업그레이드를 하지 않고 pg12 템플릿을 사용 중일 것 같습니다. 어쨌든 해결해야 할 문제입니다. 또한 운영체제도 업그레이드가 필요할 가능성이 크며, 새로운 VM으로 이전하는 것이 최선의 해결책일 것입니다.

1개의 좋아요

안녕하세요 @rahim123. 지금은 그 둘 중 어느 것도 할 필요가 없습니다. 기능을 비활성화하는 방법은 무엇인가요?

@pfaffman 아, 에러 로그에서 libsqlite3-dev 설치를 시도하는 것에 대해 경고하고 있어서 좀 이상하게 느껴졌거든요. 아니면 Discourse가 보통 이걸 무언가에 사용하나요?

@fidelio /var/discourse/containers/app.yml 파일의 templates: 섹션을 여기에 붙여넣어 주시겠어요? 파일 하단에 존재하는 비밀번호가 포함되지 않도록 주의하세요. 또한 /var/discourse/discourse-doctor를 실행하면 시스템 구성에 대한 공개 가능한 보고서를 생성하는 데 도움이 됩니다.

1개의 좋아요

@rahim123 네, discourse-doctor 보고서를 첨부합니다:

Found containers/app.yml

==================== YML SETTINGS ====================
DISCOURSE_HOSTNAME=community.bfs-filmeditor.de
SMTP_ADDRESS=in-v3.mailjet.com
DEVELOPER_EMAILS=xxx
SMTP_PASSWORD=xxx
SMTP_PORT=25
SMTP_USER_NAME=xxx
LETSENCRYPT_ACCOUNT_EMAIL=xxx

==================== DOCKER INFO ====================
DOCKER VERSION: Docker version 18.06.1-ce, build e68fc7a

DOCKER PROCESSES (docker ps -a)

CONTAINER ID        IMAGE                           COMMAND             CREATED             STATUS              PORTS                                      NAMES
ce58652241d9        local_discourse/app             "/sbin/boot"        2 weeks ago         Up 14 minutes       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   app
8e6b8ec432b4        local_discourse/mail-receiver   "/sbin/boot"        11 months ago       Up 11 months        0.0.0.0:25->25/tcp                         mail-receiver

ce58652241d9        local_discourse/app             "/sbin/boot"        2 weeks ago         Up 14 minutes       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   app

Discourse container app is running


==================== PLUGINS ====================
          - git clone https://github.com/discourse/docker_manager.git
          - git clone  https://github.com/davidtaylorhq/discourse-whos-online.git
          - git clone https://github.com/gdpelican/babble.git
          - git clone https://github.com/angusmcleod/discourse-quick-messages.git
          - git clone https://github.com/angusmcleod/discourse-events.git
          - git clone https://github.com/discourse/discourse-calendar.git
          - git clone https://github.com/discourse/discourse-data-explorer.git
          - git clone https://github.com/davidtaylorhq/discourse-telegram-notifications.git

WARNING:
You have what appear to be non-official plugins.
If you are having trouble, you should disable them and try rebuilding again.

See https://github.com/discourse/discourse/blob/main/lib/plugin/metadata.rb for the official list.

========================================
Discourse version at community.bfs-filmeditor.de: TYPO3 CMS
Discourse version at localhost: TYPO3 CMS


==================== MEMORY INFORMATION ====================
RAM (MB): 4039

              total        used        free      shared  buff/cache   available
Mem:           3944        1272        1236        1067        1436        1364
Swap:             0           0           0

==================== DISK SPACE CHECK ====================
---------- OS Disk Space ----------
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        78G   60G   18G  78% /

---------- Container Disk Space ----------
Filesystem      Size  Used Avail Use% Mounted on
overlay          78G   60G   18G  78% /
/dev/vda1        78G   60G   18G  78% /shared
/dev/vda1        78G   60G   18G  78% /var/log

==================== DISK INFORMATION ====================
Disk /dev/vda: 80 GiB, 85899345920 bytes, 167772160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C1F9A1FE-534C-4DAC-9299-5CC180C29DCE

Device      Start       End   Sectors  Size Type
/dev/vda1  227328 167772126 167544799 79.9G Linux filesystem
/dev/vda14   2048     10239      8192    4M BIOS boot
/dev/vda15  10240    227327    217088  106M Microsoft basic data

Partition table entries are not in disk order.

==================== END DISK INFORMATION ====================

quick messages는 비활성화했지만 아직 제거하지는 않았습니다.

참고로, babble은 꽤 오랫동안 깨져 있는 것 같습니다:

3개의 좋아요

discourse-doctor가 활성화된 템플릿을 표시한다고 생각했는데, 그렇지 않네요. 이것도 함께 붙여넣어 주실 수 있을까요?

1개의 좋아요

그렇지 않습니다. 좋은 아이디어일 수 있겠지만, 제가 기억하기로는 이것이 중요했던 건 처음입니다.

1개의 좋아요

여기 있습니다:

 GNU nano 2.9.3                                                                         containers/app.yml                                                                                   


## 이 파일은 올인원(All-in-one), 독립형 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/web.ratelimited.template.yml"
## Lets Encrypt(https)를 추가하려면 아래 두 줄의 주석을 해제하세요.
  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"
  - "templates/import/mbox.template.yml"
## 이 컨테이너는 어떤 TCP/IP 포트를 노출해야 합니까?
## Apache나 nginx와 같은 다른 웹 서버와 포트를 공유하려면
## https://meta.discourse.org/t/17247 를 참조하세요.
expose:
  - "80:80"   # http
  - "443:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

  ## db_shared_buffers는 총 메모리의 25%를 초과하지 않도록 설정하세요.
  ## bootstrap에 의해 감지된 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 코어 수에 따라 달라집니다.
  ## bootstrap에 의해 감지된 CPU 기반으로 자동 설정되거나, 직접 오버라이드할 수 있습니다.
  UNICORN_WORKERS: 4

이것이 문제인 것 같습니다. 앞에 #를 붙이고 ./launcher rebuild app을 실행해 보세요.

2개의 좋아요