Impossibile aggiornare a PostgreSQL 15/

Ciao, ho letto questo post: PostgreSQL 15 update - e ho provato ad aggiornare alla versione 15, tuttavia quando eseguo il comando di ricostruzione, mi imbatto in errori che non conosco e nessuna delle mie ricerche ha risolto il problema. Apprezzerei qualsiasi aiuto potessi ricevere qui.

Si lamenta che sia Locale che postgres siano inizializzati dalla versione 13 e non siano compatibili con la 15.

WARNING: Docker version 20.10.7 deprecated, recommend upgrade to 24.0.7 or newer.
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 is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 600 app
app
2.0.20250129-0720: Pulling from discourse/base
Digest: sha256:01b8516e5504c0e9bc3707773015ff4407be03a89154194ff3b5b8699291bc26
Status: Image is up to date for discourse/base:2.0.20250129-0720
docker.io/discourse/base:2.0.20250129-0720
/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2025-02-25T12:02:47.588312 #1]  INFO -- : Reading from stdin
I, [2025-02-25T12:02:47.603317 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown:
I, [2025-02-25T12:02:47.608602 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown:
I, [2025-02-25T12:02:47.614271 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown:
I, [2025-02-25T12:02:47.619607 #1]  INFO -- : File > /root/install_postgres  chmod: +x  chown:
I, [2025-02-25T12:02:47.623993 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown:
I, [2025-02-25T12:02:47.624696 #1]  INFO -- : Replacing data_directory = '/var/lib/postgresql/15/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.628520 #1]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.629701 #1]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.635680 #1]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.636635 #1]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.637658 #1]  INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.638584 #1]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.639215 #1]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.639833 #1]  INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-25T12:02:47.640892 #1]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/15/main/pg_hba.conf
I, [2025-02-25T12:02:47.641570 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/15/main/pg_hba.conf
I, [2025-02-25T12:02:47.642114 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/15/main/pg_hba.conf
I, [2025-02-25T12:02:47.642818 #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

failed to set locale!
[error] character map file `UTF-8' not found: No such file or directory
failed to set locale!
[error] default character map file `ANSI_X3.4-1968' not found: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.UTF-8",
        LC_ALL = "en_US.UTF-8",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
popen failure: Cannot allocate memory
initdb: error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/15/bin/initdb"
I, [2025-02-25T12:02:49.979779 #1]  INFO -- : Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
Upgrading PostgreSQL from version 13 to 15

I, [2025-02-25T12:02:49.980481 #1]  INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/15/bin/postmaster -D /etc/postgresql/15/main
I, [2025-02-25T12:02:49.983148 #1]  INFO -- : Terminating async processes
2025-02-25 12:02:50.007 UTC [51] FATAL:  database files are incompatible with server
2025-02-25 12:02:50.007 UTC [51] DETAIL:  The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 15.10 (Debian 15.10-1.pgdg120+1).

Grazie in anticipo!

Questo è forse il problema più grave: hai bisogno di più RAM o devi aggiungere dello swap.

Per favore, pubblica l’output di queste rapide diagnostiche:

Grazie per aver dedicato del tempo. Mi è completamente sfuggita quella cosa della memoria, ecco i risultati che hai richiesto:

root@glorious-discourse-forum:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
root@glorious-discourse-forum:~# uptime
 13:27:58 up 1341 days, 22:37,  2 users,  load average: 0.07, 0.03, 0.00
root@glorious-discourse-forum:~# df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        49G   41G  7.7G  85% /
root@glorious-discourse-forum:~# free
              total        used        free      shared  buff/cache   available
Mem:        2040976      416492      436628       20940     1187856     1433788
Swap:       2097148       85248     2011900
root@glorious-discourse-forum:~# swapon
NAME      TYPE SIZE  USED PRIO
/swapfile file   2G 83.3M   -2
root@glorious-discourse-forum:~# vmstat 5 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0  85248 436692 444416 743440    8    8   268    88    0    0  3  1 96  0  0
 0  0  85248 436684 444416 743440    0    0     0     0   50   87  0  0 100  0  0
 0  0  85248 436716 444416 743440    0    0     0     8   48   78  0  0 100  0  0
 0  0  85248 436716 444416 743440    0    0     0     6   39   63  0  0 100  0  0
 0  0  85248 436716 444416 743440    0    0     0     0   54   91  0  0 100  0  0
root@glorious-discourse-forum:~# dmesg|egrep -i "memory|oom|kill"
root@glorious-discourse-forum:~# ps auxrc
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      5781  0.0  0.1  40100  3332 pts/6    R+   13:28   0:00 ps

Grazie. Penso che potresti provare ad aggiungere solo 2G o 4G di swap. Ma il messaggio su Docker obsoleto e l’esecuzione di 18.04LTS, significa che saresti in una posizione molto migliore se migrassi a una nuova istanza con una nuova installazione del sistema operativo: preferibilmente 24.04. Attualmente eseguo sia 24.04 che 22.04.

Migrare a una nuova istanza fresca è probabilmente meno sforzo nel complesso rispetto al tentativo di aggiornare sul posto. Potrebbe persino essere meno dirompente. È molto probabile che tu abbia un po’ di tempo di inattività, qualunque cosa tu faccia.

Il primo passo è fare un backup (con i download) e scaricarlo per conservarlo al sicuro. Fai anche una copia del tuo file app.yml.

Ieri ho effettuato una migrazione, per ragioni simili. Inoltre, ho potuto ottenere una macchina migliore per lo stesso costo passando a un’offerta più recente dal provider di hosting.

Ho seguito la ricetta di migrazione e i suggerimenti qui

Inoltre, per ottenere i migliori risultati, leggi
La configurazione di distribuzione di Discourse opinata di MKJ

Ti manca anche un po’ di spazio su disco, soprattutto se aggiungi swap. Di solito faccio
du -kx / | sort -n | tail -55
o qualcosa di simile per vedere se c’è qualcosa di grande che non dovrebbe esserci.

1 Mi Piace

Oh, un altro approccio alla migrazione, invece di backup e ripristino, è usare rsync. Non l’ho fatto, ma ecco una ricetta:
Move a Discourse site to another VPS with rsync

L’altro problema è che la tua versione di Docker e il tuo sistema operativo necessitano di un aggiornamento.

La versione di Docker 24.0.7 o successiva richiede una versione di Ubuntu LTS superiore alla 18. Il servizio a lungo termine di quella LTS non è più supportato.

Ho visto alcuni siti aggiornati con 18.04, ma la maggior parte di essi non lo ha fatto.

Ho visto persone riuscire a fare un dist-upgrade, ma il suo successo è incerto, e vuoi davvero che i resti del tuo sistema operativo vecchio di 6 anni causino potenzialmente problemi per i prossimi 5 anni per cui 24.04 è supportato? Inoltre, un aggiornamento di 18.04 ti porta solo a 20.04, che è valido per circa altri 60 giorni, quindi dovresti eseguire 3 dist-upgrade per arrivare all’ultimo sistema operativo.

Quindi mi sono imbattuto esattamente nello stesso errore, solo che ho eseguito ./launcher rebuild, non avevo seguito i forum e gli avvisi e ho eseguito l’aggiornamento un po’ alla cieca. Come posso interrompere/revertire questa esecuzione? Basta fare Ctrl+C per uscire dall’esecuzione?

Cosa è successo? C’è stato un errore? Ha detto di eseguire di nuovo la ricostruzione?

Hai aggiornato docker?

Hai provato

 ./launcher start app

Hai guardato Aggiornamento PostgreSQL 15

si è bloccato dopo DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 15.10 (Debian 15.10-1.pgdg120+1).
Ho riavviato il server e questo ha riportato il server online.
Sto eseguendo altri aggiornamenti ora con Docker bloccato al 20 per qualche motivo e altre dipendenze. Che bel modo di passare il venerdì sera haha

Che peccato.

Aspetterei fino a lunedì e mi sposterei su una nuova VM (virtual machine). Immagino che questa sia al di là della fine del ciclo di vita.

Sono riuscito ad aggiornare il sistema operativo host, la versione di Docker e poi l’aggiornamento del database ha funzionato. Gli ho anche dato più RAM, lol, dovrebbe andare bene per altri 5 anni, giusto? Ahahah

Se fai aggiornamenti del sistema operativo (specialmente docker), probabilmente sì!

2 Mi Piace