AlphaNecron / Void

Fast and elegant file hosting service.
MIT License
218 stars 13 forks source link

Installing via Docker-compose doesn't allow logins. #50

Closed Chelsea-Fox closed 2 years ago

Chelsea-Fox commented 2 years ago

HI, well done on this software, looks great, however I am having issues logging into the web interface.

I had followed the steps to run with compose and only thing I had changed in the config.toml was the database URL to @ localhost:5432 rather than @ postgress.

Previous to this change I would get a toast notification saying user not found for the default login.

After this change it gives an 500 error on the /api/auth/login

Any more info I need to add just ask and I can do testing on my deployment.

AlphaNecron commented 2 years ago

Delete the container, you must not alter the database url in the config file when using Docker compose, its configured automatically.

AlphaNecron commented 2 years ago

The postgres image is linked with void container so you don't have to change the database url unless you are deploying it manually with node.

Chelsea-Fox commented 2 years ago

Okay makes sense, thought that should have been the case.

Let me give that a shot now as last time it failed to login as the default admin:voiduser account.

**After a fresh install on a new VM, im still getting an error "User Not Found"

In the browser console I keep seeing 403 errors on the /api/user, and 404 errors on /api/auth/login

image**

AlphaNecron commented 2 years ago

Can you try inspecting the database?

Chelsea-Fox commented 2 years ago

Apologies Im not familiar interacting with a postgres db in a docker instance, what would you say is the best way about this?

Chelsea-Fox commented 2 years ago

Ive managed to connect up using psql command line, ive done a select * from information_schema.tables to see any tables but there is no results brought back

Im thinking the migration has not applied

AlphaNecron commented 2 years ago

You can try using docker exec in the void container, and use prisma studio inside it. Remember to export DATABASE_URL=<the one in your config> before executing prisma studio btw.

Chelsea-Fox commented 2 years ago

image

Found that the database has some tables (looks like what id think the backend DB should look like)

Chelsea-Fox commented 2 years ago

image

Definitely looks like the default data has not been entered.

AlphaNecron commented 2 years ago

You can try prisma db seed.

Chelsea-Fox commented 2 years ago

Would that be from within the docker container for postgres?

AlphaNecron commented 2 years ago

In the void container.

Chelsea-Fox commented 2 years ago

Only way i can see to run that in the Void container is to sh into it.

when i try run prisma db seed it is an unknown command

AlphaNecron commented 2 years ago

Try prepending yarn or npx before the command?

Chelsea-Fox commented 2 years ago

image

Trys to run however doesnt like the Database env variable.

Same thing happens with npx

AlphaNecron commented 2 years ago

You need to export DATABASE_URL=<the one in your config> in the exec shell first.

Chelsea-Fox commented 2 years ago

image After running the export command doesnt seem to change much at all

Chelsea-Fox commented 2 years ago

going to try encapsulating the url in quotes

Chelsea-Fox commented 2 years ago

Still a no im afraid

AlphaNecron commented 2 years ago

sudo docker exec -i -t void_void_1 /bin/sh -c "DATABASE_URL=postgres://postgres:postgres@postgres/postgres yarn prisma db seed"

Chelsea-Fox commented 2 years ago

Thats it now.

Thanks for your help!

might be worth adding that into the docs as I presume im not the only one that will be effected by this?

AlphaNecron commented 2 years ago

No need to add as it happens with v0 only.

Chelsea-Fox commented 2 years ago

But if v0 has the issue then it should be documented somewhere for just that release?

AlphaNecron commented 2 years ago

Sure, it will be added to the README later.