PostgreSQL 18 update for self-hosters

:warning: WARNING! The upgrade requires a lot of free disk space (2x database size).

We’ve just landed changes to upgrade our Docker image to PostgreSQL 18. Any site admins rebuilding Discourse from the command line will be upgraded to PostgreSQL 18 from the previous PostgreSQL 15. Note that if you held back from upgrading when the PostgreSQL 15 update happened back in 2025, you can skip that upgrade and go straight to PostgreSQL 18.

If you had held back the upgrade previously, change the PostgreSQL template in app.yml from templates/postgres.13.template.yml to templates/postgres.template.yml.

As with any upgrade, it is strongly advised to take a backup before doing anything.

Locale changes

Previously we have seen index corruption occur when glibc was updated, such as during OS upgrades. Since PostgreSQL 17 there is a new builtin locale provider which is decoupled from the OS’ glibc and therefore stable across versions. As part of this upgrade we are moving to this builtin provider using the C.UTF-8 locale. This locale using code point ordering and we recommend it for the aforementioned stability reasons.

In order to accomplish the locale change we need to first create the new DB cluster using the builtin locale provider and then we dump and restore the DB into this cluster. For this reason the disk space requirements are greater than previous upgrades where we performed in-place upgrades.

Updating

Official Install Guide (single container)

On your next rebuild, you will see this message at the end:

-------------------------------------------------------------------------------------
UPGRADE OF POSTGRES COMPLETE

Old 15 database is stored at /shared/postgres_data_old

To complete the upgrade, rebuild again using:

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

That means everything went well in the upgrade! You just need to issue a new rebuild to get your site back and running.

Data Container Install

If you are running a setup with a dedicated data container based in the sample supplied in our discourse_docker repository, you want to be sure you are shutting down PostgreSQL in a safe and clean way.

Nowadays, we have background jobs running queries spanning several minutes, so shutting down the web container will help the data container be shutdown safely.

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

Before issuing the first rebuild to the data container, you can tail the PostgreSQL log to see if it was shutdown properly.

Running a tail -f shared/standalone/log/var-log/postgres/current should give you the following log if it was clean:

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

Postponing the update

If you need to postpone the update during your next rebuild, you can swap the PostgreSQL template on your app.yml file by changing "templates/postgres.template.yml" to "templates/postgres.15.template.yml".

This is not recommended, as some site admins will forget to revert the change afterwards.

Post update optional tasks

Optimizing PostgreSQL statistics

After the update, the new PostgreSQL won’t have table statistics on hand. You can generate those using:

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

Cleaning up old data

For a standard install, you can delete the old data in PG15 format with the following command:

cd /var/discourse
./launcher cleanup

If you have a separate data container, you’ll need to remove the backup copy like this:

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

FAQ

The source cluster was not shut down cleanly

If you get a upgrade failed with the above message, you can try a simpler approach to get it back into a better state.

Restart the old container with ./launcher start app. Wait a few minutes until it is back up.

Now shut it down again with ./launcher stop app. After that tail the logs to see if it was a clean one:

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

If the logs do not indicate that the database is shut down, you can start the old container again, enter with ./launcher enter app, run these commands and tail the logs again once done.

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

If the logs look like above, you can now try to upgrade again using ./launcher rebuild app.

lc_collate values for database “postgres” do not match

This errors happens if you are using non-default locales for your database. It was reported that you need 3 variables for it to succeed. Ensure that the env: section of you app.yml file has the 3 lines:

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

Changing en_US.UTF-8 to your locale.

Every rebuild does the upgrade again aka upgrade loop

When this happens your upgrade logs will contain

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

This means that there are still files from the last upgrade lingering around. Move those elsewhere before continuing.

I did skip the PostgreSQL 15 update, what to do now?

You can follow the standard instructions at the top of this guide and they will upgrade from your version to 18 without issues.

10 Likes

awesome, thanks Chris!

1 Like

What kind of hopefully graceful failure will occur if there is not enough free disk space? Someone is bound to exercise that path!

For those who don’t have enough free disk space, will it work to take a backup, and then restore into a fresh install, as a migration?

(In which case, it might also be a good time to move up to a new LTS version of the operating system. Ubuntu 26.04 is pretty new; 26.04.1 is expected very shortly. A fresh OS install may be less troublesome than an attempted upgrade in place.)

3 Likes

I would have, had I not received an email notification for this post :raised_back_of_hand: :flushed_face:

1 Like

Just to confirm, this is in place right now?

If I were to update from cmd line later this morning, this will all take place?

The upgrade script will check for free space and only proceed if safe to do so.

There are two steps during the process where disk space may become critical. If you were to bypass the free space check this is where you could run into trouble:

  1. When running pg_dump to extract the data from the old DB (2x DB storage required at this point).
  2. When running pg_restore to insert the data back into the new DB (3x DB storage required at this point).

To recover from this state you would need to remove /shared/postgres_dump and /shared/postgres_data_new.

Note that at the end of the upgrade we remove the temporary pg_dump files but retain your pre-upgrade DB data at /shared/postgres_data_old Just In Case. Once you’re happy everything is working you’ll probably want to remove that directory to reclaim disk space.

I’ve tested taking a Discourse backup on a PG15 site and restoring it onto a PG18 site. It worked for me, but be aware that it is not an officially supported method. Test thoroughly on something non-production first and make sure you have a rollback path!

I would recommend studying the process used by the upgrade script. If you have special storage requirements you should be able to adapt it to your needs. Again, test first:

This is now in discourse_docker, yes. If you pull main or run ./launcher rebuild app you will get it.

Switching discourse_docker off the main branch will help prevent accidental upgrades if you want to postpone it.

3 Likes

Can you give any specifics on what very large means?

I read this as needing 3x the size of your database spare, whatever the size?

1 Like

Apologies, that warning was poorly worded and incorrect.

In addition to the existing DB on disk you’ll need enough free space for the dump output and the new copy of the DB as it’s restored. pg_dump’s output is usually smaller than the DB data directory, so 2x the current DB in free space should be enough. I’ll get this corrected in the upgrade script.

EDIT: The free space check has now been updated to look for 2x DB size instead of 3x.

3 Likes

Seems, on single-core VM it’s needed to stay on PG15 postgres.15.template.yml due to limitation:

pg_dump: error: -j/--jobs must be in range 1..2147483647

or patch web.template.yml to -j1 to use one CPU. (Next rebuild will return the default value).

Yes, such configurations exist! :blob_wave:

I got this error because of how nproc is calculated (I’m running on a single vCPU): -j/–jobs must be in range 1..2147483647 (it’s trying -j0 because $(($(nproc) - 1)) = 1 - 1 = 0)

The update script should probably be updated to something like -j$(( $(nproc) > 1 ? $(nproc) - 1 : 1 ))

2 Likes

On one server I had this issue:

I addressed this by moving these directories:

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

And then ./launcher rebuild app completed with:

-------------------------------------------------------------------------------------
UPGRADE OF POSTGRES COMPLETE

Old 15 database is stored at /shared/postgres_data_old

To complete the upgrade, rebuild again using:

./launcher rebuild app
-------------------------------------------------------------------------------------
1 Like

On another server I have an error with 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

This is the same error as above and the post above that, I tried to address this using the suggestion from @Nacho_Caballero by editing ./templates/web.template.yml to change line 210:


  - exec:
      cd: $home
      tag: build
      hook: bundle_exec
      cmd:
        # - su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3'
        - su discourse -c 'bundle install --jobs $(( $(nproc) > 1 ? $(nproc) - 1 : 1 )) --retry 3'
        - su discourse -c 'bundle clean'
        - su discourse -c 'find /var/www/discourse/vendor/bundle -name cache -not -path "*/gems/*" -type d -exec rm -rf {} +'
        - su discourse -c 'find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +'

But that failed so I edited it again to:

  - exec:
      cd: $home
      tag: build
      hook: bundle_exec
      cmd:
        # - su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3'
        # - su discourse -c 'bundle install --jobs $(( $(nproc) > 1 ? $(nproc) - 1 : 1 )) --retry 3'
        - su discourse -c 'bundle install --jobs 1 --retry 3'
        - su discourse -c 'bundle clean'
        - su discourse -c 'find /var/www/discourse/vendor/bundle -name cache -not -path "*/gems/*" -type d -exec rm -rf {} +'
        - su discourse -c 'find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +'

But it still failed with:

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
-------------------------------------------------------------------------------------

Because several files need editing:

grep -l nproc templates/*.yml
templates/postgres.18.template.yml
templates/postgres.template.yml
templates/web.template.yml

Open all three in vim and search for nproc:

vim $(grep -l nproc templates/*.yml|xargs)

In templates/postgres.18.template.yml line 154 and 160:

          # su postgres -c "/usr/lib/postgresql/${PG_MAJOR_OLD}/bin/pg_dump -Fd -j$(($(nproc) - 1)) discourse -f /shared/postgres_dump/discourse"
          su postgres -c "/usr/lib/postgresql/${PG_MAJOR_OLD}/bin/pg_dump -Fd -j1) discourse -f /shared/postgres_dump/discourse"

          # su postgres -c "/usr/lib/postgresql/18/bin/pg_restore -e -j$(($(nproc) - 1)) -d discourse /shared/postgres_dump/discourse"
          su postgres -c "/usr/lib/postgresql/18/bin/pg_restore -e -j1 -d discourse /shared/postgres_dump/discourse"

And templates/postgres.template.yml line 155 and 161:

          # su postgres -c "/usr/lib/postgresql/${PG_MAJOR_OLD}/bin/pg_dump -Fd -j$(($(nproc) - 1)) discourse -f /shared/postgres_dump/discourse"
          su postgres -c "/usr/lib/postgresql/${PG_MAJOR_OLD}/bin/pg_dump -Fd -j1 discourse -f /shared/postgres_dump/discourse"

          # su postgres -c "/usr/lib/postgresql/18/bin/pg_restore -e -j$(($(nproc) - 1)) -d discourse /shared/postgres_dump/discourse"
          su postgres -c "/usr/lib/postgresql/18/bin/pg_restore -e -j1 -d discourse /shared/postgres_dump/discourse"

And in templates/web.template.yml line 209:

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

And after that it all works.

However on some server I got this loop:

x86_64 arch detected.
Ensuring launcher is up to date
Updating Launcher...
Updating 0949304..7de2cf5
error: Your local changes to the following files would be overwritten by merge:
	templates/postgres.18.template.yml
	templates/postgres.template.yml
Please commit your changes or stash them before you merge.
Aborting

So stashing the edits, updating the code and then reinstalling the edits before trying ./launcher rebuild app again:

git stash
git pull
git stash drop

On one server I had:

-------------------------------------------------------------------------------------
WARNING: Upgrading PostgreSQL would require an additional 896M of disk space
Please free up some space, or expand your disk, before continuing.

To avoid upgrading change "templates/postgres.template.yml" TO "templates/postgres.15.template.yml" in containers/app.yml

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

So I had to expand the disk before trying again.

Thanks to @Nacho_Caballero and @Ivan_Rapekas for their help with this :slight_smile:

UPDATE

The PostgreSQL template files have now been fixed by @chrisr, thanks! So to undo the changes I made above I have run the following:

git stash
git pull
git stash drop
3 Likes

Local docker development environment, pulling the latest release/2026.7 branch

d/shutdown_dev

d/boot_dev

Then run

d/rails s

What should I do if I encounter the error below?

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>'

This is likely caused by the upgrade from pg15 to pg18.

I think I run into the same problem.

In /var/discourse/templates/web.template.yml the line to change is the bundle install jobs line (around line 209):

Before (breaks on 1-CPU hosts):

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

After:

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

That is --jobs 1, not -j1. Bundler uses --jobs; -j is for pg_dump / pg_restore in templates/postgres.template.yml (and postgres.18.template.yml), e.g. change -j$(($(nproc) - 1)) to -j1 there if you hit the Postgres upgrade failure again.

2 Likes

I resolved it using the following method.

d/shutdown_dev

# Delete local database
sudo rm -rf ~/discourse/data/postgres

# Reinitialize database
d/boot_dev -i

Local development data will be lost!!! Consider restoring from the test environment.

A fix for the core count is on its way. Didn’t realise we had so many single CPU users, sorry!

4 Likes

(post deleted by author)

I’ve updated the core count detection to use nproc --ignore=1.

1 Like

My first upgrade completed ok, although I did have some strange interim container connection errors which were resolved by rebuilding data yet again.

(this is a two container setup).

But all ended well.

Thank you very much for the hard work on this one!

3 Likes