chart icon indicating copy to clipboard operation
chart copied to clipboard

relation "accounts" does not exist at character 454

Open major opened this issue 3 years ago • 10 comments

Each time I try to deploy this helm chart with the included postgres, the deployment fails and the postgres container has this in the logs:

2022-12-22 20:13:15.277 GMT [1] LOG:  pgaudit extension initialized
2022-12-22 20:13:15.281 GMT [1] LOG:  starting PostgreSQL 14.2 on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2022-12-22 20:13:15.281 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-12-22 20:13:15.282 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2022-12-22 20:13:15.283 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2022-12-22 20:13:15.287 GMT [155] LOG:  database system was shut down at 2022-12-22 20:13:15 GMT
2022-12-22 20:13:15.309 GMT [1] LOG:  database system is ready to accept connections
2022-12-22 20:13:26.068 GMT [169] ERROR:  relation "accounts" does not exist at character 454
2022-12-22 20:13:26.068 GMT [169] STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod),
	       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
	       c.collname, col_description(a.attrelid, a.attnum) AS comment
	  FROM pg_attribute a
	  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
	  LEFT JOIN pg_type t ON a.atttypid = t.oid
	  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
	 WHERE a.attrelid = '"accounts"'::regclass
	   AND a.attnum > 0 AND NOT a.attisdropped
	 ORDER BY a.attnum

major avatar Dec 22 '22 20:12 major

Did the -db-migrate job finish successfully?

deepy avatar Dec 22 '22 20:12 deepy

I'm facing this exact issue on a Mastodon deployment with docker-compose.

How would I check if the -db-migrate job finished successfully?

CSDUMMI avatar Jan 18 '23 16:01 CSDUMMI

Is the pod or the job from the migration job still around? Do you have access to the logs from the migration job?

deepy avatar Jan 22 '23 13:01 deepy

I'm facing the same issue.

These are the logs of the dbmigrate pod and the job: https://gist.github.com/dictvm/0d8200f323b2d8aeaf9638a1521d20b0

dictvm avatar Feb 10 '23 12:02 dictvm

I'm getting this same error on a fresh setup. I noticed in my web container I also have the error:

/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.7.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:19:in `exec': ERROR:  relation "accounts" does not exist (PG::UndefinedTable)
LINE 8:  WHERE a.attrelid = '"accounts"'::regclass

JeffBusch avatar Feb 18 '23 03:02 JeffBusch

This issue still exist...

zolero avatar Mar 15 '23 20:03 zolero

The solution is in https://github.com/felx/mastodon-documentation/blob/master/Running-Mastodon/Docker-Guide.md I did "docker-compose run --rm web rake mastodon:setup" and build a correct database.

waldemarschroeder avatar Jun 21 '23 08:06 waldemarschroeder

@waldemarschroeder thanks, but this doesn't help when using the Helm Chart. For some reason the db-migrate is not being created when installing the chart.

dictvm avatar Jul 28 '23 09:07 dictvm

@dictvm I did a successful Mastodon Installation with docker. With Docker you can use "docker-compose run --rm web rake db:migrate" to do a db migration. In Kubernetes you should be able to do the same with kubectl. Source: https://github.com/felx/mastodon-documentation/blob/master/Running-Mastodon/Docker-Guide.md

waldemarschroeder avatar Jul 29 '23 11:07 waldemarschroeder

Hey there, thanks! We fixed the issue by moving the db-migrate job to an initContainer in the mastodon-web Deployment.

We'll probably provide a PR some time next week, in case anyone else is interested in that approach.

dictvm avatar Jul 29 '23 13:07 dictvm