mastodon / chart

Helm chart for Mastodon deployment in Kubernetes
GNU Affero General Public License v3.0
154 stars 89 forks source link

relation "accounts" does not exist at character 454 #32

Open major opened 1 year ago

major commented 1 year ago

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
deepy commented 1 year ago

Did the -db-migrate job finish successfully?

CSDUMMI commented 1 year ago

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

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

deepy commented 1 year ago

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

dictvm commented 1 year ago

I'm facing the same issue.

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

JeffBusch commented 1 year ago

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
zolero commented 1 year ago

This issue still exist...

waldemarschroeder commented 1 year ago

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.

dictvm commented 1 year ago

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

waldemarschroeder commented 1 year ago

@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

dictvm commented 1 year ago

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.