데이터베이스 타임아웃으로 인한 오류

홈페이지 http://10.201.61.8/forum 요청
요청 시간이 5초를 초과했습니다.
image

항상 Oops 오류가 발생합니다.
요청 시간이 5초를 초과하는 경우나 기타 제한 사항이 있는 것인가요? 감사합니다!

Oops

이 토론 포럼을 구동하는 소프트웨어에서 예상치 못한 문제가 발생했습니다. 불편을 드려 죄송합니다.

오류에 대한 자세한 정보는 로그에 기록되었으며, 자동 알림이 생성되었습니다. 확인하겠습니다.

추가 조치는 필요하지 않습니다. 다만, 오류 상태가 지속되는 경우 오류를 재현하는 단계 등을 포함한 추가 정보를 사이트의 피드백 카테고리에 토론 주제를 게시하여 제공해 주실 수 있습니다.

사이트 앞에 커스텀 프록시를 실행 중인데, 그 프록시에서 타임아웃이 발생하는 것 같습니다.

네
외부에서 커스텀 nginx 프록시를 사용하고 있습니다.

그럼 외부의 커스텀 nginx 프록시 설정을 수정해야 할 것 같네요.

요청 시간이 5초를 초과하지 않으면, 때로는 웹을 정상적으로 액세스할 수 있습니다.

그래서 모든 설정이 제대로 작동할 수 있습니다.
하지만 요청이 5초를 초과하면 그냥 'Oops’만 표시됩니다.
요청이 5초를 초과하는 것에 대한 어떤 제한이 있는 것 같습니다.

아래와 같이 커스텀 nginx 설정을 외부에 작성합니다

server {
  listen       9000;
  server_name  localhost;
  root /opt/nginx/portal;
  location ~* ^.+\.(jpg|jpeg|gif|png|bmp)$ {
    access_log off;
    expires 30d;
    break;
  }
  location / {
    index index.html index.htm;
  }
  
  location ^~/forum {
   add_header 'Access-Control-Allow-Origin' '*';
   add_header 'Access-Control-Allow-Credentials' 'true';
   add_header 'Access-Control-Allow-Headers' '*';
   proxy_pass http://unix:/opt/oca-forum/shared/ocaforum/nginx.http.sock:;
   proxy_redirect  off;
   }
}

아래와 같은 app.yml:

templates:
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/cron.template.yml"
  - "templates/web.china.template.yml" 
  - "templates/web.socketed.template.yml"  

params:
  db_default_text_search_config: "pg_catalog.english"
  db_shared_buffers: "1280MB"

env:
  LC_ALL: en_US.UTF-8
  LANG: en_US.UTF-8
  LANGUAGE: en_US.UTF-8
  
  UNICORN_WORKERS: 8

  DISCOURSE_HOSTNAME: '10.201.61.8:9000'
  DOCKER_USE_HOSTNAME: false
  
  DISCOURSE_RELATIVE_URL_ROOT: /forum

  DISCOURSE_DEVELOPER_EMAILS: 'jxwoeuxer@gmail.com'


  DISCOURSE_SMTP_ADDRESS: gmail.smtp.com
  DISCOURSE_SMTP_PORT: 25
  DISCOURSE_SMTP_USER_NAME: jzwoeuxer@gmail.com
  DISCOURSE_SMTP_PASSWORD: "WEweoier2x2w3e"
  DISCOURSE_SMTP_ENABLE_START_TLS: false           # (선택 사항, 기본값: true)
  DISCOURSE_SMTP_AUTHENTICATION: login
  DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none

  DISCOURSE_NOTIFICATION_EMAIL: jxwoeuxer@gmail.com   # (알림을 보내는 주소)

  DISCOURSE_DB_HOST: 10.201.61.16
  DISCOURSE_DB_PORT: 5432
  DISCOURSE_DB_NAME: theforum
  DISCOURSE_DB_SOCKET: ''
  DISCOURSE_DB_USERNAME: postgres
  DISCOURSE_DB_PASSWORD: theforum16


volumes:
  - volume:
      host: /opt/oca-forum/shared/ocaforum
      guest: /shared
  - volume:
      host: /opt/oca-forum/shared/ocaforum/log/var-log
      guest: /var/log

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com.cnpmjs.org/discourse/docker_manager.git

run:
  - exec: echo "Beginning of custom commands"
  - exec:
      cd: $home
      cmd:
         - mkdir -p public/forum
         - cd public/forum && ln -s ../uploads && ln -s ../backups
  - replace:
      global: true
      filename: /etc/nginx/conf.d/discourse.conf
      from: proxy_pass http://discourse;
      to: |
         rewrite ^/(.*)$ /forum/$1 break;
         proxy_pass http://discourse;
  - replace:
      filename: /etc/nginx/conf.d/discourse.conf
      from: location ~ ^/(svg-sprite/|letter_avatar/|letter_avatar_proxy/|user_avatar|highlight-js|stylesheets|theme-javascripts|favicon/proxied|service-worker) {
      to: |
        location ~ ^/(svg-sprite/|letter_avatar/|letter_avatar_proxy/|user_avatar|highlight-js|stylesheets|theme-javascripts|favicon/proxied|service-worker) {
        rewrite ^/(svg-sprite|letter_avatar|letter_avatar_proxy|user_avatar|highlight-js|stylesheets|theme-javascripts|favicon/proxied|service-worker)/([^/]+):[0-9]+/(.*) /forum/$1/$2/$3  break; 
  - replace:
      filename: /etc/nginx/conf.d/discourse.conf
      from: etag off;
      to: |
        etag off;
        location /forum {
           rewrite ^/forum/?(.*)$ /$1;
        }
  - replace:
       filename: /etc/nginx/conf.d/discourse.conf
       from: $proxy_add_x_forwarded_for
       to: $http_your_original_ip_header
       global: true
  - exec: echo "End of custom commands"

리버스 프록시를 제거하고 컨테이너가 80/443 포트에 직접 바인딩하도록 설정한 후 문제가 계속 발생하는지 확인해 보세요.

감사합니다!
하지만 mydiscourse에 더 이상 사용할 수 있는 포트가 없어서 외부 nginx를 사용해야 합니다.

discourse 컨테이너에 진입하여 다음을 실행했습니다.

curl http://localhost:3000/forum을 실행했는데 동일한 오류가 발생합니다.

---
# # # curl http://localhost:3000/forum
<!DOCTYPE html>
<html>
<head>
  <title>Oops - Error 500</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
    <h1>Oops</h1>
    <p>The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.</p>
    <p>Detailed information about the error was logged, and an automatic notification generated. We'll take a look at it.</p>
    <p>No further action is necessary. However, if the error condition persists, you can provide additional detail, including steps to reproduce the error, by posting a discussion topic in the site's feedback category.</p>
</body>
</html>

저희의 오픈 디스커스를 사용 중입니다.
외부 nginx를 사용하고 URL 경로에 서브폴더가 필요합니다.
@Falco

데이터베이스(DB) 관련 원인이 있을 수 있습니다.
DB가 매우 느린 것을 확인했습니다.
db_timeout = 10으로 변경했는데, 그 후 10초가 지나면 오류가 발생합니다.
아마 DB를 더 빠르게 만들어야 할 것 같습니다.

문제를 해결했습니다. 5초 설정은 기본 데이터베이스 설정이었습니다. 아래 설정으로 변경했습니다:

DISCOURSE_DB_TIMEOUT: 10000
DISCOURSE_DB_CONNECT_TIMEOUT: 10

그리고 더 많은 변경 사항이 있습니다.
데이터베이스가 매우 느린 것을 발견했습니다.
그리고 윈도우의 기존 데이터베이스 대신 리눅스에 새로운 데이터베이스를 사용했습니다.

그럼에도 불구하고 감사합니다. 디스코스는 정말 훌륭합니다.