将 docker 镜像更新至最新版本后无法启动 bosh 会话

将 docker 镜像更新至最新版本后无法启动 bosh 会话

从图像 20.04 更新到 21.04 后,我无法再启动 bosh 会话,之后我将图像回滚到 20.04,但仍然无法启动会话。

以下是隐藏了我的信息的日志

jabberd_1  | 2021-06-04 16:36:38.974369+00:00 [debug] Incoming data: <<"<body content=\"text/xml; charset=utf-8\" hold=\"1\" rid=\"718823993\" to=\"**host**\" ver=\"1.6\" wait=\"59\" xml:lang=\"en\" xmlns=\"http://jabber.org/protocol/httpbind\" xmlns:xmpp=\"urn:xmpp:xbosh\" xmpp:version=\"1.0\"/>">>
ejabberd_1  | 2021-06-04 16:36:38.991090+00:00 [error] Failed to start BOSH session: {error,
ejabberd_1  |                                {noproc,
ejabberd_1  |                                 {gen_server,call,
ejabberd_1  |                                  [mod_bosh_mnesia,
ejabberd_1  |                                   {write,
ejabberd_1  |                                    {bosh,
ejabberd_1  |                                     <<"8beb6dd0e59106b7d3e141b1e07e3f41319f0d81">>,
ejabberd_1  |                                     {1622,824598,990924},
ejabberd_1  |                                     <0.687.0>}},
ejabberd_1  |                                   600000]}}}
ejabberd_1  | 2021-06-04 16:36:38.992080+00:00 [debug] Send error reply:{body,<<"Failed to start BOSH session">>,
ejabberd_1  |                        [{type,<<"terminate">>},
ejabberd_1  |                         {condition,<<"internal-server-error">>}],
ejabberd_1  |                        [],0}
ejabberd_1  | ** Receiced body: {body,<<>>,
ejabberd_1  |                         [{'xmpp:version',<<"1.0">>},
ejabberd_1  |                          {<<"xml:lang">>,<<"en">>},
ejabberd_1  |                          {wait,59},
ejabberd_1  |                          {ver,<<"1.6">>},
ejabberd_1  |                          {to,<<"**host**">>},
ejabberd_1  |                          {rid,718823993},
ejabberd_1  |                          {hold,1},
ejabberd_1  |                          {<<"content">>,<<"text/xml; charset=utf-8">>},
ejabberd_1  |                          {<<"xmlns:xmpp">>,<<"urn:xmpp:xbosh">>}],
ejabberd_1  |                         [],219}
ejabberd_1  | 2021-06-04 16:36:38.990975+00:00 [error] CRASH REPORT:
ejabberd_1  |   crasher:
ejabberd_1  |     initial call: ejabberd_bosh:init/1
ejabberd_1  |     pid: <0.687.0>
ejabberd_1  |     registered_name: []
ejabberd_1  |     exception exit: {noproc,
ejabberd_1  |                         {gen_server,call,
ejabberd_1  |                             [mod_bosh_mnesia,
ejabberd_1  |                              {write,
ejabberd_1  |                                  {bosh,
ejabberd_1  |                                      <<"8beb6dd0e59106b7d3e141b1e07e3f41319f0d81">>,
ejabberd_1  |                                      {1622,824598,990924},
ejabberd_1  |                                      <0.687.0>}},
ejabberd_1  |                              600000]}}
ejabberd_1  |       in function  p1_fsm:init_it/6 (/ejabberd/deps/p1_utils/src/p1_fsm.erl, line 392)
ejabberd_1  |     ancestors: ['mod_bosh_**host**',ejabberd_gen_mod_sup,
ejabberd_1  |                   ejabberd_sup,<0.126.0>]
ejabberd_1  |     message_queue_len: 0
ejabberd_1  |     messages: []
ejabberd_1  |     links: [<0.523.0>]
ejabberd_1  |     dictionary: []
ejabberd_1  |     trap_exit: false
ejabberd_1  |     status: running
ejabberd_1  |     heap_size: 987
ejabberd_1  |     stack_size: 27
ejabberd_1  |     reductions: 572
ejabberd_1  |   neighbours:
ejabberd_1  | 
ejabberd_1  | 2021-06-04 16:36:39.006465+00:00 [debug] Running hook c2s_closed: mod_stream_mgmt:c2s_closed/2
ejabberd_1  | 2021-06-04 16:36:39.006636+00:00 [debug] Running hook c2s_closed: ejabberd_c2s:process_closed/2
ejabberd_1  | 2021-06-04 16:36:39.006787+00:00 [debug] Running hook c2s_terminated: mod_stream_mgmt:c2s_terminated/2
ejabberd_1  | 2021-06-04 16:36:39.006905+00:00 [debug] Running hook c2s_terminated: mod_pubsub:on_user_offline/2
ejabberd_1  | 2021-06-04 16:36:39.007021+00:00 [debug] Running hook c2s_terminated: ejabberd_c2s:process_terminated/2

这是 ejabberd.yml

###
### ejabberd configuration file
### The parameters used in this configuration file are explained at
### https://docs.ejabberd.im/admin/configuration
### The configuration file is written in YAML.
### *******************************************************
### *******             !!! WARNING !!!             *******
### *******      YAML IS INDENTATION SENSITIVE      *******
### ******* MAKE SURE YOU INDENT SECTIONS CORRECTLY *******
### *******************************************************
### Refer to http://en.wikipedia.org/wiki/YAML for the brief description.
###

auth_method: [external]
auth_use_cache: false
extauth_program: /home/ejabberd/conf/login.py
extauth_pool_size: 1

sql_type: pgsql
sql_server: 'postgres'
sql_database: 'ejabberd'
sql_username: 'ejabberd'
sql_password: 'ejabberd'
sql_port: 5432

allow_multiple_connections: true

default_db: sql

#auth_password_format: scram

hosts:
  - '**host**'

loglevel: debug

certfiles:
 - '/home/ejabberd/conf/server.pem'

ca_file: '/home/ejabberd/conf/cacert.pem'

listen:
  -
    port: 5222
    ip: '::'
    module: ejabberd_c2s
    max_stanza_size: 262144
    shaper: c2s_shaper
    access: c2s
    starttls_required: true
  -
    port: 5443
    ip: '::'
    module: ejabberd_http
    tls: true
    request_handlers:
      /admin: ejabberd_web_admin
      /api: mod_http_api
      /bosh: mod_bosh
      /captcha: ejabberd_captcha
      /upload: mod_http_upload
      /ws: ejabberd_http_ws
  -
    port: 5444
    ip: '::'
    module: ejabberd_http
    request_handlers:
      /admin: ejabberd_web_admin
      /api: mod_http_api
      /bosh: mod_bosh
      /captcha: ejabberd_captcha
      /upload: mod_http_upload
      /ws: ejabberd_http_ws

s2s_use_starttls: optional

acl:
  local:
    user_regexp: ''
  loopback:
    ip:
      - 127.0.0.0/8
      - ::1/128
  admin:
    user:
      - 'admin': '**host**'
      - 'usr1': '**host**'
      - 'usr2': '**host**'
      - 'usr3': '**host**'

access_rules:
  local:
    allow: local
  c2s:
    deny: blocked
    allow: all
  announce:
    allow: admin
  configure:
    allow: admin
  muc_create:
    allow: local
  pubsub_createnode:
    allow: local
  trusted_network:
    allow: loopback

api_permissions:
  'api':
    who:
      ip: '10.0.1.42/8'
    what:
      - '*'
  'console commands':
    from:
      - mod_http_api 
      - ejabberd_ctl
    who: all
    what: '*'
  'admin access':
    who:
      access:
        allow:
          - acl: loopback
          - acl: admin
      oauth:
        scope: 'ejabberd:admin'
        access:
          allow:
            - acl: loopback
            - acl: admin
    what:
      - '*'
      - '!stop'
      - '!start'
  'public commands':
    who:
      ip: 127.0.0.1/8
    what:
      - status
      - connected_users_number

shaper:
  normal:
    rate: 3000
    burst_size: 20000
  fast: 100000

shaper_rules:
  max_user_sessions: 10
  max_user_offline_messages:
    5000: admin
    100: all
  c2s_shaper:
    none: admin
    normal: all
  s2s_shaper: fast

modules:
  mod_adhoc: {}
  mod_admin_extra: {}
  mod_announce:
    access: announce
  mod_avatar: {}
  mod_blocking: {}
  mod_bosh: {}
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state: {}
  mod_configure: {}
  mod_disco: {}
  mod_fail2ban: {}
  mod_http_api: {}
  mod_http_upload:
    put_url: https://@HOST@:5444/upload
    docroot: /home/ejabberd/upload
    custom_headers:
      "Access-Control-Allow-Origin": "*" # voltar para "https://@HOST@"
      "Access-Control-Allow-Methods": "GET,HEAD,PUT,OPTIONS"
      "Access-Control-Allow-Headers": "Content-Type"
  mod_last: {}
  mod_mam:
    ## Mnesia is limited to 2GB, better to use an SQL backend
    ## For small servers SQLite is a good fit and is very easy
    ## to configure. Uncomment this when you have SQL configured:
    ## db_type: sql
    assume_mam_usage: true
    default: always
  mod_mqtt: {}
  mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
    access_mam:
      - allow
    default_room_options:
      allow_subscription: true  # enable MucSub
      allow_user_invites: true
      anonymous: false
      max_users: 2000
      mam: true
      members_only: true
      moderated: false
      persistent: true
      public: false
    max_users: 2000
  mod_muc_admin: {}
  mod_offline:
    access_max_user_messages: max_user_offline_messages
  mod_ping: {}
  mod_privacy: {}
  mod_private: {}
  mod_proxy65:
    access: local
    max_connections: 5
  mod_pubsub:
    access_createnode: pubsub_createnode
    plugins:
      - flat
      - pep
    force_node_config:
      ## Avoid buggy clients to make their bookmarks public
      storage:bookmarks:
        access_model: whitelist
  mod_push: {}
  mod_push_keepalive: {}
  mod_register:
    ## Only accept registration requests from the 'trusted'
    ## network (see access_rules section above).
    ## Think twice before enabling registration from any
    ## address. See the Jabber SPAM Manifesto for details:
    ## https://github.com/ge0rg/jabber-spam-fighting-manifesto
    ip_access: trusted_network
  mod_roster:
    store_current_id: false
    versioning: false
  mod_s2s_dialback: {}
  mod_shared_roster:
    use_cache: false
  mod_stream_mgmt:
    resend_on_timeout: if_offline
  mod_stun_disco: {}
  mod_vcard:
    search: true
  mod_vcard_xupdate: {}
  mod_version:
    show_os: false

### Local Variables:
### mode: yaml
### End:
### vim: set filetype=yaml tabstop=8

有人能帮助我吗?

编辑:我实际上使用的是 20.04.02 镜像,但它在本地被标记为最新,似乎该镜像不再在存储库中。我使用现在未标记的镜像(20.04.02)让它再次工作,但使用 20.04 镜像不起作用。我仍然想更新,如果有人愿意指导我做错了什么。

答案1

快速浏览一下您的配置,我没有发现任何奇怪或明显的错误。

这就是我使用 docker 设置 ejabberd 21.04 的方法。而且 BOSH 可以正确使用。唯一的大区别是您使用外部身份验证而不是内部身份验证。以下是我的脚本,以防它们能为您提供有关您的问题的一些线索。或者您可以尝试一下。

如果您尝试我的 docker-compose.yml 文件,请记住将其替换../../ejabberd/sql/pg.sql为 ejabberd 的 pg.sql 文件的路径,并替换./conf/ejabberd.yml.database.yml为您的 ejabberd 配置文件的路径:

version: '3.7'

services:

  main:
    hostname: main
    container_name: main
    image: ejabberd/ecs:21.04
    depends_on:
      pgsql:
        condition: service_healthy
    environment:
      - CTL_ON_CREATE=register admin pgsql.localhost asd ;
                      register user1pg pgsql.localhost asd
      - CTL_ON_START=stats registeredusers ;
                     status
    command: ["foreground"]
    healthcheck:
      test: netstat -nl | grep -q 5443
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 120
    ports:
      - "5280:5280"
      - "5443:5443"
    volumes:
      - ./conf/ejabberd.yml.database.yml:/home/ejabberd/conf/ejabberd.yml:ro

  pgsql:
    image: postgres:latest
    container_name: pgsql
    healthcheck:
      test: pg_isready -U $$POSTGRES_USER
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - ../../ejabberd/sql/pg.sql:/docker-entrypoint-initdb.d/pg.sql:ro
    environment:
      POSTGRES_PASSWORD: ejabberd_test
      POSTGRES_USER: ejabberd_test
      POSTGRES_DB: ejabberd_test

  adminer:
    image: adminer
    container_name: adminer
    restart: always
    depends_on:
      pgsql:
        condition: service_healthy
      main:
        condition: service_healthy
    ports:
      - 8080:8080

yml文件

hosts:
  - pgsql.localhost

host_config:
  pgsql.localhost:
    sql_port: 5432
    sql_type: pgsql
    sql_server: "pgsql"
    sql_database: "ejabberd_test"
    sql_username: "ejabberd_test"
    sql_password: "ejabberd_test"
    sql_pool_size: 1
    auth_method: sql
    default_db: sql

loglevel: 4
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 1
log_rate_limit: 100

certfiles:
  - /home/ejabberd/conf/server.pem

ca_file: "/home/ejabberd/conf/cacert.pem"

listen:
  -
    port: 5443
    ip: "::"
    module: ejabberd_http
    tls: true
    request_handlers:
      "/admin": ejabberd_web_admin
      "/bosh": mod_bosh
  -
    port: 5280
    ip: "::"
    module: ejabberd_http
    request_handlers:
      "/admin": ejabberd_web_admin

s2s_use_starttls: optional

acl:
  local:
    user_regexp: ""
  loopback:
    ip:
      - 127.0.0.0/8
      - ::1/128
      - ::FFFF:127.0.0.1/128
  admin:
    user:
      - "[email protected]"

access_rules:
  local:
    allow: local
  c2s:
    deny: blocked
    allow: all
  announce:
    allow: admin
  configure:
    allow: admin
  muc_create:
    allow: local
  pubsub_createnode:
    allow: local
  trusted_network:
    allow: loopback

api_permissions:
  "console commands":
    from:
      - ejabberd_ctl
    who: all
    what: "*"
  "admin access":
    who:
      access:
        allow:
          acl: loopback
          acl: admin
      oauth:
        scope: "ejabberd:admin"
        access:
          allow:
            acl: loopback
            acl: admin
    what:
      - "*"
      - "!stop"
      - "!start"
  "public commands":
    who:
      ip: 127.0.0.1/8
    what:
      - status
      - connected_users_number

shaper:
  normal: 1000
  fast: 50000

shaper_rules:
  max_user_sessions: 10
  max_user_offline_messages:
    5000: admin
    100: all
  c2s_shaper:
    none: admin
    normal: all
  s2s_shaper: fast

max_fsm_queue: 10000

acme:
   contact: "mailto:[email protected]"
   ca_url: "https://acme-v01.api.letsencrypt.org"

modules:
  mod_adhoc: {}
  mod_admin_extra: {}
  mod_announce:
    access: announce
  mod_avatar: {}
  mod_blocking: {}
  mod_bosh: {}
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state: {}
  mod_configure: {}
  mod_disco: {}
  mod_fail2ban: {}
  mod_http_api: {}
  mod_http_upload:
    put_url: https://@HOST@:5443/upload
  mod_last: {}
  mod_mam:
    ## Mnesia is limited to 2GB, better to use an SQL backend
    ## For small servers SQLite is a good fit and is very easy
    ## to configure. Uncomment this when you have SQL configured:
    ## db_type: sql
    assume_mam_usage: true
    default: never
  mod_mqtt: {}
  mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
    access_mam:
      - allow
    default_room_options:
      allow_subscription: true  # enable MucSub
      mam: false
  mod_muc_admin: {}
  mod_offline:
    access_max_user_messages: max_user_offline_messages
  mod_ping: {}
  mod_privacy: {}
  mod_private: {}
  mod_proxy65:
    access: local
    max_connections: 5
  mod_pubsub:
    access_createnode: pubsub_createnode
    plugins:
      - flat
      - pep
    force_node_config:
      ## Avoid buggy clients to make their bookmarks public
      storage:bookmarks:
        access_model: whitelist
  mod_push: {}
  mod_push_keepalive: {}
  mod_register:
    ## Only accept registration requests from the "trusted"
    ## network (see access_rules section above).
    ## Think twice before enabling registration from any
    ## address. See the Jabber SPAM Manifesto for details:
    ## https://github.com/ge0rg/jabber-spam-fighting-manifesto
    ip_access: trusted_network
  mod_roster:
    versioning: true
  mod_sip: {}
  mod_s2s_dialback: {}
  mod_shared_roster: {}
  mod_stream_mgmt:
    resend_on_timeout: if_offline
  mod_vcard: {}
  mod_vcard_xupdate: {}
  mod_version:
    show_os: false

### Local Variables:
### mode: yaml
### End:
### vim: set filetype=yaml tabstop=8

一旦创建了这些文件,sudo docker-compose up你就应该能够登录到[电子邮件保护]使用 BOSH url 的账户https://localhost:5443/bosh/

相关内容