After the update, the site did not open and the backup database was not loaded

I updated the site, then it started giving nginx errors. I couldn’t reach the site. No matter what I did, it didn’t work. So I made a new installation and tried to add yesterday’s food. However, I was not successful in that either. I get the following error when installing the backup:

error complete:

CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
ERROR:  unrecognized parameter "dims"
EXCEPTION: psql failed: ERROR:  unrecognized parameter "dims"
/var/www/discourse/lib/backup_restore/database_restorer.rb:92:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:51:in `run'
script/discourse:149:in `restore'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
script/discourse:290:in `<top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:451:in `exec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/exe/bundle:28:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/exe/bundle:20:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Trying to rollback...
Rolling back...
Cleaning stuff up...
Dropping functions from the discourse_functions schema...
Removing tmp '/var/www/discourse/tmp/restores/default/2024-02-18-120937' directory...
Unpausing sidekiq...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

when updating app.yml used to build the pgembeddings codes

hooks:
  after_code:
    - exec:
        cd: $home
        cmd:
          - sudo apt-get install wget ca-certificates
    - exec:
        cd: $home
        cmd:
          - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
    - exec:
        cd: $home
        cmd:
          - sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    - exec:
        cd: $home
        cmd:
          - apt-get update
    - exec:
        cd: $home
        cmd:
          - apt-get -y install -y postgresql-server-dev-${PG_MAJOR}
    - exec:
        cd: $home/tmp
        cmd:
          - git clone https://github.com/neondatabase/pg_embedding.git
    - exec:
        cd: $home/tmp/pg_embedding
        cmd:
          - make PG_CONFIG=/usr/lib/postgresql/13/bin/pg_config
    - exec:
        cd: $home/tmp/pg_embedding
        cmd:
          - make PG_CONFIG=/usr/lib/postgresql/13/bin/pg_config install
    - exec:
        cd: $home
        cmd:
          - su postgres -c 'psql discourse -c "create extension if not exists embedding;"'
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-question-answer.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-gamification.git
          - git clone https://github.com/discourse/discourse-restricted-replies.git
          - git clone https://github.com/discourse/discourse-saved-searches.git
          - git clone https://github.com/discourse/discourse-follow.git
          - git clone https://github.com/discourse/discourse-yearly-review.git
          - git clone https://github.com/discourse/discourse-voting.git
          - git clone https://github.com/discourse/discourse-no-bump.git
          - git clone https://github.com/discourse/discourse-math.git
          - git clone https://github.com/discourse/discourse-akismet.git
          - git clone https://github.com/discourse/discourse-adplugin.git
          - git clone https://github.com/spirobel/discourse-matheditor.git
          - git clone https://github.com/discourse/discourse-google-one-tap.git
          - git clone https://github.com/merefield/discourse-chatbot.git
          - git clone https://github.com/discourse/discourse-ai.git
#          - git clone https://github.com/paviliondev/discourse-custom-wizard.git
          - git clone https://github.com/discourse/discourse-reactions.git
#          - git clone https://github.com/discourse/discourse-subscriptions.git```

I’ve had a look at this with @kuaza because of his history with my plugin.

We removed the offending index from dump.sql that was causing the error above and restored it.

There was an updated script to drop this index but some users of the plugin may not have seen the update.

We now have a build up but there’s no connection from the browser.

We have the container up again without the offending index and all the old script in app.yml to build pgembedding has been removed, so it’s clean but with plugins.

the container is up - you can enter it np.

psql apparently up - you can bring up the database prompt within the container np.

within the container you can open rails c without issue.

/var/discourse/shared/standalone/log/rails# tail -n 200 production.log

does not show any obvious error messages.

I’m currently stumped.

Any ideas for other things to check?

1 Like

I missed one check …

going into the container and doing this:

curl 0.0.0.0:3000

Going to try that next …

2 Likes

When you do this, the codes of the setup html page appear. I think the problem is caused by DNS. And this nonsense is destroying me.

When I ran this, it seemed to be working, but actually the problem was that the webserver was not working and we cannot understand it this way. When we enter the container and run this code, we can see whether nginx is running or not:

nginx -t

However, I would like to answer the problem in this topic by copying the solution from your message. The nginx issue is completely different, I am testing it in a separate domain with a fresh installation. If it gives an error again, I will open a separate issue and report it.

The problem of the backup not working in the subject is caused by a table or record that is no longer used. I think it was a record that the chatbot plugin no longer uses, but this was not deleted during the update. I think the plugin author friend has solved this, you can rest easy :slight_smile: I deleted the error line, repackaged it and installed it from the admin panel, it works without any problems. Or you can also download from the server:

Explanation of fixing corrupted plugin file in is:

  • Ungz a backup: tar -xvzf foo.tar.gz
  • ungz the dump.sql file
  • remove the offending lines that build the unwanted index:
–
– TOC entry 8020 (class 1259 OID 84313)
– Name: hnsw_index_on_chatbot_post_embeddings; Type: INDEX; Schema: public; Owner: -
–

CREATE INDEX hnsw_index_on_chatbot_post_embeddings ON public.chatbot_post_embeddings_old USING hnsw (embedding) WITH (dims='1536', m='64', efconstruction='64', efsearch='64');
  • zip back up the dump.sql file
  • combine it in a directory with your uploads folder
  • targz the whole thing back up
  • manually restore this file

If it gives you the error of a different table, I think it will be fixed if you delete the table that contains that record using the method above.

My site, which I worked hard on and was starting to grow, was down for two days. Let’s not forget a sleepless night and a day. There is always the possibility of such events happening to us. Don’t forget to make a backup and check that the backup is working. I would like to thank my brother @merefield for helping me during this process. We learned new things together.

3 Likes

This method did work for me when I was getting the same error. Thank you for posting this.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.