因所有权问题而失败的维护不善服务器重建 - 寻求帮助

我的更新过程中出现了错误

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

请帮我修复它。

Heathrow 机场关闭:伦敦机场经理称,航班停飞预计将在未来几天内持续

来自 BBC 网站

英国航空估计,周六其计划航班的 85% 将得以执行,但所有航班均出现延误。格林尼治标准时间上午 7 点,大多数起飞航班按预期进行,但在到达航班中,前 20 架计划降落的航班中有 9 架被取消。

我们非常高兴你能来!想运行自己的 Minecraft 服务器吗?只需点击下方的“开始使用”按钮——非常简单。

他提出了一种所谓的“干净”架构用于新服务。但“干净”并不总是意味着“简单”。

您好,感谢阅读!我们的社区失去了主要的技术管理员,因此在许多方面为我们造成了单点故障。最近,一位管理员注意到事务性邮件不再送达,而我是唯一拥有系统管理经验的活跃成员。

然而,有一位成员拥有我们云服务器的所有权并负责付款,因此我们获得了 Discourse 服务器的 root 访问权限。

我们最初认为可以进行本地备份,但由于配置了 S3,本地备份步骤无法工作,且我们最后的本地备份停留在 2019 年。

虽然 S3 上的备份最近至上周,但我们无法访问 S3 存储桶。我们剩余的管理员据称会收到邮件,但他能否在没有 S3 身份验证的情况下下载这些邮件仍是一个未解之谜。

此时,我们决定要么尝试重建,要么将邮件服务重新配置到新的 SendGrid 账户——我们之前已经在使用 SendGrid,但不知道相关信息。

我决定尝试重建,因为不知为何,在我看来,这似乎是解决潜在错误更可靠的选项,而且最终也是必须的。

重建失败,输出如下:

==================== REBUILD LOG ====================
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 has diverged source, this is only expected in Dev mode
Stopping old container
+ /usr/bin/docker stop -t 60 app
app
2.0.20230313-1023: Pulling from discourse/base
Digest: sha256:f7467469ab9e39c3548d4478e3f416c05b34a0ee58eb6e40b963e562005669cc
Status: Image is up to date for discourse/base:2.0.20230313-1023
docker.io/discourse/base:2.0.20230313-1023
/usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2025-03-23T00:18:18.600612 #1]  INFO -- : Reading from stdin
I, [2025-03-23T00:18:18.607987 #1]  INFO -- : > locale-gen $LANG && update-locale
I, [2025-03-23T00:18:18.693415 #1]  INFO -- : Generating locales (this might take a while)...
Generation complete.

I, [2025-03-23T00:18:18.693711 #1]  INFO -- : > mkdir -p /shared/postgres_run
I, [2025-03-23T00:18:18.699738 #1]  INFO -- :
I, [2025-03-23T00:18:18.700585 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2025-03-23T00:18:18.705669 #1]  INFO -- :
I, [2025-03-23T00:18:18.706036 #1]  INFO -- : > chmod 775 /shared/postgres_run
I, [2025-03-23T00:18:18.710603 #1]  INFO -- :
I, [2025-03-23T00:18:18.710840 #1]  INFO -- : > rm -fr /var/run/postgresql
I, [2025-03-23T00:18:18.715934 #1]  INFO -- :
I, [2025-03-23T00:18:18.716265 #1]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2025-03-23T00:18:18.720901 #1]  INFO -- :
I, [2025-03-23T00:18:18.721141 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2025/03/23 00:18:18 socat[19] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2025-03-23T00:18:18.735107 #1]  INFO -- :
I, [2025-03-23T00:18:18.735305 #1]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2025-03-23T00:18:18.741065 #1]  INFO -- :
I, [2025-03-23T00:18:18.741225 #1]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2025-03-23T00:18:18.747157 #1]  INFO -- :
I, [2025-03-23T00:18:18.747321 #1]  INFO -- : > mkdir -p /shared/postgres_run/13-main.pg_stat_tmp
I, [2025-03-23T00:18:18.752360 #1]  INFO -- :
I, [2025-03-23T00:18:18.752671 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run/13-main.pg_stat_tmp
I, [2025-03-23T00:18:18.758084 #1]  INFO -- :
I, [2025-03-23T00:18:18.768877 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown:
I, [2025-03-23T00:18:18.778907 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown:
I, [2025-03-23T00:18:18.788505 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown:
I, [2025-03-23T00:18:18.799277 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown:
I, [2025-03-23T00:18:18.799808 #1]  INFO -- : > chown -R root /var/lib/postgresql/13/main
I, [2025-03-23T00:18:19.007579 #1]  INFO -- :
I, [2025-03-23T00:18:19.007806 #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, [2025-03-23T00:18:19.010768 #1]  INFO -- :
I, [2025-03-23T00:18:19.010931 #1]  INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2025-03-23T00:18:19.047929 #1]  INFO -- :
I, [2025-03-23T00:18:19.048161 #1]  INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2025-03-23T00:18:19.051531 #1]  INFO -- :
I, [2025-03-23T00:18:19.051974 #1]  INFO -- : > /root/upgrade_postgres
I, [2025-03-23T00:18:19.062513 #1]  INFO -- :
I, [2025-03-23T00:18:19.062718 #1]  INFO -- : > rm /root/upgrade_postgres
I, [2025-03-23T00:18:19.065696 #1]  INFO -- :
I, [2025-03-23T00:18:19.066378 #1]  INFO -- : Replacing data_directory = '/var/lib/postgresql/13/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/13/main/postgresql.conf
I, [2025-03-23T00:18:19.067338 #1]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/13/main/postgresql.conf
I, [2025-03-23T00:18:19.067801 #1]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/13/main/postgresql.conf
I, [2025-03-23T00:18:19.068343 #1]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/13/main/postgresql.conf
I, [2025-03-23T00:18:19.068760 #1]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/13/main/postgresql.conf
I, [2025-03-23T00:18:19.069202 #1]  INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/13/main/postgresql.conf
I, [2025-03-23T00:18:19.069589 #1]  INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2025-03-23T00:18:19.075219 #1]  INFO -- :
I, [2025-03-23T00:18:19.075772 #1]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/13/main/postgresql.conf
I, [2025-03-23T00:18:19.076190 #1]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/13/main/postgresql.conf
I, [2025-03-23T00:18:19.076722 #1]  INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/13/main/postgresql.conf
I, [2025-03-23T00:18:19.077185 #1]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/13/main/pg_hba.conf
I, [2025-03-23T00:18:19.077661 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2025-03-23T00:18:19.078027 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2025-03-23T00:18:19.078404 #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, [2025-03-23T00:18:19.080855 #1]  INFO -- : > sleep 5
2025-03-23 00:18:19.198 UTC [42] LOG:  starting PostgreSQL 13.10 (Debian 13.10-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2025-03-23 00:18:19.199 UTC [42] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2025-03-23 00:18:19.199 UTC [42] LOG:  listening on IPv6 address "::", port 5432
2025-03-23 00:18:19.205 UTC [42] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-03-23 00:18:19.214 UTC [45] LOG:  database system was shut down at 2025-03-23 00:03:12 UTC
2025-03-23 00:18:19.229 UTC [42] LOG:  database system is ready to accept connections
I, [2025-03-23T00:18:24.084187 #1]  INFO -- :
I, [2025-03-23T00:18:24.084488 #1]  INFO -- : > su postgres -c 'createdb discourse' || true
2025-03-23 00:18:24.204 UTC [55] postgres@postgres ERROR:  database "discourse" already exists
2025-03-23 00:18:24.204 UTC [55] postgres@postgres STATEMENT:  CREATE DATABASE discourse;
createdb: error: database creation failed: ERROR:  database "discourse" already exists
I, [2025-03-23T00:18:24.207833 #1]  INFO -- :
I, [2025-03-23T00:18:24.208363 #1]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2025-03-23 00:18:24.305 UTC [59] postgres@discourse ERROR:  role "discourse" already exists
2025-03-23 00:18:24.305 UTC [59] postgres@discourse STATEMENT:  create user discourse;
ERROR:  role "discourse" already exists
I, [2025-03-23T00:18:24.309053 #1]  INFO -- :
I, [2025-03-23T00:18:24.309640 #1]  INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
I, [2025-03-23T00:18:24.419882 #1]  INFO -- : GRANT

I, [2025-03-23T00:18:24.420493 #1]  INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
I, [2025-03-23T00:18:24.517946 #1]  INFO -- : ALTER SCHEMA

I, [2025-03-23T00:18:24.518418 #1]  INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists hstore;"'
NOTICE:  extension "hstore" already exists, skipping
I, [2025-03-23T00:18:24.625671 #1]  INFO -- : CREATE EXTENSION

I, [2025-03-23T00:18:24.626326 #1]  INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists pg_trgm;"'
NOTICE:  extension "pg_trgm" already exists, skipping
I, [2025-03-23T00:18:24.725233 #1]  INFO -- : CREATE EXTENSION

I, [2025-03-23T00:18:24.725801 #1]  INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists hstore;"'
NOTICE:  extension "hstore" already exists, skipping
I, [2025-03-23T00:18:24.827529 #1]  INFO -- : CREATE EXTENSION

I, [2025-03-23T00:18:24.828107 #1]  INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists pg_trgm;"'
NOTICE:  extension "pg_trgm" already exists, skipping
I, [2025-03-23T00:18:24.931702 #1]  INFO -- : CREATE EXTENSION

I, [2025-03-23T00:18:24.932258 #1]  INFO -- : > sudo -u postgres psql discourse
I, [2025-03-23T00:18:24.935282 #1]  INFO -- : update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = 'discourse' AND encoding = pg_char_to_encoding('SQL_ASCII');

I, [2025-03-23T00:18:25.031195 #1]  INFO -- : File > /var/lib/postgresql/take-database-backup  chmod: +x  chown: postgres:postgres
I, [2025-03-23T00:18:25.037342 #1]  INFO -- : File > /var/spool/cron/crontabs/postgres  chmod:   chown:
I, [2025-03-23T00:18:25.037745 #1]  INFO -- : > echo postgres installed!
I, [2025-03-23T00:18:25.042262 #1]  INFO -- : postgres installed!

I, [2025-03-23T00:18:25.052240 #1]  INFO -- : File > /etc/service/redis/run  chmod: +x  chown:
I, [2025-03-23T00:18:25.061161 #1]  INFO -- : File > /etc/service/redis/log/run  chmod: +x  chown:
I, [2025-03-23T00:18:25.070080 #1]  INFO -- : File > /etc/runit/3.d/10-redis  chmod: +x  chown:
I, [2025-03-23T00:18:25.070956 #1]  INFO -- : Replacing daemonize yes with  in /etc/redis/redis.conf
I, [2025-03-23T00:18:25.072697 #1]  INFO -- : Replacing (?-mix:^pidfile.*$) with  in /etc/redis/redis.conf
I, [2025-03-23T00:18:25.073799 #1]  INFO -- : > install -d -m 0755 -o redis -g redis /shared/redis_data
I, [2025-03-23T00:18:25.077931 #1]  INFO -- :
I, [2025-03-23T00:18:25.078752 #1]  INFO -- : Replacing (?-mix:^logfile.*$) with logfile "" in /etc/redis/redis.conf
I, [2025-03-23T00:18:25.080205 #1]  INFO -- : Replacing (?-mix:^bind .*$) with  in /etc/redis/redis.conf
I, [2025-03-23T00:18:25.081472 #1]  INFO -- : Replacing (?-mix:^dir .*$) with dir /shared/redis_data in /etc/redis/redis.conf
I, [2025-03-23T00:18:25.082868 #1]  INFO -- : Replacing (?-mix:^protected-mode yes) with protected-mode no in /etc/redis/redis.conf
I, [2025-03-23T00:18:25.084108 #1]  INFO -- : Replacing # io-threads 4 with io-threads $redis_io_threads in /etc/redis/redis.conf
I, [2025-03-23T00:18:25.085201 #1]  INFO -- : > echo redis installed
I, [2025-03-23T00:18:25.088466 #1]  INFO -- : redis installed

I, [2025-03-23T00:18:25.088953 #1]  INFO -- : > cat /etc/redis/redis.conf | grep logfile
I, [2025-03-23T00:18:25.095957 #1]  INFO -- : logfile ""

I, [2025-03-23T00:18:25.096489 #1]  INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2025-03-23T00:18:25.099538 #1]  INFO -- : > sleep 10
103:C 23 Mar 2025 00:18:25.116 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
103:C 23 Mar 2025 00:18:25.116 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=103, just started
103:C 23 Mar 2025 00:18:25.116 # Configuration loaded
103:M 23 Mar 2025 00:18:25.118 * monotonic clock: POSIX clock_gettime
103:M 23 Mar 2025 00:18:25.120 * Running mode=standalone, port=6379.
103:M 23 Mar 2025 00:18:25.120 # Server initialized
103:M 23 Mar 2025 00:18:25.120 # 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.
103:M 23 Mar 2025 00:18:25.121 * Loading RDB produced by version 7.0.7
103:M 23 Mar 2025 00:18:25.121 * RDB age 913 seconds
103:M 23 Mar 2025 00:18:25.121 * RDB memory usage when created 29.75 Mb
103:M 23 Mar 2025 00:18:25.266 * Done loading RDB, keys loaded: 18090, keys expired: 3.
103:M 23 Mar 2025 00:18:25.266 * DB loaded from disk: 0.145 seconds
103:M 23 Mar 2025 00:18:25.266 * Ready to accept connections
I, [2025-03-23T00:18:35.105146 #1]  INFO -- :
I, [2025-03-23T00:18:35.107388 #1]  INFO -- : > thpoff echo "thpoff is installed!"
I, [2025-03-23T00:18:35.117140 #1]  INFO -- : thpoff is installed!

I, [2025-03-23T00:18:35.118070 #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, [2025-03-23T00:18:35.260647 #1]  INFO -- :
I, [2025-03-23T00:18:35.261530 #1]  INFO -- : > /usr/local/bin/ruby -e 'if ENV["DISCOURSE_HOSTNAME"] == "discourse.example.com"; puts "Aborting! Domain is not configured!"; exit 1; end'
I, [2025-03-23T00:18:35.379994 #1]  INFO -- :
I, [2025-03-23T00:18:35.380922 #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, [2025-03-23T00:18:35.520434 #1]  INFO -- :
I, [2025-03-23T00:18:35.521804 #1]  INFO -- : > rm -f /etc/cron.d/anacron
I, [2025-03-23T00:18:35.527278 #1]  INFO -- :
I, [2025-03-23T00:18:35.533681 #1]  INFO -- : File > /etc/cron.d/anacron  chmod:   chown:
I, [2025-03-23T00:18:35.544400 #1]  INFO -- : File > /etc/runit/1.d/copy-env  chmod: +x  chown:
I, [2025-03-23T00:18:35.555450 #1]  INFO -- : File > /etc/service/unicorn/run  chmod: +x  chown:
I, [2025-03-23T00:18:35.565315 #1]  INFO -- : File > /etc/service/nginx/run  chmod: +x  chown:
I, [2025-03-23T00:18:35.575445 #1]  INFO -- : File > /etc/runit/3.d/01-nginx  chmod: +x  chown:
I, [2025-03-23T00:18:35.586497 #1]  INFO -- : File > /etc/runit/3.d/02-unicorn  chmod: +x  chown:
I, [2025-03-23T00:18:35.586705 #1]  INFO -- : Replacing # postgres with sv start postgres || exit 1 in /etc/service/unicorn/run
I, [2025-03-23T00:18:35.587163 #1]  INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2025-03-23T00:18:35.590588 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git reset --hard
130:C 23 Mar 2025 00:18:35.612 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
130:C 23 Mar 2025 00:18:35.612 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=130, just started
130:C 23 Mar 2025 00:18:35.612 # Configuration loaded
130:M 23 Mar 2025 00:18:35.613 * monotonic clock: POSIX clock_gettime
130:M 23 Mar 2025 00:18:35.614 # Warning: Could not create server TCP listening socket *:6379: bind: Address already in use
130:M 23 Mar 2025 00:18:35.614 # Failed listening on port 6379 (TCP), aborting.
Updating files: 100% (32972/32972), done.
I, [2025-03-23T00:18:40.370921 #1]  INFO -- : HEAD is now at 59e548540 Build(deps): Bump sass from 1.58.3 to 1.59.2 in /app/assets/javascripts (#20656)

I, [2025-03-23T00:18:40.371398 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git clean -f
I, [2025-03-23T00:18:40.710584 #1]  INFO -- :
I, [2025-03-23T00:18:40.711030 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse bash -c '
  if [ $(git rev-parse --is-shallow-repository) == "true" ]; then
      git remote set-branches --add origin main
      git remote set-branches origin tests-passed
      git fetch --depth 1 origin tests-passed
  else
      git fetch --prune --prune-tags origin tests-passed
  fi
'
From https://github.com/discourse/discourse
 * branch                tests-passed -> FETCH_HEAD
   05e713d09..e7c3abb94  tests-passed -> origin/tests-passed
I, [2025-03-23T00:18:42.586103 #1]  INFO -- :
I, [2025-03-23T00:18:42.586534 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse bash -c '
  if [[ $(git symbolic-ref --short HEAD) == tests-passed ]] ; then
      git pull
  else
      git -c advice.detachedHead=false checkout tests-passed
  fi
'
Switched to a new branch 'tests-passed'
I, [2025-03-23T00:18:51.833256 #1]  INFO -- : Branch 'tests-passed' set up to track remote branch 'tests-passed' from 'origin'.

I, [2025-03-23T00:18:51.834334 #1]  INFO -- : > cd /var/www/discourse && mkdir -p tmp
I, [2025-03-23T00:18:51.841544 #1]  INFO -- :
I, [2025-03-23T00:18:51.841855 #1]  INFO -- : > cd /var/www/discourse && chown discourse:www-data tmp
I, [2025-03-23T00:18:51.847601 #1]  INFO -- :
I, [2025-03-23T00:18:51.847953 #1]  INFO -- : > cd /var/www/discourse && mkdir -p tmp/pids
I, [2025-03-23T00:18:51.855859 #1]  INFO -- :
I, [2025-03-23T00:18:51.856222 #1]  INFO -- : > cd /var/www/discourse && mkdir -p tmp/sockets
I, [2025-03-23T00:18:51.863615 #1]  INFO -- :
I, [2025-03-23T00:18:51.863977 #1]  INFO -- : > cd /var/www/discourse && touch tmp/.gitkeep
I, [2025-03-23T00:18:51.869796 #1]  INFO -- :
I, [2025-03-23T00:18:51.870182 #1]  INFO -- : > cd /var/www/discourse && mkdir -p                    /shared/log/rails
I, [2025-03-23T00:18:51.876106 #1]  INFO -- :
I, [2025-03-23T00:18:51.876454 #1]  INFO -- : > cd /var/www/discourse && bash -c "touch -a           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log"
I, [2025-03-23T00:18:51.888118 #1]  INFO -- :
I, [2025-03-23T00:18:51.888454 #1]  INFO -- : > cd /var/www/discourse && bash -c "ln    -s           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log /var/www/discourse/log"
I, [2025-03-23T00:18:51.897590 #1]  INFO -- :
I, [2025-03-23T00:18:51.898001 #1]  INFO -- : > cd /var/www/discourse && bash -c "mkdir -p           /shared/{uploads,backups}"
I, [2025-03-23T00:18:51.906190 #1]  INFO -- :
I, [2025-03-23T00:18:51.906512 #1]  INFO -- : > cd /var/www/discourse && bash -c "ln    -s           /shared/{uploads,backups} /var/www/discourse/public"
I, [2025-03-23T00:18:51.917159 #1]  INFO -- :
I, [2025-03-23T00:18:51.917467 #1]  INFO -- : > cd /var/www/discourse && bash -c "mkdir -p           /shared/tmp/{backups,restores}"
I, [2025-03-23T00:18:51.927203 #1]  INFO -- :
I, [2025-03-23T00:18:51.927487 #1]  INFO -- : > cd /var/www/discourse && bash -c "ln    -s           /shared/tmp/{backups,restores} /var/www/discourse/tmp"
I, [2025-03-23T00:18:51.937966 #1]  INFO -- :
I, [2025-03-23T00:18:51.938298 #1]  INFO -- : > cd /var/www/discourse && chown -R discourse:www-data /shared/log/rails /shared/uploads /shared/backups /shared/tmp
I, [2025-03-23T00:18:52.001123 #1]  INFO -- :
I, [2025-03-23T00:18:52.001476 #1]  INFO -- : > cd /var/www/discourse && [ ! -d public/plugins ] || find public/plugins/ -maxdepth 1 -xtype l -delete
I, [2025-03-23T00:18:52.010734 #1]  INFO -- :
I, [2025-03-23T00:18:52.011660 #1]  INFO -- : Replacing # redis with sv start redis || exit 1 in /etc/service/unicorn/run
I, [2025-03-23T00:18:52.013337 #1]  INFO -- : > cd /var/www/discourse/plugins && mkdir -p plugins
I, [2025-03-23T00:18:52.019369 #1]  INFO -- :
I, [2025-03-23T00:18:52.019704 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/docker_manager.git
Cloning into 'docker_manager'...
I, [2025-03-23T00:18:53.224801 #1]  INFO -- :
I, [2025-03-23T00:18:53.225328 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-spoiler-alert.git
Cloning into 'discourse-spoiler-alert'...
I, [2025-03-23T00:18:53.893263 #1]  INFO -- :
I, [2025-03-23T00:18:53.893765 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-data-explorer.git
Cloning into 'discourse-data-explorer'...
I, [2025-03-23T00:18:54.647629 #1]  INFO -- :
I, [2025-03-23T00:18:54.647998 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/merefield/discourse-onebox-assistant.git
Cloning into 'discourse-onebox-assistant'...
I, [2025-03-23T00:18:55.121580 #1]  INFO -- :
I, [2025-03-23T00:18:55.122655 #1]  INFO -- : > cp /var/www/discourse/config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf
I, [2025-03-23T00:18:55.127568 #1]  INFO -- :
I, [2025-03-23T00:18:55.128317 #1]  INFO -- : > rm /etc/nginx/sites-enabled/default
I, [2025-03-23T00:18:55.133169 #1]  INFO -- :
I, [2025-03-23T00:18:55.133494 #1]  INFO -- : > mkdir -p /var/nginx/cache
I, [2025-03-23T00:18:55.137201 #1]  INFO -- :
I, [2025-03-23T00:18:55.137985 #1]  INFO -- : Replacing pid /run/nginx.pid; with daemon off; in /etc/nginx/nginx.conf
I, [2025-03-23T00:18:55.139546 #1]  INFO -- : Replacing (?m-ix:upstream[^\}]+\}) with upstream discourse { server 127.0.0.1:3000; } in /etc/nginx/conf.d/discourse.conf
I, [2025-03-23T00:18:55.140371 #1]  INFO -- : Replacing (?-mix:server_name.+$) with server_name _ ; in /etc/nginx/conf.d/discourse.conf
I, [2025-03-23T00:18:55.141165 #1]  INFO -- : Replacing (?-mix:client_max_body_size.+$) with client_max_body_size $upload_size ; in /etc/nginx/conf.d/discourse.conf
I, [2025-03-23T00:18:55.142058 #1]  INFO -- : Replacing (?-mix:worker_connections.+$) with worker_connections $nginx_worker_connections ; in /etc/nginx/nginx.conf
I, [2025-03-23T00:18:55.142716 #1]  INFO -- : > echo "done configuring web"
I, [2025-03-23T00:18:55.145799 #1]  INFO -- : done configuring web

I, [2025-03-23T00:18:55.146504 #1]  INFO -- : > cd /var/www/discourse && gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,""); print $0 }' Gemfile.lock)
I, [2025-03-23T00:18:56.661918 #1]  INFO -- : Successfully installed bundler-2.6.4
1 gem installed

I, [2025-03-23T00:18:56.662443 #1]  INFO -- : > cd /var/www/discourse && find /var/www/discourse ! -user discourse -exec chown discourse {} \+
I, [2025-03-23T00:18:58.289649 #1]  INFO -- :
I, [2025-03-23T00:18:58.290115 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'yarn install --production --frozen-lockfile && yarn cache clean'
error discourse@: The engine "node" is incompatible with this module. Expected version ">= 20". Got "18.15.0"
error discourse@: The engine "yarn" is incompatible with this module. Expected version "please-use-pnpm". Got "1.22.19"
warning discourse@: The engine "pnpm" appears to be invalid.
error Found incompatible module.
I, [2025-03-23T00:18:58.802017 #1]  INFO -- : yarn install v1.22.19
info No lockfile found.
[1/5] Validating package.json...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

I, [2025-03-23T00:18:58.803434 #1]  INFO -- : Terminating async processes
I, [2025-03-23T00:18:58.803753 #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, [2025-03-23T00:18:58.804011 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 103
103:signal-handler (1742689138) Received SIGTERM scheduling shutdown...
2025-03-23 00:18:58.804 UTC [42] LOG:  received fast shutdown request
103:M 23 Mar 2025 00:18:58.806 # User requested shutdown...
103:M 23 Mar 2025 00:18:58.806 * Saving the final RDB snapshot before exiting.
2025-03-23 00:18:58.863 UTC [42] LOG:  aborting any active transactions
2025-03-23 00:18:58.868 UTC [42] LOG:  background worker "logical replication launcher" (PID 51) exited with exit code 1
2025-03-23 00:18:58.871 UTC [46] LOG:  shutting down
2025-03-23 00:18:58.960 UTC [42] LOG:  database system is shut down
103:M 23 Mar 2025 00:18:59.184 * DB saved on disk
103:M 23 Mar 2025 00:18:59.184 # Redis is now ready to exit, bye bye...

我假设这些错误是主要原因?

error discourse@: The engine "node" is incompatible with this module. Expected version ">= 20". Got "18.15.0"
error discourse@: The engine "yarn" is incompatible with this module. Expected version "please-use-pnpm". Got "1.22.19"
warning discourse@: The engine "pnpm" appears to be invalid.

随后我尝试使用 npm 更新这些模块。我在 Discourse 服务器上安装了 npm,并尝试升级 yarn,但需要 node 作为依赖项。我尝试升级 node,但在安装过程中收到错误,提示某个文件需要管理员权限,我需要运行 chown 命令来更改权限。我照做了,但没有任何效果。

最终我们就停在了这里。

我的请求如下:

  1. 如果我们能更新这个 yarn/node 的情况,这会解决重建错误吗?我们该如何操作?

  2. 有什么办法可以强制服务器现在进行本地备份,而不依赖 S3 吗?如果能做到这一点,我们可能会直接放弃,并恢复到新的 Discourse 托管服务器。

  3. 是否有付费的 Discourse 服务可以帮我们?我的时间几乎为零,即使花费一些费用,我也希望我们的社区得以保存。

最后,服务器运行的是 Ubuntu 20.04。此外,我们的插件列表如下:

==================== PLUGINS ====================
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-spoiler-alert.git
          - git clone https://github.com/discourse/discourse-data-explorer.git
          - git clone https://github.com/merefield/discourse-onebox-assistant.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.

但我推测这些与重建失败无关。

感谢您的帮助。

如果备份在那里,您就可以访问它。是的,拥有该存储桶的人也可以访问。

如果您想了解第三方付费服务,请随时在#marketplace(市场)板块发帖。

这真是一个棘手的处境——我同情你。

就我个人而言,我非常希望在尝试重建之前获得一个备份。如果常规备份过程对你没有用(因为它将备份发送到无法访问的地方),那么我会想办法使用命令行进行数据库备份,但我不太确定具体方法。也许是在 Docker 中使用 pg_dump?

或者,也许你可以使用你的命令行访问权限将备份重定向到本地磁盘而不是 S3。

但在这两种情况下,你都需要足够的本地磁盘空间。

编辑:与 Jay 的帖子交叉了。

谢谢——我的想法是,如果我们能做一个备份,那就是将备份重定向到本地磁盘而不是 S3,这样我们就有空间了。

这是我的错,昨晚我没有弄清楚本地备份,而是进行了重建——事后看来,这很清楚。我低估了重建的影响。

你能帮我理解一下吗?您的意思是,如果备份被路由到那里,就必须存在凭据?(我们确实确认了我们的 Discourse 管理面板中出现了一个新的备份)

问题是,如果我们需要的凭据来访问备份,我认为除了那个消失的家伙之外,没有人真正拥有这些凭据。

如果 literatecomputing 承担这项工作,他们能否获取本地备份并将我们现有的站点恢复到新的维护服务器上?

如果 S3 存储桶有上周的备份,那么 Discourse 就拥有该存储桶的凭证。它们可能在 app.yml 或站点设置中。

但您不需要自己访问 S3 存储桶,您应该能够通过 Discourse 下载备份。

您是否在 /admin/backups看到了备份?
如果看到了,尝试下载它们时会发生什么?
您也可以将站点设置 - 备份 - 备份位置更改为“本地存储”。

是的。如果你备份到 S3,凭据就在你的数据库或 yml 文件中。

是的。在 SiteSettings 或 yml 文件中都有 backup_location 设置。如果它在 SiteSettings 中而不是在数据库中,那么会比较困难,但并非不可能更改。

我只是个新手,但根据最近的帖子报告的关于重建时文件的所有权问题,您是否可以:

如果您有命令行访问权限,为什么不进行命令行备份?

我有 root 访问权限。我确实执行了命令行备份,但它已推送到 S3。感谢 @pfaffman 的评论,我现在意识到我可以尝试将备份从 S3 拉取到本地 - 我只需要时间去尝试。

您在用户体验(UX)的设置中看到了 backup_location 这个设置吗(或者服务器宕机了,所以您看不到?)

您是指这个警告吗?

WARNING: containers/app.yml 文件是可被所有人读取的。您可以通过运行以下命令来保护此文件:chmod o-rwx containers/app.yml

这是一个警告。多年来,默认情况下该文件是可被所有人读取的(假设大多数自托管者只会以 root 用户登录,并且没有其他用户),但后来有人认为该文件中包含的秘密信息可被任何人读取不是最佳实践。由于您以 root 用户身份运行启动器,root 用户始终能够读取该文件。

我没有看到 admin/backups,它在哪里?我唯一看到 backups 的地方是 /var/discourse/shared/standalone/backups/default,但这些都是很久以前的本地备份。

我稍后会跟进网站设置的情况,等能访问的人醒来(他们是英国时间)。我推测他们没有访问权限,因为网站宕机了。

我没有在 app.yml 文件中看到特定的 backup_location 设置。

另外,侧边栏,但我看到你们公司简介里说你曾是一名 CS 老师。那是我目前的正职 :smiley:

不是那个。等我有机会时我会贴出具体的错误,但正如我所说,那是在尝试升级节点时出现的,而不是在重建过程中。

将此添加到您的论坛 URL。您应该可以在用户界面中看到您的备份。

明白了。我一直在服务器上查找这个。网站已完全瘫痪,所以我无法访问该页面。

只是一个一般性问题。服务器的规格是什么?包括操作系统版本。

这是一个很久以前[^1]的镜像,很可能是导致这些错误的原因:

[^1]:以互联网时间计算

你可能需要 git pull discourse_docker 目录(你运行 launcher 的目录)。

像往常一样,由于你处于降级状态,请先备份服务器。

我们今天设法完成了一个本地新备份,我现在正在本地下载它。

所以,我将 pull /var/discourse,然后尝试重建以进行更新?

Your branch and 'origin/main' have diverged,
and have 15 and 201 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

diverged 确实是轻描淡写了 :smile:

我猜你一直在提交容器配置,所以 git pullgit pull --rebase 可能 会让你达到目的,不妨试试 :+1:

我的朋友,我不知道发生了什么,但如果需要的话,我会看看通过拉取或变基能得到什么。我将创建一个新的维护窗口,因为出于某种原因,网站确实恢复到了旧版本。我会向大家更新结果。

我真的很感激所有的智慧!