처음에는 업그레이드 화면에서 모든 항목이 비활성화되어 있었습니다. 재부팅한 후 docker_manager 업그레이드를 선택할 수 있었습니다. 하지만 다음과 같은 오류와 함께 실패했습니다:
rake aborted!
NoMethodError: undefined method `path' for nil:NilClass
그래서 서버에 ssh로 접속하여 재구축(rebuild)을 시도했는데, 다음과 같은 결과가 나왔습니다:
root@Discourse-1:/var/discourse# ./launcher rebuild app
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
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
............
Downloading MaxMindDB...
Compressing Javascript and Generating Source Maps
I, [2023-03-10T03:08:58.958320 #1] INFO -- : Terminating async processes
I, [2023-03-10T03:08:58.958649 #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-03-10T03:08:58.958745 #1] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 103
103:signal-handler (1678417738) Received SIGTERM scheduling shutdown...
2023-03-10 03:08:58.959 UTC [42] LOG: received fast shutdown request
2023-03-10 03:08:58.966 UTC [42] LOG: aborting any active transactions
2023-03-10 03:08:58.969 UTC [42] LOG: background worker "logical replication launcher" (PID 51) exited with exit code 1
2023-03-10 03:08:58.971 UTC [46] LOG: shutting down
103:M 10 Mar 2023 03:08:59.047 # User requested shutdown...
103:M 10 Mar 2023 03:08:59.047 * Saving the final RDB snapshot before exiting.
2023-03-10 03:08:59.060 UTC [42] LOG: database system is shut down
103:M 10 Mar 2023 03:08:59.073 * DB saved on disk
103:M 10 Mar 2023 03:08:59.073 # Redis is now ready to exit, bye bye...
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 1004 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'bundle exec rake themes:update assets:precompile'"]}
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.
e956a73644feb880e4b524bcbd4fa3c626fcfcc4edb3752f72e523194f663b4e
root@Discourse-1:/var/discourse# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@Discourse-1:/var/discourse#
문제가 스폰 실패라면, RAM과 스왑 사용량뿐 아니라 커널 구성도 신경 써야 합니다. 로그에 다음 내용이 표시되면
# WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
저의 Discourse 설치 환경은 매우 일반적인 구성입니다. 재부팅 후 깨끗한 백업을 확보했습니다. 그래서 결국 처음부터 새로 설치하기로 결정했습니다. 하지만 위에서 게시한 것과 동일한 오류로 설치가 실패했습니다. 지난 4년간 LXD 컨테이너에서 6GB 메모리를 사용하여 Discourse를 운영해 왔으며, 그간 문제가 없었습니다. 메모리 사용량은 안정적으로 1.9GB를 유지하고 있습니다. 업그레이드 중에는 메모리 사용량이 최대 5.1GB까지 상승합니다. 데이터베이스 백업은 데이터 용량 기준 30GB에 불과하며, 타 사이트와 비교했을 때 제 설치 규모는 작은 편입니다. 현재 Ubuntu 22.04에서 실행 중입니다. 다른 배포판으로 전환해야 할까요?
## 이것은 올인원, 스탠드얼론 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"
## 이 컨테이너가 노출해야 하는 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: "4096MB"
## 정렬 성능을 향상시킬 수 있지만, 연결당 메모리 사용량이 증가합니다
#db_work_mem: "40MB"
## 이 컨테이너가 사용할 Git 리비전은 무엇입니까? (기본값: tests-passed)
#version: tests-passed
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
# DISCOURSE_DEFAULT_LOCALE: en
## 동시 웹 요청을 얼마나 많이 지원할 수 있습니까? 메모리와 CPU 코어 수에 따라 달라집니다.
## bootstrap이 감지된 CPU에 따라 자동으로 설정하거나, 직접 덮어쓸 수 있습니다
UNICORN_WORKERS: 8
## TODO: 이 Discourse 인스턴스가 응답할 도메인 이름
## 필수 항목입니다. Discourse는 IP 주소만으로는 작동하지 않습니다.
DISCOURSE_HOSTNAME: discussion.scottibyte.com
## 컨테이너가 위에서 지정한 도메인 이름(-h 옵션)과 동일한
## 도메인 이름으로 시작되도록 하려면 주석을 해제하세요 (기본값 "$hostname-$config")
#DOCKER_USE_HOSTNAME: true
## TODO: 초기 가입 시 관리자 및 개발자로 설정될 쉼표로 구분된 이메일 목록
## 예: 'user1@example.com,user2@example.com'
DISCOURSE_DEVELOPER_EMAILS: 'aaaaaa@gmail.com'
## TODO: 새 계정을 검증하고 알림을 보내는 데 사용되는 SMTP 메일 서버
# SMTP 주소, 사용자 이름, 비밀번호는 필수입니다
# 경고: SMTP 비밀번호에 '#' 문자가 있으면 문제가 생길 수 있습니다!
DISCOURSE_SMTP_ADDRESS: smtp.gmail.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: redacted
DISCOURSE_SMTP_PASSWORD: redacted
DISCOURSE_SMTP_ENABLE_START_TLS: true # (선택 사항, 기본값 true)
DISCOURSE_SMTP_DOMAIN: discussion.scottibyte.com
DISCOURSE_NOTIFICATION_EMAIL: noreply@scottibyte.com
## Lets Encrypt 템플릿을 추가했다면 무료 SSL 인증서를 얻으려면 아래 주석을 해제하세요
LETSENCRYPT_ACCOUNT_EMAIL: me@example.com
## 이 Discourse 인스턴스의 http 또는 https CDN 주소 (인라인으로 설정됨)
## https://meta.discourse.org/t/14857을 참조하세요
#DISCOURSE_CDN_URL: https://discourse-cdn.example.com
## IP 주소 조회를 위한 maxmind 지리 위치 IP 주소 키
## https://meta.discourse.org/t/-/137387/23을 참조하세요
DISCOURSE_MAXMIND_LICENSE_KEY: aaaaaaaa
## 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 "Beginning of custom commands"
## 첫 번째 가입 시 'From' 이메일 주소를 설정하려면 주석을 해제하고 변경하세요:
## 첫 번째 가입 이메일을 받은 후, 해당 줄을 다시 주석 처리하세요. 한 번만 실행하면 됩니다.
# - exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
- exec: echo "End of custom commands"
YAML에서 Maxmind 키를 주석 처리했습니다. 재구성이 진행 중입니다. 참고로, 이메일 알림은 항상 정상적으로 작동했습니다. 최근에는 백업 다운로드 링크를 담은 이메일이 더 이상 작동하지 않습니다. 저는 그냥 폴더에 들어가서 sftp로 백업을 다운로드하는데, 그건 정상적으로 작동하고 백업 로그도 성공적으로 완료됩니다. 그래서 Maxmind 키 문제의 원인이 뭐라고 생각하시나요?
보시다시피, 재구성이 성공적으로 완료되었고 포럼이 최신 빌드로 업데이트되었습니다. GUI에서 새 백업을 생성하는 것도, 백업 알림도, 심지어 백업 다운로드 링크까지 모두 정상적으로 작동했습니다. 모든 기능이 잘 동작하고 있습니다.
감사합니다. 당신은 진정한 전문가시네요! 훌륭한 코멘트와 훌륭한 도움에 감사드립니다.
하지만 새로운 Maxmind 키를 사용해도 여전히 문제가 해결되지 않았습니다. 이에 대해 조언을 주실 수 있을까요?