Discourse 升级失败后离线 "bootstrap failed with exit code 5"

大家好,

我的 Discourse 目前处于离线状态 :cry: :pensive:

今天早上尝试从/向 v3.2.0.beta3 +468 升级时失败了:

命令行上的错误信息是:

以及完整的控制台日志:

root@greyarro:~# cd /var/discourse/
root@greyarro:/var/discourse# git pull
已是最新。
root@greyarro:/var/discourse# ./launcher rebuild app
检测到 x86_64 架构。
警告:containers/app.yml 文件对所有用户可读。你可以通过运行以下命令来保护该文件:chmod o-rwx containers/app.yml
确保 launcher 是最新的
获取 origin
Launcher 已是最新
2.0.20231023-1945: Pulling from discourse/base
Digest: sha256:2b0eb484d20888cc2daadb690dcfa73522105650c1420212e99345a36a424d77
状态:discourse/base:2.0.20231023-1945 镜像已是最新
/usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2023-12-11T06:36:42.453494 #1]  INFO -- : 从 stdin 读取
I, [2023-12-11T06:36:42.461560 #1]  INFO -- : > locale-gen $LANG && update-locale
I, [2023-12-11T06:36:42.523575 #1]  INFO -- : 正在生成 locale(这可能需要一段时间)...
生成完成。

I, [2023-12-11T06:36:42.524082 #1]  INFO -- : > mkdir -p /shared/postgres_run
I, [2023-12-11T06:36:42.529018 #1]  INFO -- : 
I, [2023-12-11T06:36:42.529478 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2023-12-11T06:36:42.534085 #1]  INFO -- : 
I, [2023-12-11T06:36:42.534610 #1]  INFO -- : > chmod 775 /shared/postgres_run
I, [2023-12-11T06:36:42.538665 #1]  INFO -- : 
I, [2023-12-11T06:36:42.539119 #1]  INFO -- : > rm -fr /var/run/postgresql
I, [2023-12-11T06:36:42.542429 #1]  INFO -- : 
I, [2023-12-11T06:36:42.542918 #1]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2023-12-11T06:36:42.545917 #1]  INFO -- : 
I, [2023-12-11T06:36:42.546272 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2023/12/11 06:36:42 socat[17] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2023-12-11T06:36:42.557289 #1]  INFO -- : 
I, [2023-12-11T06:36:42.557926 #1]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2023-12-11T06:36:42.562906 #1]  INFO -- : 
I, [2023-12-11T06:36:42.563405 #1]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2023-12-11T06:36:42.568125 #1]  INFO -- : 
I, [2023-12-11T06:36:42.568537 #1]  INFO -- : > mkdir -p /shared/postgres_run/13-main.pg_stat_tmp
I, [2023-12-11T06:36:42.571897 #1]  INFO -- : 
I, [2023-12-11T06:36:42.572328 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run/13-main.pg_stat_tmp
I, [2023-12-11T06:36:42.575429 #1]  INFO -- : 
I, [2023-12-11T06:36:42.583069 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown: 
I, [2023-12-11T06:36:42.591097 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown: 
I, [2023-12-11T06:36:42.599557 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown: 
I, [2023-12-11T06:36:42.607693 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown: 
I, [2023-12-11T06:36:42.608293 #1]  INFO -- : > chown -R root /var/lib/postgresql/13/main
I, [2023-12-11T06:36:43.061308 #1]  INFO -- : 
I, [2023-12-11T06:36:43.061769 #1]  INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/13/bin/initdb -D /shared/postgres_data || exit 0
I, [2023-12-11T06:36:43.066134 #1]  INFO -- : 
I, [2023-12-11T06:36:43.066571 #1]  INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2023-12-11T06:36:43.105049 #1]  INFO -- : 
I, [2023-12-11T06:36:43.105891 #1]  INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2023-12-11T06:36:43.111420 #1]  INFO -- : 
I, [2023-12-11T06:36:43.112072 #1]  INFO -- : > /root/upgrade_postgres
I, [2023-12-11T06:36:43.122177 #1]  INFO -- : 
I, [2023-12-11T06:36:43.122713 #1]  INFO -- : > rm /root/upgrade_postgres
I, [2023-12-11T06:36:43.126702 #1]  INFO -- : 
I, [2023-12-11T06:36:43.127981 #1]  INFO -- : 在 /etc/postgresql/13/main/postgresql.conf 中将 data_directory = '/var/lib/postgresql/13/main' 替换为 data_directory = '/shared/postgres_data'
I, [2023-12-11T06:36:43.128927 #1]  INFO -- : 在 /etc/postgresql/13/main/postgresql.conf 中将 (?-mix:#?listen_addresses *=.*) 替换为 listen_addresses = '*'
I, [2023-12-11T06:36:43.129583 #1]  INFO -- : 在 /etc/postgresql/13/main/postgresql.conf 中将 (?-mix:#?synchronous_commit *=.*) 替换为 synchronous_commit = $db_synchronous_commit
I, [2023-12-11T06:36:43.130214 #1]  INFO -- : 在 /etc/postgresql/13/main/postgresql.conf 中将 (?-mix:#?shared_buffers *=.*) 替换为 shared_buffers = $db_shared_buffers
I, [2023-12-11T06:36:43.130899 #1]  INFO -- : 在 /etc/postgresql/13/main/postgresql.conf 中将 (?-mix:#?work_mem *=.*) 替换为 work_mem = $db_work_mem
I, [2023-12-11T06:36:43.131457 #1]  INFO -- : 在 /etc/postgresql/13/main/postgresql.conf 中将 (?-mix:#?default_text_search_config *=.*) 替换为 default_text_search_config = '$db_default_text_search_config'
I, [2023-12-11T06:36:43.132096 #1]  INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2023-12-11T06:36:43.137173 #1]  INFO -- : 
I, [2023-12-11T06:36:43.137747 #1]  INFO -- : 在 /etc/postgresql/13/main/postgresql.conf 中将 (?-mix:#?checkpoint_segments *=.*) 替换为 checkpoint_segments = $db_checkpoint_segments
I, [2023-12-11T06:36:43.138339 #1]  INFO -- : 在 /etc/postgresql/13/main/postgresql.conf 中将 (?-mix:#?logging_collector *=.*) 替换为 logging_collector = $db_logging_collector
I, [2023-12-11T06:36:43.139065 #1]  INFO -- : 在 /etc/postgresql/13/main/postgresql.conf 中将 (?-mix:#?log_min_duration_statement *=.*) 替换为 log_min_duration_statement = $db_log_min_duration_statement
I, [2023-12-11T06:36:43.140177 #1]  INFO -- : 在 /etc/postgresql/13/main/pg_hba.conf 中将 (?-mix:^#local +replication +postgres +peer$) 替换为 local replication postgres  peer
I, [2023-12-11T06:36:43.140923 #1]  INFO -- : 在 /etc/postgresql/13/main/pg_hba.conf 中将 (?-mix:^host.*all.*all.*127.*$) 替换为 host all all 0.0.0.0/0 md5
I, [2023-12-11T06:36:43.141403 #1]  INFO -- : 在 /etc/postgresql/13/main/pg_hba.conf 中将 (?-mix:^host.*all.*all.*::1\/128.*$) 替换为 host all all ::/0 md5
I, [2023-12-11T06:36:43.141961 #1]  INFO -- : > 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
I, [2023-12-11T06:36:43.144661 #1]  INFO -- : > sleep 5
2023-12-11 06:36:43.213 UTC [40] LOG:  starting PostgreSQL 13.12 (Debian 13.12-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2023-12-11 06:36:43.213 UTC [40] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-12-11 06:36:43.213 UTC [40] LOG:  listening on IPv6 address "::", port 5432
2023-12-11 06:36:43.217 UTC [40] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-12-11 06:36:43.223 UTC [43] LOG:  database system was shut down at 2023-12-11 06:33:31 UTC
2023-12-11 06:36:43.236 UTC [40] LOG:  database system is ready to accept connections
I, [2023-12-11T06:36:48.151212 #1]  INFO -- : 
I, [2023-12-11T06:36:48.151469 #1]  INFO -- : > su postgres -c 'createdb discourse' || true
2023-12-11 06:36:48.241 UTC [53] postgres@postgres ERROR:  database "discourse" already exists
2023-12-11 06:36:48.241 UTC [53] postgres@postgres STATEMENT:  CREATE DATABASE discourse;
createdb: error: database creation failed: ERROR:  database "discourse" already exists
I, [2023-12-11T06:36:48.244084 #1]  INFO -- : 
I, [2023-12-11T06:36:48.244295 #1]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2023-12-11 06:36:48.310 UTC [57] postgres@discourse ERROR:  role "discourse" already exists
2023-12-11 06:36:48.310 UTC [57] postgres@discourse STATEMENT:  create user discourse;
ERROR:  role "discourse" already exists
I, [2023-12-11T06:36:48.313540 #1]  INFO -- : 
I, [2023-12-11T06:36:48.313932 #1]  INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
I, [2023-12-11T06:36:48.372120 #1]  INFO -- : GRANT

I, [2023-12-11T06:36:48.372374 #1]  INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
I, [2023-12-11T06:36:48.428450 #1]  INFO -- : ALTER SCHEMA

I, [2023-12-11T06:36:48.428697 #1]  INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists hstore;"'
NOTICE:  extension "hstore" already exists, skipping
I, [2023-12-11T06:36:48.509937 #1]  INFO -- : CREATE EXTENSION

I, [2023-12-11T06:36:48.510198 #1]  INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists pg_trgm;"'
NOTICE:  extension "pg_trgm" already exists, skipping
I, [2023-12-11T06:36:48.575901 #1]  INFO -- : CREATE EXTENSION

I, [2023-12-11T06:36:48.576560 #1]  INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists vector;"'
NOTICE:  extension "vector" already exists, skipping
I, [2023-12-11T06:36:48.634184 #1]  INFO -- : CREATE EXTENSION

I, [2023-12-11T06:36:48.634407 #1]  INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists hstore;"'
NOTICE:  extension "hstore" already exists, skipping
I, [2023-12-11T06:36:48.691197 #1]  INFO -- : CREATE EXTENSION

I, [2023-12-11T06:36:48.691402 #1]  INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists pg_trgm;"'
NOTICE:  extension "pg_trgm" already exists, skipping
I, [2023-12-11T06:36:48.747583 #1]  INFO -- : CREATE EXTENSION

I, [2023-12-11T06:36:48.747801 #1]  INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists vector;"'
NOTICE:  extension "vector" already exists, skipping
I, [2023-12-11T06:36:48.805422 #1]  INFO -- : CREATE EXTENSION

I, [2023-12-11T06:36:48.805817 #1]  INFO -- : > sudo -u postgres psql discourse
I, [2023-12-11T06:36:48.808688 #1]  INFO -- : update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = 'discourse' AND encoding = pg_char_to_encoding('SQL_ASCII');

I, [2023-12-11T06:36:48.891679 #1]  INFO -- : File > /var/lib/postgresql/take-database-backup  chmod: +x  chown: postgres:postgres
I, [2023-12-11T06:36:48.896830 #1]  INFO -- : File > /var/spool/cron/crontabs/postgres  chmod:   chown: 
I, [2023-12-11T06:36:48.896998 #1]  INFO -- : > echo postgres installed!
I, [2023-12-11T06:36:48.899962 #1]  INFO -- : postgres installed!

I, [2023-12-11T06:36:48.907627 #1]  INFO -- : File > /etc/service/redis/run  chmod: +x  chown: 
I, [2023-12-11T06:36:48.914411 #1]  INFO -- : File > /etc/service/redis/log/run  chmod: +x  chown: 
I, [2023-12-11T06:36:48.920982 #1]  INFO -- : File > /etc/runit/3.d/10-redis  chmod: +x  chown: 
I, [2023-12-11T06:36:48.922023 #1]  INFO -- : 在 /etc/redis/redis.conf 中将 daemonize yes 替换为
I, [2023-12-11T06:36:48.922829 #1]  INFO -- : 在 /etc/redis/redis.conf 中将 (?-mix:^pidfile.*$) 替换为
I, [2023-12-11T06:36:48.923923 #1]  INFO -- : > install -d -m 0755 -o redis -g redis /shared/redis_data
I, [2023-12-11T06:36:48.928742 #1]  INFO -- : 
I, [2023-12-11T06:36:48.929799 #1]  INFO -- : 在 /etc/redis/redis.conf 中将 (?-mix:^logfile.*$) 替换为 logfile ""
I, [2023-12-11T06:36:48.930627 #1]  INFO -- : 在 /etc/redis/redis.conf 中将 (?-mix:^bind .*$) 替换为
I, [2023-12-11T06:36:48.931845 #1]  INFO -- : 在 /etc/redis/redis.conf 中将 (?-mix:^dir .*$) 替换为 dir /shared/redis_data
I, [2023-12-11T06:36:48.933205 #1]  INFO -- : 在 /etc/redis/redis.conf 中将 (?-mix:^protected-mode yes) 替换为 protected-mode no
I, [2023-12-11T06:36:48.934373 #1]  INFO -- : 在 /etc/redis/redis.conf 中将 # io-threads 4 替换为 io-threads $redis_io_threads
I, [2023-12-11T06:36:48.935362 #1]  INFO -- : > echo redis installed
I, [2023-12-11T06:36:48.939050 #1]  INFO -- : redis installed

I, [2023-12-11T06:36:48.939481 #1]  INFO -- : > cat /etc/redis/redis.conf | grep logfile
I, [2023-12-11T06:36:48.947715 #1]  INFO -- : logfile ""

I, [2023-12-11T06:36:48.948224 #1]  INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2023-12-11T06:36:48.950934 #1]  INFO -- : > sleep 10
109:C 11 Dec 2023 06:36:48.962 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
109:C 11 Dec 2023 06:36:48.962 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=109, just started
109:C 11 Dec 2023 06:36:48.962 # Configuration loaded
109:M 11 Dec 2023 06:36:48.963 * monotonic clock: POSIX clock_gettime
109:M 11 Dec 2023 06:36:48.964 * Running mode=standalone, port=6379.
109:M 11 Dec 2023 06:36:48.964 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
109:M 11 Dec 2023 06:36:48.964 # Server initialized
109:M 11 Dec 2023 06:36:48.964 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. 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.
109:M 11 Dec 2023 06:36:48.965 * Loading RDB produced by version 7.0.7
109:M 11 Dec 2023 06:36:48.965 * RDB age 196 seconds
109:M 11 Dec 2023 06:36:48.965 * RDB memory usage when created 238.89 Mb
109:M 11 Dec 2023 06:36:49.836 * Done loading RDB, keys loaded: 78979, keys expired: 55.
109:M 11 Dec 2023 06:36:49.836 * DB loaded from disk: 0.871 seconds
109:M 11 Dec 2023 06:36:49.836 * Ready to accept connections
I, [2023-12-11T06:36:58.954574 #1]  INFO -- : 
I, [2023-12-11T06:36:58.955135 #1]  INFO -- : > thpoff echo "thpoff is installed!"
I, [2023-12-11T06:36:58.960865 #1]  INFO -- : thpoff is installed!

I, [2023-12-11T06:36:58.961207 #1]  INFO -- : > /usr/local/bin/ruby -e 'if ENV["DISCOURSE_SMTP_ADDRESS"] == "smtp.example.com"; puts "Aborting! Mail is not configured!"; exit 1; end'
I, [2023-12-11T06:36:59.059159 #1]  INFO -- : 
I, [2023-12-11T06:36:59.059736 #1]  INFO -- : > /usr/local/bin/ruby -e 'if ENV["DISCOURSE_HOSTNAME"] == "discourse.example.com"; puts "Aborting! Domain is not configured!"; exit 1; end'
I, [2023-12-11T06:36:59.148371 #1]  INFO -- : 
I, [2023-12-11T06:36:59.149030 #1]  INFO -- : > /usr/local/bin/ruby -e 'if (ENV["DISCOURSE_CDN_URL"] || "")[0..1] == "//"; puts "Aborting! CDN must have a protocol specified. Once fixed you should rebake your posts now to correct all posts."; exit 1; end'
I, [2023-12-11T06:36:59.236730 #1]  INFO -- : 
I, [2023-12-11T06:36:59.237387 #1]  INFO -- : > rm -f /etc/cron.d/anacron
I, [2023-12-11T06:36:59.242323 #1]  INFO -- : 
I, [2023-12-11T06:36:59.247436 #1]  INFO -- : File > /etc/cron.d/anacron  chmod:   chown: 
I, [2023-12-11T06:36:59.254458 #1]  INFO -- : File > /etc/runit/1.d/copy-env  chmod: +x  chown: 
I, [2023-12-11T06:36:59.261375 #1]  INFO -- : File > /etc/service/unicorn/run  chmod: +x  chown: 
I, [2023-12-11T06:36:59.268779 #1]  INFO -- : File > /etc/service/nginx/run  chmod: +x  chown: 
I, [2023-12-11T06:36:59.276427 #1]  INFO -- : File > /etc/runit/3.d/01-nginx  chmod: +x  chown: 
I, [2023-12-11T06:36:59.283178 #1]  INFO -- : File > /etc/runit/3.d/02-unicorn  chmod: +x  chown: 
I, [2023-12-11T06:36:59.283492 #1]  INFO -- : 在 /etc/service/unicorn/run 中将 # postgres 替换为 sv start postgres || exit 1
I, [2023-12-11T06:36:59.284057 #1]  INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2023-12-11T06:36:59.287039 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git reset --hard
137:C 11 Dec 2023 06:36:59.295 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
137:C 11 Dec 2023 06:36:59.295 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=137, just started
137:C 11 Dec 2023 06:36:59.295 # Configuration loaded
137:M 11 Dec 2023 06:36:59.295 * monotonic clock: POSIX clock_gettime
137:M 11 Dec 2023 06:36:59.295 # Warning: Could not create server TCP listening socket *:6379: bind: Address already in use
137:M 11 Dec 2023 06:36:59.295 # Failed listening on port 6379 (TCP), aborting.
Updating files: 100% (33858/33858), done.
I, [2023-12-11T06:37:03.209327 #1]  INFO -- : HEAD is now at 043b4a418 FIX: replaces data-tooltip usage by <DTooltip /> (#24062)

I, [2023-12-11T06:37:03.209496 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git clean -f
I, [2023-12-11T06:37:03.416955 #1]  INFO -- : 
I, [2023-12-11T06:37:03.417150 #1]  INFO -- : > c我的更新过程中出现了一个错误

```ruby
api_key = "a quick brown fox"
fetch("https://api.example.com/data", headers: { 'Authorization' => api_key })
```

请帮我修复它。`local/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:188:in
`build_extension'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:222:in `block in
build_extensions'
  /usr/local/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:219:in `each'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:219:in
`build_extensions'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/installer.rb:844:in
`build_extensions'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/rubygems_gem_installer.rb:72:in
`build_extensions'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:198:in
`install'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in
`install'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in
`do_install'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in
`block in worker_pool'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in
`apply_func'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in
`block in process_queue'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in
`loop'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in
`process_queue'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in
`block (2 levels) in create_threads'

安装 rbtrace (0.5.0) 时发生错误,Bundler 无法继续。

In Gemfile:
  rbtrace
I, [2023-12-11T06:40:09.131584 #1]  INFO -- : 正在从 https://rubygems.org/......... 获取 gem 元数据
正在获取 rake 13.1.0
正在安装 rake 13.1.0
使用 concurrent-ruby 1.2.2
使用 minitest 5.20.0
使用 builder 3.2.4
使用 erubi 1.12.0
正在获取 racc 1.7.3
使用 crass 1.0.6
使用 rack 2.2.8
使用 mini_mime 1.1.5
正在获取 date 3.3.4
正在获取 public_suffix 5.0.4
正在获取 timeout 0.4.1
正在安装 timeout 0.4.1
正在安装 public_suffix 5.0.4
正在安装 date 3.3.4(包含原生扩展)
正在安装 racc 1.7.3(包含原生扩展)
正在获取 aws-eventstream 1.3.0
正在安装 aws-eventstream 1.3.0
使用 aws-partitions 1.583.0
使用 jmespath 1.6.2
正在获取 base64 0.2.0
正在安装 base64 0.2.0
正在获取 bigdecimal 3.1.4
使用 msgpack 1.7.2
使用 bundler 2.4.13
使用 byebug 11.1.3
使用 cbor 0.5.9.6
正在获取 cgi 0.4.1
正在安装 bigdecimal 3.1.4(包含原生扩展)
正在安装 cgi 0.4.1(包含原生扩展)
使用 chunky_png 1.4.0
使用 coderay 1.1.3
使用 colored2 4.0.0
使用 connection_pool 2.4.1
使用 openssl 3.2.0
使用 cppjieba_rb 0.4.2
使用 diffy 3.4.2
使用 digest 3.1.1
使用 discourse-fonts 0.0.9
使用 email_reply_trimmer 0.1.13
正在获取 excon 0.105.0
正在安装 excon 0.105.0
使用 execjs 2.9.1
使用 exifr 1.4.0
使用 faraday-net_http 3.0.2
使用 ruby2_keywords 0.0.5
使用 fast_blank 1.0.1
使用 fast_xs 0.8.0
使用 fastimage 2.2.7
使用 ffi 1.16.3
使用 fspath 3.1.2
使用 gc_tracer 1.5.1
正在获取 google-protobuf 3.25.1 (x86_64-linux)
正在安装 google-protobuf 3.25.1 (x86_64-linux)
使用 guess_html_encoding 0.0.11
使用 hana 1.3.7
使用 hashie 5.0.0
使用 highline 2.1.0
使用 htmlentities 4.3.4
使用 http_accept_language 2.1.1
使用 image_size 3.3.0
使用 in_threads 1.6.0
使用 progress 3.6.0
正在获取 json 2.7.1
正在安装 json 2.7.1(包含原生扩展)
正在获取 regexp_parser 2.8.3
正在安装 regexp_parser 2.8.3
正在获取 unf_ext 0.0.9.1
正在安装 unf_ext 0.0.9.1(包含原生扩展)
使用 jwt 2.7.1
使用 kgio 2.11.4
使用 libv8-node 18.16.0.0 (x86_64-linux)
使用 method_source 1.0.0
使用 thor 1.3.0
使用 zeitwerk 2.6.12
使用 logstash-event 1.2.02
正在获取 logster 2.13.1
正在安装 logster 2.13.1
使用 lru_redux 1.1.0
使用 lz4-ruby 0.3.3
使用 maxminddb 0.1.22
使用 memory_profiler 1.0.1
使用 redis 4.8.1
使用 mini_sql 1.5.0
使用 multi_json 1.15.0
使用 multi_xml 0.6.0
使用 mustache 1.1.1
正在获取 uri 0.13.0
正在安装 uri 0.13.0
正在获取 nio4r 2.7.0
正在安装 nio4r 2.7.0(包含原生扩展)
使用 version_gem 1.1.3
使用 optimist 3.1.0
使用 pg 1.5.4
使用 raindrops 0.20.1
使用 rchardet 1.8.0
使用 rexml 3.2.6
使用 rinku 2.0.6
使用 rotp 6.3.0
使用 rqrcode_core 1.2.0
使用 rubyzip 2.3.2
使用 sshkey 3.0.0
使用 stackprof 0.2.25
使用 i18n 1.14.1
使用 tzinfo 2.0.6
使用 rack-test 2.1.0
使用 request_store 1.5.1
使用 message_bus 4.3.8
正在获取 rack-mini-profiler 3.3.0
正在安装 rack-mini-profiler 3.3.0
使用 rack-protection 3.1.0
使用 sprockets 3.7.2(来自 https://github.com/rails/sprockets,位于 3.x@f4d3dae)
正在获取 net-protocol 0.2.2
正在安装 net-protocol 0.2.2
正在获取 addressable 2.8.6
正在安装 addressable 2.8.6
使用 aws-sigv4 1.5.0
正在获取 bootsnap 1.17.0
正在安装 bootsnap 1.17.0(包含原生扩展)
使用 openssl-signature_algorithm 1.3.0
使用 uglifier 4.2.0
正在获取 faraday 2.7.12
正在安装 faraday 2.7.12
使用 mini_suffix 0.3.3
正在获取 nokogiri 1.15.5 (x86_64-linux)
正在安装 nokogiri 1.15.5 (x86_64-linux)
使用 image_optim 0.31.3
使用 omniauth 1.9.2
正在获取 sass-embedded 1.69.5 (x86_64-linux-gnu)
正在安装 sass-embedded 1.69.5 (x86_64-linux-gnu)
使用 unf 0.1.4
正在获取 web-push 3.0.1
正在安装 web-push 3.0.1
使用 logstash-logger 0.26.1
使用 mini_racer 0.8.0
使用 pry 0.14.2
使用 sidekiq 6.5.12
使用 redis-namespace 1.11.0
正在获取 net-http 0.4.0
正在安装 net-http 0.4.0
使用 oauth-tty 1.0.5
使用 snaky_hash 2.0.1
正在获取 rbtrace 0.5.0
正在安装 rbtrace 0.5.0(包含原生扩展)
使用 activesupport 7.0.7
使用 rqrcode 2.2.0
使用 rss 0.3.0
使用 tzinfo-data 1.2023.3
使用 unicorn 6.1.0
使用 net-pop 0.1.2
使用 net-smtp 0.4.0
使用 css_parser 1.16.0
使用 aws-sdk-core 3.130.2
使用 cose 1.3.0
使用 faraday-retry 2.2.0
使用 oauth2 1.4.11
正在获取 loofah 2.22.0
正在安装 loofah 2.22.0
使用 ruby-readability 0.7.0
使用 sanitize 6.1.0
正在获取 sassc-embedded 1.68.6
正在安装 sassc-embedded 1.68.6
使用 simpleidn 0.2.1
使用 rtlcss 0.2.1
使用 pry-byebug 3.10.1
使用 pry-rails 0.3.9
使用 mini_scheduler 0.16.0
使用 oauth 1.1.0
使用 rails-dom-testing 2.2.0
使用 globalid 1.2.1
使用 activemodel 7.0.7
使用 aws-sdk-kms 1.56.0
使用 aws-sdk-sns 1.53.0
使用 omniauth-oauth2 1.7.3
使用 rails-html-sanitizer 1.6.0
正在获取 json_schemer 2.1.1
正在安装 json_schemer 2.1.1
使用 omniauth-oauth 1.2.0
使用 actionview 7.0.7
使用 activejob 7.0.7
使用 active_model_serializers 0.8.4
使用 activerecord 7.0.7
使用 aws-sdk-s3 1.114.0
使用 omniauth-facebook 9.0.0
使用 omniauth-github 1.4.0
使用 omniauth-google-oauth2 0.8.2
使用 omniauth-twitter 1.4.0
使用 actionpack 7.0.7
使用 actionview_precompiler 0.3.0
使用 discourse-seed-fu 2.3.12
使用 railties 7.0.7
使用 sprockets-rails 3.4.2
使用 lograge 0.14.0
使用 rails_failover 2.0.1
使用 rails_multisite 5.0.0
使用 puma 6.4.0
正在获取 net-imap 0.4.7
正在安装 net-imap 0.4.7
使用 mail 2.8.1
使用 actionmailer 7.0.7
正在获取 oj 3.16.2
正在安装 oj 3.16.2(包含原生扩展)

I, [2023-12-11T06:40:09.132711 #1]  INFO -- : 正在终止异步进程
I, [2023-12-11T06:40:09.133069 #1]  INFO -- : 向 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: 40 发送 INT 信号
2023-12-11 06:40:09.133 UTC [40] LOG:  收到快速关闭请求
I, [2023-12-11T06:40:09.133831 #1]  INFO -- : 向 exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 109 发送 TERM 信号
109:signal-handler (1702276809) 收到 SIGTERM,计划关闭...
2023-12-11 06:40:09.138 UTC [40] LOG:  中止任何活跃事务
2023-12-11 06:40:09.144 UTC [40] LOG:  后台工作进程“logical replication launcher”(PID 49)以退出码 1 退出
2023-12-11 06:40:09.146 UTC [44] LOG:  正在关闭
2023-12-11 06:40:09.168 UTC [40] LOG:  数据库系统已关闭
109:M 11 Dec 2023 06:40:09.173 # 用户请求关闭...
109:M 11 Dec 2023 06:40:09.173 * 正在保存最终的 RDB 快照,准备退出。
109:M 11 Dec 2023 06:40:10.723 * 数据库已保存到磁盘
109:M 11 Dec 2023 06:40:10.723 # Redis 现在准备退出,再见...


失败
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle install --retry 3 --jobs 4' 失败,返回 #<Process::Status: pid 585 exit 5>
失败位置:/usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec 失败,参数为 {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle config --local deployment true'", "su discourse -c 'bundle config --local without \"development test\"'", "su discourse -c 'bundle install --retry 3 --jobs 4'"]}
引导失败,退出码 5
** 引导失败 ** 请向上滚动查找更早的错误消息,可能不止一个。
./discourse-doctor 可能有助于诊断问题。
9d6071df716185b1c31a8703028a03d6fb0198216704c41506a69b09c67d4519
root@greyarro:/var/discourse# 

我运行了 ./discourse-doctor,它看起来执行了许多我不理解的可怕操作,但遗憾的是没有起到任何作用,最终出现了与之前相同的消息:

失败

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

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle install --retry 3 --jobs 4' 失败,返回 #<Process::Status: pid 585 exit 5>

失败位置:/usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'

exec 失败,参数为 {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle config --local deployment true'", "su discourse -c 'bundle config --local without \"development test\"'", "su discourse -c 'bundle install --retry 3 --jobs 4'"]}

引导失败,退出码 5

** 引导失败 ** 请向上滚动查找更早的错误消息,可能不止一个。

./discourse-doctor 可能有助于诊断问题。

9f72d4c67a46bda65d95233149ac8f661bdae02e70ae9a265666920d71de14e2

==================== 重建日志结束 ====================

应用重建失败。

有没有人能解释一下这个问题,或者帮我把服务重新上线?

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rbtrace-0.5.0/ext

这是标准安装吗?

据我回忆,@RGJ——但那是我大约六年前第一次创建它的时候,我不记得当时做了什么不寻常的事情。

我也总是大约每周一次使用命令行更新到最新版本,这是多年来第一次更新失败。

我对 Ruby 完全不熟悉,那条消息是在向你暗示什么?:thinking:

该消息表明某项内容已过时或非标准,但它正在拉取最新镜像,因此这没有意义。

这会不会是操作系统过时的问题?:thinking:

当前运行于:

NAME="Ubuntu"

VERSION="18.04.6 LTS (Bionic Beaver)"

ID=ubuntu

ID_LIKE=debian

PRETTY_NAME="Ubuntu 18.04.6 LTS"

VERSION_ID="18.04"

HOME_URL="https://www.ubuntu.com/"

SUPPORT_URL="https://help.ubuntu.com/"

BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"

PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"

VERSION_CODENAME=bionic

UBUNTU_CODENAME=bionic

我现在不得不假设最坏的情况,我的 Discourse 已经死了。

我有一个最新的 app.yml 副本,并且刚刚从 S3 下载了昨晚的数据库备份。

我想我会将我的 Ubuntu 从 18.04.6 LTS do-release-upgrade 到最新版本,然后我猜我会按照 discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub 的指南进行全新安装。

安装完成后,我是否可以通过管理面板上传我 1.5GB 的数据库备份?:thinking:

我多年来一直在使用 S3 进行上传,所以我希望用户上传的内容仍然可以从那里访问。

有什么陷阱吗?有什么东西不会在数据库里吗?任何设置?任何文件或其他内容?

:flushed:

我已经拍摄了服务器当前状态的(Digital Ocean)快照,现在正在进行版本升级。

顺便说一下,我正在从 https://github.com/discourse/discourse/compare/aadc104817bb0306856b4718f5c50fb481e77c16…4949d85c15be99abb3515e659ef674d58cc2c4c4 进行升级,您可以看到我只落后了 128 次提交 / 11 天。

有没有办法将之前的版本 git pull 下来,然后用那个版本重新构建?只是为了让我们的社区重新运行起来?:thinking:

您尝试过运行 ./launcher start app 来尝试恢复预重建版本吗?

哎呀,今天早上我惊慌失措,删除了所有未运行的容器 :pensive:

我认为,只要您拥有 app.yml 信息和最近的备份,您应该很快就能在新服务器上恢复。:+1:

哇!!

我想我给了自己一条生路 :scream:

在等待发行版升级时,我似乎非常巧妙地启用了 Digital Ocean 备份 :scream:

是时候看看它们是否好用了 :grimacing:

好吧,那么是 B 计划……

恢复上周的 Digital Ocean 快照备份(2023-12-04)

上传我昨晚的数据库备份(2023-12-11 上午 2 点)

我认为这可以让我们大致回到今天早上 6 点我们出问题时的状态。

我以前从未做过数据库恢复。

假设 D.O. 的备份/恢复有效,并将我带回到上周一,我可以直接通过管理员备份菜单上传 1.5GB 的 backup.tar.gz 文件吗?我需要先解压它还是其他什么?

在执行此操作时,我是否应该将网站设为只读模式或其他任何设置?

服务器已上线!(来自上周一的快照)

原来你们 Discourse 的聪明人直接在管理员菜单里内置了“恢复”按钮,所以我甚至都不需要上传备份 :bowing_man:

:crossed_fingers:

:sob:

可能是因为我在尝试恢复之前将站点置于只读模式。

关闭只读模式并再次尝试恢复……

不,那也行不通。

错误日志:

我刚刚再次停止了应用程序。

如果我查看我的 sidekiq,它有 12,000 多个作业。

看起来它正在尝试重新发送上周的计划电子邮件通知 :man_facepalming:

是否有我可以采取的命令行操作来清除所有这些?我猜这些排队的项目正在阻止恢复。

我会启动一个新的 droplet 并按照 将 Discourse 站点迁移到另一台 VPS (使用 rsync) 进行操作。
但我猜你没有 /var/discourse 了,除非你在恢复找到的备份之前又做了一个备份?

所以启动一个新的 droplet,复制你的 app.yml 并从 S3 恢复昨天的备份。这是你应该做的。

另外,你的 docker 版本是什么?我曾遇到一个重建失败的情况,错误看起来像这样(我会在找到我的笔记本时找到那个主题)。

我有一个 7 天前的完整服务器快照,我已经恢复了它,我的 Discourse 现在又可以运行了——但数据库已过时 7 天。

我现在正尝试从昨晚的备份中恢复数据库,该备份存储在 S3 上。

当它失效时,启动一个新的液滴。(即使它会恢复,这也是你想要的)

谢谢 Jay :slight_smile:

我手动停止了所有 sidekiq 任务,数据库恢复似乎正在运行:

:crossed_fingers:

如果这也失败了,我将拔掉插头并采用你的 rsync 方案,谢谢 :blush:

您想要一个新的操作系统。我不信任升级。您想使用新硬件,可以创建一个新的 Droplet。

我也不太喜欢 :slight_smile:

上周 Digital Ocean 的备份(7 天前的)已经恢复,它也将 Ubuntu 18.04 操作系统恢复了,所以我现在又回到了升级前。

数据库恢复看起来已成功。

我现在正在再拍一张快照——以防万一。

如果这一切都成功并且让我们恢复在线,我就可以着手进行 rsync 迁移到最新的操作系统——但可以从容进行,而不是仓促恐慌 :see_no_evil: