Error upgrading from 3.0.1 to 3.1.0

Hello!

Here’s are my log details:

I, [2023-03-28T15:29:11.675436 #1]  INFO -- : Terminating async processes
I, [2023-03-28T15:29:11.675493 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 42
I, [2023-03-28T15:29:11.675526 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 103
103:signal-handler (1680017351) Received SIGTERM scheduling shutdown...
2023-03-28 15:29:11.675 UTC [42] LOG:  received fast shutdown request
2023-03-28 15:29:11.686 UTC [42] LOG:  aborting any active transactions
2023-03-28 15:29:11.688 UTC [42] LOG:  background worker "logical replication launcher" (PID 51) exited with exit code 1
2023-03-28 15:29:11.689 UTC [46] LOG:  shutting down
103:M 28 Mar 2023 15:29:11.726 # User requested shutdown...
103:M 28 Mar 2023 15:29:11.726 * Saving the final RDB snapshot before exiting.
2023-03-28 15:29:11.733 UTC [42] LOG:  database system is shut down
103:M 28 Mar 2023 15:29:12.075 * DB saved on disk
103:M 28 Mar 2023 15:29:12.075 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 413 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** 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.
3a71b6f8b65d32605201011066c2d30256bdba147312ea57fe6ae85813374198

I’ve tried running both:

cd /var/discourse
git pull
./launcher rebuild app

And

./discourse-doctor

Are there any know issues with the latest release?

How can I back to my older version and rebuild?

So you moved from stable to tests-passed ?

please scroll up and look for earlier error messages

Depends on the error. If it already ran some migrations, then you will need to restore a backup after moving back to stable.

2 Likes

I was already on tests-passed. I just hadn’t done the latest update.

I’ve tried re-uploading my app.yml with the “stable” tag and the app isn’t working either.

Are you saying I need to install a brand new version of discourse and upload a backup?

I’d try another rebuild, then.

Only if you were, and wanted to stay, on stable, but you weren’t, and don’t.

Yeah that’s not working. :confused:

Not sure what I should do here… Do you have any pointers?

You can try scrolling up and looking for what the actual error is.

1 Like

I don’t understand how you could be on 3.0.1 and tests-passed at the same time.

Anyway, in order to find the cause of the issue

:point_up_2:

1 Like

Here’s the full log:

x86_64 arch detected.
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 60 app
app
2.0.20230313-1023: Pulling from discourse/base
Digest: sha256:f7467469ab9e39c3548d4478e3f416c05b34a0ee58eb6e40b963e562005669cc
Status: Image is up to date for discourse/base:2.0.20230313-1023
docker.io/discourse/base:2.0.20230313-1023
/usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2023-03-28T15:53:54.333438 #1]  INFO -- : Reading from stdin
I, [2023-03-28T15:53:54.337781 #1]  INFO -- : > locale-gen $LANG && update-locale
I, [2023-03-28T15:53:54.401943 #1]  INFO -- : Generating locales (this might take a while)...
Generation complete.

I, [2023-03-28T15:53:54.402138 #1]  INFO -- : > mkdir -p /shared/postgres_run
I, [2023-03-28T15:53:54.409507 #1]  INFO -- :
I, [2023-03-28T15:53:54.410890 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2023-03-28T15:53:54.415761 #1]  INFO -- :
I, [2023-03-28T15:53:54.415968 #1]  INFO -- : > chmod 775 /shared/postgres_run
I, [2023-03-28T15:53:54.419003 #1]  INFO -- :
I, [2023-03-28T15:53:54.419148 #1]  INFO -- : > rm -fr /var/run/postgresql
I, [2023-03-28T15:53:54.421702 #1]  INFO -- :
I, [2023-03-28T15:53:54.421895 #1]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2023-03-28T15:53:54.424652 #1]  INFO -- :
I, [2023-03-28T15:53:54.424778 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2023/03/28 15:53:54 socat[19] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2023-03-28T15:53:54.447387 #1]  INFO -- :
I, [2023-03-28T15:53:54.447498 #1]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2023-03-28T15:53:54.450395 #1]  INFO -- :
I, [2023-03-28T15:53:54.450545 #1]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2023-03-28T15:53:54.453201 #1]  INFO -- :
I, [2023-03-28T15:53:54.453463 #1]  INFO -- : > mkdir -p /shared/postgres_run/13-main.pg_stat_tmp
I, [2023-03-28T15:53:54.455690 #1]  INFO -- :
I, [2023-03-28T15:53:54.456001 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run/13-main.pg_stat_tmp
I, [2023-03-28T15:53:54.458189 #1]  INFO -- :
I, [2023-03-28T15:53:54.463017 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown:
I, [2023-03-28T15:53:54.467517 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown:
I, [2023-03-28T15:53:54.472056 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown:
I, [2023-03-28T15:53:54.476649 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown:
I, [2023-03-28T15:53:54.476888 #1]  INFO -- : > chown -R root /var/lib/postgresql/13/main
I, [2023-03-28T15:53:54.961444 #1]  INFO -- :
I, [2023-03-28T15:53:54.961605 #1]  INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/13/bin/initdb -D /shared/postgres_data || exit 0
I, [2023-03-28T15:53:54.964190 #1]  INFO -- :
I, [2023-03-28T15:53:54.964264 #1]  INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2023-03-28T15:53:55.004351 #1]  INFO -- :
I, [2023-03-28T15:53:55.004550 #1]  INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2023-03-28T15:53:55.006946 #1]  INFO -- :
I, [2023-03-28T15:53:55.007214 #1]  INFO -- : > /root/upgrade_postgres
I, [2023-03-28T15:53:55.012623 #1]  INFO -- :
I, [2023-03-28T15:53:55.012886 #1]  INFO -- : > rm /root/upgrade_postgres
I, [2023-03-28T15:53:55.014809 #1]  INFO -- :
I, [2023-03-28T15:53:55.016006 #1]  INFO -- : Replacing data_directory = '/var/lib/postgresql/13/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-28T15:53:55.016541 #1]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-28T15:53:55.017807 #1]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-28T15:53:55.018586 #1]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-28T15:53:55.019308 #1]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-28T15:53:55.019966 #1]  INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-28T15:53:55.020526 #1]  INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2023-03-28T15:53:55.025814 #1]  INFO -- :
I, [2023-03-28T15:53:55.026116 #1]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-28T15:53:55.026440 #1]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-28T15:53:55.027247 #1]  INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-28T15:53:55.028214 #1]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/13/main/pg_hba.conf
I, [2023-03-28T15:53:55.028511 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2023-03-28T15:53:55.028984 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2023-03-28T15:53:55.029362 #1]  INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main
I, [2023-03-28T15:53:55.030886 #1]  INFO -- : > sleep 5
2023-03-28 15:53:55.170 UTC [42] LOG:  starting PostgreSQL 13.10 (Debian 13.10-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2023-03-28 15:53:55.170 UTC [42] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-03-28 15:53:55.170 UTC [42] LOG:  listening on IPv6 address "::", port 5432
2023-03-28 15:53:55.174 UTC [42] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-03-28 15:53:55.183 UTC [45] LOG:  database system was shut down at 2023-03-28 15:51:27 UTC
2023-03-28 15:53:55.194 UTC [42] LOG:  database system is ready to accept connections
I, [2023-03-28T15:54:00.034394 #1]  INFO -- :
I, [2023-03-28T15:54:00.034751 #1]  INFO -- : > su postgres -c 'createdb discourse' || true
2023-03-28 15:54:00.106 UTC [55] postgres@postgres ERROR:  database "discourse" already exists
2023-03-28 15:54:00.106 UTC [55] postgres@postgres STATEMENT:  CREATE DATABASE discourse;
createdb: error: database creation failed: ERROR:  database "discourse" already exists
I, [2023-03-28T15:54:00.107948 #1]  INFO -- :
I, [2023-03-28T15:54:00.108179 #1]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2023-03-28 15:54:00.159 UTC [59] postgres@discourse ERROR:  role "discourse" already exists
2023-03-28 15:54:00.159 UTC [59] postgres@discourse STATEMENT:  create user discourse;
ERROR:  role "discourse" already exists
I, [2023-03-28T15:54:00.161333 #1]  INFO -- :
I, [2023-03-28T15:54:00.161604 #1]  INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
I, [2023-03-28T15:54:00.207310 #1]  INFO -- : GRANT

I, [2023-03-28T15:54:00.207544 #1]  INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
I, [2023-03-28T15:54:00.248830 #1]  INFO -- : ALTER SCHEMA

I, [2023-03-28T15:54:00.248979 #1]  INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists hstore;"'
NOTICE:  extension "hstore" already exists, skipping
I, [2023-03-28T15:54:00.293459 #1]  INFO -- : CREATE EXTENSION

I, [2023-03-28T15:54:00.293710 #1]  INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists pg_trgm;"'
NOTICE:  extension "pg_trgm" already exists, skipping
I, [2023-03-28T15:54:00.335539 #1]  INFO -- : CREATE EXTENSION

I, [2023-03-28T15:54:00.335749 #1]  INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists hstore;"'
NOTICE:  extension "hstore" already exists, skipping
I, [2023-03-28T15:54:00.377780 #1]  INFO -- : CREATE EXTENSION

I, [2023-03-28T15:54:00.378010 #1]  INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists pg_trgm;"'
NOTICE:  extension "pg_trgm" already exists, skipping
I, [2023-03-28T15:54:00.421189 #1]  INFO -- : CREATE EXTENSION

I, [2023-03-28T15:54:00.421495 #1]  INFO -- : > sudo -u postgres psql discourse
I, [2023-03-28T15:54:00.425124 #1]  INFO -- : update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = 'discourse' AND encoding = pg_char_to_encoding('SQL_ASCII');

I, [2023-03-28T15:54:00.481590 #1]  INFO -- : File > /var/lib/postgresql/take-database-backup  chmod: +x  chown: postgres:postgres
I, [2023-03-28T15:54:00.485387 #1]  INFO -- : File > /var/spool/cron/crontabs/postgres  chmod:   chown:
I, [2023-03-28T15:54:00.485475 #1]  INFO -- : > echo postgres installed!
I, [2023-03-28T15:54:00.487397 #1]  INFO -- : postgres installed!

I, [2023-03-28T15:54:00.492236 #1]  INFO -- : File > /etc/service/redis/run  chmod: +x  chown:
I, [2023-03-28T15:54:00.496849 #1]  INFO -- : File > /etc/service/redis/log/run  chmod: +x  chown:
I, [2023-03-28T15:54:00.501433 #1]  INFO -- : File > /etc/runit/3.d/10-redis  chmod: +x  chown:
I, [2023-03-28T15:54:00.502933 #1]  INFO -- : Replacing daemonize yes with  in /etc/redis/redis.conf
I, [2023-03-28T15:54:00.503735 #1]  INFO -- : Replacing (?-mix:^pidfile.*$) with  in /etc/redis/redis.conf
I, [2023-03-28T15:54:00.506781 #1]  INFO -- : > install -d -m 0755 -o redis -g redis /shared/redis_data
I, [2023-03-28T15:54:00.509405 #1]  INFO -- :
I, [2023-03-28T15:54:00.509830 #1]  INFO -- : Replacing (?-mix:^logfile.*$) with logfile "" in /etc/redis/redis.conf
I, [2023-03-28T15:54:00.510297 #1]  INFO -- : Replacing (?-mix:^bind .*$) with  in /etc/redis/redis.conf
I, [2023-03-28T15:54:00.512594 #1]  INFO -- : Replacing (?-mix:^dir .*$) with dir /shared/redis_data in /etc/redis/redis.conf
I, [2023-03-28T15:54:00.514902 #1]  INFO -- : Replacing (?-mix:^protected-mode yes) with protected-mode no in /etc/redis/redis.conf
I, [2023-03-28T15:54:00.517756 #1]  INFO -- : Replacing # io-threads 4 with io-threads $redis_io_threads in /etc/redis/redis.conf
I, [2023-03-28T15:54:00.520568 #1]  INFO -- : > echo redis installed
I, [2023-03-28T15:54:00.522651 #1]  INFO -- : redis installed

I, [2023-03-28T15:54:00.522842 #1]  INFO -- : > cat /etc/redis/redis.conf | grep logfile
I, [2023-03-28T15:54:00.529874 #1]  INFO -- : logfile ""

I, [2023-03-28T15:54:00.530028 #1]  INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2023-03-28T15:54:00.531579 #1]  INFO -- : > sleep 10
103:C 28 Mar 2023 15:54:00.545 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
103:C 28 Mar 2023 15:54:00.545 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=103, just started
103:C 28 Mar 2023 15:54:00.545 # Configuration loaded
103:M 28 Mar 2023 15:54:00.546 * monotonic clock: POSIX clock_gettime
103:M 28 Mar 2023 15:54:00.547 * Running mode=standalone, port=6379.
103:M 28 Mar 2023 15:54:00.547 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
103:M 28 Mar 2023 15:54:00.547 # Server initialized
103:M 28 Mar 2023 15:54:00.547 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
103:M 28 Mar 2023 15:54:00.548 * Loading RDB produced by version 7.0.7
103:M 28 Mar 2023 15:54:00.548 * RDB age 153 seconds
103:M 28 Mar 2023 15:54:00.549 * RDB memory usage when created 94.88 Mb
103:M 28 Mar 2023 15:54:00.764 * Done loading RDB, keys loaded: 41662, keys expired: 2.
103:M 28 Mar 2023 15:54:00.764 * DB loaded from disk: 0.216 seconds
103:M 28 Mar 2023 15:54:00.764 * Ready to accept connections
I, [2023-03-28T15:54:10.533949 #1]  INFO -- :
I, [2023-03-28T15:54:10.534246 #1]  INFO -- : > thpoff echo "thpoff is installed!"
I, [2023-03-28T15:54:10.539516 #1]  INFO -- : thpoff is installed!

I, [2023-03-28T15:54:10.539733 #1]  INFO -- : > /usr/local/bin/ruby -e 'if ENV["DISCOURSE_SMTP_ADDRESS"] == "smtp.example.com"; puts "Aborting! Mail is not configured!"; exit 1; end'
I, [2023-03-28T15:54:10.605607 #1]  INFO -- :
I, [2023-03-28T15:54:10.605767 #1]  INFO -- : > /usr/local/bin/ruby -e 'if ENV["DISCOURSE_HOSTNAME"] == "discourse.example.com"; puts "Aborting! Domain is not configured!"; exit 1; end'
I, [2023-03-28T15:54:10.666708 #1]  INFO -- :
I, [2023-03-28T15:54:10.666924 #1]  INFO -- : > /usr/local/bin/ruby -e 'if (ENV["DISCOURSE_CDN_URL"] || "")[0..1] == "//"; puts "Aborting! CDN must have a protocol specified. Once fixed you should rebake your posts now to correct all posts."; exit 1; end'
I, [2023-03-28T15:54:10.728593 #1]  INFO -- :
I, [2023-03-28T15:54:10.728765 #1]  INFO -- : > rm -f /etc/cron.d/anacron
I, [2023-03-28T15:54:10.732076 #1]  INFO -- :
I, [2023-03-28T15:54:10.735553 #1]  INFO -- : File > /etc/cron.d/anacron  chmod:   chown:
I, [2023-03-28T15:54:10.741952 #1]  INFO -- : File > /etc/runit/1.d/copy-env  chmod: +x  chown:
I, [2023-03-28T15:54:10.746684 #1]  INFO -- : File > /etc/service/unicorn/run  chmod: +x  chown:
I, [2023-03-28T15:54:10.751255 #1]  INFO -- : File > /etc/service/nginx/run  chmod: +x  chown:
I, [2023-03-28T15:54:10.755626 #1]  INFO -- : File > /etc/runit/3.d/01-nginx  chmod: +x  chown:
I, [2023-03-28T15:54:10.760025 #1]  INFO -- : File > /etc/runit/3.d/02-unicorn  chmod: +x  chown:
I, [2023-03-28T15:54:10.760120 #1]  INFO -- : Replacing # postgres with sv start postgres || exit 1 in /etc/service/unicorn/run
I, [2023-03-28T15:54:10.760302 #1]  INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2023-03-28T15:54:10.762269 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git reset --hard
130:C 28 Mar 2023 15:54:10.769 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
130:C 28 Mar 2023 15:54:10.769 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=130, just started
130:C 28 Mar 2023 15:54:10.769 # Configuration loaded
130:M 28 Mar 2023 15:54:10.770 * monotonic clock: POSIX clock_gettime
130:M 28 Mar 2023 15:54:10.770 # Warning: Could not create server TCP listening socket *:6379: bind: Address already in use
130:M 28 Mar 2023 15:54:10.770 # Failed listening on port 6379 (TCP), aborting.
Updating files: 100% (32972/32972), done.
I, [2023-03-28T15:54:13.654831 #1]  INFO -- : HEAD is now at 59e548540 Build(deps): Bump sass from 1.58.3 to 1.59.2 in /app/assets/javascripts (#20656)

I, [2023-03-28T15:54:13.654991 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git clean -f
I, [2023-03-28T15:54:13.786755 #1]  INFO -- :
I, [2023-03-28T15:54:13.786916 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse bash -c '
  if [ $(git rev-parse --is-shallow-repository) == "true" ]; then
      git remote set-branches --add origin main
      git remote set-branches origin tests-passed
      git fetch --depth 1 origin tests-passed
  else
      git fetch --prune --prune-tags origin tests-passed
  fi
'
From https://github.com/discourse/discourse
 * branch                tests-passed -> FETCH_HEAD
   05e713d09..f8720a20f  tests-passed -> origin/tests-passed
I, [2023-03-28T15:54:14.533792 #1]  INFO -- :
I, [2023-03-28T15:54:14.533937 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse bash -c '
  if [[ $(git symbolic-ref --short HEAD) == tests-passed ]] ; then
      git pull
  else
      git -c advice.detachedHead=false checkout tests-passed
  fi
'
Switched to a new branch 'tests-passed'
I, [2023-03-28T15:54:18.658593 #1]  INFO -- : Branch 'tests-passed' set up to track remote branch 'tests-passed' from 'origin'.

I, [2023-03-28T15:54:18.658778 #1]  INFO -- : > cd /var/www/discourse && mkdir -p tmp
I, [2023-03-28T15:54:18.669376 #1]  INFO -- :
I, [2023-03-28T15:54:18.669485 #1]  INFO -- : > cd /var/www/discourse && chown discourse:www-data tmp
I, [2023-03-28T15:54:18.672786 #1]  INFO -- :
I, [2023-03-28T15:54:18.672896 #1]  INFO -- : > cd /var/www/discourse && mkdir -p tmp/pids
I, [2023-03-28T15:54:18.676021 #1]  INFO -- :
I, [2023-03-28T15:54:18.676111 #1]  INFO -- : > cd /var/www/discourse && mkdir -p tmp/sockets
I, [2023-03-28T15:54:18.679129 #1]  INFO -- :
I, [2023-03-28T15:54:18.679231 #1]  INFO -- : > cd /var/www/discourse && touch tmp/.gitkeep
I, [2023-03-28T15:54:18.682902 #1]  INFO -- :
I, [2023-03-28T15:54:18.682991 #1]  INFO -- : > cd /var/www/discourse && mkdir -p                    /shared/log/rails
I, [2023-03-28T15:54:18.685866 #1]  INFO -- :
I, [2023-03-28T15:54:18.685964 #1]  INFO -- : > cd /var/www/discourse && bash -c "touch -a           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log"
I, [2023-03-28T15:54:18.691768 #1]  INFO -- :
I, [2023-03-28T15:54:18.691868 #1]  INFO -- : > cd /var/www/discourse && bash -c "ln    -s           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log /var/www/discourse/log"
I, [2023-03-28T15:54:18.696319 #1]  INFO -- :
I, [2023-03-28T15:54:18.696405 #1]  INFO -- : > cd /var/www/discourse && bash -c "mkdir -p           /shared/{uploads,backups}"
I, [2023-03-28T15:54:18.701325 #1]  INFO -- :
I, [2023-03-28T15:54:18.701432 #1]  INFO -- : > cd /var/www/discourse && bash -c "ln    -s           /shared/{uploads,backups} /var/www/discourse/public"
I, [2023-03-28T15:54:18.705604 #1]  INFO -- :
I, [2023-03-28T15:54:18.705697 #1]  INFO -- : > cd /var/www/discourse && bash -c "mkdir -p           /shared/tmp/{backups,restores}"
I, [2023-03-28T15:54:18.710142 #1]  INFO -- :
I, [2023-03-28T15:54:18.710234 #1]  INFO -- : > cd /var/www/discourse && bash -c "ln    -s           /shared/tmp/{backups,restores} /var/www/discourse/tmp"
I, [2023-03-28T15:54:18.714413 #1]  INFO -- :
I, [2023-03-28T15:54:18.714499 #1]  INFO -- : > cd /var/www/discourse && chown -R discourse:www-data /shared/log/rails /shared/uploads /shared/backups /shared/tmp
I, [2023-03-28T15:54:19.202066 #1]  INFO -- :
I, [2023-03-28T15:54:19.202205 #1]  INFO -- : > cd /var/www/discourse && [ ! -d public/plugins ] || find public/plugins/ -maxdepth 1 -xtype l -delete
I, [2023-03-28T15:54:19.209576 #1]  INFO -- :
I, [2023-03-28T15:54:19.209818 #1]  INFO -- : Replacing # redis with sv start redis || exit 1 in /etc/service/unicorn/run
I, [2023-03-28T15:54:19.211441 #1]  INFO -- : > cd /var/www/discourse/plugins && mkdir -p plugins
I, [2023-03-28T15:54:19.214521 #1]  INFO -- :
I, [2023-03-28T15:54:19.214616 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-solved.git
Cloning into 'discourse-solved'...
I, [2023-03-28T15:54:19.744178 #1]  INFO -- :
I, [2023-03-28T15:54:19.744331 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-voting.git
Cloning into 'discourse-voting'...
I, [2023-03-28T15:54:20.206430 #1]  INFO -- :
I, [2023-03-28T15:54:20.206594 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-assign.git
Cloning into 'discourse-assign'...
I, [2023-03-28T15:54:20.783714 #1]  INFO -- :
I, [2023-03-28T15:54:20.783857 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-push-notifications.git
Cloning into 'discourse-push-notifications'...
I, [2023-03-28T15:54:21.288125 #1]  INFO -- :
I, [2023-03-28T15:54:21.288269 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-affiliate.git
Cloning into 'discourse-affiliate'...
I, [2023-03-28T15:54:21.689712 #1]  INFO -- :
I, [2023-03-28T15:54:21.689871 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/docker_manager.git
Cloning into 'docker_manager'...
I, [2023-03-28T15:54:22.576188 #1]  INFO -- :
I, [2023-03-28T15:54:22.576335 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/angusmcleod/discourse-tickets.git
Cloning into 'discourse-tickets'...
I, [2023-03-28T15:54:23.002103 #1]  INFO -- :
I, [2023-03-28T15:54:23.002258 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/davidtaylorhq/discourse-whos-online.git
Cloning into 'discourse-whos-online'...
I, [2023-03-28T15:54:23.430643 #1]  INFO -- :
I, [2023-03-28T15:54:23.430753 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/angusmcleod/discourse-follow.git
Cloning into 'discourse-follow'...
I, [2023-03-28T15:54:23.884284 #1]  INFO -- :
I, [2023-03-28T15:54:23.884415 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-sitemap.git
Cloning into 'discourse-sitemap'...
I, [2023-03-28T15:54:24.289283 #1]  INFO -- :
I, [2023-03-28T15:54:24.289441 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-reactions
Cloning into 'discourse-reactions'...
I, [2023-03-28T15:54:24.814124 #1]  INFO -- :
I, [2023-03-28T15:54:24.814270 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/angusmcleod/discourse-locations.git
Cloning into 'discourse-locations'...
I, [2023-03-28T15:54:25.337581 #1]  INFO -- :
I, [2023-03-28T15:54:25.337729 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/communiteq/discourse-guest-gate.git
Cloning into 'discourse-guest-gate'...
I, [2023-03-28T15:54:25.753079 #1]  INFO -- :
I, [2023-03-28T15:54:25.753239 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/angusmcleod/discourse-ratings.git
Cloning into 'discourse-ratings'...
I, [2023-03-28T15:54:26.207452 #1]  INFO -- :
I, [2023-03-28T15:54:26.207601 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-chat.git
Cloning into 'discourse-chat'...
I, [2023-03-28T15:54:26.914270 #1]  INFO -- :
I, [2023-03-28T15:54:26.914433 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-cakeday.git
Cloning into 'discourse-cakeday'...
I, [2023-03-28T15:54:27.493646 #1]  INFO -- :
I, [2023-03-28T15:54:27.493793 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-category-icons.git
Cloning into 'discourse-category-icons'...
I, [2023-03-28T15:54:27.852671 #1]  INFO -- :
I, [2023-03-28T15:54:27.852833 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-data-explorer.git
Cloning into 'discourse-data-explorer'...
I, [2023-03-28T15:54:28.392711 #1]  INFO -- :
I, [2023-03-28T15:54:28.392858 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-checklist.git
Cloning into 'discourse-checklist'...
I, [2023-03-28T15:54:28.805900 #1]  INFO -- :
I, [2023-03-28T15:54:28.806051 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/discourse-upvotes.git
Cloning into 'discourse-upvotes'...
I, [2023-03-28T15:54:29.291424 #1]  INFO -- :
I, [2023-03-28T15:54:29.291572 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/paviliondev/discourse-topic-previews-sidecar.git
Cloning into 'discourse-topic-previews-sidecar'...
I, [2023-03-28T15:54:30.064772 #1]  INFO -- :
I, [2023-03-28T15:54:30.065075 #1]  INFO -- : > cp /var/www/discourse/config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf
I, [2023-03-28T15:54:30.070150 #1]  INFO -- :
I, [2023-03-28T15:54:30.070403 #1]  INFO -- : > rm /etc/nginx/sites-enabled/default
I, [2023-03-28T15:54:30.072721 #1]  INFO -- :
I, [2023-03-28T15:54:30.072995 #1]  INFO -- : > mkdir -p /var/nginx/cache
I, [2023-03-28T15:54:30.075291 #1]  INFO -- :
I, [2023-03-28T15:54:30.075933 #1]  INFO -- : Replacing pid /run/nginx.pid; with daemon off; in /etc/nginx/nginx.conf
I, [2023-03-28T15:54:30.076500 #1]  INFO -- : Replacing (?m-ix:upstream[^\}]+\}) with upstream discourse { server 127.0.0.1:3000; } in /etc/nginx/conf.d/discourse.conf
I, [2023-03-28T15:54:30.076718 #1]  INFO -- : Replacing (?-mix:server_name.+$) with server_name _ ; in /etc/nginx/conf.d/discourse.conf
I, [2023-03-28T15:54:30.077213 #1]  INFO -- : Replacing (?-mix:client_max_body_size.+$) with client_max_body_size $upload_size ; in /etc/nginx/conf.d/discourse.conf
I, [2023-03-28T15:54:30.077766 #1]  INFO -- : Replacing (?-mix:worker_connections.+$) with worker_connections $nginx_worker_connections ; in /etc/nginx/nginx.conf
I, [2023-03-28T15:54:30.077913 #1]  INFO -- : > echo "done configuring web"
I, [2023-03-28T15:54:30.079797 #1]  INFO -- : done configuring web

I, [2023-03-28T15:54:30.080000 #1]  INFO -- : > cd /var/www/discourse && gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,""); print $0 }' Gemfile.lock)
I, [2023-03-28T15:54:30.603455 #1]  INFO -- : Successfully installed bundler-2.4.4
1 gem installed

I, [2023-03-28T15:54:30.603577 #1]  INFO -- : > cd /var/www/discourse && find /var/www/discourse ! -user discourse -exec chown discourse {} \+
I, [2023-03-28T15:54:34.002887 #1]  INFO -- :
I, [2023-03-28T15:54:34.003162 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'yarn install --production --frozen-lockfile && yarn cache clean'
warning " > babel-plugin-debug-macros@0.4.0-pre1" has unmet peer dependency "@babel/core@^7.0.0".
warning "workspace-aggregator-32531007-7d2b-4f26-8fe0-4f2be3542db5 > discourse > @uppy/aws-s3@3.0.5" has incorrect peer dependency "@uppy/core@^3.0.5".
warning "workspace-aggregator-32531007-7d2b-4f26-8fe0-4f2be3542db5 > discourse > @uppy/aws-s3-multipart@3.1.2" has incorrect peer dependency "@uppy/core@^3.0.5".
warning "workspace-aggregator-32531007-7d2b-4f26-8fe0-4f2be3542db5 > discourse > @uppy/xhr-upload@3.1.0" has incorrect peer dependency "@uppy/core@^3.0.6".
I, [2023-03-28T15:55:01.837803 #1]  INFO -- : yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
$ yarn --cwd app/assets/javascripts/discourse $(node -e 'if(JSON.parse(process.env.npm_config_argv).original.includes(`--frozen-lockfile`)){console.log(`--frozen-lockfile`)}')
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 24.36s.
Done in 24.87s.
yarn cache v1.22.19
success Cleared cache.
Done in 2.27s.

I, [2023-03-28T15:55:01.838171 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle config --local deployment true'
I, [2023-03-28T15:55:02.003079 #1]  INFO -- :
I, [2023-03-28T15:55:02.003219 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle config --local without "development test"'
I, [2023-03-28T15:55:02.164885 #1]  INFO -- : You are replacing the current local value of without, which is currently "test:development"

I, [2023-03-28T15:55:02.165007 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle install --retry 3 --jobs 4'
I, [2023-03-28T15:55:07.179015 #1]  INFO -- : Fetching gem metadata from https://rubygems.org/.........
Using rake 13.0.6
Using concurrent-ruby 1.2.2
Using minitest 5.18.0
Using builder 3.2.4
Using erubi 1.12.0
Using racc 1.6.2
Using crass 1.0.6
Fetching rack 2.2.6.4
Using date 3.3.3
Using timeout 0.3.2
Using mini_mime 1.1.2
Using public_suffix 5.0.1
Using aws-eventstream 1.2.0
Using jmespath 1.6.2
Using aws-partitions 1.583.0
Using bundler 2.4.4
Using msgpack 1.6.1
Using byebug 11.1.3
Using cbor 0.5.9.6
Using cgi 0.3.6
Using chunky_png 1.4.0
Using coderay 1.1.3
Using colored2 3.1.2
Fetching connection_pool 2.4.0
Using openssl 3.1.0
Using cppjieba_rb 0.4.2
Using google-protobuf 3.22.2 (x86_64-linux)
Using method_source 1.0.0
Using thor 1.2.1
Using zeitwerk 2.6.7
Using tilt 2.1.0
Using digest 3.1.1
Using diffy 3.4.2
Using discourse-fonts 0.0.9
Using regexp_parser 2.7.0
Using email_reply_trimmer 0.1.13
Using excon 0.99.0
Using execjs 2.8.1
Using exifr 1.3.10
Using ruby2_keywords 0.0.5
Using faraday-net_http 3.0.2
Using fast_blank 1.0.1
Using fast_xs 0.8.0
Using fastimage 2.2.6
Using ffi 1.15.5
Using fspath 3.1.2
Using gc_tracer 1.5.1
Using guess_html_encoding 0.0.11
Installing connection_pool 2.4.0
Using hana 1.3.7
Using highline 2.1.0
Using hashie 5.0.0
Using hkdf 1.0.0
Using htmlentities 4.3.4
Using http_accept_language 2.1.1
Using image_size 3.2.0
Installing rack 2.2.6.4
Using in_threads 1.6.0
Using json 2.6.3
Using progress 3.6.0
Using uri_template 0.7.0
Using jwt 2.7.0
Using libv8-node 16.10.0.0 (x86_64-linux)
Using logstash-event 1.2.02
Using logster 2.12.2
Using lru_redux 1.1.0
Using lz4-ruby 0.3.3
Using maxminddb 0.1.22
Using memory_profiler 1.0.1
Using redis 4.8.1
Using mini_sql 1.4.0
Using multi_json 1.15.0
Using multi_xml 0.6.0
Using mustache 1.1.1
Using uri 0.12.0
Using nio4r 2.5.8
Fetching version_gem 1.1.2
Using kgio 2.11.4
Using oj 3.13.14
Using optimist 3.0.1
Using pg 1.4.6
Using raindrops 0.20.1
Using rchardet 1.8.0
Using rexml 3.2.5
Installing version_gem 1.1.2
Using rqrcode_core 1.2.0
Using rubyzip 2.3.2
Using sshkey 2.0.0
Fetching stackprof 0.2.24
Using rinku 2.0.6
Using rotp 6.2.2
Using unf_ext 0.0.8.2
Using webrick 1.7.0
Using xorcist 1.1.3
Using i18n 1.12.0
Using tzinfo 2.0.6
Using nokogiri 1.14.2 (x86_64-linux)
Using net-protocol 0.2.1
Using aws-sigv4 1.5.0
Using addressable 2.8.1
Installing stackprof 0.2.24 with native extensions
Using bootsnap 1.16.0
Using openssl-signature_algorithm 1.3.0
Fetching sass-embedded 1.60.0 (x86_64-linux-gnu)
Using pry 0.14.2
Using ecma-re-validator 0.4.0
Using uglifier 4.2.0
Using faraday 2.7.4
Using mini_suffix 0.3.3
Using image_optim 0.31.3
Using logstash-logger 0.26.1
Using mini_racer 0.6.3
Using net-http 0.3.2
Using puma 6.1.1
Using redis-namespace 1.10.0
Using web-push 3.0.0
Using rbtrace 0.4.14
Using unicorn 6.1.0
Using oauth-tty 1.0.5
Using snaky_hash 2.0.1
Using rqrcode 2.1.2
Using rss 0.2.9
Using unf 0.1.4
Fetching activesupport 7.0.4.3
Using loofah 2.19.1
Fetching rack-test 2.1.0
Installing rack-test 2.1.0
Using sprockets 3.7.2 from https://github.com/rails/sprockets (at 3.x@f4d3dae)
Installing activesupport 7.0.4.3
Using request_store 1.5.1
Using message_bus 4.3.2
Using sidekiq 6.5.8
Using omniauth 1.9.2
Using rack-mini-profiler 3.0.0
Using rack-protection 3.0.5
Using ruby-readability 0.7.0
Using sanitize 6.0.1
Fetching tzinfo-data 1.2023.2
Installing tzinfo-data 1.2023.2
Using net-imap 0.3.4
Using net-pop 0.1.2
Using net-smtp 0.3.3
Using aws-sdk-core 3.130.2
Using cose 1.3.0
Using faraday-retry 2.1.0
Using json_schemer 0.2.23
Using oauth 1.1.0
Using oauth2 1.4.11
Using pry-byebug 3.10.1
Using pry-rails 0.3.9
Using rtlcss 0.2.0
Using rails-html-sanitizer 1.5.0
Using css_parser 1.14.0
Using mini_scheduler 0.15.0
Using rails-dom-testing 2.0.3
Using globalid 1.1.0
Fetching activemodel 7.0.4.3
Installing sass-embedded 1.60.0 (x86_64-linux-gnu)
Installing activemodel 7.0.4.3
Fetching mail 2.8.1
Installing mail 2.8.1
Using aws-sdk-kms 1.56.0
Using aws-sdk-sns 1.53.0
Using omniauth-oauth 1.2.0
Using omniauth-oauth2 1.7.3
Fetching actionview 7.0.4.3
Installing actionview 7.0.4.3
Fetching activejob 7.0.4.3
Using active_model_serializers 0.8.4
Fetching activerecord 7.0.4.3
Installing activejob 7.0.4.3
Using aws-sdk-s3 1.114.0
Using omniauth-twitter 1.4.0
Using omniauth-facebook 9.0.0
Using omniauth-github 1.4.0
Using omniauth-google-oauth2 0.8.2
Using dartsass-ruby 3.0.1
Using actionview_precompiler 0.2.3
Fetching actionpack 7.0.4.3
Installing activerecord 7.0.4.3
Installing actionpack 7.0.4.3
Fetching railties 7.0.4.3
Fetching actionmailer 7.0.4.3
Installing actionmailer 7.0.4.3
Installing railties 7.0.4.3
Using sprockets-rails 3.4.2
Using discourse-seed-fu 2.3.12
Using lograge 0.12.0
Using rails_failover 0.8.1
Using dartsass-sprockets 3.0.0
Using rails_multisite 4.0.1
Bundle complete! 137 Gemfile dependencies, 175 gems now installed.
Gems in the groups 'development' and 'test' were not installed.
Bundled gems are installed into `./vendor/bundle`

I, [2023-03-28T15:55:07.179337 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'LOAD_PLUGINS=0 bundle exec rake plugin:pull_compatible_all'
I, [2023-03-28T15:55:09.309965 #1]  INFO -- : discourse-affiliate is already at latest compatible version
discourse-assign is already at latest compatible version
discourse-cakeday is already at latest compatible version
discourse-category-icons is already at latest compatible version
discourse-chat is already at latest compatible version
discourse-checklist is already at latest compatible version
discourse-data-explorer is already at latest compatible version
discourse-follow is already at latest compatible version
discourse-guest-gate is already at latest compatible version
discourse-locations is already at latest compatible version
discourse-push-notifications is already at latest compatible version
discourse-ratings is already at latest compatible version
discourse-reactions is already at latest compatible version
discourse-sitemap is already at latest compatible version
discourse-solved is already at latest compatible version
discourse-tickets is already at latest compatible version
discourse-topic-previews-sidecar is already at latest compatible version
discourse-upvotes is already at latest compatible version
discourse-voting is already at latest compatible version
discourse-whos-online is already at latest compatible version
docker_manager is already at latest compatible version

I, [2023-03-28T15:55:09.310247 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
2023-03-28 15:55:19.590 UTC [884] discourse@discourse ERROR:  duplicate key value violates unique constraint "index_tags_on_name"
2023-03-28 15:55:19.590 UTC [884] discourse@discourse DETAIL:  Key (name)=(e-commerce) already exists.
2023-03-28 15:55:19.590 UTC [884] discourse@discourse STATEMENT:  UPDATE tags t
        SET public_topic_count = x.topic_count
        FROM (
          SELECT
            COUNT(topics.id) AS topic_count,
            tags.id AS tag_id
          FROM tags
          INNER JOIN topic_tags ON tags.id = topic_tags.tag_id
          INNER JOIN topics ON topics.id = topic_tags.topic_id AND topics.deleted_at IS NULL AND topics.archetype != 'private_message'
          INNER JOIN categories ON categories.id = topics.category_id AND NOT categories.read_restricted
          GROUP BY tags.id
        ) x
        WHERE x.tag_id = t.id
        AND x.topic_count <> t.public_topic_count;

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_tags_on_name"
DETAIL:  Key (name)=(e-commerce) already exists.
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `exec'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block (2 levels) in execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block in execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:765:in `block in log'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:756:in `log'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:932:in `block in method_missing'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:900:in `block in say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:900:in `say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:921:in `method_missing'
/var/www/discourse/db/migrate/20230118020114_add_public_topic_count_to_tags.rb:7:in `up'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:873:in `public_send'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:873:in `exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:854:in `block (2 levels) in migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:853:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:852:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1046:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1360:in `block in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/transactions.rb:209:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1411:in `ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1359:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1333:in `each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1333:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1282:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1432:in `block in with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1447:in `with_advisory_lock_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1428:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1282:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1117:in `up'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1092:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/tasks/database_tasks.rb:262:in `migrate'
/var/www/discourse/lib/tasks/db.rake:246:in `block (2 levels) in <main>'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:221:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'

Caused by:
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_tags_on_name"
DETAIL:  Key (name)=(e-commerce) already exists.
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `exec'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block (2 levels) in execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block in execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:765:in `block in log'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:756:in `log'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:932:in `block in method_missing'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:900:in `block in say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:900:in `say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:921:in `method_missing'
/var/www/discourse/db/migrate/20230118020114_add_public_topic_count_to_tags.rb:7:in `up'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:873:in `public_send'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:873:in `exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:854:in `block (2 levels) in migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:853:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:852:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1046:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1360:in `block in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/transactions.rb:209:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1411:in `ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1359:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1333:in `each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1333:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1282:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1432:in `block in with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1447:in `with_advisory_lock_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1428:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1282:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1117:in `up'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1092:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/tasks/database_tasks.rb:262:in `migrate'
/var/www/discourse/lib/tasks/db.rake:246:in `block (2 levels) in <main>'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:221:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'

Caused by:
PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_tags_on_name"
DETAIL:  Key (name)=(e-commerce) already exists.
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `exec'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block (2 levels) in execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block in execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:765:in `block in log'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract_adapter.rb:756:in `log'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:932:in `block in method_missing'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:900:in `block in say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:900:in `say_with_time'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:921:in `method_missing'
/var/www/discourse/db/migrate/20230118020114_add_public_topic_count_to_tags.rb:7:in `up'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:873:in `public_send'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:873:in `exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:854:in `block (2 levels) in migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:853:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:852:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1046:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1360:in `block in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/transactions.rb:209:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1411:in `ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1359:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1333:in `each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1333:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1282:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1432:in `block in with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1447:in `with_advisory_lock_connection'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1428:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1282:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1117:in `up'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/migration.rb:1092:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/tasks/database_tasks.rb:262:in `migrate'
/var/www/discourse/lib/tasks/db.rake:246:in `block (2 levels) in <main>'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:221:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2023-03-28T15:55:19.647401 #1]  INFO -- : gem install geocoder -v 1.4.4 -i /var/www/discourse/plugins/discourse-locations/gems/3.2.1 --no-document --ignore-dependencies --no-user-install
Successfully installed geocoder-1.4.4
1 gem installed
gem install color -v 1.8 -i /var/www/discourse/plugins/discourse-topic-previews-sidecar/gems/3.2.1 --no-document --ignore-dependencies --no-user-install
Successfully installed color-1.8
1 gem installed
gem install colorscore -v 0.0.5 -i /var/www/discourse/plugins/discourse-topic-previews-sidecar/gems/3.2.1 --no-document --ignore-dependencies --no-user-install
Successfully installed colorscore-0.0.5
1 gem installed
gem install rmagick -v 4.2.2 -i /var/www/discourse/plugins/discourse-topic-previews-sidecar/gems/3.2.1 --no-document --ignore-dependencies --no-user-install
Building native extensions. This could take a while...
Successfully installed rmagick-4.2.2
1 gem installed
gem install prizm -v 0.0.3 -i /var/www/discourse/plugins/discourse-topic-previews-sidecar/gems/3.2.1 --no-document --ignore-dependencies --no-user-install
Successfully installed prizm-0.0.3
1 gem installed
== 20230118020114 AddPublicTopicCountToTags: migrating ========================
-- add_column(:tags, :public_topic_count, :integer, {:default=>0, :null=>false})
   -> 0.0012s
-- execute("UPDATE tags t\nSET public_topic_count = x.topic_count\nFROM (\n  SELECT\n    COUNT(topics.id) AS topic_count,\n    tags.id AS tag_id\n  FROM tags\n  INNER JOIN topic_tags ON tags.id = topic_tags.tag_id\n  INNER JOIN topics ON topics.id = topic_tags.topic_id AND topics.deleted_at IS NULL AND topics.archetype != 'private_message'\n  INNER JOIN categories ON categories.id = topics.category_id AND NOT categories.read_restricted\n  GROUP BY tags.id\n) x\nWHERE x.tag_id = t.id\nAND x.topic_count <> t.public_topic_count;\n")

I, [2023-03-28T15:55:19.647791 #1]  INFO -- : Terminating async processes
I, [2023-03-28T15:55:19.647832 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 42
103:signal-handler (1680018919) Received SIGTERM scheduling shutdown...
I, [2023-03-28T15:55:19.647862 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 103
2023-03-28 15:55:19.647 UTC [42] LOG:  received fast shutdown request
2023-03-28 15:55:19.658 UTC [42] LOG:  aborting any active transactions
2023-03-28 15:55:19.660 UTC [42] LOG:  background worker "logical replication launcher" (PID 51) exited with exit code 1
2023-03-28 15:55:19.661 UTC [46] LOG:  shutting down
103:M 28 Mar 2023 15:55:19.694 # User requested shutdown...
103:M 28 Mar 2023 15:55:19.694 * Saving the final RDB snapshot before exiting.
2023-03-28 15:55:19.704 UTC [42] LOG:  database system is shut down
103:M 28 Mar 2023 15:55:20.048 * DB saved on disk
103:M 28 Mar 2023 15:55:20.049 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 713 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** 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.
fd0647ec1406b72533188648a2defa4c015b461e8c7ed124badb8e20d0a3a270

If I am correct, this would be the problem?

2023-03-28 15:55:19.590 UTC [884] discourse@discourse ERROR:  duplicate key value violates unique constraint "index_tags_on_name"
2023-03-28 15:55:19.590 UTC [884] discourse@discourse DETAIL:  Key (name)=(e-commerce) already exists.
2023-03-28 15:55:19.590 UTC [884] discourse@discourse STATEMENT:  UPDATE tags t
        SET public_topic_count = x.topic_count
        FROM (
          SELECT
            COUNT(topics.id) AS topic_count,
            tags.id AS tag_id
          FROM tags
          INNER JOIN topic_tags ON tags.id = topic_tags.tag_id
          INNER JOIN topics ON topics.id = topic_tags.topic_id AND topics.deleted_at IS NULL AND topics.archetype != 'private_message'
          INNER JOIN categories ON categories.id = topics.category_id AND NOT categories.read_restricted
          GROUP BY tags.id
        ) x
        WHERE x.tag_id = t.id
        AND x.topic_count <> t.public_topic_count;

Thanks a lot, I’m not too familiar with this.

I wrote the title with the version from memory, it could be a different version. I don’t have access to my dashboard anymore :sweat_smile:

Yes, the lines like

Caused by:
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_tags_on_name"
DETAIL:  Key (name)=(e-commerce) already exists.

are the problem. You somehow have a corrupt index (or maybe two tags with similar names were created and now they look the same).

You can try renaming those.

You might be able to restart your site with

 ./launcher start app

But you might need to restart the container, then enter it, and fix the database with psql.

1 Like

What Jay says. And in addition, if that migration was being run now, then you were on 3.0.0 stable.

1 Like

Yeah so the container is running, but the instance isn’t running.

I should run:

./launcher enter app
rails c

Then use psql to look for duplicates in my tags database?

You can try to reindex that table and if it fails due to duplicate keys you can delete or rename tags until it’ll rebuild.

select * from tags where name like '%e-commerce%'

might also help.

Alright, is there any documentation on the forum as to how to use PSQL with discourse?

Like a shema of the database, name, default username/password to connect, etc…

Alright, for anyone else reading this in the future, here’s how you do it:

// Enter the container
./launcher enter app

// Use the postgres user
su postgres

// Access the Database
psql discourse

// Needs to have a semi-column at the end
select * from tags where name like '%e-commerce%';

// Tip: press the Q key after a query to go back.

Here’s what I’m getting:

Looks like there are two tags with the same slug.

I’ve also checked my table for duplicates using this:

SELECT name, COUNT(*) 
FROM tags
GROUP BY name
HAVING COUNT(*) > 1;

Which returned this:
image

I’ve deleted all the duplicates and will try to rebuild.

Update

The rebuild process worked! God damned, these udpates scare the shit out of me.

A big thank you to @pfaffman and @RGJ, your pointers were very helpful!

5 Likes

The the other thing to do is to rename them like

update tags set name = 'e-commerce2' where id=714;

If your rebuild fails then you might try

 reindex table tags;

to look for other duplicates

1 Like