lukevella / rallly

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
https://rallly.co
GNU Affero General Public License v3.0
3.56k stars 338 forks source link

Error creating polls #188

Closed Dangersohn closed 2 years ago

Dangersohn commented 2 years ago

Describe the bug

I'm using ralllly with the provided docker-compose file.

I get the following error trying to create a demo poll

image

To Reproduce Steps to reproduce the behavior:

  1. Go to rallly Dashboard
  2. Click on View demo
  3. See error

log entry from rallly_db

2022-05-24 09:25:00.518 UTC [34] ERROR:  column "deleted" of relation "polls" does not exist at character 182
2022-05-24 09:25:00.518 UTC [34] STATEMENT:  INSERT INTO "public"."polls" ("url_id","created_at","updated_at","title","type","description","location","user_id","verified","author_name","demo","legacy","closed","notifications","deleted","touched_at") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16) RETURNING "public"."polls"."url_id"
lukevella commented 2 years ago

It looks like the migrations didn't get deployed. Can you run docker-compose up and see what the results of yarn prisma migrate deploy is? It should run before starting the server with yarn start

BackedUpBooty commented 2 years ago

so I'm getting this same error in the gui when trying to run a demo poll, create a new poll, or log in with magic link.

I'm running it in docker, rallly app logs show the following:

All migrations have been successfully applied.
Done in 23.19s.
yarn run v1.22.19

$ next start 

I do seem to have a database error though:

2022-05-24 10:04:52.927 UTC [1] LOG:  starting PostgreSQL 14.2 (Debian 14.2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2022-05-24 10:04:52.927 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-05-24 10:04:52.927 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2022-05-24 10:04:53.187 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-05-24 10:04:53.362 UTC [61] LOG:  database system was shut down at 2022-05-24 10:04:52 UTC
2022-05-24 10:04:53.435 UTC [1] LOG:  database system is ready to accept connections
2022-05-24 10:04:55.322 UTC [68] FATAL:  database "db" does not exist
2022-05-24 10:04:55.384 UTC [69] FATAL:  database "db" does not exist

I'm not sure where that db comes from though, is it from the args list, meaning it should have been created during build? I can't find any issues when going back through the build printouts in CLI.

Edit: noticed that the db was being created by the rallly app container:

Datasource "db": PostgreSQL database "db", schema "public" at "rallly_db:5432"
PostgreSQL database db created at rallly_db:5432
17 migrations found in prisma/migrations
Prisma schema loaded from prisma/schema.prisma
$ /usr/src/app/node_modules/.bin/prisma migrate deploy --schema prisma/schema.prisma

So restarting the rallly_db container resolved the database "db" does not exist error found in the rallly_db container, but the issue persists.

Dangersohn commented 2 years ago

i  ran _docker-compose up and got the following output:

rallly         | yarn run v1.22.18
rallly         | $ /usr/src/app/node_modules/.bin/prisma migrate deploy
rallly         | Prisma schema loaded from schema.prisma
rallly         | Datasource "db": PostgreSQL database "db", schema "public" at "rallly_db:5432"
rallly_db      | 2022-05-24 11:00:48.335 UTC [33] LOG:  could not receive data from client: Connection reset by peer
rallly         |
rallly         | No migration found in prisma/migrations
rallly         |
rallly         |
rallly         | No pending migrations to apply.
rallly_db      | 2022-05-24 11:00:49.374 UTC [34] LOG:  could not receive data from client: Connection reset by peer
rallly         | Done in 3.59s.
rallly         | yarn run v1.22.18
rallly         | $ next start
rallly         | ready - started server on 0.0.0.0:3000, url: http://localhost:3000
lukevella commented 2 years ago

This is an old bug fixed in #182.

Update to the latest commit:

git fetch
git pull

Rebuild:

docker-compose build

And run it again 👍

Dangersohn commented 2 years ago

I deleted everything and did a fresh installation. I got the same error as BackedUpBooty.

After restarting the db container, I got rid of the first error, but now _docker logs ralllydb shows the following:

2022-05-24 12:14:25.973 UTC [1] LOG:  database system is ready to accept connections
2022-05-24 12:15:00.924 UTC [34] ERROR:  relation "public.users" does not exist at character 35
2022-05-24 12:15:00.924 UTC [34] STATEMENT:  SELECT "public"."users"."id" FROM "public"."users" WHERE "public"."users"."email" = $1 OFFSET $2
lukevella commented 2 years ago

Look at your docker-compose.yml specifically the command and you will see that it doesn't match what is in the latest commit: https://github.com/lukevella/rallly/blob/main/docker-compose.yml#L18

Dangersohn commented 2 years ago

Silly me! Now everything works fine! My apologies!

BackedUpBooty commented 2 years ago

@lukevella was any of the above in response to me? I only cloned your repo earlier today, but for some reason getting that error.

Dangersohn commented 2 years ago

@BackedUpBooty did you cp sample.env .env and put in a 32 charter long string?

lukevella commented 2 years ago

@BackedUpBooty no your issue seems different. We’re expecting the postgres image to have a database with the name ‘db’ but in your case it doesn’t exist. You haven’t included any logs that would indicate why that would be though. Closing this, please open a discussion if you need help but keep in mind this is not a docker support forum.

BackedUpBooty commented 2 years ago

Thanks for the replies. Yes I was using the 32 char string, I actually got it working by reinserting the DATABASE_URL variable in the .env and using the same one as listed in the rallly container environment variable (your configuration page instructs to remove this if using docker).

Thanks for your suggestions.