Atualização do PostgreSQL 18 para self-hosters

:warning: AVISO! A atualização exige bastante espaço livre em disco (2x o tamanho do banco de dados).

Acabamos de implementar alterações para atualizar nossa imagem Docker para o PostgreSQL 18. Qualquer administrador de site que reconstruir o Discourse pela linha de comando será atualizado do PostgreSQL 15 anterior para o PostgreSQL 18. Observe que, se você evitou a atualização quando a atualização do PostgreSQL 15 aconteceu em 2025, você pode pular essa atualização e ir diretamente para o PostgreSQL 18.

Se você evitou a atualização anteriormente, altere o modelo do PostgreSQL em app.yml de templates/postgres.13.template.yml para templates/postgres.template.yml.

Como em qualquer atualização, é fortemente recomendado fazer um backup antes de fazer qualquer coisa.

Alterações de localidade

Anteriormente, já vimos corrupção de índice ocorrer quando o glibc era atualizado, como durante atualizações do SO. Desde o PostgreSQL 17, há um novo provedor de localidade integrado que é desacoplado do glibc do SO e, portanto, estável entre versões. Como parte desta atualização, estamos migrando para este provedor integrado usando a localidade C.UTF-8. Esta localidade usa ordenação por ponto de código e a recomendamos pelos motivos de estabilidade mencionados acima.

Para realizar a alteração de localidade, precisamos primeiro criar o novo cluster de banco de dados usando o provedor de localidade integrado e, em seguida, fazer o dump e restaurar o banco de dados neste cluster. Por este motivo, os requisitos de espaço em disco são maiores do que nas atualizações anteriores, onde realizávamos atualizações no local.

Atualização

Guia de Instalação Oficial (contêiner único)

Na sua próxima reconstrução, você verá esta mensagem no final:

-------------------------------------------------------------------------------------
ATUALIZAÇÃO DO POSTGRES CONCLUÍDA

O banco de dados 15 antigo está armazenado em /shared/postgres_data_old

Para concluir a atualização, reconstrua novamente usando:

./launcher rebuild app
-------------------------------------------------------------------------------------

Isso significa que tudo ocorreu bem na atualização! Você só precisa emitir uma nova reconstrução para colocar seu site de volta no ar.

Instalação com Contêiner de Dados

Se você estiver executando uma configuração com um contêiner de dados dedicado baseado no modelo fornecido em nosso repositório discourse_docker, certifique-se de estar desligando o PostgreSQL de forma segura e limpa.

Hoje em dia, temos jobs em segundo plano executando consultas que levam vários minutos, então desligar o contêiner web ajudará a desligar o contêiner de dados com segurança.

./launcher stop web_only
./launcher stop data
./launcher rebuild data
./launcher rebuild data
./launcher rebuild web_only

Antes de emitir a primeira reconstrução para o contêiner de dados, você pode monitorar o log do PostgreSQL para ver se ele foi desligado corretamente.

Executar um tail -f shared/standalone/log/var-log/postgres/current deve fornecer o seguinte log se foi limpo:

2025-01-24 09:19:06.437 UTC [37] LOG:  received smart shutdown request
2025-01-24 09:19:06.444 UTC [37] LOG:  background worker "logical replication launcher" (PID 54) exited with exit code 1
2025-01-24 09:19:06.446 UTC [49] LOG:  shutting down
2025-01-24 09:19:06.468 UTC [37] LOG:  database system is shut down

Adiando a atualização

Se você precisar adiar a atualização durante sua próxima reconstrução, pode alternar o modelo do PostgreSQL em seu arquivo app.yml, alterando "templates/postgres.template.yml" para "templates/postgres.15.template.yml".

Isso não é recomendado, pois alguns administradores de site esquecerão de reverter a alteração posteriormente.

Tarefas opcionais pós-atualização

Otimizando estatísticas do PostgreSQL

Após a atualização, o novo PostgreSQL não terá estatísticas de tabelas disponíveis. Você pode gerar essas estatísticas usando:

docker exec -u postgres app \
	/usr/lib/postgresql/18/bin/vacuumdb -d discourse --analyze-in-stages

Limpando dados antigos

Para uma instalação padrão, você pode excluir os dados antigos no formato PG15 com o seguinte comando:

cd /var/discourse
./launcher cleanup

Se você tiver um contêiner de dados separado, precisará remover a cópia de backup assim:

rm -fr /var/discourse/shared/data/postgres_data_old/

FAQ

O cluster de origem não foi desligado corretamente

Se você receber uma falha na atualização com a mensagem acima, pode tentar uma abordagem mais simples para colocá-lo em um estado melhor.

Reinicie o contêiner antigo com ./launcher start app. Aguarde alguns minutos até que ele esteja de volta.

Agora desligue-o novamente com ./launcher stop app. Após isso, monitore os logs para ver se foi um desligamento limpo:

tail -f shared/standalone/log/var-log/postgres/current
2025-01-24 09:19:06.437 UTC [37] LOG:  received smart shutdown request
2025-01-24 09:19:06.444 UTC [37] LOG:  background worker "logical replication launcher" (PID 54) exited with exit code 1
2025-01-24 09:19:06.446 UTC [49] LOG:  shutting down
2025-01-24 09:19:06.468 UTC [37] LOG:  database system is shut down

Se os logs não indicarem que o banco de dados foi desligado, você pode iniciar o contêiner antigo novamente, entrar com ./launcher enter app, executar esses comandos e monitorar os logs novamente ao terminar.

export SVWAIT=300
sv stop nginx
sv stop unicorn
sv stop postgres
exit

Se os logs parecerem com os acima, você pode tentar atualizar novamente usando ./launcher rebuild app.

Valores de lc_collate para o banco de dados “postgres” não correspondem

Este erro ocorre se você estiver usando localidades não padrão para seu banco de dados. Foi relatado que você precisa de 3 variáveis para que tenha sucesso. Certifique-se de que a seção env: do seu arquivo app.yml tenha as 3 linhas:

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

Alterando en_US.UTF-8 para sua localidade.

Cada reconstrução faz a atualização novamente, ou seja, loop de atualização

Quando isso acontece, seus logs de atualização conterão

mv: cannot move '/shared/postgres_data' to '/shared/postgres_data_old/postgres_data': Directory not empty
mv: cannot move '/shared/postgres_data_new' to '/shared/postgres_data/postgres_data_new': Directory not empty

Isso significa que ainda há arquivos da última atualização por perto. Mova-os para outro lugar antes de continuar.

Eu pulei a atualização do PostgreSQL 15, o que fazer agora?

Você pode seguir as instruções padrão no topo deste guia e elas atualizarão de sua versão para a 18 sem problemas.

8 curtidas

ótimo, obrigado Chris!

1 curtida

Que tipo de falha, esperançosamente elegante, ocorrerá se não houver espaço livre em disco suficiente? Alguém certamente vai percorrer esse caminho!

Para aqueles que não têm espaço livre em disco suficiente, funcionaria fazer um backup e, em seguida, restaurá-lo em uma instalação limpa, como uma migração?

(Nesse caso, também seria uma boa oportunidade para migrar para uma nova versão LTS do sistema operacional. O Ubuntu 26.04 é bastante recente; a versão 26.04.1 deve chegar muito em breve. Uma instalação limpa do sistema operacional pode ser menos problemática do que uma tentativa de atualização no local.)

3 curtidas

Eu teria, se não tivesse recebido uma notificação por e-mail sobre esta postagem :raised_back_of_hand: :flushed_face:

Só para confirmar, isso já está ativo agora?

Se eu atualizar pela linha de comando mais tarde esta manhã, tudo isso acontecerá?

O script de atualização verificará o espaço livre e só prosseguirá se for seguro fazê-lo.

Há duas etapas no processo onde o espaço em disco pode se tornar crítico. Se você ignorasse a verificação de espaço livre, é aqui que poderia encontrar problemas:

  1. Ao executar o pg_dump para extrair os dados do banco de dados antigo (é necessário o dobro do armazenamento do BD neste ponto).
  2. Ao executar o pg_restore para inserir os dados de volta no novo banco de dados (é necessário o triplo do armazenamento do BD neste ponto).

Para se recuperar desse estado, você precisaria remover /shared/postgres_dump e /shared/postgres_data_new.

Observe que, ao final da atualização, removemos os arquivos temporários do pg_dump, mas mantemos seus dados do banco de dados pré-atualização em /shared/postgres_data_old apenas por precaução. Uma vez que você estiver satisfeito com o funcionamento de tudo, provavelmente desejará remover esse diretório para liberar espaço em disco.

Testei fazer um backup do Discourse em um site com PG15 e restaurá-lo em um site com PG18. Funcionou para mim, mas esteja ciente de que não é um método oficialmente suportado. Teste minuciosamente em algo que não seja produção primeiro e certifique-se de ter um caminho de retorno!

Recomendo estudar o processo usado pelo script de atualização. Se você tiver requisitos especiais de armazenamento, deverá ser capaz de adaptá-lo às suas necessidades. Novamente, teste primeiro:

Isso está agora no discourse_docker, sim. Se você executar pull na branch main ou rodar ./launcher rebuild app, você obterá isso.

Desativar o discourse_docker da branch main ajuda a prevenir atualizações acidentais se você quiser adiá-la.

2 curtidas

Você pode dar mais detalhes sobre o que significa “muito grande”?

Entendi isso como a necessidade de ter um espaço de reserva no banco de dados três vezes maior, independentemente do tamanho?

1 curtida

Desculpe, aquele aviso foi mal formulado e incorreto.

Além do banco de dados existente no disco, você precisará de espaço livre suficiente para a saída do dump e para a nova cópia do banco de dados enquanto é restaurado. A saída do pg_dump geralmente é menor que o diretório de dados do banco de dados, então 2x o tamanho atual do banco de dados em espaço livre deve ser suficiente. Vou corrigir isso no script de atualização.

EDIT: A verificação de espaço livre foi atualizada para procurar 2x o tamanho do banco de dados em vez de 3x.

3 curtidas

Parece que, em uma VM de núcleo único, é necessário permanecer na PG15 postgres.15.template.yml devido à limitação:

pg_dump: erro: -j/--jobs deve estar no intervalo 1..2147483647

ou corrigir web.template.yml para -j1 para usar uma CPU. (A próxima reconstrução restaurará o valor padrão).

Sim, essas configurações existem! :blob_wave:

Esse erro ocorreu devido à forma como o nproc é calculado (estou executando em uma única vCPU): -j/–jobs deve estar na faixa de 1..2147483647 (ele está tentando -j0 porque $(($(nproc) - 1)) = 1 - 1 = 0)

O script de atualização provavelmente deve ser atualizado para algo como -j$(( $(nproc) > 1 ? $(nproc) - 1 : 1 ))

2 curtidas

Em um dos servidores, tive o seguinte problema:

Resolvi isso movendo esses diretórios:

cd /var/discourse/shared/standalone
mv postgres_data_older postgres_data_oldest
mv postgres_data_old postgres_data_older

E então ./launcher rebuild app foi concluído com:

-------------------------------------------------------------------------------------
ATUALIZAÇÃO DO POSTGRES CONCLUÍDA

O banco de dados 15 antigo está armazenado em /shared/postgres_data_old

Para concluir a atualização, reconstrua novamente usando:

./launcher rebuild app
-------------------------------------------------------------------------------------

Em outro servidor, tenho um erro com pg_dump:

x86_64 arch detected.
Ensuring launcher is up to date
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 600 app
app
2.0.20260803-0122: Pulling from discourse/base
Digest: sha256:ab1e7217470759e63313a16bc5b71b9f2dd7d3ae8303286e5985f563ad12b7b3
Status: Image is up to date for discourse/base:2.0.20260803-0122
docker.io/discourse/base:2.0.20260803-0122
/usr/local/lib/ruby/gems/3.4.0/gems/pups-1.4.0/lib/pups.rb
/usr/local/bin/pups --stdin
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)
I, [2026-08-03T09:02:29.698631 #1]  INFO -- : Reading from stdin
I, [2026-08-03T09:02:29.724575 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown: 
I, [2026-08-03T09:02:29.737296 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown: 
I, [2026-08-03T09:02:29.750650 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown: 
I, [2026-08-03T09:02:29.763301 #1]  INFO -- : File > /root/install_postgres  chmod: +x  chown: 
I, [2026-08-03T09:02:29.775620 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown: 
I, [2026-08-03T09:02:29.777021 #1]  INFO -- : Replacing data_directory = '/var/lib/postgresql/18/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/18/main/postgresql.conf
I, [2026-08-03T09:02:29.778673 #1]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/18/main/postgresql.conf
I, [2026-08-03T09:02:29.780140 #1]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/18/main/postgresql.conf
I, [2026-08-03T09:02:29.781699 #1]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/18/main/postgresql.conf
I, [2026-08-03T09:02:29.783144 #1]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/18/main/postgresql.conf
I, [2026-08-03T09:02:29.784461 #1]  INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/18/main/postgresql.conf
I, [2026-08-03T09:02:29.785820 #1]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/18/main/postgresql.conf
I, [2026-08-03T09:02:29.787120 #1]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/18/main/postgresql.conf
I, [2026-08-03T09:02:29.788468 #1]  INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/18/main/postgresql.conf
I, [2026-08-03T09:02:29.789816 #1]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/18/main/pg_hba.conf
I, [2026-08-03T09:02:29.790932 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/18/main/pg_hba.conf
I, [2026-08-03T09:02:29.792274 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/18/main/pg_hba.conf
I, [2026-08-03T09:02:29.793638 #1]  INFO -- : > if [ -f /root/install_postgres ]; then
  /root/install_postgres && rm -f /root/install_postgres
elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then
  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
fi

/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)
Generating locales (this might take a while)...
  en_GB.UTF-8... done
  en_US.UTF-8... done
Generation complete.
2026/08/03 09:02:33 socat[35] E connect(, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): Connection refused
Upgrading PostgreSQL from version 15 to 18
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with this locale configuration:
  locale provider:   builtin
  default collation: C.UTF-8
  LC_COLLATE:  C.UTF-8
  LC_CTYPE:    C.UTF-8
  LC_MESSAGES: C.UTF-8
  LC_MONETARY: C.UTF-8
  LC_NUMERIC:  C.UTF-8
  LC_TIME:     C.UTF-8
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /shared/postgres_data_new ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default "max_connections" ... 100
selecting default "shared_buffers" ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/lib/postgresql/18/bin/pg_ctl -D /shared/postgres_data_new -l logfile start

Get:1 http://deb.debian.org/debian bookworm-backports InRelease [59.4 kB]
Hit:2 http://deb.debian.org/debian bookworm InRelease
Get:3 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Hit:4 http://deb.debian.org/debian-security bookworm-security InRelease
Hit:5 https://deb.nodesource.com/node_22.x nodistro InRelease
Hit:6 https://dl.yarnpkg.com/debian stable InRelease
Hit:7 https://apt.postgresql.org/pub/repos/apt bookworm-pgdg InRelease
Fetched 115 kB in 1s (77.2 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  postgresql-15 postgresql-15-pgvector
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 15.2 MB of archives.
After this operation, 52.6 MB of additional disk space will be used.
Get:1 https://apt.postgresql.org/pub/repos/apt bookworm-pgdg/main amd64 postgresql-15 amd64 15.18-1.pgdg12+1 [15.0 MB]
Get:2 https://apt.postgresql.org/pub/repos/apt bookworm-pgdg/main amd64 postgresql-15-pgvector amd64 0.8.6-1.pgdg12+1 [271 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 15.2 MB in 1s (29.8 MB/s)
Selecting previously unselected package postgresql-15.
(Reading database ... 32784 files and directories currently installed.)
Preparing to unpack .../postgresql-15_15.18-1.pgdg12+1_amd64.deb ...
Unpacking postgresql-15 (15.18-1.pgdg12+1) ...
Selecting previously unselected package postgresql-15-pgvector.
Preparing to unpack .../postgresql-15-pgvector_0.8.6-1.pgdg12+1_amd64.deb ...
Unpacking postgresql-15-pgvector (0.8.6-1.pgdg12+1) ...
Setting up postgresql-15 (15.18-1.pgdg12+1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Setting up postgresql-15-pgvector (0.8.6-1.pgdg12+1) ...
Processing triggers for postgresql-common (293.pgdg12+1) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Creating new PostgreSQL cluster 15/main ...
/usr/lib/postgresql/15/bin/initdb -D /var/lib/postgresql/15/main --auth-local peer --auth-host scram-sha-256 --no-instructions
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_GB.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/15/main ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Stopping PostgreSQL 15 database server: main.
Stopping PostgreSQL 18 database server: main.
waiting for server to start....2026-08-03 09:02:47.642 UTC [1145] LOG:  starting PostgreSQL 15.18 (Debian 15.18-1.pgdg12+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14+deb12u1) 12.2.0, 64-bit
2026-08-03 09:02:47.643 UTC [1145] LOG:  listening on IPv6 address "::1", port 5432
2026-08-03 09:02:47.644 UTC [1145] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2026-08-03 09:02:47.647 UTC [1145] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2026-08-03 09:02:47.664 UTC [1148] LOG:  database system was interrupted; last known up at 2026-08-03 08:59:02 UTC
2026-08-03 09:02:48.205 UTC [1148] LOG:  database system was not properly shut down; automatic recovery in progress
2026-08-03 09:02:48.212 UTC [1148] LOG:  invalid record length at 12/F5C779B0: wanted 24, got 0
2026-08-03 09:02:48.213 UTC [1148] LOG:  redo is not required
2026-08-03 09:02:48.218 UTC [1146] LOG:  checkpoint starting: end-of-recovery immediate wait
2026-08-03 09:02:48.230 UTC [1146] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.004 s, sync=0.002 s, total=0.013 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB
2026-08-03 09:02:48.252 UTC [1145] LOG:  database system is ready to accept connections
 done
server started
pg_dump: error: -j/--jobs must be in range 1..2147483647
-------------------------------------------------------------------------------------
UPGRADE OF POSTGRES FAILED
Failed on: su postgres -c "/usr/lib/postgresql/${PG_MAJOR_OLD}/bin/pg_dump -Fd -j$(($(nproc) - 1)) discourse -f /shared/postgres_dump/discourse"

Please visit https://meta.discourse.org/t/postgresql-18-update/406194 for support.

You can run ./launcher start app to restart your app in the meantime
-------------------------------------------------------------------------------------


FAILED
--------------------
Pups::ExecError: if [ -f /root/install_postgres ]; then
  /root/install_postgres && rm -f /root/install_postgres
elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then
  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
fi
 failed with return #<Process::Status: pid 18 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.4.0/gems/pups-1.4.0/lib/pups/exec_command.rb:138:in 'Pups::ExecCommand#spawn'
exec failed with the params {"tag" => "db", "cmd" => "if [ -f /root/install_postgres ]; then\n  /root/install_postgres && rm -f /root/install_postgres\nelif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then\n  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1\nfi\n"}
bootstrap failed with exit code 1
---
HINT: The plugin 'discourse-calendar' is now bundled with Discourse and should not be included in your container configuration.
Remove the line 'git clone https://github.com/discourse/discourse-calendar' from your containers/app.yml file, then try again.
For more information, see https://meta.discourse.org/t/373574
---
---
HINT: The plugin 'discourse-templates' is now bundled with Discourse and should not be included in your container configuration.
Remove the line 'git clone https://github.com/discourse/discourse-templates' from your containers/app.yml file, then try again.
For more information, see https://meta.discourse.org/t/373574
---
---
HINT: The plugin 'discourse-policy' is now bundled with Discourse and should not be included in your container configuration.
Remove the line 'git clone https://github.com/discourse/discourse-policy' from your containers/app.yml file, then try again.
For more information, see https://meta.discourse.org/t/373574
---
** 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.
d2f4b0c8ce1d67917f88c87da7d3fd8886b2b3c93800e30ae6d8ceeeb131a419

Este é o mesmo erro que acima? Qual é o script de atualização que precisa ser editado para corrigir isso? @Nacho_Caballero

2 curtidas

Ambiente de desenvolvimento local docker, puxando a branch release/2026.7 mais recente

d/shutdown_dev

d/boot_dev

E então execute

d/rails s

Encontrei o erro abaixo, o que devo fazer?

singi@GL-D-009011A:~/discourse$ d/rails s
Starting Pitchfork...
Starting CSS change watcher
URGENT: Failed to initialize site default: ActiveRecord::ConnectionNotEstablished connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

/src/config/initializers/000-pg_connection_patch.rb:35:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new_client'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql_adapter.rb:944:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#connect'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql_adapter.rb:956:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#reconnect'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:670:in 'block (2 levels) in ActiveRecord::ConnectionAdapters::AbstractAdapter#reconnect!'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:1224:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#attempt_configure_connection'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:669:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#reconnect!'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:668:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#reconnect!'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:778:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#verify!'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:766:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#verify!'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:786:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#connect!'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:992:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:991:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/quoting.rb:128:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting#quote_string'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract/quoting.rb:76:in 'ActiveRecord::ConnectionAdapters::Quoting#quote'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/quoting.rb:122:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting#quote'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:1142:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#quoted_scope'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:1119:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#data_source_sql'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:60:in 'ActiveRecord::ConnectionAdapters::SchemaStatements#table_exists?'
/src/lib/site_settings/db_provider.rb:58:in 'SiteSettings::DbProvider#table_exists?'
/src/lib/site_settings/db_provider.rb:14:in 'SiteSettings::DbProvider#all'
/src/lib/site_setting_extension.rb:1286:in 'SiteSettingExtension#fetch_setting_hash_from_provider'
/src/lib/site_setting_extension.rb:602:in 'block in SiteSettingExtension#refresh!'
/src/lib/site_setting_extension.rb:598:in 'Thread::Mutex#synchronize'
/src/lib/site_setting_extension.rb:598:in 'SiteSettingExtension#refresh!'
/src/config/initializers/005-site_settings.rb:19:in 'block (2 levels) in <main>'
/src/lib/freedom_patches/rails_multisite.rb:15:in 'block in RailsMultisite::ConnectionManagement.safe_each_connection'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/rails_multisite-7.0.0/lib/rails_multisite/connection_management/null_instance.rb:49:in 'RailsMultisite::ConnectionManagement::NullInstance#with_connection'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/rails_multisite-7.0.0/lib/rails_multisite/connection_management/null_instance.rb:36:in 'RailsMultisite::ConnectionManagement::NullInstance#each_connection'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/rails_multisite-7.0.0/lib/rails_multisite/connection_management.rb:17:in 'RailsMultisite::ConnectionManagement.each_connection'
/src/lib/freedom_patches/rails_multisite.rb:9:in 'RailsMultisite::ConnectionManagement.each_active_connection'
/src/lib/freedom_patches/rails_multisite.rb:14:in 'RailsMultisite::ConnectionManagement.safe_each_connection'
/src/config/initializers/005-site_settings.rb:18:in 'block in <main>'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:406:in 'BasicObject#instance_exec'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:406:in 'block in ActiveSupport::Callbacks::CallTemplate::InstanceExec0#make_lambda'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:178:in 'block in ActiveSupport::Callbacks::Filters::Before#call'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:668:in 'block (2 levels) in ActiveSupport::Callbacks::CallbackChain#default_terminator'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:667:in 'Kernel#catch'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:667:in 'block in ActiveSupport::Callbacks::CallbackChain#default_terminator'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:179:in 'ActiveSupport::Callbacks::Filters::Before#call'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:559:in 'block in ActiveSupport::Callbacks::CallbackSequence#invoke_before'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:559:in 'Array#each'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:559:in 'ActiveSupport::Callbacks::CallbackSequence#invoke_before'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:108:in 'ActiveSupport::Callbacks#run_callbacks'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/reloader.rb:96:in 'ActiveSupport::Reloader.prepare!'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/application/finisher.rb:73:in 'block in <module:Finisher>'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:32:in 'BasicObject#instance_exec'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:32:in 'Rails::Initializable::Initializer#run'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:61:in 'block in Rails::Initializable#run_initializers'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:231:in 'block in TSort.tsort_each'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:353:in 'block (2 levels) in TSort.each_strongly_connected_component'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:434:in 'TSort.each_strongly_connected_component_from'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:352:in 'block in TSort.each_strongly_connected_component'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'Rails::Initializable::Collection#each'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'Method#call'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'TSort.each_strongly_connected_component'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:229:in 'TSort.tsort_each'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:208:in 'TSort#tsort_each'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:60:in 'Rails::Initializable#run_initializers'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/application.rb:444:in 'Rails::Application#initialize!'
/src/config/environment.rb:7:in '<top (required)>'
/usr/local/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'
/usr/local/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
config.ru:8:in 'block in <main>'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/rack-2.2.23/lib/rack/builder.rb:125:in 'BasicObject#instance_eval'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/rack-2.2.23/lib/rack/builder.rb:125:in 'Rack::Builder#initialize'
config.ru:3:in 'Class#new'
config.ru:3:in '<main>'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:91:in 'Kernel#eval'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:91:in 'block in Pitchfork.builder'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:1160:in 'Pitchfork::HttpServer#build_app!'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:694:in 'block in Pitchfork::HttpServer#spawn_initial_mold'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:170:in 'block in Pitchfork.clean_fork'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:168:in 'Kernel#catch'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:168:in 'Pitchfork.clean_fork'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:690:in 'Pitchfork::HttpServer#spawn_initial_mold'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:176:in 'Pitchfork::HttpServer#start'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/exe/pitchfork:110:in '<top (required)>'
/src/bin/pitchfork:58:in 'Kernel#load'
/src/bin/pitchfork:58:in 'block in <main>'
/src/bin/pitchfork:58:in 'Kernel#fork'
/src/bin/pitchfork:58:in '<main>'
/src/config/initializers/000-pg_connection_patch.rb:35:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new_client': connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (ActiveRecord::ConnectionNotEstablished)
        Is the server running locally and accepting connections on that socket?
connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql_adapter.rb:944:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#connect'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql_adapter.rb:956:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#reconnect'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:670:in 'block (2 levels) in ActiveRecord::ConnectionAdapters::AbstractAdapter#reconnect!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:1224:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#attempt_configure_connection'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:669:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#reconnect!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:668:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#reconnect!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:778:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#verify!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:766:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#verify!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:786:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#connect!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:992:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:991:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/quoting.rb:128:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting#quote_string'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract/quoting.rb:76:in 'ActiveRecord::ConnectionAdapters::Quoting#quote'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/quoting.rb:122:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting#quote'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:1142:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#quoted_scope'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:1119:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#data_source_sql'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:45:in 'ActiveRecord::ConnectionAdapters::SchemaStatements#data_source_exists?'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/schema_migration.rb:102:in 'block in ActiveRecord::SchemaMigration#table_exists?'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in 'ActiveRecord::ConnectionAdapters::ConnectionPool#with_connection'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/schema_migration.rb:101:in 'ActiveRecord::SchemaMigration#table_exists?'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/migration.rb:1282:in 'ActiveRecord::MigrationContext#get_all_versions'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/migration.rb:1299:in 'ActiveRecord::MigrationContext#pending_migration_versions'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/migration.rb:1295:in 'ActiveRecord::MigrationContext#needs_migration?'
        from /src/config/initializers/100-flags.rb:6:in 'block in <main>'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:406:in 'BasicObject#instance_exec'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:406:in 'block in ActiveSupport::Callbacks::CallTemplate::InstanceExec0#make_lambda'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:178:in 'block in ActiveSupport::Callbacks::Filters::Before#call'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:668:in 'block (2 levels) in ActiveSupport::Callbacks::CallbackChain#default_terminator'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:667:in 'Kernel#catch'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:667:in 'block in ActiveSupport::Callbacks::CallbackChain#default_terminator'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:179:in 'ActiveSupport::Callbacks::Filters::Before#call'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:559:in 'block in ActiveSupport::Callbacks::CallbackSequence#invoke_before'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:559:in 'Array#each'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:559:in 'ActiveSupport::Callbacks::CallbackSequence#invoke_before'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:108:in 'ActiveSupport::Callbacks#run_callbacks'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/reloader.rb:96:in 'ActiveSupport::Reloader.prepare!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/application/finisher.rb:73:in 'block in <module:Finisher>'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:32:in 'BasicObject#instance_exec'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:32:in 'Rails::Initializable::Initializer#run'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:61:in 'block in Rails::Initializable#run_initializers'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:231:in 'block in TSort.tsort_each'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:353:in 'block (2 levels) in TSort.each_strongly_connected_component'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:434:in 'TSort.each_strongly_connected_component_from'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:352:in 'block in TSort.each_strongly_connected_component'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'Rails::Initializable::Collection#each'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'Method#call'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'TSort.each_strongly_connected_component'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:229:in 'TSort.tsort_each'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:208:in 'TSort#tsort_each'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:60:in 'Rails::Initializable#run_initializers'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/application.rb:444:in 'Rails::Application#initialize!'
        from /src/config/environment.rb:7:in '<top (required)>'
        from /usr/local/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'
        from /usr/local/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
        from config.ru:8:in 'block in <main>'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/rack-2.2.23/lib/rack/builder.rb:125:in 'BasicObject#instance_eval'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/rack-2.2.23/lib/rack/builder.rb:125:in 'Rack::Builder#initialize'
        from config.ru:3:in 'Class#new'
        from config.ru:3:in '<main>'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:91:in 'Kernel#eval'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:91:in 'block in Pitchfork.builder'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:1160:in 'Pitchfork::HttpServer#build_app!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:694:in 'block in Pitchfork::HttpServer#spawn_initial_mold'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:170:in 'block in Pitchfork.clean_fork'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:168:in 'Kernel#catch'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:168:in 'Pitchfork.clean_fork'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:690:in 'Pitchfork::HttpServer#spawn_initial_mold'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:176:in 'Pitchfork::HttpServer#start'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/exe/pitchfork:110:in '<top (required)>'
        from /src/bin/pitchfork:58:in 'Kernel#load'
        from /src/bin/pitchfork:58:in 'block in <main>'
        from /src/bin/pitchfork:58:in 'Kernel#fork'
        from /src/bin/pitchfork:58:in '<main>'
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pg-1.6.3-x86_64-linux/lib/pg/connection.rb:944:in 'PG::Connection.connect_start': connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (PG::ConnectionBad)
        Is the server running locally and accepting connections on that socket?
connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pg-1.6.3-x86_64-linux/lib/pg/connection.rb:944:in 'PG::Connection.connect_to_hosts'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pg-1.6.3-x86_64-linux/lib/pg/connection.rb:871:in 'PG::Connection.new'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pg-1.6.3-x86_64-linux/lib/pg.rb:88:in 'PG.connect'
        from /src/config/initializers/000-pg_connection_patch.rb:5:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new_client'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql_adapter.rb:944:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#connect'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql_adapter.rb:956:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#reconnect'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:670:in 'block (2 levels) in ActiveRecord::ConnectionAdapters::AbstractAdapter#reconnect!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:1224:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#attempt_configure_connection'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:669:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#reconnect!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:668:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#reconnect!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:778:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#verify!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:766:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#verify!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:786:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#connect!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:992:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:991:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/quoting.rb:128:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting#quote_string'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract/quoting.rb:76:in 'ActiveRecord::ConnectionAdapters::Quoting#quote'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/quoting.rb:122:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting#quote'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:1142:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#quoted_scope'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:1119:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#data_source_sql'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:45:in 'ActiveRecord::ConnectionAdapters::SchemaStatements#data_source_exists?'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/schema_migration.rb:102:in 'block in ActiveRecord::SchemaMigration#table_exists?'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in 'ActiveRecord::ConnectionAdapters::ConnectionPool#with_connection'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/schema_migration.rb:101:in 'ActiveRecord::SchemaMigration#table_exists?'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/migration.rb:1282:in 'ActiveRecord::MigrationContext#get_all_versions'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/migration.rb:1299:in 'ActiveRecord::MigrationContext#pending_migration_versions'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activerecord-8.0.5/lib/active_record/migration.rb:1295:in 'ActiveRecord::MigrationContext#needs_migration?'
        from /src/config/initializers/100-flags.rb:6:in 'block in <main>'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:406:in 'BasicObject#instance_exec'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:406:in 'block in ActiveSupport::Callbacks::CallTemplate::InstanceExec0#make_lambda'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:178:in 'block in ActiveSupport::Callbacks::Filters::Before#call'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:668:in 'block (2 levels) in ActiveSupport::Callbacks::CallbackChain#default_terminator'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:667:in 'Kernel#catch'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:667:in 'block in ActiveSupport::Callbacks::CallbackChain#default_terminator'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:179:in 'ActiveSupport::Callbacks::Filters::Before#call'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:559:in 'block in ActiveSupport::Callbacks::CallbackSequence#invoke_before'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:559:in 'Array#each'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:559:in 'ActiveSupport::Callbacks::CallbackSequence#invoke_before'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/callbacks.rb:108:in 'ActiveSupport::Callbacks#run_callbacks'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/activesupport-8.0.5/lib/active_support/reloader.rb:96:in 'ActiveSupport::Reloader.prepare!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/application/finisher.rb:73:in 'block in <module:Finisher>'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:32:in 'BasicObject#instance_exec'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:32:in 'Rails::Initializable::Initializer#run'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:61:in 'block in Rails::Initializable#run_initializers'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:231:in 'block in TSort.tsort_each'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:353:in 'block (2 levels) in TSort.each_strongly_connected_component'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:434:in 'TSort.each_strongly_connected_component_from'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:352:in 'block in TSort.each_strongly_connected_component'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'Rails::Initializable::Collection#each'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'Method#call'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:350:in 'TSort.each_strongly_connected_component'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:229:in 'TSort.tsort_each'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/tsort-0.2.0/lib/tsort.rb:208:in 'TSort#tsort_each'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/initializable.rb:60:in 'Rails::Initializable#run_initializers'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/railties-8.0.5/lib/rails/application.rb:444:in 'Rails::Application#initialize!'
        from /src/config/environment.rb:7:in '<top (required)>'
        from /usr/local/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'
        from /usr/local/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
        from config.ru:8:in 'block in <main>'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/rack-2.2.23/lib/rack/builder.rb:125:in 'BasicObject#instance_eval'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/rack-2.2.23/lib/rack/builder.rb:125:in 'Rack::Builder#initialize'
        from config.ru:3:in 'Class#new'
        from config.ru:3:in '<main>'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:91:in 'Kernel#eval'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:91:in 'block in Pitchfork.builder'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:1160:in 'Pitchfork::HttpServer#build_app!'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:694:in 'block in Pitchfork::HttpServer#spawn_initial_mold'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:170:in 'block in Pitchfork.clean_fork'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:168:in 'Kernel#catch'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork.rb:168:in 'Pitchfork.clean_fork'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:690:in 'Pitchfork::HttpServer#spawn_initial_mold'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:176:in 'Pitchfork::HttpServer#start'
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/exe/pitchfork:110:in '<top (required)>'
        from /src/bin/pitchfork:58:in 'Kernel#load'
        from /src/bin/pitchfork:58:in 'block in <main>'
        from /src/bin/pitchfork:58:in 'Kernel#fork'
        from /src/bin/pitchfork:58:in '<main>'
mold gen=0 pid=189 reaped (#<Process::Status: pid 189 exit 1>)
/home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/lib/pitchfork/http_server.rb:179:in 'Pitchfork::HttpServer#start': The initial mold failed to boot (Pitchfork::BootFailure)
        from /home/discourse/.bundle/gems/ruby/3.4.0/gems/pitchfork-0.18.2/exe/pitchfork:110:in '<top (required)>'
        from /src/bin/pitchfork:58:in 'Kernel#load'
        from /src/bin/pitchfork:58:in 'block in <main>'
        from /src/bin/pitchfork:58:in 'Kernel#fork'
        from /src/bin/pitchfork:58:in '<main>'

Provavelmente foi causado pela atualização do pg15 para o pg18.

Acho que estou enfrentando o mesmo problema.

Em /var/discourse/templates/web.template.yml, a linha a ser alterada é a do comando de instalação do bundle (por volta da linha 209):

Antes (falha em hosts com 1 CPU):

- su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3'

Depois:

- su discourse -c 'bundle install --jobs 1 --retry 3'

Isso é --jobs 1, não -j1. O Bundler usa --jobs; -j é para pg_dump / pg_restore em templates/postgres.template.yml (e postgres.18.template.yml), por exemplo, altere -j$(($(nproc) - 1)) para -j1 lá se você encontrar a falha de atualização do Postgres novamente.

1 curtida

Resolvi da seguinte maneira.

d/shutdown_dev

# Remove o banco de dados local
sudo rm -rf ~/discourse/data/postgres

# Reinicializa o banco de dados
d/boot_dev -i

Os dados locais de desenvolvimento serão perdidos!!! Considere restaurar a partir do ambiente de teste.

A correção para a contagem de núcleos está a caminho. Não percebíamos que tínhamos tantos usuários com CPU única, desculpe!

3 curtidas

(publicação excluída pelo autor)

Atualizei a detecção da contagem de núcleos para usar nproc --ignore=1.

1 curtida

A minha primeira atualização foi concluída sem problemas, embora tenha tido alguns erros estranhos de conexão entre os contêineres que foram resolvidos reconstruindo os dados mais uma vez.

(esta é uma configuração com dois contêineres).

Mas tudo terminou bem.

Muito obrigado pelo duro trabalho nisso!

1 curtida