Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot sign into new installation #17

Closed
GraphicHealer opened this issue Apr 27, 2022 · 14 comments
Closed

Cannot sign into new installation #17

GraphicHealer opened this issue Apr 27, 2022 · 14 comments
Assignees
Labels
docker help wanted Extra attention is needed installation

Comments

@GraphicHealer
Copy link

I have installed the Portainer setup method, with docker.

The issue I am currently having though is this:
image

I cannot get any further. It locks me out for some reason. Here are the logs:
_papermerge_redis_1_logs.txt
_papermerge_db_1_logs (1).txt
_papermerge_es_1_logs (1).txt
_papermerge_frontend_1_logs.txt
_papermerge_ws_server_1_logs.txt
_papermerge_backend_1_logs.txt
_papermerge_worker_1_logs.txt
_papermerge_backend_init_1_logs (1).txt
_portainer_logs.txt
_papermerge_traefik_1_logs.txt

Please help. I don't know what to do at this point.

@GraphicHealer GraphicHealer changed the title Cannot sign into new installation, also fixes for compose file Cannot sign into new installation Apr 27, 2022
@ciur
Copy link
Member

ciur commented Apr 27, 2022

I am wondering if this issue is related to docker compose problem you had i.e. #18
Are you trying to access it from another host ?
Do you use TLS ? Is there any proxy in between ?
I am asking because portainer logs complains about TLS (unkown certificate):

level=info msg="] [err: %!s(<nil>)]"

level=info msg="2022/04/27 15:18:42 http: TLS handshake error from 192.168.0.51:55187: remote error: tls: unknown certificate"

level=info msg="2022/04/27 15:44:12 http: TLS handshake error from 192.168.0.51:55558: remote error: tls: unknown certificate"

level=info msg="2022/04/27 15:44:26 proxy error: context canceled"

@GraphicHealer
Copy link
Author

Hmm, yeah... I am using Ubuntu server 20.04 LTS with docker and Portainer installed. It has no GUI (being server) so I have to use a separate PC to connect to it. I did not change any of the config (Besides the other issue you mentioned), so I don't know what could be causing it.

@GraphicHealer
Copy link
Author

GraphicHealer commented Apr 28, 2022

I am wondering if this issue is related to docker compose problem you had i.e. #18 Are you trying to access it from another host ? Do you use TLS ? Is there any proxy in between ? I am asking because portainer logs complains about TLS (unkown certificate):

level=info msg="] [err: %!s(<nil>)]"

level=info msg="2022/04/27 15:18:42 http: TLS handshake error from 192.168.0.51:55187: remote error: tls: unknown certificate"

level=info msg="2022/04/27 15:44:12 http: TLS handshake error from 192.168.0.51:55558: remote error: tls: unknown certificate"

level=info msg="2022/04/27 15:44:26 proxy error: context canceled"

Ohhhhh I just looked at which log you were talking about. That error is because I am using portainer locally only, and it is using a self-generated TLS certificate. I have to click the "proceed to this site anyways" in chrome when I go to the portainer web portal.

Edit: Also there is no proxy besides Traefik, which is using the config you set up. It is completely vanilla, besides what I fixed in issue #18.

@GraphicHealer
Copy link
Author

GraphicHealer commented May 9, 2022

Ok, the issue still happens. I used the new setup, with the HOSTNAME variable, and it now has the old 404: Page Not Found error again.

@GraphicHealer
Copy link
Author

Would this have anything to do with the error?


2022-05-03 13:32:39.193 UTC [69] STATEMENT:  SELECT "core_user"."password", "core_user"."last_login", "core_user"."is_superuser", "core_user"."username", "core_user"."first_name", "core_user"."last_name", "core_user"."email", "core_user"."is_staff", "core_user"."is_active", "core_user"."date_joined", "core_user"."id", "core_user"."role_id", "core_user"."home_folder_id", "core_user"."inbox_folder_id", "core_user"."created_at", "core_user"."updated_at" FROM "core_user" WHERE "core_user"."username" = 'admin' LIMIT 21,
2022-05-03 13:32:39.193 UTC [69] ERROR:  relation "core_user" does not exist at character 416

@GraphicHealer
Copy link
Author

GraphicHealer commented May 9, 2022

Also noticed a bunch of python errors in the backend_init container:
_papermerge_backend_init_1_logs (2).txt

@GraphicHealer
Copy link
Author

GraphicHealer commented May 9, 2022

AHA! I found something! the 1st line in that backent_init log is:

File "/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 603, in temporary_connection, django.db.utils.ProgrammingError: relation "core_user" does not exist

And the error in the Database is:

2022-05-03 13:32:39.193 UTC [69] STATEMENT:  SELECT "core_user"."password", "core_user"."last_login", "core_user"."is_superuser", "core_user"."username", "core_user"."first_name", "core_user"."last_name", "core_user"."email", "core_user"."is_staff", "core_user"."is_active", "core_user"."date_joined", "core_user"."id", "core_user"."role_id", "core_user"."home_folder_id", "core_user"."inbox_folder_id", "core_user"."created_at", "core_user"."updated_at" FROM "core_user" WHERE "core_user"."username" = 'admin' LIMIT 21,
2022-05-03 13:32:39.193 UTC [69] ERROR:  relation "core_user" does not exist at character 416

Notice the core_user errors correlate. There is an error creating the core_user relation in the database, and then the backend fails to read it because core_user doesn't exist.

@ciur
Copy link
Member

ciur commented May 9, 2022

Also noticed a bunch of python errors in the backend_init container: _papermerge_backend_init_1_logs (2).txt

The most important message from the log is this part:

django.db.utils.OperationalError: could not connect to server: Connection refused

	Is the server running on host "db" (172.20.0.6) and accepting

	TCP/IP connections on port 5432?

Which means that for some reason it fails to connect to database. In docker compose file, backend_init depends on db. Aparently your database service is not running.

There is an error creating the core_user relation in the database, and then the backend fails to read it because core_user doesn't exist.

core_user is just one table that was not created because database was not up and running during backend_init initialization.

@GraphicHealer
Copy link
Author

Huh. The database is running. I don't know why it would be connecting.

@GraphicHealer
Copy link
Author

Have you looked into doing something like this: https://docs.docker.com/compose/networking/#links

If you add a link to the backend_init compose section connecting it to db, that might help IDK.

@cupracer
Copy link
Contributor

cupracer commented Jun 3, 2022

Ok, the issue still happens. I used the new setup, with the HOSTNAME variable, and it now has the old 404: Page Not Found error again.

I discovered Papermerge today and gave it a try. This setup was started via docker-compose on a dedicated SLES 15 SP3 host. I experienced the same issues as described here during startup ("core_user" missing, db connection refused... seem to be irrelevant here) and also that "404: Page Not Found" error.

I configured "HOSTNAME" in .env as a full-qualified hostname ("somehost.my.domain"). Using the FQDN in the browser lead to that 404 error while using just the short name worked perfectly and presented the login page as expected.
Searching for an explanation revealed that docker-compose just used the local part "somehost" when ${HOSTNAME} was used in docker-compose.yml.

I finally solved this 404 error for my setup and it seems that #22 is broken by design (@ciur):

"HOSTNAME" from the .env file is simply not used if that variable also exists in the shell environment where docker-compose is executed. On my system "HOSTNAME" is set automatically and contains the local part of my system's hostname.

See docker-compose documentation regarding environment variables

You can set default values for environment variables using a .env file, which Compose automatically looks for in project directory (parent folder of your Compose file). Values set in the shell environment override those set in the .env file.

I fixed this by just renaming the variable HOSTNAME to USE_HOSTNAME in .env and docker-compose.yml.

@ciur
Copy link
Member

ciur commented Jun 4, 2022

@cupracer , awesome research! Thank you!

@gljones2001, can you please confirm if renaming HOSTNAME variable to USE_HOSTNAME fixes your issue ?

@ciur ciur self-assigned this Jun 4, 2022
@ciur ciur added docker installation help wanted Extra attention is needed labels Jun 4, 2022
@ciur
Copy link
Member

ciur commented Jun 18, 2022

Closing the ticket due to inactivity.

@ciur ciur closed this as completed Jun 18, 2022
@GraphicHealer
Copy link
Author

@cupracer , awesome research! Thank you!

@gljones2001, can you please confirm if renaming HOSTNAME variable to USE_HOSTNAME fixes your issue ?

So sorry, I ended up switching to a different software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker help wanted Extra attention is needed installation
Projects
None yet
Development

No branches or pull requests

3 participants